Improved navigation performance

This commit is contained in:
Eduard Urbach 2018-04-20 10:13:49 +02:00
parent 9d06309dc1
commit dd10b8e1e4

View File

@ -239,13 +239,12 @@ export default class AnimeNotifier {
assignTooltipOffsets(elements?: IterableIterator<HTMLElement>) {
const distanceToBorder = 5
let contentRect: ClientRect
if(!elements) {
elements = findAll("tip")
}
let contentRect = this.app.content.getBoundingClientRect()
for(let element of elements) {
element.onmouseenter = () => {
if(element.dataset.offsetAssigned) {
@ -254,6 +253,10 @@ export default class AnimeNotifier {
}
Diff.mutations.queue(() => {
if(!contentRect) {
contentRect = this.app.content.getBoundingClientRect()
}
let rect = element.getBoundingClientRect()
let tipStyle = window.getComputedStyle(element, ":before")
let tipWidth = parseInt(tipStyle.width) + parseInt(tipStyle.paddingLeft) * 2