Merge branch 'develop' into feature/2024.10

This commit is contained in:
dakkar 2024-11-22 10:42:58 +00:00
commit d069d78c21
33 changed files with 594 additions and 178 deletions

View file

@ -15,6 +15,8 @@ export function calcPopupPosition(el: HTMLElement, props: {
const contentWidth = el.offsetWidth;
const contentHeight = el.offsetHeight;
const HORIZONTAL_MARGIN = 1;
let rect: DOMRect;
if (props.anchorElement) {
@ -36,9 +38,11 @@ export function calcPopupPosition(el: HTMLElement, props: {
left -= (el.offsetWidth / 2);
if (left + contentWidth - window.scrollX > window.innerWidth) {
left = window.innerWidth - contentWidth + window.scrollX - 1;
left = window.innerWidth - contentWidth + window.scrollX - HORIZONTAL_MARGIN;
}
left = Math.max(HORIZONTAL_MARGIN, left);
return [left, top];
};
@ -57,9 +61,11 @@ export function calcPopupPosition(el: HTMLElement, props: {
left -= (el.offsetWidth / 2);
if (left + contentWidth - window.scrollX > window.innerWidth) {
left = window.innerWidth - contentWidth + window.scrollX - 1;
left = window.innerWidth - contentWidth + window.scrollX - HORIZONTAL_MARGIN;
}
left = Math.max(HORIZONTAL_MARGIN, left);
return [left, top];
};
@ -75,6 +81,8 @@ export function calcPopupPosition(el: HTMLElement, props: {
top = props.y;
}
left = Math.max(HORIZONTAL_MARGIN, left);
top -= (el.offsetHeight / 2);
if (top + contentHeight - window.scrollY > window.innerHeight) {
@ -106,6 +114,8 @@ export function calcPopupPosition(el: HTMLElement, props: {
top -= (el.offsetHeight / 2);
}
left = Math.max(HORIZONTAL_MARGIN, left);
if (top + contentHeight - window.scrollY > window.innerHeight) {
top = window.innerHeight - contentHeight + window.scrollY - 1;
}