fix(ui): the left rail's panels use all the room it counted above an obstacle across the middle

Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
Sameh KhamisandManjunath Paparaju committed 2026-11-18 23:01:47 -08:00
1 parent 98a100ed7e
commit 81df2c8c42
3 files changed
+25 -9

No files matched your search

+3 -2
View File
@@ -1202,8 +1202,9 @@ short windows) form one block with any obstacle that leaves no room between
itself and them, and both rails put their panels on whichever side of that
block has more room up to the next obstacle, above it on a tie, whatever
order the obstacles come in (`bandBesideMidpointObstacles` in
`src/ui/panelRailGeometry.js`). With no room on either side the obstacles
are read as before.
`src/ui/panelRailGeometry.js`); on the left rail the panels may then rise
above the corridor's usual top to use all the room above. With no room on
either side the obstacles are read as before.
Wind appears in the Weather group before Audio. The surface-weather prototype
uses keyless NOAA GFS or ECMWF IFS forecasts on an approximately 1° display grid.
+6 -4
View File
@@ -115,7 +115,8 @@ export function layoutLeftPanelRail({
const baseTop = viewportHeight * 0.26;
const baseBottomInset = viewportHeight * 0.04;
const safeGap = viewportHeight * 0.012;
let obstacleSafeTop = viewportHeight * 0.04;
const topInset = viewportHeight * 0.04;
let obstacleSafeTop = topInset;
let safeTop = baseTop;
let safeBottom = viewportHeight - baseBottomInset;
const bottomObstacles = [];
@@ -159,18 +160,19 @@ export function layoutLeftPanelRail({
}
}
// Obstacles across the midpoint (common in short windows) put the panels
// on whichever side of them has more room; with no room on either side the
// on whichever side of them has more room, and the panels may use all of
// it, above the corridor's usual top too; with no room on either side the
// obstacles are read as before.
const beside = bandBesideMidpointObstacles({
midpoint: viewportHeight * 0.5,
top: viewportHeight * 0.04,
top: topInset,
bottom: safeBottom,
obstacles: inLane,
gap: safeGap,
});
if (beside) {
obstacleSafeTop = beside.top;
safeTop = Math.max(baseTop, beside.top);
safeTop = beside.top;
bottomObstacles.length = 0;
bottomObstacles.push({ top: beside.bottom + safeGap });
}
+16 -3
View File
@@ -268,14 +268,27 @@ test('the left corridor counts cards beside those across the midpoint', () => {
];
f.run();
assert(Number(f.stack.dataset.safeTopPct) * 4.8 >= 300);
// No room on either side: the cards are read as before, and the corridor
// never runs down through the lower one.
// Only a little room above the cards: the corridor stays there rather
// than run down through the lower one.
f.options.obstacles = [
element('card', { top: 50, height: 150 }),
element('card', { top: 150, height: 320 }),
];
f.run();
assert(Number(f.stack.dataset.safeBottomPct) * 4.8 <= 210);
assert(Number(f.stack.dataset.safeBottomPct) * 4.8 <= 50);
// The room above a card is all the panels' to use, above the corridor's
// usual top (26%) too: 700px window, card 300 to 420, about 263px above
// against 244 below.
f.options.windowRef.innerHeight = 700;
f.options.obstacles = [element('card', { top: 300, height: 120 })];
f.run();
assert(Number(f.stack.dataset.safeBottomPct) * 7 <= 300);
assert(Number(f.stack.dataset.safeTopPct) * 7 < 0.26 * 700);
// No room on either side: the card is read as before.
f.options.windowRef.innerHeight = 480;
f.options.obstacles = [element('card', { top: 0, height: 480 })];
f.run();
assert.equal(Number(f.stack.dataset.safeTopPct), 26);
});
test('a centered timeline only shortens the corridor when it reaches a laid-out panel', () => {