Keep Directions reachable and tested in the Utilities panel

Voice show_data_layers_menu opens the panel that holds the row, so asking
for Directions opens UTILITIES and reports that panel, not a hidden row
under Data Layers. In Cockpit the panel stays with Directions alone, as
Data Layers does; only Draw and Import step aside there.

Draw's options sit flat under its name instead of keeping the card that
hung under a DISPLAY button, and its Shape label no longer takes DISPLAY's
label column in other languages. Cyber marks Draw on with its red edge.

LayerPanel routing, the voice panel choice, and the panel's order, mode
and phone-sheet CSS gain tests that fail on the earlier code. The form-field
and segmented-control gates open Utilities for Draw's controls, measuring
Scenes and Utilities in turn since the left rail fits one tall panel.
README, CONTRIBUTING, the PR template, CURRENT-STATE and comments now say
UTILITIES for Draw and Import and list the Audio group, and two files
outside the format scope lose an unrelated reflow.
This commit is contained in:
Said Turksever committed 2026-10-29 11:53:15 +00:00
1 parent d730b0ce87
commit 8543b7be43
22 files changed
+319 -97

No files matched your search

+3 -14
View File
@@ -1,9 +1,4 @@
import {
getScopeMaskFeather,
isScopeMaskEnabled,
setScopeMaskEnabled,
setScopeMaskFeather,
} from '../scopeMask.js';
import { getScopeMaskFeather, isScopeMaskEnabled, setScopeMaskEnabled, setScopeMaskFeather } from '../scopeMask.js';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import test from 'node:test';
@@ -279,14 +274,8 @@ test('Display and voice HUD routes preserve explicit Cyber entry and exit author
test('scope choice and expanded feather survive every HUD layout and both restore paths', async (t) => {
const { owner } = styleOwner(t, 'tactical');
const previous = {
enabled: isScopeMaskEnabled(),
feather: getScopeMaskFeather(),
};
t.after(() => {
setScopeMaskEnabled(previous.enabled);
setScopeMaskFeather(previous.feather);
});
const previous = { enabled: isScopeMaskEnabled(), feather: getScopeMaskFeather() };
t.after(() => { setScopeMaskEnabled(previous.enabled); setScopeMaskFeather(previous.feather); });
Object.assign(owner.services, { setScopeMaskEnabled, setScopeMaskFeather });
owner._scopeBtn = { checked: true };
owner._scopeFeatherSlider = { value: '11', disabled: false };
+1 -1
View File
@@ -1,4 +1,4 @@
// Behavioral tests for DISPLAY ▸ Import: the controller is driven against
// Behavioral tests for UTILITIES ▸ Import: the controller is driven against
// fake DOM and viewer doubles with an injected loader, and its observable
// effects are asserted — data sources added and removed, list rows, the hint,
// drop handling, the file limit, and what destroy() gives back. Real parsing
+109
View File
@@ -378,3 +378,112 @@ test('the Weather readout receives enabled air-quality alongside weather layers'
],
);
});
// Directions renders in the Utilities panel's list; Data Layers keeps the rest.
async function utilitiesFixture({ withUtilities = true } = {}) {
const { LayerPanel } = await import('./layerPanel.js');
const { railFixture } = await import('./railTestFixture.mjs');
const f = railFixture();
// Rows are looked up by layer id on refresh; a render clears with innerHTML.
const findable = (node) => {
Object.defineProperty(node, 'innerHTML', {
set(html) {
if (html === '') for (const child of [...node.children]) child.remove();
},
});
const querySelector = node.querySelector.bind(node);
node.querySelector = (selector) => {
const id = /^\[data-layer-id="(.+)"\]$/.exec(selector)?.[1];
return id
? f.find((child) => child.dataset?.layerId === id, node)
: querySelector(selector);
};
return node;
};
findable(f.container);
const utilities = findable(f.document.createElement('div'));
f.document.getElementById = (id) =>
withUtilities && id === 'utilities-toggles' ? utilities : null;
const previousDocument = globalThis.document;
globalThis.document = f.document;
const layers = ['radio', 'directions', 'flights'].map((id) => ({
id,
name: id,
icon: '*',
source: 'S',
enabled: false,
showInTogglePanel: true,
stats: {},
}));
const panel = new LayerPanel({
getLayers: () => layers,
isEnabled: (id) => layers.find((layer) => layer.id === id).enabled,
setEnabled() {},
setLayerParams() {},
getRowControls: () => null,
hasRowControls: () => false,
subscribeRowControls: () => () => {},
});
panel.mount(f.container);
const headings = (root) =>
root.children
.filter((node) => node.tagName === 'H3')
.map((node) => node.textContent);
const rowIds = (root) =>
root.children
.filter((node) => node.dataset?.layerId)
.map((node) => node.dataset.layerId);
const restore = () => {
panel.destroy();
globalThis.document = previousDocument;
};
return { f, panel, utilities, layers, headings, rowIds, restore };
}
test('Directions renders in the Utilities list without a heading, and Radio under Audio', async () => {
const { f, panel, utilities, headings, rowIds, restore } =
await utilitiesFixture();
try {
assert.deepEqual(rowIds(utilities), ['directions']);
assert.deepEqual(headings(utilities), []);
assert.deepEqual(rowIds(f.container), ['flights', 'radio']);
assert.deepEqual(headings(f.container), ['Movement', 'Audio']);
panel.mount(f.container);
assert.deepEqual(
rowIds(utilities),
['directions'],
'a remount replaces it',
);
} finally {
restore();
}
});
test('a refresh updates the Directions row in the Utilities list', async () => {
const { f, panel, utilities, layers, restore } = await utilitiesFixture();
try {
const row = f.find(
(node) => node.dataset?.layerId === 'directions',
utilities,
);
const toggle = row.querySelector('.data-toggle-btn');
assert.ok(!toggle.className.includes('active'));
layers.find(({ id }) => id === 'directions').enabled = true;
panel._refreshTogglePanel();
assert.ok(toggle.className.includes('active'));
} finally {
restore();
}
});
test('without the Utilities list, Directions stays in Data Layers under Utilities', async () => {
const { f, headings, rowIds, restore } = await utilitiesFixture({
withUtilities: false,
});
try {
assert.deepEqual(rowIds(f.container), ['flights', 'directions', 'radio']);
assert.deepEqual(headings(f.container), ['Movement', 'Utilities', 'Audio']);
} finally {
restore();
}
});
+5 -1
View File
@@ -2007,10 +2007,14 @@ body.cockpit-mode #left-panel-stack {
max-height: none;
transition: none;
}
body.cockpit-mode #left-panel-stack > #utilities-panel,
body.cockpit-mode #left-panel-stack > #scene-panel {
display: none !important;
}
/* Directions stays reachable in Cockpit, as in Data Layers; Draw and Import
were never there (DISPLAY sits in the hidden right rail). */
body.cockpit-mode #utilities-panel .utilities-tools {
display: none !important;
}
body.cockpit-mode #right-context-rail {
display: none !important;
}
+2 -2
View File
@@ -750,7 +750,7 @@ html:not([lang='en']) .pp-slider-row > .pp-slider-mini-label {
min-width: 0;
}
/* DISPLAY ▸ Draw: shape segment, label field, colour, and the one-line hint */
/* UTILITIES ▸ Draw: shape segment, label field, colour, and the one-line hint */
#draw-mode-row {
min-width: 184px;
}
@@ -801,7 +801,7 @@ body.gev-drawing #cesiumContainer canvas {
cursor: crosshair;
}
/* DISPLAY ▸ Import: one row per imported file, and the drop-target outline */
/* UTILITIES ▸ Import: one row per imported file, and the drop-target outline */
.geo-import-list {
display: none;
flex-direction: column;
+9 -3
View File
@@ -519,6 +519,14 @@
color: #f7f8f7;
}
:root[data-ui-theme='cyber']
#utilities-panel
.utilities-tools
.pp-toggle-btn:is([aria-pressed='true'], .active) {
background: rgba(64, 45, 46, 0.94);
box-shadow: 3px 0 0 var(--cyber-red) inset;
}
:root[data-ui-theme='cyber'] .pp-toggle-btn.active .pp-label {
color: #f5f7f6;
}
@@ -1662,9 +1670,7 @@
:root[data-ui-theme='cyber']
body:not(.cockpit-mode)
#left-panel-stack:has(> [data-panel-id]:not(.collapsed))
> :is(#data-panel, #cctv-panel, #utilities-panel, #scene-panel):not(
.collapsed
) {
> :is(#data-panel, #cctv-panel, #utilities-panel, #scene-panel):not(.collapsed) {
flex: 1 1 auto;
height: auto;
max-height: none;
+16 -3
View File
@@ -1478,7 +1478,8 @@ body.recording-mode #right-context-rail > [data-panel-id] {
color: var(--text-primary);
}
/* Draw reads as on with the accent of an enabled layer row. */
/* Draw marks its on state with an accent edge, like an active DISPLAY
button; Cyber swaps in its red edge (cyber.css). */
#utilities-panel
.utilities-tools
.pp-toggle-btn:is([aria-pressed='true'], .active) {
@@ -1493,6 +1494,18 @@ body.recording-mode #right-context-rail > [data-panel-id] {
margin-right: 10px;
}
#utilities-panel.collapsed .utilities-tools {
display: none;
/* Draw's options sit flat under its name, like a layer row's controls, not
as the card that hangs under a DISPLAY button. DISPLAY's shared label
column means nothing here, so the Shape label takes its own width. */
#utilities-panel .utilities-tools .pp-slider-row {
padding: 4px 0;
background: none;
border: 0;
border-radius: 0;
backdrop-filter: none;
-webkit-backdrop-filter: none;
}
#utilities-panel .utilities-tools .pp-slider-mini-label {
min-width: 0;
}