1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-01 19:18:28 -04:00

systray: fix menu positioning on vbars

fixes #2818
port 1.5
This commit is contained in:
bbedward
2026-07-19 16:37:23 -04:00
parent d003683689
commit 1402d2312a
@@ -1250,13 +1250,8 @@ BasePill {
if (root.isVerticalOrientation) { if (root.isVerticalOrientation) {
const edge = root.axis?.edge; const edge = root.axis?.edge;
if (edge === "left") { const targetX = edge === "left" ? overflowMenu.anchorPos.x : overflowMenu.anchorPos.x - alignedWidth;
const targetX = overflowMenu.anchorPos.x; return Math.max(10, Math.min(overflowMenu.width - alignedWidth - 10, targetX));
return Math.max(left, Math.min(right, targetX));
} else {
const targetX = overflowMenu.anchorPos.x - alignedWidth;
return Math.max(left, Math.min(right, targetX));
}
} else { } else {
const want = overflowMenu.anchorPos.x - alignedWidth / 2; const want = overflowMenu.anchorPos.x - alignedWidth / 2;
return Math.max(left, Math.min(right, want)); return Math.max(left, Math.min(right, want));
@@ -1271,13 +1266,8 @@ BasePill {
const want = overflowMenu.anchorPos.y - alignedHeight / 2; const want = overflowMenu.anchorPos.y - alignedHeight / 2;
return Math.max(top, Math.min(bottom, want)); return Math.max(top, Math.min(bottom, want));
} else { } else {
if (root.isAtBottom) { const targetY = root.isAtBottom ? overflowMenu.anchorPos.y - alignedHeight : overflowMenu.anchorPos.y;
const targetY = overflowMenu.anchorPos.y - alignedHeight; return Math.max(10, Math.min(overflowMenu.height - alignedHeight - 10, targetY));
return Math.max(top, Math.min(bottom, targetY));
} else {
const targetY = overflowMenu.anchorPos.y;
return Math.max(top, Math.min(bottom, targetY));
}
} }
})(), overflowMenu.dpr) })(), overflowMenu.dpr)
@@ -1770,13 +1760,8 @@ BasePill {
if (menuRoot.isVertical) { if (menuRoot.isVertical) {
const edge = menuRoot.axis?.edge; const edge = menuRoot.axis?.edge;
if (edge === "left") { const targetX = edge === "left" ? menuWindow.anchorPos.x : menuWindow.anchorPos.x - alignedWidth;
const targetX = menuWindow.anchorPos.x; return Math.max(10, Math.min(menuWindow.width - alignedWidth - 10, targetX));
return Math.max(left, Math.min(right, targetX));
} else {
const targetX = menuWindow.anchorPos.x - alignedWidth;
return Math.max(left, Math.min(right, targetX));
}
} else { } else {
const want = menuWindow.anchorPos.x - alignedWidth / 2; const want = menuWindow.anchorPos.x - alignedWidth / 2;
return Math.max(left, Math.min(right, want)); return Math.max(left, Math.min(right, want));
@@ -1791,13 +1776,8 @@ BasePill {
const want = menuWindow.anchorPos.y - alignedHeight / 2; const want = menuWindow.anchorPos.y - alignedHeight / 2;
return Math.max(top, Math.min(bottom, want)); return Math.max(top, Math.min(bottom, want));
} else { } else {
if (menuRoot.isAtBottom) { const targetY = menuRoot.isAtBottom ? menuWindow.anchorPos.y - alignedHeight : menuWindow.anchorPos.y;
const targetY = menuWindow.anchorPos.y - alignedHeight; return Math.max(10, Math.min(menuWindow.height - alignedHeight - 10, targetY));
return Math.max(top, Math.min(bottom, targetY));
} else {
const targetY = menuWindow.anchorPos.y;
return Math.max(top, Math.min(bottom, targetY));
}
} }
})(), menuWindow.dpr) })(), menuWindow.dpr)