From 3297296d59b76c716a9a14dec6f19a4bfd903fc1 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Tue, 4 Mar 2025 11:51:13 +0100 Subject: [PATCH] fix: measure/drawing tooltip was misplaced Since 70f87d863606576ee4e363cf24f6ddf8d1b3242b fix #2539 --- umap/static/umap/js/modules/ui/base.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/umap/static/umap/js/modules/ui/base.js b/umap/static/umap/js/modules/ui/base.js index db4aff9a..b6479b37 100644 --- a/umap/static/umap/js/modules/ui/base.js +++ b/umap/static/umap/js/modules/ui/base.js @@ -4,6 +4,8 @@ export class Positioned { this.anchorTop(anchor) } else if (anchor && position === 'bottom') { 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) { return el.getBoundingClientRect() }