From 5738cdc45ce49d54d06ee6ce9a71614b001dac77 Mon Sep 17 00:00:00 2001 From: Denis Groshev Date: Wed, 4 Nov 2026 16:25:38 +0100 Subject: [PATCH 1/4] fix(cockpit): centre the phone Display/Radio row above the flight readouts On phones (<=760 px) the collapsed Display/Radio launcher row was right-anchored at bottom: 152px, off the Reset/Exit axis and on top of the ground speed and altitude readouts. Centre it and anchor it above the compass block through a shared --cockpit-compass-bottom variable; only the launchers take pointer input. Cyber's top row is centred too. --- docs/CURRENT-STATE.md | 7 ++++- scripts/qa-cockpit-utility.mjs | 50 ++++++++++++++++++++++++++++++++++ src/cockpitMarkup.test.mjs | 8 +++++- src/ui/styles/cockpit.css | 19 +++++++++++-- src/ui/styles/cyber.css | 4 +++ 5 files changed, 83 insertions(+), 5 deletions(-) diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index c3e15ea4d2..11b2f28f6f 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -3255,7 +3255,12 @@ down | auth-failed` (plus the unchanged `missing-key`/`unsupported`) with > stacking. Narrow mobile Cockpit > viewports suppress the legacy layer stack, peripheral HUD, and secondary > Context/briefing panes so the flight instruments and primary controls remain -> unobstructed. Outside Cockpit, Radio starts collapsed while off and lives +> unobstructed. There the collapsed Display and Radio launchers form one row +> centred on the Reset/Exit axis; the default theme anchors it above the +> compass block, clear of the ground speed and altitude telemetry it used to +> cover, while Cyber keeps the row at the top. `scripts/qa-cockpit-utility.mjs` +> checks the default row's centring and clearance at 390 and 360 px. Outside +> Cockpit, Radio starts collapsed while off and lives > only in its section inside Context; the detailed panel's normal accordion > control owns its disclosure and its Enable/Disable action owns power. > Radio volume in the full and Cockpit surfaces, plus Space Mission diff --git a/scripts/qa-cockpit-utility.mjs b/scripts/qa-cockpit-utility.mjs index c5a94018fa..7b1b860723 100644 --- a/scripts/qa-cockpit-utility.mjs +++ b/scripts/qa-cockpit-utility.mjs @@ -2321,6 +2321,56 @@ try { JSON.stringify(narrowViewActions), ); + // The collapsed Display/Radio row on a phone: centred on the Reset/Exit + // axis and clear of the ground speed and altitude telemetry it once covered. + for (const [width, height] of [[390, 844], [360, 740]]) { + await page.setViewport({ width, height, deviceScaleFactor: 1 }); + const phoneRow = await page.evaluate(async () => { + const manager = window.__godsEyeView.styleManager; + manager._setCockpitDisclosure('display', false); + manager._setCockpitDisclosure('radio', false); + await new Promise(requestAnimationFrame); + manager.cockpitView.syncSignalLayout(); + await new Promise(requestAnimationFrame); + const rect = (element) => element?.getBoundingClientRect().toJSON() || null; + const launchers = [...document.querySelectorAll( + '#cockpit-utility-controls .cockpit-utility-control', + )].map(rect); + return { + launchers, + speed: rect(document.querySelector('#cockpit-hud .cockpit-speed')), + altitude: rect(document.querySelector('#cockpit-hud .cockpit-altitude')), + switcher: rect(document.getElementById('view-switcher')), + viewport: { width: innerWidth, height: innerHeight }, + // Cyber parks its row at the top; this check is the default theme's. + theme: document.documentElement.dataset.uiTheme || 'default', + }; + }); + const overlaps = (a, b) => Boolean(a && b) + && a.left < b.right && b.left < a.right && a.top < b.bottom && b.top < a.bottom; + const rowLeft = Math.min(...phoneRow.launchers.map((launcher) => launcher.left)); + const rowRight = Math.max(...phoneRow.launchers.map((launcher) => launcher.right)); + const switcherCentre = phoneRow.switcher + ? (phoneRow.switcher.left + phoneRow.switcher.right) / 2 + : NaN; + check( + `${width}px Cockpit Display/Radio row is centred and clear of the speed and altitude readouts`, + phoneRow.launchers.length === 2 + && phoneRow.launchers.every((launcher) => launcher.width > 0) + && phoneRow.theme !== 'cyber' + && phoneRow.speed?.width > 0 + && phoneRow.altitude?.width > 0 + && phoneRow.launchers.every((launcher) => ( + !overlaps(launcher, phoneRow.speed) && !overlaps(launcher, phoneRow.altitude) + )) + && Math.abs((rowLeft + rowRight) / 2 - switcherCentre) <= 2 + && rowLeft >= 0 + && rowRight <= phoneRow.viewport.width, + JSON.stringify(phoneRow), + ); + } + await page.setViewport({ width: 390, height: 844, deviceScaleFactor: 1 }); + const resetResult = await page.evaluate(() => { // Both the UI and compatibility facade delegate to this navigation owner. const manager = window.__godsEyeView.styleManager._locationNavigation; diff --git a/src/cockpitMarkup.test.mjs b/src/cockpitMarkup.test.mjs index 64d03914bd..3ce5918cb2 100644 --- a/src/cockpitMarkup.test.mjs +++ b/src/cockpitMarkup.test.mjs @@ -1137,10 +1137,16 @@ test('mobile Cockpit prioritizes flight instruments and collision-safe controls' assert.match(mobileCockpit[1], /body\.cockpit-mode #intel-hud/); assert.match(mobileCockpit[1], /body\.cockpit-mode \.cockpit-context-window/); assert.match(mobileCockpit[1], /body\.cockpit-mode \.cockpit-signal-window/); + // The collapsed Display/Radio row is centred on the Reset/Exit axis and + // anchored above the compass block, not at a fixed offset that covered the + // ground speed and altitude readouts; the compass reads the same anchor. assert.match( mobileCockpit[1], - /body\.cockpit-mode \.cockpit-utility-controls[\s\S]*?bottom:\s*152px;/, + /body\.cockpit-mode \.cockpit-utility-controls \{[\s\S]*?bottom:\s*calc\(var\(--cockpit-compass-bottom\) \+ 182px\);[\s\S]*?left:\s*12px;[\s\S]*?justify-content:\s*center;/, ); + assert.doesNotMatch(mobileCockpit[1], /bottom:\s*152px;/); + assert.match(css, /\.cockpit-compass \{[\s\S]*?bottom:\s*var\(--cockpit-compass-bottom\);/); + assert.match(css, /--cockpit-compass-bottom:\s*clamp\(44px, 7vh, 72px\);/); assert.match( mobileCockpit[1], /body\.cockpit-mode \.cockpit-utility-control\.is-expanded[\s\S]*?top:\s*96px;/, diff --git a/src/ui/styles/cockpit.css b/src/ui/styles/cockpit.css index befbfbbff4..ae9e8025b0 100644 --- a/src/ui/styles/cockpit.css +++ b/src/ui/styles/cockpit.css @@ -48,6 +48,9 @@ --cockpit-side-panel-width: min(340px, 28vw); /* HUD bottom offset + tallest scaled telemetry block + 20px clear border. */ --cockpit-bottom-rail-safe: calc(clamp(84px, 11vh, 118px) + 100px); + /* The compass block's bottom edge; the phone Display/Radio row sits above + the telemetry it carries. */ + --cockpit-compass-bottom: clamp(44px, 7vh, 72px); position: fixed; inset: 0; z-index: 145; @@ -645,7 +648,7 @@ html:not([lang='en']) .cockpit-roll-token.is-separator { .cockpit-compass { position: absolute; left: 50%; - bottom: clamp(44px, 7vh, 72px); + bottom: var(--cockpit-compass-bottom); width: min(760px, 72vw); transform: translateX(-50%) rotateX(7deg) translateZ(18px); transform-style: preserve-3d; @@ -2076,15 +2079,25 @@ body.cockpit-mode #intel-hud .hud-right-edge { body.cockpit-mode #right-context-rail { display: none !important; } + /* A centred row above the compass block: its ground speed and altitude + telemetry tops out ~171px above the block's bottom edge on phones, so + the row clears it by ~10px and stays on the same axis as RESET/EXIT. + The row spans the width to centre its launchers; only they take input. */ body.cockpit-mode .cockpit-utility-controls { top: auto; right: 12px; - bottom: 152px; - max-width: calc(100vw - 24px); + bottom: calc(var(--cockpit-compass-bottom) + 182px); + left: 12px; + justify-content: center; + max-width: none; + pointer-events: none; } body.cockpit-mode .cockpit-utility-controls { flex-direction: row; } + body.cockpit-mode .cockpit-utility-control { + pointer-events: auto; + } body.cockpit-mode .cockpit-utility-launcher { width: min(150px, calc((100vw - 31px) / 2)); min-height: 42px; diff --git a/src/ui/styles/cyber.css b/src/ui/styles/cyber.css index 4957cd7697..d7c0c174ea 100644 --- a/src/ui/styles/cyber.css +++ b/src/ui/styles/cyber.css @@ -2892,10 +2892,14 @@ max-height: min(48vh, 440px); } + /* Centred like the default theme's phone row; the desktop panel width + would otherwise pin it left of the Reset/Exit axis. */ :root[data-ui-theme='cyber'] body.cockpit-mode .cockpit-utility-controls { top: 92px !important; right: 12px; bottom: auto; + left: 12px; + width: auto; } :root[data-ui-theme='cyber'] From 1165286c7bf0a9345b02d81842220f1afcb7c59f Mon Sep 17 00:00:00 2001 From: Denis Groshev Date: Wed, 4 Nov 2026 16:26:11 +0100 Subject: [PATCH 2/4] docs(changelog): add the phone Cockpit utility row fragment --- changelog.d/1549-cockpit-phone-utility-row.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog.d/1549-cockpit-phone-utility-row.md diff --git a/changelog.d/1549-cockpit-phone-utility-row.md b/changelog.d/1549-cockpit-phone-utility-row.md new file mode 100644 index 0000000000..bccc2ea27f --- /dev/null +++ b/changelog.d/1549-cockpit-phone-utility-row.md @@ -0,0 +1,5 @@ +- Keep the phone Cockpit's Display and Radio launchers off the flight + readouts. At 760 px wide and below, the collapsed row now sits centred on the + Reset/Exit axis above the compass block instead of right-anchored over the + ground speed and altitude telemetry; Cyber's top row is centred too (Denis + Groshev, @ZloyS, #1549). From 4b8a407ba27ca01053571bf2c33de32daad53189 Mon Sep 17 00:00:00 2001 From: German Khokhlov Date: Thu, 19 Nov 2026 18:54:59 +0400 Subject: [PATCH 3/4] fix(cockpit): keep the phone Display/Radio row clear of the DEST cue Above the compass block the centred row covered the DEST route-direction label and chevron at 320-390 px, and its fixed +182px offset pushed it off the top of short landscape screens. Place it between the roll scale and the reticle from a viewport-aware visor inset instead, keep it on screen below the vision controls on short landscape phones, and centre Cyber's expanded panel on the Reset/Exit axis. The unit test now asserts the pointer-events contract and Cyber centring; the browser QA adds the DEST cue to the clearance check, hit-tests each launcher glyph and covers 740x360 and 667x240. --- changelog.d/1549-cockpit-phone-utility-row.md | 7 ++- docs/CURRENT-STATE.md | 16 +++--- scripts/qa-cockpit-utility.mjs | 56 +++++++++++++++---- src/cockpitMarkup.test.mjs | 21 +++++-- src/ui/styles/cockpit.css | 20 +++---- src/ui/styles/cyber.css | 10 +++- 6 files changed, 87 insertions(+), 43 deletions(-) diff --git a/changelog.d/1549-cockpit-phone-utility-row.md b/changelog.d/1549-cockpit-phone-utility-row.md index bccc2ea27f..9e091467a1 100644 --- a/changelog.d/1549-cockpit-phone-utility-row.md +++ b/changelog.d/1549-cockpit-phone-utility-row.md @@ -1,5 +1,6 @@ - Keep the phone Cockpit's Display and Radio launchers off the flight - readouts. At 760 px wide and below, the collapsed row now sits centred on the - Reset/Exit axis above the compass block instead of right-anchored over the - ground speed and altitude telemetry; Cyber's top row is centred too (Denis + instruments. At 760 px wide and below, the collapsed row now sits centred on + the Reset/Exit axis between the roll scale and the reticle, instead of + right-anchored over the ground speed and altitude telemetry, and stays on + screen on short landscape phones. Cyber's top row is centred too (Denis Groshev, @ZloyS, #1549). diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 11b2f28f6f..17d10e4d8b 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -3256,13 +3256,15 @@ down | auth-failed` (plus the unchanged `missing-key`/`unsupported`) with > viewports suppress the legacy layer stack, peripheral HUD, and secondary > Context/briefing panes so the flight instruments and primary controls remain > unobstructed. There the collapsed Display and Radio launchers form one row -> centred on the Reset/Exit axis; the default theme anchors it above the -> compass block, clear of the ground speed and altitude telemetry it used to -> cover, while Cyber keeps the row at the top. `scripts/qa-cockpit-utility.mjs` -> checks the default row's centring and clearance at 390 and 360 px. Outside -> Cockpit, Radio starts collapsed while off and lives -> only in its section inside Context; the detailed panel's normal accordion -> control owns its disclosure and its Enable/Disable action owns power. +> centred on the Reset/Exit axis. The default theme places it between the roll +> scale and the reticle, clear of the destination cue and flight readouts. +> On short landscape screens it stays on screen below the vision controls. +> Cyber keeps the row at the top. `scripts/qa-cockpit-utility.mjs` checks the +> default row's centring, clearance and tap targets at 390×844, 360×740, +> 740×360 and 667×240. Outside Cockpit, Radio starts collapsed while off +> and lives only in its section inside Context; the detailed panel's normal +> accordion control owns its disclosure and its Enable/Disable action +> owns power. > Radio volume in the full and Cockpit surfaces, plus Space Mission > replay speed, use Display / Sharpen's muted 3px rail, circular cyan thumb, > glow, and mono value treatment. Their larger transparent hit areas, keyboard diff --git a/scripts/qa-cockpit-utility.mjs b/scripts/qa-cockpit-utility.mjs index 7b1b860723..9122c8c7e2 100644 --- a/scripts/qa-cockpit-utility.mjs +++ b/scripts/qa-cockpit-utility.mjs @@ -2321,9 +2321,14 @@ try { JSON.stringify(narrowViewActions), ); - // The collapsed Display/Radio row on a phone: centred on the Reset/Exit - // axis and clear of the ground speed and altitude telemetry it once covered. - for (const [width, height] of [[390, 844], [360, 740]]) { + // Short screens have no free band between instruments. The launchers still + // need to stay on screen, accept taps and clear the vision controls. + for (const [width, height, room] of [ + [390, 844, 'portrait'], + [360, 740, 'portrait'], + [740, 360, 'landscape'], + [667, 240, 'short'], + ]) { await page.setViewport({ width, height, deviceScaleFactor: 1 }); const phoneRow = await page.evaluate(async () => { const manager = window.__godsEyeView.styleManager; @@ -2333,19 +2338,41 @@ try { manager.cockpitView.syncSignalLayout(); await new Promise(requestAnimationFrame); const rect = (element) => element?.getBoundingClientRect().toJSON() || null; - const launchers = [...document.querySelectorAll( + const hud = (selector) => document.querySelector(`#cockpit-hud ${selector}`); + const route = document.getElementById('cockpit-route-direction'); + const routeShown = Boolean(route && !route.hidden); + const controls = [...document.querySelectorAll( '#cockpit-utility-controls .cockpit-utility-control', - )].map(rect); + )]; return { - launchers, - speed: rect(document.querySelector('#cockpit-hud .cockpit-speed')), - altitude: rect(document.querySelector('#cockpit-hud .cockpit-altitude')), + launchers: controls.map(rect), + hits: controls.map((control) => { + const glyph = control.querySelector('.cockpit-utility-glyph'); + const box = glyph?.getBoundingClientRect(); + const target = box && document.elementFromPoint( + box.left + box.width / 2, + box.top + box.height / 2, + ); + return Boolean(target && glyph.contains(target)); + }), + speed: rect(hud('.cockpit-speed')), + altitude: rect(hud('.cockpit-altitude')), + route: routeShown ? rect(route) : null, + chevron: routeShown ? rect(route.querySelector('.cockpit-route-chevron')) : null, + reticle: rect(hud('.cockpit-reticle')), + rollArc: rect(hud('.cockpit-roll-arc')), + vision: rect(hud('.cockpit-vision-controls')), switcher: rect(document.getElementById('view-switcher')), viewport: { width: innerWidth, height: innerHeight }, // Cyber parks its row at the top; this check is the default theme's. theme: document.documentElement.dataset.uiTheme || 'default', }; }); + const obstacles = { + portrait: ['speed', 'altitude', 'route', 'chevron', 'reticle', 'rollArc', 'vision'], + landscape: ['speed', 'altitude', 'route', 'chevron', 'reticle', 'vision'], + short: ['vision'], + }[room]; const overlaps = (a, b) => Boolean(a && b) && a.left < b.right && b.left < a.right && a.top < b.bottom && b.top < a.bottom; const rowLeft = Math.min(...phoneRow.launchers.map((launcher) => launcher.left)); @@ -2354,18 +2381,23 @@ try { ? (phoneRow.switcher.left + phoneRow.switcher.right) / 2 : NaN; check( - `${width}px Cockpit Display/Radio row is centred and clear of the speed and altitude readouts`, + `${width}×${height} Cockpit Display/Radio row is centred, on screen, tappable and clear of ${obstacles.join(', ')}`, phoneRow.launchers.length === 2 && phoneRow.launchers.every((launcher) => launcher.width > 0) && phoneRow.theme !== 'cyber' && phoneRow.speed?.width > 0 && phoneRow.altitude?.width > 0 - && phoneRow.launchers.every((launcher) => ( - !overlaps(launcher, phoneRow.speed) && !overlaps(launcher, phoneRow.altitude) + && phoneRow.hits.length === 2 + && phoneRow.hits.every(Boolean) + && phoneRow.launchers.every((launcher) => obstacles.every( + (name) => !overlaps(launcher, phoneRow[name]), )) && Math.abs((rowLeft + rowRight) / 2 - switcherCentre) <= 2 && rowLeft >= 0 - && rowRight <= phoneRow.viewport.width, + && rowRight <= phoneRow.viewport.width + && phoneRow.launchers.every((launcher) => ( + launcher.top >= 0 && launcher.bottom <= phoneRow.viewport.height + )), JSON.stringify(phoneRow), ); } diff --git a/src/cockpitMarkup.test.mjs b/src/cockpitMarkup.test.mjs index 3ce5918cb2..36eef2bf14 100644 --- a/src/cockpitMarkup.test.mjs +++ b/src/cockpitMarkup.test.mjs @@ -1137,16 +1137,25 @@ test('mobile Cockpit prioritizes flight instruments and collision-safe controls' assert.match(mobileCockpit[1], /body\.cockpit-mode #intel-hud/); assert.match(mobileCockpit[1], /body\.cockpit-mode \.cockpit-context-window/); assert.match(mobileCockpit[1], /body\.cockpit-mode \.cockpit-signal-window/); - // The collapsed Display/Radio row is centred on the Reset/Exit axis and - // anchored above the compass block, not at a fixed offset that covered the - // ground speed and altitude readouts; the compass reads the same anchor. assert.match( mobileCockpit[1], - /body\.cockpit-mode \.cockpit-utility-controls \{[\s\S]*?bottom:\s*calc\(var\(--cockpit-compass-bottom\) \+ 182px\);[\s\S]*?left:\s*12px;[\s\S]*?justify-content:\s*center;/, + /body\.cockpit-mode \.cockpit-utility-controls \{[^}]*?top:\s*clamp\(\s*72px,\s*calc\(46% - 68px\),\s*calc\(var\(--cockpit-visor-top\) \+ 108px\)\s*\);[^}]*?left:\s*12px;[^}]*?justify-content:\s*center;[^}]*?pointer-events:\s*none;/, + ); + assert.match( + mobileCockpit[1], + /body\.cockpit-mode \.cockpit-utility-control \{\s*pointer-events:\s*auto;\s*\}/, ); assert.doesNotMatch(mobileCockpit[1], /bottom:\s*152px;/); - assert.match(css, /\.cockpit-compass \{[\s\S]*?bottom:\s*var\(--cockpit-compass-bottom\);/); - assert.match(css, /--cockpit-compass-bottom:\s*clamp\(44px, 7vh, 72px\);/); + assert.match(css, /--cockpit-visor-top:\s*clamp\(62px, 9vh, 90px\);/); + assert.match(css, /\.cockpit-visor-shell \{[^}]*?inset:\s*var\(--cockpit-visor-top\)/); + assert.match( + css, + /:root\[data-ui-theme='cyber'\] body\.cockpit-mode \.cockpit-utility-controls \{[^}]*?top:\s*92px !important;[^}]*?width:\s*auto;/, + ); + assert.match( + css, + /:root\[data-ui-theme='cyber'\]\s+body\.cockpit-mode\s+\.cockpit-utility-control\.is-expanded \{\s*right:\s*auto;\s*\}/, + ); assert.match( mobileCockpit[1], /body\.cockpit-mode \.cockpit-utility-control\.is-expanded[\s\S]*?top:\s*96px;/, diff --git a/src/ui/styles/cockpit.css b/src/ui/styles/cockpit.css index ae9e8025b0..b3cc9b0862 100644 --- a/src/ui/styles/cockpit.css +++ b/src/ui/styles/cockpit.css @@ -48,9 +48,8 @@ --cockpit-side-panel-width: min(340px, 28vw); /* HUD bottom offset + tallest scaled telemetry block + 20px clear border. */ --cockpit-bottom-rail-safe: calc(clamp(84px, 11vh, 118px) + 100px); - /* The compass block's bottom edge; the phone Display/Radio row sits above - the telemetry it carries. */ - --cockpit-compass-bottom: clamp(44px, 7vh, 72px); + /* The phone Display/Radio row shares the visor inset with the roll scale. */ + --cockpit-visor-top: clamp(62px, 9vh, 90px); position: fixed; inset: 0; z-index: 145; @@ -68,7 +67,7 @@ } .cockpit-visor-shell { position: absolute; - inset: clamp(62px, 9vh, 90px) clamp(18px, 3vw, 48px) clamp(38px, 5vh, 56px); + inset: var(--cockpit-visor-top) clamp(18px, 3vw, 48px) clamp(38px, 5vh, 56px); transform-style: preserve-3d; perspective: 880px; } @@ -648,7 +647,7 @@ html:not([lang='en']) .cockpit-roll-token.is-separator { .cockpit-compass { position: absolute; left: 50%; - bottom: var(--cockpit-compass-bottom); + bottom: clamp(44px, 7vh, 72px); width: min(760px, 72vw); transform: translateX(-50%) rotateX(7deg) translateZ(18px); transform-style: preserve-3d; @@ -2079,17 +2078,14 @@ body.cockpit-mode #intel-hud .hud-right-edge { body.cockpit-mode #right-context-rail { display: none !important; } - /* A centred row above the compass block: its ground speed and altitude - telemetry tops out ~171px above the block's bottom edge on phones, so - the row clears it by ~10px and stays on the same axis as RESET/EXIT. - The row spans the width to centre its launchers; only they take input. */ + /* Place the row just below the roll arc (visor inset + 2px + 96px). + On shorter screens, leave 8px between the 42px row and the reticle + (46% - 18px), keeping the row below the vision controls at 72px. */ body.cockpit-mode .cockpit-utility-controls { - top: auto; + top: clamp(72px, calc(46% - 68px), calc(var(--cockpit-visor-top) + 108px)); right: 12px; - bottom: calc(var(--cockpit-compass-bottom) + 182px); left: 12px; justify-content: center; - max-width: none; pointer-events: none; } body.cockpit-mode .cockpit-utility-controls { diff --git a/src/ui/styles/cyber.css b/src/ui/styles/cyber.css index d7c0c174ea..fb78028056 100644 --- a/src/ui/styles/cyber.css +++ b/src/ui/styles/cyber.css @@ -2892,16 +2892,20 @@ max-height: min(48vh, 440px); } - /* Centred like the default theme's phone row; the desktop panel width - would otherwise pin it left of the Reset/Exit axis. */ + /* Centred like the default theme's phone row. */ :root[data-ui-theme='cyber'] body.cockpit-mode .cockpit-utility-controls { top: 92px !important; right: 12px; bottom: auto; - left: 12px; width: auto; } + :root[data-ui-theme='cyber'] + body.cockpit-mode + .cockpit-utility-control.is-expanded { + right: auto; + } + :root[data-ui-theme='cyber'] body.cockpit-mode .cockpit-utility-control:not(.is-expanded) From 49785e423d041e54bbc5ccfc4b4d3f7e74819845 Mon Sep 17 00:00:00 2001 From: German Khokhlov Date: Fri, 20 Nov 2026 11:39:45 +0400 Subject: [PATCH 4/4] fix(cockpit): scope the centred phone row and keep Stories unread in Cockpit The centred Display/Radio row now applies only inside the phone shell (720 px and below) on flight and bridge views; satellite and provider cockpits, narrow short windows (under 390x450) and very short windows (under 240 px) keep main's right-anchored place, so the row no longer lands on the desktop rail, orbital zoom, LOOK AHEAD, Reset or the Stories button. The row sizes to its launchers instead of spanning the width. The first-visit Stories announcement stays hidden and unread while Cockpit is open: a Stories tap that Cockpit refuses no longer marks it seen, so it shows again after Exit. The unit tests and the Cockpit QA cover the phone boundary, glyph and side taps, the destination cue, short and narrow windows and the announcement's return. --- changelog.d/1549-cockpit-phone-utility-row.md | 12 +- docs/CURRENT-STATE.md | 23 +-- scripts/qa-cockpit-utility.mjs | 143 +++++++++++++----- src/cockpitMarkup.test.mjs | 19 ++- src/ui/storiesView.test.mjs | 27 ++++ src/ui/styles/cockpit.css | 43 ++++-- src/ui/views/StoriesView.vue | 6 +- 7 files changed, 204 insertions(+), 69 deletions(-) diff --git a/changelog.d/1549-cockpit-phone-utility-row.md b/changelog.d/1549-cockpit-phone-utility-row.md index d01e466ae0..e3e59d6ea6 100644 --- a/changelog.d/1549-cockpit-phone-utility-row.md +++ b/changelog.d/1549-cockpit-phone-utility-row.md @@ -1,5 +1,9 @@ - Keep the phone Cockpit's Display and Radio launchers off the flight - instruments. At 760 px wide and below, the collapsed row now sits centred on - the Reset/Exit axis between the roll scale and the reticle, instead of - right-anchored over the ground speed and altitude telemetry, and stays on - screen on short landscape phones (Denis Groshev, @ZloyS, #1549). + instruments. In the phone layout (720 px wide and below), the collapsed row + of the flight and bridge views now sits centred on the Reset/Exit axis + above the reticle, clear of the destination cue, instead of right-anchored + over the ground speed and altitude readouts. On short landscape phones it + stays on screen and tappable below the vision controls, though it may cover + the top of the readouts. Very short or narrow split-screen windows keep + the old place above Reset/Exit. The first-visit Stories announcement waits until + Cockpit closes (Denis Groshev, @ZloyS, #1549). diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 6b54f70a83..15ad11f388 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -5104,15 +5104,20 @@ down | auth-failed` (plus the unchanged `missing-key`/`unsupported`) with > stacking. Narrow mobile Cockpit > viewports suppress the legacy layer stack, peripheral HUD, and secondary > Context/briefing panes so the flight instruments and primary controls remain -> unobstructed. There the collapsed Display and Radio launchers form one row -> centred on the Reset/Exit axis, between the roll scale and the reticle, -> clear of the destination cue and flight readouts. On short landscape -> screens it stays on screen below the vision controls. -> `scripts/qa-cockpit-utility.mjs` checks the row's centring, clearance and -> tap targets at 390×844, 360×740, 740×360 and 667×240. Outside Cockpit, -> Radio starts collapsed while off and lives only in its section inside -> Context; the detailed panel's normal accordion control owns its disclosure -> and its Enable/Disable action owns power. +> unobstructed. In the phone layout (720 px wide and below) the flight and +> bridge views put the collapsed Display and Radio launchers in one row +> centred on the Reset/Exit axis, above the reticle and clear of the +> destination cue: below the roll arc in portrait, over the arc's lower tick +> ends in landscape. On short landscape screens the row stays +> on screen and tappable below the vision controls but may cover the top of +> the speed and altitude readouts. Windows under 240 px tall, and those under +> 390 px wide and 450 px tall, keep the row above Reset/Exit at the right. +> Satellite and provider views keep the row +> above Reset/Exit at the right, where their own layouts expect it. The +> first-visit Stories announcement waits, unread, until Cockpit closes. +> Outside Cockpit, Radio starts collapsed while off and lives only in its +> section inside Context; the detailed panel's normal accordion control +> owns its disclosure and its Enable/Disable action owns power. > Radio volume in the full and Cockpit surfaces, plus Space Mission > replay speed, use Display / Sharpen's muted 3px rail, circular cyan thumb, > glow, and mono value treatment. Their larger transparent hit areas, keyboard diff --git a/scripts/qa-cockpit-utility.mjs b/scripts/qa-cockpit-utility.mjs index 3d556f2f4f..157592d398 100644 --- a/scripts/qa-cockpit-utility.mjs +++ b/scripts/qa-cockpit-utility.mjs @@ -2050,13 +2050,50 @@ try { JSON.stringify(narrowViewActions), ); - // Short screens have no free band between instruments. The launchers still - // need to stay on screen, accept taps and clear the vision controls. + // A fresh profile has not seen the Stories announcement: Cockpit keeps + // it unread and off the phone row until it closes. + const storiesPopupDisplay = () => { + const popup = document.getElementById('hPop'); + return popup ? getComputedStyle(popup).display : null; + }; + const storiesPopupInCockpit = await page.evaluate(storiesPopupDisplay); + check('the unread Stories announcement waits while Cockpit is open', + storiesPopupInCockpit === 'none', String(storiesPopupInCockpit)); + + // Windows too short for the centred row keep it above Reset/Exit. + for (const [width, height] of [[360, 370], [320, 360], [568, 188], [667, 190]]) { + await page.setViewport({ width, height, deviceScaleFactor: 1 }); + const glyphHits = await page.evaluate(async () => { + const manager = window.__godsEyeView.styleManager; + manager._setCockpitDisclosure('display', false); + manager._setCockpitDisclosure('radio', false); + await new Promise(requestAnimationFrame); + await new Promise(requestAnimationFrame); + return [...document.querySelectorAll( + '#cockpit-utility-controls .cockpit-utility-glyph', + )].map((glyph) => { + const box = glyph.getBoundingClientRect(); + const target = document.elementFromPoint( + box.left + box.width / 2, + box.top + box.height / 2, + ); + return target && glyph.contains(target) ? 'ok' : target?.closest('[id]')?.id || null; + }); + }); + check( + `${width}×${height} Cockpit Display/Radio glyph centres reach their own launchers`, + glyphHits.length === 2 && glyphHits.every((hit) => hit === 'ok'), + JSON.stringify(glyphHits), + ); + } + + // The phone row's place in each room: centred on Reset/Exit, on screen, + // tappable, and clear of what that room has space to clear. for (const [width, height, room] of [ - [390, 844, 'portrait'], [360, 740, 'portrait'], - [740, 360, 'landscape'], + [720, 360, 'landscape'], [667, 240, 'short'], + [390, 844, 'portrait'], ]) { await page.setViewport({ width, height, deviceScaleFactor: 1 }); const phoneRow = await page.evaluate(async () => { @@ -2069,52 +2106,76 @@ try { const rect = (element) => element?.getBoundingClientRect().toJSON() || null; const hud = (selector) => document.querySelector(`#cockpit-hud ${selector}`); const route = document.getElementById('cockpit-route-direction'); - const routeShown = Boolean(route && !route.hidden); - const controls = [...document.querySelectorAll( - '#cockpit-utility-controls .cockpit-utility-control', - )]; - return { - launchers: controls.map(rect), - hits: controls.map((control) => { - const glyph = control.querySelector('.cockpit-utility-glyph'); - const box = glyph?.getBoundingClientRect(); - const target = box && document.elementFromPoint( - box.left + box.width / 2, - box.top + box.height / 2, - ); - return Boolean(target && glyph.contains(target)); - }), - speed: rect(hud('.cockpit-speed')), - altitude: rect(hud('.cockpit-altitude')), - route: routeShown ? rect(route) : null, - chevron: routeShown ? rect(route.querySelector('.cockpit-route-chevron')) : null, - reticle: rect(hud('.cockpit-reticle')), - rollArc: rect(hud('.cockpit-roll-arc')), - vision: rect(hud('.cockpit-vision-controls')), - switcher: rect(document.getElementById('view-switcher')), - viewport: { width: innerWidth, height: innerHeight }, - }; + // A live flight may have no route, which hides the DEST cue. Show it while + // measuring so the clearance check always has a cue to clear. + const wasHidden = route.hidden; + try { + route.hidden = false; + const controls = [...document.querySelectorAll( + '#cockpit-utility-controls .cockpit-utility-control', + )]; + const launchers = controls.map(rect); + const rowLeft = Math.min(...launchers.map((launcher) => launcher.left)); + const rowRight = Math.max(...launchers.map((launcher) => launcher.right)); + // Taps beside the row reach what is under it. + const besideHits = []; + if (launchers.length) { + const middle = launchers[0].top + launchers[0].height / 2; + for (const x of [rowLeft - 8, rowRight + 8]) { + const target = document.elementFromPoint(x, middle); + besideHits.push(Boolean(target?.closest('#cockpit-utility-controls'))); + } + } + return { + launchers, + rowLeft, + rowRight, + besideHits, + hits: controls.map((control) => { + const glyph = control.querySelector('.cockpit-utility-glyph'); + const box = glyph?.getBoundingClientRect(); + const target = box && document.elementFromPoint( + box.left + box.width / 2, + box.top + box.height / 2, + ); + return Boolean(target && glyph.contains(target)); + }), + speed: rect(hud('.cockpit-speed')), + altitude: rect(hud('.cockpit-altitude')), + route: rect(route), + chevron: rect(route.querySelector('.cockpit-route-chevron')), + reticle: rect(hud('.cockpit-reticle')), + rollArc: rect(hud('.cockpit-roll-arc')), + vision: rect(hud('.cockpit-vision-controls')), + switcher: rect(document.getElementById('view-switcher')), + viewport: { width: innerWidth, height: innerHeight }, + }; + } finally { + route.hidden = wasHidden; + } }); const obstacles = { portrait: ['speed', 'altitude', 'route', 'chevron', 'reticle', 'rollArc', 'vision'], + // The row covers the roll arc's lower tick ends; ticks and labels stay readable. landscape: ['speed', 'altitude', 'route', 'chevron', 'reticle', 'vision'], + // No free band between the instruments: only the vision controls. short: ['vision'], }[room]; const overlaps = (a, b) => Boolean(a && b) && a.left < b.right && b.left < a.right && a.top < b.bottom && b.top < a.bottom; - const rowLeft = Math.min(...phoneRow.launchers.map((launcher) => launcher.left)); - const rowRight = Math.max(...phoneRow.launchers.map((launcher) => launcher.right)); - const switcherCentre = phoneRow.switcher - ? (phoneRow.switcher.left + phoneRow.switcher.right) / 2 - : NaN; + const { rowLeft, rowRight } = phoneRow; + const switcherCentre = (phoneRow.switcher?.left + phoneRow.switcher?.right) / 2; + const [first, second] = phoneRow.launchers; check( - `${width}×${height} Cockpit Display/Radio row is centred, on screen, tappable and clear of ${obstacles.join(', ')}`, + `${width}×${height} Cockpit Display/Radio row is centred in one line, on screen, tappable and clear of ${obstacles.join(', ')}`, phoneRow.launchers.length === 2 && phoneRow.launchers.every((launcher) => launcher.width > 0) && phoneRow.speed?.width > 0 && phoneRow.altitude?.width > 0 - && phoneRow.hits.length === 2 + && (room === 'short' || (phoneRow.route?.width > 0 && phoneRow.chevron?.width > 0)) && phoneRow.hits.every(Boolean) + && phoneRow.besideHits.every((inside) => !inside) + && Math.abs((first?.top + first?.bottom) / 2 - (second?.top + second?.bottom) / 2) <= 1 && phoneRow.launchers.every((launcher) => obstacles.every( (name) => !overlaps(launcher, phoneRow[name]), )) @@ -2127,7 +2188,12 @@ try { JSON.stringify(phoneRow), ); } - await page.setViewport({ width: 390, height: 844, deviceScaleFactor: 1 }); + + // A Stories tap that Cockpit refuses leaves the announcement unread. + await page.evaluate(() => document.getElementById('hStories').click()); + await page.waitForFunction( + () => document.querySelector('#toast.visible')?.textContent === 'Exit cockpit to open Stories', + ); const resetResult = await page.evaluate(() => { // Both the UI and compatibility facade delegate to this navigation owner. @@ -2200,6 +2266,9 @@ try { && resetState.visionRestored, JSON.stringify(resetState), ); + const storiesPopupAfterReset = await page.evaluate(storiesPopupDisplay); + check('the Stories announcement returns once Cockpit closes', + storiesPopupAfterReset !== null && storiesPopupAfterReset !== 'none', String(storiesPopupAfterReset)); check('runtime console remains clean', consoleErrors.length === 0 && localHttpErrors.length === 0, [...localHttpErrors, ...consoleErrors].slice(0, 6).join(' | ')); } finally { diff --git a/src/cockpitMarkup.test.mjs b/src/cockpitMarkup.test.mjs index 32196b3dce..8c4d15d98f 100644 --- a/src/cockpitMarkup.test.mjs +++ b/src/cockpitMarkup.test.mjs @@ -1142,14 +1142,16 @@ test('mobile Cockpit prioritizes flight instruments and collision-safe controls' assert.match(mobileCockpit[1], /body\.cockpit-mode \.cockpit-signal-window/); assert.match( mobileCockpit[1], - /body\.cockpit-mode \.cockpit-utility-controls \{[^}]*?top:\s*clamp\(\s*72px,\s*calc\(46% - 68px\),\s*calc\(var\(--cockpit-visor-top\) \+ 108px\)\s*\);[^}]*?left:\s*12px;[^}]*?justify-content:\s*center;[^}]*?pointer-events:\s*none;/, + /body\.cockpit-mode \.cockpit-utility-controls[\s\S]*?bottom:\s*152px;/, ); assert.match( mobileCockpit[1], - /body\.cockpit-mode \.cockpit-utility-control \{\s*pointer-events:\s*auto;\s*\}/, + /body\.cockpit-mode\.mobile-shell[^{]*?\.cockpit-utility-controls \{[^}]*?top:[^;]*?var\(--cockpit-visor-top\)/, + ); + assert.match( + mobileCockpit[1], + /@media \(min-width: 390px\) and \(min-height: 240px\),\s*\(min-height: 450px\) \{\s*body\.cockpit-mode\.mobile-shell/, ); - assert.doesNotMatch(mobileCockpit[1], /bottom:\s*152px;/); - assert.match(css, /--cockpit-visor-top:\s*clamp\(62px, 9vh, 90px\);/); assert.match(css, /\.cockpit-visor-shell \{[^}]*?inset:\s*var\(--cockpit-visor-top\)/); assert.match( mobileCockpit[1], @@ -1169,6 +1171,15 @@ test('mobile Cockpit prioritizes flight instruments and collision-safe controls' ); }); +test('the unread Stories announcement waits until Cockpit closes', () => { + assert.match(css, /body\.cockpit-mode #gev-stories #hPop \{\s*display:\s*none;\s*\}/); + const storiesView = fs.readFileSync(path.join(ROOT, 'src', 'ui', 'views', 'StoriesView.vue'), 'utf8'); + assert.match( + storiesView, + /async function openExplore\(\) \{[^}]*?if \(await store\.controller\.open\(\)\) markPopSeen\(\);/, + ); +}); + test('cockpit route direction uses self-contained vector artwork, not a font ligature', () => { const match = html.match(/
/); assert.ok(match, 'cockpit route-direction markup is missing'); diff --git a/src/ui/storiesView.test.mjs b/src/ui/storiesView.test.mjs index e200cbab63..3a0c0ef1db 100644 --- a/src/ui/storiesView.test.mjs +++ b/src/ui/storiesView.test.mjs @@ -6,6 +6,33 @@ import { createPinia } from 'pinia'; import { useStoriesStore } from './stores/stories.js'; import { storyById } from '../stories/catalog.js'; import StoryScreen from './views/stories/StoryScreen.vue'; +import StoriesView from './views/StoriesView.vue'; + +test('the announcement stays unread when a lazy Stories open resolves to false', async (t) => { + const host = document.body.appendChild(document.createElement('div')); + const pinia = createPinia(); + const store = useStoriesStore(pinia); + let allowed = false; + store.connect({ open: async () => allowed }); + const app = createApp(StoriesView).use(pinia); + app.mount(host); + t.after(() => { + app.unmount(); + host.remove(); + localStorage.removeItem('gevStoriesPopSeen'); + }); + + const entry = host.querySelector('#hStories'); + entry.click(); + await nextTick(); + assert.equal(localStorage.getItem('gevStoriesPopSeen'), null); + assert.ok(host.querySelector('#hPop')); + + allowed = true; + entry.click(); + await nextTick(); + assert.equal(localStorage.getItem('gevStoriesPopSeen'), '1'); +}); test('the story screen previews a drag and seeks once on release', async (t) => { const host = document.body.appendChild(document.createElement('div')); diff --git a/src/ui/styles/cockpit.css b/src/ui/styles/cockpit.css index 4a091450ef..f5756cef93 100644 --- a/src/ui/styles/cockpit.css +++ b/src/ui/styles/cockpit.css @@ -78,7 +78,7 @@ --cockpit-side-panel-width: min(340px, 28vw); /* HUD bottom offset + tallest scaled telemetry block + 20px clear border. */ --cockpit-bottom-rail-safe: calc(clamp(84px, 11vh, 118px) + 100px); - /* The phone Display/Radio row shares the visor inset with the roll scale. */ + /* The phone Display/Radio row shares the visor inset with the roll arc. */ --cockpit-visor-top: clamp(62px, 9vh, 90px); position: fixed; inset: 0; @@ -2026,6 +2026,11 @@ body.cockpit-mode ) { display: none !important; } +/* The first-visit Stories announcement waits, unread, until Cockpit closes: + on a phone it would cover the Display/Radio row. */ +body.cockpit-mode #gev-stories #hPop { + display: none; +} body.cockpit-mode #left-panel-stack { z-index: 147; display: flex; @@ -2118,21 +2123,35 @@ body.cockpit-mode #intel-hud .hud-right-edge { body.cockpit-mode #right-context-rail { display: none !important; } - /* Place the row just below the roll arc (visor inset + 2px + 96px). - On shorter screens, leave 8px between the 42px row and the reticle - (46% - 18px), keeping the row below the vision controls at 72px. */ body.cockpit-mode .cockpit-utility-controls { - top: clamp(72px, calc(46% - 68px), calc(var(--cockpit-visor-top) + 108px)); + top: auto; right: 12px; - left: 12px; - justify-content: center; - pointer-events: none; - } - body.cockpit-mode .cockpit-utility-controls { + bottom: 152px; flex-direction: row; + max-width: calc(100vw - 24px); } - body.cockpit-mode .cockpit-utility-control { - pointer-events: auto; + /* Phone flight and bridge views: one row centred on the Reset/Exit axis, + 10px below the roll arc (.cockpit-roll-arc: 2px + 96px into the visor). + Shorter screens reserve 36px around the 46% centre of .cockpit-reticle + (about 25px tall on phones), plus an 8px gap below the 42px row. + The row stops at 72px, below the vision controls. Windows under 240px + tall, and narrow ones under 450px tall, keep the right-aligned row above + Reset/Exit, clear of Reset, LOOK AHEAD and the Stories button, as do + satellite and provider views. */ + @media (min-width: 390px) and (min-height: 240px), (min-height: 450px) { + body.cockpit-mode.mobile-shell + #cockpit-hud:not([data-generic]):not([data-subject='satellite']) + .cockpit-utility-controls { + top: clamp( + 72px, + calc(46% - 68px), + calc(var(--cockpit-visor-top) + 108px) + ); + bottom: auto; + left: 12px; + width: max-content; + margin-inline: auto; + } } body.cockpit-mode .cockpit-utility-launcher { width: min(150px, calc((100vw - 31px) / 2)); diff --git a/src/ui/views/StoriesView.vue b/src/ui/views/StoriesView.vue index 84d9939bf0..31b8370436 100644 --- a/src/ui/views/StoriesView.vue +++ b/src/ui/views/StoriesView.vue @@ -152,9 +152,9 @@ function markPopSeen() { /* storage off: the popup comes back next visit */ } } -function openExplore() { - markPopSeen(); - store.controller.open(); +async function openExplore() { + // A refused open (Cockpit) leaves the announcement unread. + if (await store.controller.open()) markPopSeen(); } // ── Opened in GEV: a toast that leads back to the story ──