mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 17:52:21 +00:00
Display > HUD > Sonar now turns the sonar sweep on over Tactical or Minimal. It is off by default, ON reveals its five sliders, and it keeps its guards: an OFF control, the sweep only while the HUD is visible and outside Cockpit, no animation under reduced motion, and repaint timers re-armed only after a drawn frame that still shows contacts. The Cyber layout, its shell skin and its Cockpit lanes are removed. Share links, scenes, saved views and set_hud that name Cyber open Tactical with Sonar on; links and scene shots record Tactical with Sonar under the same code, and a restored state that names another layout turns Sonar off. set_cyber_sonar keeps its name and works under any layout. A newer Sonar toggle or voice setting wins over a share-link restore that lands later. From 1200px wide the command dock and World Timeline sit 74px above the bottom edge, as in the Omnibar layout, leaving the bottom row to the map attribution (left) and the Power Up corner row (right). The attribution moves to the bottom right when the page runs right to left, where the corner row sits at the bottom left, and a long credit line wraps upward before reaching the corner row. The Tactical bottom-right readout sits 8px above Power Up and the coordinates start level with it. The World Timeline is narrowed to sit between the corners. Toasts keep clear of the raised dock and the chat and voice panel height budgets subtract its rise. Below 1200px the layout is unchanged. The left rail treats the centered World Timeline and voice control as obstacles only where they reach a laid-out panel. On top of the Omnibar: sonar.css replaces cyber.css after the Omnibar imports, the Omnibar's HUD guide step now says Layout picks Tactical or Minimal, and the Omnibar's Tactical bottom-right readout keeps the same 8px above Power Up. Co-authored-by: Sameh Khamis <[email protected]>
105 lines
3.2 KiB
JavaScript
105 lines
3.2 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
|
|
import {
|
|
resolveCockpitUtilityAnchor,
|
|
resolveCockpitUtilityLayout,
|
|
} from './cockpitUtilityLayout.js';
|
|
|
|
// 1512x790, the height the strip used to collide with the briefing card at.
|
|
const desktop = { viewportHeight: 790, stripHeight: 107, collapsedHeight: 50 };
|
|
|
|
test('the strip hangs 12px under the REC readout when the briefing card leaves room', () => {
|
|
const { top } = resolveCockpitUtilityAnchor({ ...desktop, recBottom: 148.1, signalTop: 420 });
|
|
assert.equal(Number(top.toFixed(1)), 160.1);
|
|
});
|
|
|
|
test('a tall briefing card pulls the strip up instead of being overlapped', () => {
|
|
const { top, maxHeight } = resolveCockpitUtilityAnchor({
|
|
...desktop,
|
|
recBottom: 148.1,
|
|
signalTop: 265.4,
|
|
});
|
|
assert.equal(Number(top.toFixed(1)), 150.4);
|
|
assert.equal(Number((265.4 - (top + desktop.stripHeight)).toFixed(1)), 8);
|
|
assert.equal(Number(maxHeight.toFixed(1)), 107);
|
|
});
|
|
|
|
test('the strip never climbs into the topline, whatever the briefing card does', () => {
|
|
const { top } = resolveCockpitUtilityAnchor({
|
|
...desktop,
|
|
viewportHeight: 1400,
|
|
recBottom: 200,
|
|
signalTop: 150,
|
|
});
|
|
// minTop = max(96, 1400 * 0.12) = 168.
|
|
assert.equal(top, 168);
|
|
});
|
|
|
|
test('the corridor is measured from the resolved top and floors on a launcher, not 120', () => {
|
|
const { top, maxHeight } = resolveCockpitUtilityAnchor({
|
|
...desktop,
|
|
viewportHeight: 700,
|
|
recBottom: 148.1,
|
|
signalTop: 140,
|
|
});
|
|
assert.equal(top, 96);
|
|
// 140 - 96 - 8 = 36px of real corridor: report the launcher floor, never a
|
|
// 120px fiction that let the strip run straight through the card.
|
|
assert.equal(maxHeight, 50);
|
|
});
|
|
|
|
test('a missing REC readout leaves the strip on the viewport ceiling', () => {
|
|
const { top } = resolveCockpitUtilityAnchor({ ...desktop, recBottom: 0, signalTop: 600 });
|
|
assert.equal(top, 96);
|
|
});
|
|
|
|
test('the visible briefing card bounds the utility strip, collapsed or not', () => {
|
|
const { top, maxHeight } = resolveCockpitUtilityAnchor({
|
|
...desktop, recBottom: 148.1, signalTop: 265.4,
|
|
});
|
|
assert.equal(Number((top + maxHeight).toFixed(1)), 257.4);
|
|
assert.equal(Number(maxHeight.toFixed(1)), 107);
|
|
});
|
|
|
|
test('keeps the collapsed sibling visible when both Cockpit utilities fit', () => {
|
|
assert.deepEqual(resolveCockpitUtilityLayout({
|
|
availableHeight: 320,
|
|
expandedHeight: 220,
|
|
collapsedHeight: 50,
|
|
}), {
|
|
primaryOnly: false,
|
|
expandedMaxHeight: 263,
|
|
});
|
|
});
|
|
|
|
test('keeps the collapsed sibling at the exact corridor boundary', () => {
|
|
assert.equal(resolveCockpitUtilityLayout({
|
|
availableHeight: 277,
|
|
expandedHeight: 220,
|
|
collapsedHeight: 50,
|
|
}).primaryOnly, false);
|
|
});
|
|
|
|
test('gives the expanded panel the full corridor when both controls do not fit', () => {
|
|
assert.deepEqual(resolveCockpitUtilityLayout({
|
|
availableHeight: 276,
|
|
expandedHeight: 220,
|
|
collapsedHeight: 50,
|
|
}), {
|
|
primaryOnly: true,
|
|
expandedMaxHeight: 276,
|
|
});
|
|
});
|
|
|
|
test('clamps malformed or short corridors to the minimum expanded height', () => {
|
|
assert.deepEqual(resolveCockpitUtilityLayout({
|
|
availableHeight: Number.NaN,
|
|
expandedHeight: 180,
|
|
collapsedHeight: 50,
|
|
}), {
|
|
primaryOnly: true,
|
|
expandedMaxHeight: 120,
|
|
});
|
|
});
|