fix(ui): panel rails keep clear of an obstacle across the middle of the window

An obstacle that crossed the middle of the window (the World Timeline, the
voice control or a card in a window under about 520px tall) was neither
above nor below it, so neither rail counted it and panels could be laid out
over it. Such an obstacle now puts the panels on whichever side of it has
more room. When neither side has room, the rails keep their existing
minimum (the right rail's empty band, the left rail's minimum lane height).

Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
Sameh KhamisandManjunath Paparaju committed 2026-11-18 22:32:40 -08:00
1 parent ec1fc6bc09
commit 8b055a1423
5 files changed
+109 -2

No files matched your search

+20
View File
@@ -118,6 +118,7 @@ export function layoutLeftPanelRail({
let safeTop = baseTop;
let safeBottom = viewportHeight - baseBottomInset;
const bottomObstacles = [];
const straddling = [];
for (const obstacle of obstacles) {
if (stack.contains(obstacle)) continue;
@@ -153,8 +154,27 @@ export function layoutLeftPanelRail({
safeTop = Math.max(safeTop, obstacleBottom);
} else if (rect.top >= baseTop) {
bottomObstacles.push({ top: rect.top });
} else {
straddling.push(rect);
}
}
// An obstacle from above the corridor across the midpoint (common in short
// windows) still limits it: the panels go on whichever side of it leaves
// more room.
for (const rect of straddling) {
const roomAbove = rect.top - safeGap - obstacleSafeTop;
const lowerBottom = resolveLeftStackBottomBoundary({
baseBottom: safeBottom,
obstacles: bottomObstacles,
safeGap,
});
const roomBelow = lowerBottom - (rect.bottom + safeGap);
if (roomBelow > roomAbove) {
const obstacleBottom = rect.bottom + safeGap;
obstacleSafeTop = Math.max(obstacleSafeTop, obstacleBottom);
safeTop = Math.max(safeTop, obstacleBottom);
} else bottomObstacles.push({ top: rect.top });
}
safeBottom = resolveLeftStackBottomBoundary({
baseBottom: safeBottom,
obstacles: bottomObstacles,