mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-02 01:05:20 +03:00
check if to far left before right
This commit is contained in:
parent
4e3f07f337
commit
3b7b3e3064
@ -69,14 +69,15 @@ export default function RelativeModal({
|
|||||||
let newTop = top;
|
let newTop = top;
|
||||||
let newLeft = left;
|
let newLeft = left;
|
||||||
|
|
||||||
// too far right
|
|
||||||
if (newLeft + width + WINDOW_PADDING >= windowWidth - WINDOW_PADDING) {
|
|
||||||
newLeft = windowWidth - width - WINDOW_PADDING;
|
|
||||||
}
|
|
||||||
// too far left
|
// too far left
|
||||||
else if (left < WINDOW_PADDING) {
|
if (left < WINDOW_PADDING) {
|
||||||
newLeft = WINDOW_PADDING;
|
newLeft = WINDOW_PADDING;
|
||||||
}
|
}
|
||||||
|
// too far right
|
||||||
|
else if (newLeft + width + WINDOW_PADDING >= windowWidth - WINDOW_PADDING) {
|
||||||
|
newLeft = windowWidth - width - WINDOW_PADDING;
|
||||||
|
}
|
||||||
|
|
||||||
// too close to bottom
|
// too close to bottom
|
||||||
if (top + menuHeight > windowHeight - WINDOW_PADDING + window.scrollY) {
|
if (top + menuHeight > windowHeight - WINDOW_PADDING + window.scrollY) {
|
||||||
newTop = WINDOW_PADDING;
|
newTop = WINDOW_PADDING;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user