mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +02:00
fix: measure/drawing tooltip was misplaced (#2541)
Broken since 70f87d8636
fix #2539
Before:

After:

This commit is contained in:
commit
86d60f0b8e
1 changed files with 11 additions and 0 deletions
|
@ -4,6 +4,8 @@ export class Positioned {
|
||||||
this.anchorTop(anchor)
|
this.anchorTop(anchor)
|
||||||
} else if (anchor && position === 'bottom') {
|
} else if (anchor && position === 'bottom') {
|
||||||
this.anchorBottom(anchor)
|
this.anchorBottom(anchor)
|
||||||
|
} else {
|
||||||
|
this.anchorAbsolute()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +33,15 @@ export class Positioned {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
anchorAbsolute() {
|
||||||
|
const left =
|
||||||
|
this.parent.offsetLeft +
|
||||||
|
this.parent.clientWidth / 2 -
|
||||||
|
this.container.clientWidth / 2
|
||||||
|
const top = this.parent.offsetTop + 75
|
||||||
|
this.setPosition({ top: top, left: left })
|
||||||
|
}
|
||||||
|
|
||||||
getPosition(el) {
|
getPosition(el) {
|
||||||
return el.getBoundingClientRect()
|
return el.getBoundingClientRect()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue