From 81df2c8c42bad49216bf7f1627f96fdd6d63de9d Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Wed, 18 Nov 2026 23:01:47 -0800 Subject: [PATCH] fix(ui): the left rail's panels use all the room it counted above an obstacle across the middle Co-authored-by: Manjunath Paparaju --- docs/CURRENT-STATE.md | 5 +++-- src/ui/leftPanelRail.js | 10 ++++++---- src/ui/panelRails.test.mjs | 19 ++++++++++++++++--- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index d08d3ccb0b..91655cb712 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -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. diff --git a/src/ui/leftPanelRail.js b/src/ui/leftPanelRail.js index c6e7f6d1f3..4def1dcfc6 100644 --- a/src/ui/leftPanelRail.js +++ b/src/ui/leftPanelRail.js @@ -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 }); } diff --git a/src/ui/panelRails.test.mjs b/src/ui/panelRails.test.mjs index c58d7b0603..32f972775c 100644 --- a/src/ui/panelRails.test.mjs +++ b/src/ui/panelRails.test.mjs @@ -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', () => {