From 89c13a3b7eb028758382a679e2f21f56cd2c45de Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Sat, 5 Oct 2024 11:08:36 +0200 Subject: [PATCH] fix: window.offsetHeight does not means anything --- umap/static/umap/js/modules/ui/base.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/umap/static/umap/js/modules/ui/base.js b/umap/static/umap/js/modules/ui/base.js index 67f17b0f..725e3c9b 100644 --- a/umap/static/umap/js/modules/ui/base.js +++ b/umap/static/umap/js/modules/ui/base.js @@ -66,13 +66,13 @@ export class Positioned { computePosition([x, y]) { let left let top - if (x < window.offsetWidth / 2) { + if (x < window.innerWidth / 2) { left = x } else { left = x - this.container.offsetWidth } - if (y < window.offsetHeight / 2) { - top = Math.min(y, window.offsetHeight - this.container.offsetHeight) + if (y < window.innerHeight / 2) { + top = Math.min(y, window.innerHeight - this.container.offsetHeight) } else { top = Math.max(0, y - this.container.offsetHeight) }