Center popup placement on narrow screens
Previous calculation resulted in out of screen placement on insanely narrow screens.
This commit is contained in:
parent
56a27c8432
commit
a5bc133d5e
@ -1475,7 +1475,7 @@ class BesPopup extends HTMLElement {
|
|||||||
} else if (this.offsetWidth <= x) {
|
} else if (this.offsetWidth <= x) {
|
||||||
this.style.left = `${x - this.offsetWidth}px`
|
this.style.left = `${x - this.offsetWidth}px`
|
||||||
} else {
|
} else {
|
||||||
this.style.left = `${x - this.offsetWidth / 2}px`
|
this.style.left = `${(window.innerWidth - this.offsetWidth) / 2}px`
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y + 20 + this.offsetHeight <= window.innerHeight) {
|
if (y + 20 + this.offsetHeight <= window.innerHeight) {
|
||||||
@ -1483,7 +1483,7 @@ class BesPopup extends HTMLElement {
|
|||||||
} else if (this.offsetHeight <= y) {
|
} else if (this.offsetHeight <= y) {
|
||||||
this.style.top = `${y - this.offsetHeight}px`
|
this.style.top = `${y - this.offsetHeight}px`
|
||||||
} else {
|
} else {
|
||||||
this.style.top = `${y - this.offsetHeight / 2}px`
|
this.style.top = `${(window.innerHeight - this.offsetHeight) / 2}px`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user