Lazily apply tooltip calculations

This commit is contained in:
Eduard Urbach 2018-04-19 11:31:01 +02:00
parent d71f046f53
commit 0a83c00c78

View File

@ -245,6 +245,12 @@ export default class AnimeNotifier {
let contentRect = this.app.content.getBoundingClientRect() let contentRect = this.app.content.getBoundingClientRect()
for(let element of elements) { for(let element of elements) {
element.onmouseenter = () => {
if(element.dataset.offsetAssigned) {
element.onmouseenter = null
return
}
Diff.mutations.queue(() => { Diff.mutations.queue(() => {
let rect = element.getBoundingClientRect() let rect = element.getBoundingClientRect()
let tipStyle = window.getComputedStyle(element, ":before") let tipStyle = window.getComputedStyle(element, ":before")
@ -271,9 +277,12 @@ export default class AnimeNotifier {
tipChild.style.height = rect.height + "px" tipChild.style.height = rect.height + "px"
element.appendChild(tipChild) element.appendChild(tipChild)
} }
element.dataset.offsetAssigned = "true"
}) })
} }
} }
}
dragAndDrop() { dragAndDrop() {
for(let element of findAll("inventory-slot")) { for(let element of findAll("inventory-slot")) {