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

+19
View File
@@ -219,6 +219,25 @@ test('left corridor respects a lower obstacle but ignores an obstacle hidden by
assert.equal(Number(f.stack.dataset.safeBottomPct), 65.47);
});
test('in a short window the left corridor stays clear of an obstacle across the midpoint', () => {
// 480px window, midpoint 240. Neither card is wholly above or below it.
const f = fixture('left');
f.options.windowRef.innerHeight = 480;
const low = element('card', { top: 100, height: 200 });
f.options.obstacles = [low];
f.run();
// More room below the card than above it: the corridor starts under it.
assert(Number(f.stack.dataset.safeTopPct) * 4.8 >= 300);
assert(Number(f.stack.dataset.safeBottomPct) * 4.8 <= 480);
const high = element('card', { top: 200, height: 200 });
f.options.obstacles = [high];
f.run();
// More room above it: the corridor ends over it.
assert(Number(f.stack.dataset.safeBottomPct) * 4.8 <= 200);
assert(Number(f.stack.dataset.safeTopPct) * 4.8 >= 0);
});
test('a centered timeline only shortens the corridor when it reaches a laid-out panel', () => {
const f = fixture('left');
f.stack.rect.width = 360;