fix: Adjust popup positioning #34

This commit is contained in:
Aljaž Grilc 2025-01-23 12:35:13 +01:00
parent 18d23633ff
commit 675ecdc7a4

View File

@ -2085,7 +2085,7 @@ class BesPopup extends HTMLElement {
if (x + this.offsetWidth <= window.innerWidth) {
this.style.left = `${x}px`
} else if (this.offsetWidth <= x) {
this.style.left = `${x - this.offsetWidth}px`
this.style.left = `${x - this.offsetWidth - 10}px`
} else {
this.style.left = `${(window.innerWidth - this.offsetWidth) / 2}px`
}
@ -2093,7 +2093,7 @@ class BesPopup extends HTMLElement {
if (y + 20 + this.offsetHeight <= window.innerHeight) {
this.style.top = `${y + 20}px`
} else if (this.offsetHeight <= y) {
this.style.top = `${y - this.offsetHeight}px`
this.style.top = `${y - this.offsetHeight - 20}px`
} else {
this.style.top = `${(window.innerHeight - this.offsetHeight) / 2}px`
}