mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 18:22:25 +00:00
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.
This commit is contained in:
1 parent
1165286c7b
commit
4b8a407ba2
6 files changed
+87
-43
No files matched your search
@@ -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).
|
||||
@@ -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
|
||||
|
||||
@@ -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),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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;/,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user