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