fix: measure/drawing tooltip was misplaced (#2541)

Broken since 70f87d8636

fix #2539

Before:


![image](https://github.com/user-attachments/assets/5e68628c-a9f7-422a-b4b9-dd5daf0d77cd)


After:


![image](https://github.com/user-attachments/assets/c1857ab2-a8d1-43eb-a3d0-11bb24286bd6)
This commit is contained in:
Yohan Boniface 2025-03-04 15:48:04 +01:00 committed by GitHub
commit 86d60f0b8e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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()
} }