mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-23 11:42:21 +00:00
Merge upstream main into feat/iss-3d-model
Translation files: kept both sides' new keys. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
commit
349b3a04ec
407 files changed
+23411
-2582
No files matched your search
@@ -25,7 +25,9 @@ const items = computed(() =>
|
||||
id: panel.id,
|
||||
icon: item?.icon ?? PANEL_RAIL_FALLBACK_ICON,
|
||||
// Static markup is translated at boot, so a host's title already is.
|
||||
label: item ? t(item.label) : panel.title,
|
||||
label: item
|
||||
? t(item.label, item.context && { context: item.context })
|
||||
: panel.title,
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -65,6 +65,7 @@ import { useHudStore } from './stores/hud.js';
|
||||
import { useDisplayStore } from './stores/display.js';
|
||||
import { useLocaleStore } from './stores/locale.js';
|
||||
import { useLocationStore } from './stores/location.js';
|
||||
import { installRailEdgeScroll } from './railEdgeScroll.js';
|
||||
import { useCockpitStore } from './stores/cockpit.js';
|
||||
import { useGlobeActionsStore } from './stores/globeActions.js';
|
||||
import { useRecordingStore } from './stores/recording.js';
|
||||
@@ -164,6 +165,8 @@ export class StyleManager extends ShellFacade {
|
||||
});
|
||||
// Vue views share this runtime and its stores; dispose unmounts them.
|
||||
this._ui = createUiRuntime({ pinia: applicationPinia() });
|
||||
// Scrolling at a screen edge steps through that side's rail panels.
|
||||
this._removeRailEdgeScroll = installRailEdgeScroll();
|
||||
this._feedback = new ShellFeedback({
|
||||
readLayers: () => withPlacePacks(this._dataManager?.getAll?.() || []),
|
||||
});
|
||||
@@ -223,6 +226,7 @@ export class StyleManager extends ShellFacade {
|
||||
getDetectionTuning: services.getDetectionTuning,
|
||||
getKeyholeFadeTuning: services.getKeyholeFadeTuning,
|
||||
getScopeMaskFeather: services.getScopeMaskFeather,
|
||||
getScopeMaskOpacity: services.getScopeMaskOpacity,
|
||||
getScopeTerminusOverride: services.getScopeTerminusOverride,
|
||||
governorRequestRender: services.governorRequestRender,
|
||||
holdContinuousRender: services.holdContinuousRender,
|
||||
@@ -236,6 +240,7 @@ export class StyleManager extends ShellFacade {
|
||||
setKeyholeFadeTuning: services.setKeyholeFadeTuning,
|
||||
setScopeMaskEnabled: services.setScopeMaskEnabled,
|
||||
setScopeMaskFeather: services.setScopeMaskFeather,
|
||||
setScopeMaskOpacity: services.setScopeMaskOpacity,
|
||||
},
|
||||
elements: {
|
||||
_ppToggles: this._ppToggles,
|
||||
@@ -400,6 +405,9 @@ export class StyleManager extends ShellFacade {
|
||||
owner: 'cockpit-orbit',
|
||||
switchPolicy: 'esri-if-photoreal',
|
||||
}) ?? null,
|
||||
// The application's own first-person subjects
|
||||
// (src/cockpitSubjectProviders.js), checked by the coordinator.
|
||||
cockpitSubjects: services.cockpitSubjects,
|
||||
},
|
||||
elements: {
|
||||
_ppToggles: this._ppToggles,
|
||||
@@ -588,6 +596,10 @@ export class StyleManager extends ShellFacade {
|
||||
this._setDetectionAllocation(...args),
|
||||
_setDetectionFade: (...args) => this._setDetectionFade(...args),
|
||||
_setScope: (...args) => this._visualSettings._setScope(...args),
|
||||
_applyGlobalPostDefaults: (...args) =>
|
||||
this._applyGlobalPostDefaults(...args),
|
||||
_adoptDetectionAsRestore: () =>
|
||||
this._visualSettings.adoptDetectionAsRestore(),
|
||||
setCelestialRingEnabled: (...args) =>
|
||||
this.setCelestialRingEnabled(...args),
|
||||
_setModels3dEnabled: (...args) => this._setModels3dEnabled(...args),
|
||||
@@ -1197,6 +1209,11 @@ export class StyleManager extends ShellFacade {
|
||||
toggleEnabled: (...args) => this._toggleCctvEnabled(...args),
|
||||
runExplicitFocus: (...args) => this._runExplicitCctvFocus(...args),
|
||||
setPanelCollapsed: (...args) => this.setPanelCollapsed(...args),
|
||||
// Clear selected data layers and Context isolation switch the layer
|
||||
// off without the user asking: the panel keeps its state for both.
|
||||
preservePanelState: () =>
|
||||
this._preservePanelStateDuringLayerClear ||
|
||||
this._contextSuspendsLayer('cctv'),
|
||||
showToast: (message) => this._showToast(message),
|
||||
syncViewport: () => this._syncCctvPanelViewport(),
|
||||
},
|
||||
@@ -1848,6 +1865,7 @@ export class StyleManager extends ShellFacade {
|
||||
const { destroyTrackedReadout, destroyWorldOverlay, destroyDetection } =
|
||||
this.services;
|
||||
if (this._disposed) return;
|
||||
this._removeRailEdgeScroll?.();
|
||||
this._shareRestoration.destroy();
|
||||
this._feedback.clearLoadingStatus();
|
||||
this._disposed = true;
|
||||
|
||||
@@ -280,7 +280,7 @@ test('a tracked flight’s photo shows under its name, credited and linked to it
|
||||
test('no photo renders without one', async (t) => {
|
||||
const { panel, publish } = fixture(t);
|
||||
await publish({ ...results(), photo: null });
|
||||
assert.equal(panel().querySelector('.military-awareness-photo'), null);
|
||||
assert.equal(panel().querySelector('.military-awareness-photo') === null, true);
|
||||
});
|
||||
|
||||
test('a photo whose image fails to load is hidden until another arrives', async (t) => {
|
||||
@@ -290,10 +290,10 @@ test('a photo whose image fails to load is hidden until another arrives', async
|
||||
.querySelector('.military-awareness-photo img')
|
||||
.dispatchEvent(new Event('error'));
|
||||
await nextTick();
|
||||
assert.equal(panel().querySelector('.military-awareness-photo'), null);
|
||||
assert.equal(panel().querySelector('.military-awareness-photo') === null, true);
|
||||
// A repaint with the same photo keeps it hidden.
|
||||
await publish({ ...results({ previousDisabled: false }), photo: photo() });
|
||||
assert.equal(panel().querySelector('.military-awareness-photo'), null);
|
||||
assert.equal(panel().querySelector('.military-awareness-photo') === null, true);
|
||||
// Another plane's photo shows.
|
||||
const next = photo({ src: 'https://t.plnspttrs.net/2/def456_280.jpg' });
|
||||
await publish({ ...results(), photo: next });
|
||||
|
||||
@@ -54,6 +54,7 @@ export class CctvControls {
|
||||
this._cctvSummaryTypingTimer = null;
|
||||
this._lastCctvSummaryText = '';
|
||||
this._lastSeenCctvActiveId = null;
|
||||
this._wasCctvEnabled = false;
|
||||
this._cctvChipHideTimer = null;
|
||||
this._cctvChipWasBusy = false;
|
||||
// The camera grid chip as last published; its label stays while hidden.
|
||||
|
||||
@@ -513,3 +513,96 @@ test('the panel meta line reads a bearing that rounds to north as HDG 0°', () =
|
||||
assert.match(meta(359.4), /· HDG 359° ·/);
|
||||
assert.match(meta(359.6), /· HDG 0° ·/);
|
||||
});
|
||||
|
||||
/** The panel collapses the test asked for, as `[panelId, collapsed]` pairs. */
|
||||
function collapseCalls(controls) {
|
||||
const calls = [];
|
||||
controls.actions.setPanelCollapsed = (panelId, collapsed) => {
|
||||
calls.push([panelId, collapsed]);
|
||||
// The panel chrome owns the class the controls read back.
|
||||
controls._cctvPanel.classList.toggle('collapsed', collapsed);
|
||||
};
|
||||
return calls;
|
||||
}
|
||||
|
||||
const activeState = {
|
||||
enabled: true,
|
||||
count: 1,
|
||||
cameraIndex: [],
|
||||
activeCameraId: camera.id,
|
||||
activeCamera: camera,
|
||||
};
|
||||
|
||||
test('switching the layer off collapses the panel it opened', (t) => {
|
||||
const { controls } = panel(t);
|
||||
const calls = collapseCalls(controls);
|
||||
controls._renderCctvState(activeState);
|
||||
assert.deepEqual(calls, [['cctv-panel', false]]);
|
||||
// The layer keeps its active camera while off.
|
||||
controls._renderCctvState({ ...activeState, enabled: false });
|
||||
assert.deepEqual(calls.at(-1), ['cctv-panel', true]);
|
||||
// A panel reopened by hand stays open through later notifications while
|
||||
// the layer is off: only the on → off change collapses.
|
||||
controls._cctvPanel.classList.remove('collapsed');
|
||||
controls._renderCctvState({ ...activeState, enabled: false });
|
||||
assert.equal(calls.length, 2);
|
||||
assert.equal(controls._cctvPanel.classList.contains('collapsed'), false);
|
||||
});
|
||||
|
||||
test('a layer that was never on leaves an open panel alone', (t) => {
|
||||
const { controls } = panel(t);
|
||||
const calls = collapseCalls(controls);
|
||||
controls._renderCctvState({ enabled: false, count: 3, cameraIndex: [] });
|
||||
controls._renderCctvState({ enabled: false, count: 3, cameraIndex: [] });
|
||||
assert.deepEqual(calls, []);
|
||||
});
|
||||
|
||||
test('the data manager switching the layer off collapses the panel too', (t) => {
|
||||
const { controls } = panel(t);
|
||||
const calls = collapseCalls(controls);
|
||||
let on = true;
|
||||
controls.actions.isEnabled = () => on;
|
||||
controls._renderCctvState(activeState);
|
||||
on = false;
|
||||
controls._renderCctvState(activeState);
|
||||
assert.deepEqual(calls.at(-1), ['cctv-panel', true]);
|
||||
});
|
||||
|
||||
test('a layer the application suspends keeps its panel through the round trip', (t) => {
|
||||
const { controls } = panel(t);
|
||||
const calls = collapseCalls(controls);
|
||||
// Clear selected data layers and Context isolation both answer true.
|
||||
let suspended = true;
|
||||
controls.actions.preservePanelState = () => suspended;
|
||||
controls._renderCctvState(activeState);
|
||||
controls._renderCctvState({ ...activeState, enabled: false });
|
||||
assert.equal(controls._cctvPanel.classList.contains('collapsed'), false);
|
||||
suspended = false;
|
||||
controls._renderCctvState(activeState);
|
||||
assert.equal(controls._cctvPanel.classList.contains('collapsed'), false);
|
||||
assert.ok(calls.every(([, collapsed]) => collapsed === false));
|
||||
// The next switch-off is the user's again.
|
||||
controls._renderCctvState({ ...activeState, enabled: false });
|
||||
assert.deepEqual(calls.at(-1), ['cctv-panel', true]);
|
||||
});
|
||||
|
||||
test('a panel the accordion folded still has its saved state closed', (t) => {
|
||||
const { controls } = panel(t);
|
||||
controls._renderCctvState(activeState);
|
||||
const calls = [];
|
||||
controls.actions.setPanelCollapsed = (...args) => calls.push(args);
|
||||
// Folded for layout only: the class is there, the saved state is open. The
|
||||
// panel chrome tells the two apart, so the controls always ask it.
|
||||
controls._cctvPanel.classList.add('collapsed');
|
||||
controls._renderCctvState({ ...activeState, enabled: false });
|
||||
assert.deepEqual(calls, [['cctv-panel', true]]);
|
||||
});
|
||||
|
||||
test('the meta line of a disabled layer does not describe its last camera', () => {
|
||||
const off = { ...activeState, enabled: false, count: 3 };
|
||||
assert.equal(
|
||||
presentCctvPanel(off, false).meta,
|
||||
'3 cameras loaded · enable CCTV to activate',
|
||||
);
|
||||
assert.match(presentCctvPanel(activeState, true).meta, /^Austin · HDG /);
|
||||
});
|
||||
@@ -90,7 +90,9 @@ export function presentCctvPanel(state, enabled) {
|
||||
}
|
||||
|
||||
function metaText(state, enabled, activeCamera, catalogCount) {
|
||||
if (activeCamera) {
|
||||
// The layer keeps its active camera while off: a disabled panel must not
|
||||
// describe a feed it no longer shows.
|
||||
if (enabled && activeCamera) {
|
||||
const provider = cctvSourceLabelText(
|
||||
activeCamera.sourceLabel || activeCamera.provider || 'Configured Source',
|
||||
);
|
||||
@@ -188,6 +190,20 @@ export function _renderCctvState(state) {
|
||||
});
|
||||
}
|
||||
this._lastSeenCctvActiveId = effectiveActiveId;
|
||||
// Switching the layer off closes the panel it opened: nothing is left to
|
||||
// show. Only the on → off change collapses, so a panel the user opens
|
||||
// while the layer is off stays open. Clear selected data layers and
|
||||
// Context isolation keep the panel: the layer comes back with it. The
|
||||
// panel chrome decides whether anything changes: a panel the desktop
|
||||
// accordion only folded still has an open saved state to close.
|
||||
if (
|
||||
this._wasCctvEnabled &&
|
||||
!enabled &&
|
||||
!this.actions.preservePanelState?.()
|
||||
) {
|
||||
this.actions.setPanelCollapsed('cctv-panel', true);
|
||||
}
|
||||
this._wasCctvEnabled = enabled;
|
||||
|
||||
this._updateCctvSyncChip(state?.loading, enabled);
|
||||
|
||||
|
||||
@@ -839,7 +839,7 @@ test('arrows do nothing new in an aircraft cockpit', async (t) => {
|
||||
near(after.pitchDeg, before.pitchDeg, 'the aircraft pitch', 1e-6);
|
||||
assert.deepEqual(cockpit.lookTarget, { yawDeg: 0, pitchDeg: -2 });
|
||||
assert.equal(store.instruments.look.offset, false);
|
||||
assert.equal(document.querySelector('.cockpit-look'), null);
|
||||
assert.equal(document.querySelector('.cockpit-look') === null, true);
|
||||
// The tape stays on the aircraft's heading, with no bow or stern marks.
|
||||
const centre = store.instruments.compass.find(
|
||||
(division) => division.slot === 0,
|
||||
@@ -849,7 +849,7 @@ test('arrows do nothing new in an aircraft cockpit', async (t) => {
|
||||
prograde: null,
|
||||
retrograde: null,
|
||||
});
|
||||
assert.equal(document.querySelector('.cockpit-compass-marker'), null);
|
||||
assert.equal(document.querySelector('.cockpit-compass-marker') === null, true);
|
||||
assert.doesNotMatch(
|
||||
document.querySelector('.cockpit-help').textContent,
|
||||
/ARROWS LOOK/,
|
||||
@@ -1248,7 +1248,7 @@ test('a ship with neither heading nor course makes up no direction', async (t) =
|
||||
prograde: null,
|
||||
retrograde: null,
|
||||
});
|
||||
assert.equal(document.querySelector('.cockpit-compass-marker'), null);
|
||||
assert.equal(document.querySelector('.cockpit-compass-marker') === null, true);
|
||||
assert.match(
|
||||
$('.cockpit-visor-status-right').textContent,
|
||||
/NO HEADING · AIS/,
|
||||
|
||||
@@ -164,7 +164,7 @@ export function maybeRefreshRegionalBrief(info) {
|
||||
!Number.isFinite(info.longitude)
|
||||
)
|
||||
return;
|
||||
const subjectId = `${info.layerId || 'aircraft'}:${info.icao24 || (info.kind === 'vessel' ? info.id : '') || info.noradId || info.registration || info.callsign || 'unknown'}`;
|
||||
const subjectId = `${info.layerId || 'aircraft'}:${info.icao24 || (info.kind === 'vessel' || info.generic === true ? info.id : '') || info.noradId || info.registration || info.callsign || 'unknown'}`;
|
||||
if (subjectId !== this.regionalBriefSubjectId) {
|
||||
this.regionalBriefAbort?.abort();
|
||||
this.regionalBriefAbort = null;
|
||||
|
||||
+168
-4
@@ -3,6 +3,8 @@ import * as Cesium from 'cesium';
|
||||
import {
|
||||
cockpitAnchorCorrectionStep,
|
||||
cockpitGroundSafeHeight,
|
||||
easeCockpitLift,
|
||||
cockpitSubjectStepSec,
|
||||
cockpitSurfaceWaitExpired,
|
||||
cockpitUiUpdateDue,
|
||||
slewHeading,
|
||||
@@ -16,6 +18,7 @@ import {
|
||||
waterlineProbePoints,
|
||||
} from '../cockpitSubjects.js';
|
||||
import { easeLook } from '../cockpitLook.js';
|
||||
import { cockpitSubjectFrame } from '../cockpitSubjectProviders.js';
|
||||
import {
|
||||
COCKPIT_HEADING_SLEW_DPS,
|
||||
COCKPIT_FORWARD_OFFSET_M,
|
||||
@@ -53,6 +56,10 @@ export function update() {
|
||||
}
|
||||
|
||||
const nowMs = performance.now();
|
||||
if (this.subjectProvider) {
|
||||
updateSubject.call(this, nowMs);
|
||||
return;
|
||||
}
|
||||
if (this.subjectKind === 'vessel') {
|
||||
updateVessel.call(this, nowMs);
|
||||
return;
|
||||
@@ -297,9 +304,128 @@ function updateVessel(nowMs) {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Drive the camera from an application provider's subject: read its frame,
|
||||
* stand the eye `eye.upM` above `heightM` (the shared floor where the frame
|
||||
* gives none) and slew toward its heading. A frame that is null, malformed or
|
||||
* for another subject ends the view, as an aircraft tracked meanwhile does.
|
||||
* The update runs on the provider's `cameraIntervalMs` (0: every frame), and
|
||||
* its rates advance by the time that interval spans (cockpitSubjectStepSec).
|
||||
*/
|
||||
function updateSubject(nowMs) {
|
||||
const provider = this.subjectProvider;
|
||||
if (this.viewer.trackedEntity?.position) {
|
||||
this.exit({ restoreTracking: false });
|
||||
return;
|
||||
}
|
||||
const intervalMs = provider.cameraIntervalMs ?? COCKPIT_CAMERA_UPDATE_MS;
|
||||
if (!cockpitUiUpdateDue(nowMs, this.lastCameraUpdateMs, intervalMs)) return;
|
||||
this.lastCameraUpdateMs = nowMs;
|
||||
const frame = cockpitSubjectFrame(
|
||||
this.callSubject(provider, 'read', [nowMs, this.subjectContext()], null),
|
||||
this.subjectId,
|
||||
);
|
||||
if (!frame) {
|
||||
this.exit({ restoreTracking: false });
|
||||
return;
|
||||
}
|
||||
this.lastSubjectFrame = frame;
|
||||
let heightM = frame.heightM;
|
||||
if (heightM === null) {
|
||||
this.services.warmGroundFloor?.([
|
||||
{ lat: frame.latitude, lon: frame.longitude },
|
||||
]);
|
||||
const floorM = this.services.cachedGroundFloor?.(
|
||||
frame.latitude,
|
||||
frame.longitude,
|
||||
);
|
||||
// A frame with no height stands on the shared floor; while that is cold
|
||||
// it keeps the height it last stood at.
|
||||
heightM = Number.isFinite(floorM) ? floorM : this.subjectHeightM;
|
||||
}
|
||||
if (!Number.isFinite(heightM)) {
|
||||
// Nothing to stand on yet, from the first frame: the camera stays where
|
||||
// it is while the floor is acquired, its HUD saying so, rather than
|
||||
// standing on the ellipsoid (kilometres underground on a plateau). The
|
||||
// wait is bounded as the built-in views' is. Unlike a parked aircraft,
|
||||
// whose fallback is its own reported altitude, such a subject has no
|
||||
// height at all to fall back to: any number would be a guess, so the
|
||||
// view ends and the provider gets its subject back.
|
||||
if (!this.surfaceWaitStartedMs) this.surfaceWaitStartedMs = nowMs;
|
||||
if (
|
||||
cockpitSurfaceWaitExpired(
|
||||
nowMs,
|
||||
this.surfaceWaitStartedMs,
|
||||
COCKPIT_GROUND_WAIT_TIMEOUT_MS,
|
||||
)
|
||||
) {
|
||||
this.exit({ restoreTracking: false });
|
||||
return;
|
||||
}
|
||||
this.surfaceAcquiring = true;
|
||||
if (
|
||||
cockpitUiUpdateDue(nowMs, this.lastHudUpdateMs, COCKPIT_HUD_UPDATE_MS)
|
||||
) {
|
||||
this.lastHudUpdateMs = nowMs;
|
||||
this.updateHud(this.subjectInfo(frame), nowMs);
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.surfaceWaitStartedMs = 0;
|
||||
this.surfaceAcquiring = false;
|
||||
this.subjectHeightM = heightM;
|
||||
const target = Cesium.Cartesian3.fromDegrees(
|
||||
frame.longitude,
|
||||
frame.latitude,
|
||||
heightM,
|
||||
Cesium.Ellipsoid.WGS84,
|
||||
this.scratchTarget,
|
||||
);
|
||||
const dtSec = cockpitSubjectStepSec(nowMs - this.lastFrameMs, intervalMs);
|
||||
this.lastFrameMs = nowMs;
|
||||
if (frame.headingDeg !== null) {
|
||||
const rate = provider.headingSlewDps ?? COCKPIT_HEADING_SLEW_DPS;
|
||||
this.heading =
|
||||
rate === Infinity
|
||||
? frame.headingDeg
|
||||
: slewHeading(
|
||||
this.heading ?? frame.headingDeg,
|
||||
frame.headingDeg,
|
||||
rate * dtSec,
|
||||
);
|
||||
}
|
||||
let look = null;
|
||||
if (provider.look) {
|
||||
this.lookView = easeLook(
|
||||
this.lookView,
|
||||
this.lookTarget,
|
||||
nowMs - (this.lookLastMs || nowMs),
|
||||
);
|
||||
this.lookLastMs = nowMs;
|
||||
look = this.lookView;
|
||||
}
|
||||
placeCamera.call(
|
||||
this,
|
||||
target,
|
||||
this.subjectInfo(frame),
|
||||
nowMs,
|
||||
dtSec,
|
||||
{
|
||||
forwardM: frame.eye.forwardM,
|
||||
upM: frame.eye.upM,
|
||||
pitchDeg: frame.eye.pitchDeg,
|
||||
minClearanceM: frame.eye.minClearanceM,
|
||||
},
|
||||
look,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Place the camera for one update: advance the inertial anchor, clamp it and
|
||||
* the eye against the rendered surface, and look along the slewed heading.
|
||||
* A subject with `anchor: 'exact'` keeps the anchor on its target (its layer
|
||||
* already moves it smoothly), and one with `groundClamp: false` (inside a
|
||||
* structure, say) is never pushed up to the floor: a lift it had eases out.
|
||||
* @param {Cesium.Cartesian3} target Authoritative subject position.
|
||||
* @param {object} info Subject info; `motionCourse` (when present) is the
|
||||
* direction the subject moves, otherwise it moves where it faces.
|
||||
@@ -316,6 +442,7 @@ function placeCamera(target, info, nowMs, dtSec, profile, look = null) {
|
||||
if (!this.cockpitAnchorValid) {
|
||||
Cesium.Cartesian3.clone(target, this.cockpitAnchor);
|
||||
this.cockpitAnchorValid = true;
|
||||
this.subjectLiftM = null;
|
||||
}
|
||||
|
||||
// First-person motion cannot use the delayed feed correction as a raw
|
||||
@@ -339,7 +466,8 @@ function placeCamera(target, info, nowMs, dtSec, profile, look = null) {
|
||||
? Math.max(0, info.velocityMps)
|
||||
: 0;
|
||||
|
||||
if (info.stale) {
|
||||
const groundClamp = info.groundClamp !== false;
|
||||
if (info.stale || info.anchor === 'exact') {
|
||||
// A feed backoff has no authoritative velocity epoch to advance from.
|
||||
// Hold the cockpit on the exact layer-rendered position so the camera
|
||||
// cannot coast away while the icon correctly remains fixed.
|
||||
@@ -377,10 +505,13 @@ function placeCamera(target, info, nowMs, dtSec, profile, look = null) {
|
||||
const correctionDistanceM = Cesium.Cartesian3.magnitude(
|
||||
this.scratchCorrection,
|
||||
);
|
||||
// An application subject's step is already bounded by its own update
|
||||
// interval (cockpitSubjectStepSec); the built-in views keep the 0.1 s.
|
||||
const correctionStepM = cockpitAnchorCorrectionStep(
|
||||
correctionDistanceM,
|
||||
speedMps,
|
||||
dtSec,
|
||||
info.generic === true ? dtSec : undefined,
|
||||
);
|
||||
if (correctionStepM > 0 && correctionDistanceM > 0) {
|
||||
Cesium.Cartesian3.multiplyByScalar(
|
||||
@@ -498,7 +629,14 @@ function placeCamera(target, info, nowMs, dtSec, profile, look = null) {
|
||||
cockpitFloorM =
|
||||
targetCartographic.height - this.services.GROUND_FLOOR_LIFT_M;
|
||||
}
|
||||
if (anchorCartographic && Number.isFinite(cockpitFloorM)) {
|
||||
// An application subject's anchor is where its provider puts it; only its
|
||||
// eye is kept out of the floor, below.
|
||||
if (
|
||||
groundClamp &&
|
||||
info.generic !== true &&
|
||||
anchorCartographic &&
|
||||
Number.isFinite(cockpitFloorM)
|
||||
) {
|
||||
const minimumAnchorHeightM = cockpitGroundSafeHeight(
|
||||
anchorCartographic.height,
|
||||
cockpitFloorM,
|
||||
@@ -579,7 +717,7 @@ function placeCamera(target, info, nowMs, dtSec, profile, look = null) {
|
||||
Cesium.Ellipsoid.WGS84,
|
||||
this.scratchCameraCartographic,
|
||||
);
|
||||
if (cameraCartographic) {
|
||||
if (groundClamp && cameraCartographic) {
|
||||
const cameraLat = Cesium.Math.toDegrees(cameraCartographic.latitude);
|
||||
const cameraLon = Cesium.Math.toDegrees(cameraCartographic.longitude);
|
||||
const cameraFloorM = this.services.cachedGroundFloor(cameraLat, cameraLon);
|
||||
@@ -589,11 +727,26 @@ function placeCamera(target, info, nowMs, dtSec, profile, look = null) {
|
||||
cameraFloorM,
|
||||
);
|
||||
}
|
||||
const safeHeightM = cockpitGroundSafeHeight(
|
||||
let safeHeightM = cockpitGroundSafeHeight(
|
||||
cameraCartographic.height,
|
||||
cockpitFloorM,
|
||||
profile.minClearanceM,
|
||||
);
|
||||
// An application subject's eye rides its provider's smoothed height:
|
||||
// the clearance over the coarse, refining floor eases in and out
|
||||
// rather than jumping at each cell (easeCockpitLift).
|
||||
if (info.generic === true) {
|
||||
const hardM =
|
||||
cockpitGroundSafeHeight(cameraCartographic.height, cockpitFloorM, 0) -
|
||||
cameraCartographic.height;
|
||||
this.subjectLiftM = easeCockpitLift(
|
||||
this.subjectLiftM,
|
||||
safeHeightM - cameraCartographic.height,
|
||||
hardM,
|
||||
dtSec,
|
||||
);
|
||||
safeHeightM = cameraCartographic.height + this.subjectLiftM;
|
||||
}
|
||||
if (safeHeightM !== cameraCartographic.height) {
|
||||
cameraCartographic.height = safeHeightM;
|
||||
Cesium.Ellipsoid.WGS84.cartographicToCartesian(
|
||||
@@ -601,6 +754,17 @@ function placeCamera(target, info, nowMs, dtSec, profile, look = null) {
|
||||
this.scratchCamera,
|
||||
);
|
||||
}
|
||||
} else if (info.generic === true) {
|
||||
// Inside a structure the floor holds the eye up no more: the lift it gave
|
||||
// goes at the rate it came (easeCockpitLift), never at once.
|
||||
this.subjectLiftM = easeCockpitLift(this.subjectLiftM, 0, 0, dtSec);
|
||||
if (cameraCartographic && this.subjectLiftM > 0) {
|
||||
cameraCartographic.height += this.subjectLiftM;
|
||||
Cesium.Ellipsoid.WGS84.cartographicToCartesian(
|
||||
cameraCartographic,
|
||||
this.scratchCamera,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
this.viewer.camera.setView({
|
||||
|
||||
@@ -3,12 +3,18 @@ import {
|
||||
readAircraftInfo,
|
||||
readSatelliteInfo,
|
||||
readVesselInfo,
|
||||
readSubjectCandidate,
|
||||
readSubjectLayerId,
|
||||
subjectContext,
|
||||
subjectInfo,
|
||||
entryCandidates,
|
||||
resolveEntry,
|
||||
resolveEntryKind,
|
||||
dispatchCockpitModeChanged,
|
||||
toggleTrackedTr3b,
|
||||
syncTr3bToggle,
|
||||
syncEntry,
|
||||
refreshSubjectWords,
|
||||
publishPresenceView,
|
||||
navigateContext,
|
||||
_adoptTrackedEntity,
|
||||
@@ -100,6 +106,7 @@ import {
|
||||
import { DEFAULT_RADAR_RANGE_NM, nextRadarRange } from '../cockpitRadar.js';
|
||||
import { VESSEL_BRIDGE_PITCH_DEG } from '../cockpitSubjects.js';
|
||||
import { stepLook } from '../cockpitLook.js';
|
||||
import { createCockpitSubjectCaller } from '../cockpitSubjectProviders.js';
|
||||
import * as Cesium from 'cesium';
|
||||
|
||||
/** Whether the user asked for reduced motion: look turns then jump. */
|
||||
@@ -120,6 +127,8 @@ export class CockpitViewController {
|
||||
isEntryAllowed = null,
|
||||
isBridgeEntryAllowed = null,
|
||||
isOrbitEntryAllowed = null,
|
||||
subjectProviders = [],
|
||||
isSubjectEntryAllowed = null,
|
||||
isUtilityDisclosureOpen = null,
|
||||
onEntered = null,
|
||||
onExited = null,
|
||||
@@ -134,10 +143,27 @@ export class CockpitViewController {
|
||||
this.disposed = false;
|
||||
this.active = false;
|
||||
/**
|
||||
* 'aircraft', 'vessel' or 'satellite' while active; which subject the
|
||||
* camera rides.
|
||||
* 'aircraft', 'vessel', 'satellite' or a provider's kind while active;
|
||||
* which subject the camera rides.
|
||||
*/
|
||||
this.subjectKind = null;
|
||||
/**
|
||||
* The application's subject providers (cockpitSubjectProviders.js),
|
||||
* checked by the coordinator; the one ridden while active, else null.
|
||||
*/
|
||||
this.subjectProviders = Array.isArray(subjectProviders)
|
||||
? subjectProviders
|
||||
: [];
|
||||
this.subjectProvider = null;
|
||||
/** The ridden provider subject's last frame and normalized HUD view. */
|
||||
this.lastSubjectFrame = null;
|
||||
this.subjectHud = null;
|
||||
/** The Live Signals rows the provider's HUD view pushed. */
|
||||
this.subjectSignalKeys = new Set();
|
||||
/** Provider methods run through one guard: a throw warns once. */
|
||||
this.callSubject = createCockpitSubjectCaller();
|
||||
/** The look's rest pitch for a provider's view; null on a bridge. */
|
||||
this.lookRestPitchDeg = null;
|
||||
/**
|
||||
* The vessel subject's id or the satellite's NORAD id; aircraft are
|
||||
* identified by trackedEntity.
|
||||
@@ -160,6 +186,10 @@ export class CockpitViewController {
|
||||
this.surfaceWaitStartedMs = 0;
|
||||
this.surfaceAcquiring = false;
|
||||
this.surfaceFallback = false;
|
||||
/** The height an application subject's frame last stood at (m). */
|
||||
this.subjectHeightM = null;
|
||||
/** The ground clamp's eased lift under that subject's eye (m). */
|
||||
this.subjectLiftM = null;
|
||||
/**
|
||||
* Where the bridge view is turned to (`lookTarget`) and where the camera
|
||||
* looks on its way there (`lookView`): yaw off the bow, starboard
|
||||
@@ -203,6 +233,11 @@ export class CockpitViewController {
|
||||
typeof isOrbitEntryAllowed === 'function'
|
||||
? isOrbitEntryAllowed
|
||||
: () => false;
|
||||
// Nor a provider's subject without a gate for it.
|
||||
this.isSubjectEntryAllowed =
|
||||
typeof isSubjectEntryAllowed === 'function'
|
||||
? isSubjectEntryAllowed
|
||||
: () => false;
|
||||
this.isUtilityDisclosureOpen =
|
||||
typeof isUtilityDisclosureOpen === 'function'
|
||||
? isUtilityDisclosureOpen
|
||||
@@ -246,7 +281,14 @@ export class CockpitViewController {
|
||||
entryAvailable: false,
|
||||
// Which subject the entry button would enter, and the active subject.
|
||||
entryKind: null,
|
||||
// A provider's entry face, `{icon, label}`; null for the built-ins.
|
||||
entryFace: null,
|
||||
subjectKind: null,
|
||||
// While a provider's subject is ridden: its HUD and exit labels, and
|
||||
// `{aheadLabel}` when it looks around.
|
||||
subjectGeneric: false,
|
||||
subjectLabels: null,
|
||||
subjectLook: null,
|
||||
tr3b: null,
|
||||
context: false,
|
||||
// The Contact and briefing cards' collapse, which their toggles show.
|
||||
@@ -508,6 +550,21 @@ export class CockpitViewController {
|
||||
if (reset && hadFocus) this.mapViewButton?.focus({ preventScroll: true });
|
||||
return reset;
|
||||
}
|
||||
readSubjectCandidate(provider) {
|
||||
return readSubjectCandidate.call(this, provider);
|
||||
}
|
||||
subjectContext() {
|
||||
return subjectContext.call(this);
|
||||
}
|
||||
subjectInfo(frame) {
|
||||
return subjectInfo.call(this, frame);
|
||||
}
|
||||
entryCandidates(nowMs) {
|
||||
return entryCandidates.call(this, nowMs);
|
||||
}
|
||||
resolveEntry(nowMs) {
|
||||
return resolveEntry.call(this, nowMs);
|
||||
}
|
||||
readSubjectLayerId() {
|
||||
return readSubjectLayerId.call(this);
|
||||
}
|
||||
@@ -529,6 +586,9 @@ export class CockpitViewController {
|
||||
syncEntry() {
|
||||
return syncEntry.call(this);
|
||||
}
|
||||
refreshSubjectWords() {
|
||||
return refreshSubjectWords.call(this);
|
||||
}
|
||||
navigateContext(direction, options) {
|
||||
return navigateContext.call(this, direction, options);
|
||||
}
|
||||
@@ -568,6 +628,19 @@ export class CockpitViewController {
|
||||
presentLook() {
|
||||
return presentLook.call(this);
|
||||
}
|
||||
/** Whether the active view looks around: a bridge, or a provider's with `look`. */
|
||||
get looksAround() {
|
||||
return (
|
||||
this.active &&
|
||||
(this.subjectKind === 'vessel' || Boolean(this.subjectProvider?.look))
|
||||
);
|
||||
}
|
||||
/** Where the look rests: the bridge's pitch, or the provider's. */
|
||||
get lookRestPitch() {
|
||||
return Number.isFinite(this.lookRestPitchDeg)
|
||||
? this.lookRestPitchDeg
|
||||
: VESSEL_BRIDGE_PITCH_DEG;
|
||||
}
|
||||
/**
|
||||
* Turn the bridge view one arrow step (see `lookKeyStep`). The camera
|
||||
* eases there unless the user prefers reduced motion.
|
||||
@@ -575,7 +648,7 @@ export class CockpitViewController {
|
||||
* @returns {boolean} True when a bridge view was turned.
|
||||
*/
|
||||
turnLook(step) {
|
||||
if (!this.active || this.subjectKind !== 'vessel' || !step) return false;
|
||||
if (!this.looksAround || !step) return false;
|
||||
this.lookTarget = stepLook(this.lookTarget, step);
|
||||
if (prefersReducedMotion()) this.lookView = { ...this.lookTarget };
|
||||
this.presentLook();
|
||||
@@ -588,7 +661,7 @@ export class CockpitViewController {
|
||||
* as entry and exit do.
|
||||
*/
|
||||
resetLook({ immediate = false } = {}) {
|
||||
this.lookTarget = { yawDeg: 0, pitchDeg: VESSEL_BRIDGE_PITCH_DEG };
|
||||
this.lookTarget = { yawDeg: 0, pitchDeg: this.lookRestPitch };
|
||||
if (immediate || prefersReducedMotion())
|
||||
this.lookView = { ...this.lookTarget };
|
||||
this.lookLastMs = performance.now();
|
||||
@@ -601,7 +674,7 @@ export class CockpitViewController {
|
||||
* @returns {boolean} True on a bridge.
|
||||
*/
|
||||
lookAhead() {
|
||||
if (!this.active || this.subjectKind !== 'vessel') return false;
|
||||
if (!this.looksAround) return false;
|
||||
const button = document.getElementById('cockpit-look-ahead');
|
||||
const hadFocus = !!button && button.contains(document.activeElement);
|
||||
this.resetLook();
|
||||
@@ -718,6 +791,9 @@ export class CockpitViewController {
|
||||
this.relocalizeBrief();
|
||||
this.publishVision(createVisionState(this.visionMode));
|
||||
this.routeSignature = null;
|
||||
// A provider's words, ridden or on the entry, follow the language.
|
||||
this.refreshSubjectWords();
|
||||
if (!this.active) this.syncEntry();
|
||||
if (this.active && this.lastSubjectInfo) {
|
||||
this.rewordingSignals = true;
|
||||
try {
|
||||
|
||||
@@ -5,7 +5,9 @@ import {
|
||||
bridgeEntryAllowed,
|
||||
cockpitEntryAllowed,
|
||||
orbitEntryAllowed,
|
||||
subjectEntryAllowed,
|
||||
} from '../contextModePolicy.js';
|
||||
import { cockpitSubjectProviders } from '../cockpitSubjectProviders.js';
|
||||
import { formatAwarenessLabel } from '../data/militaryAwarenessEngine.js';
|
||||
import { enterCockpitWithTracking } from '../cockpitTracking.js';
|
||||
import { cockpitVisionModeForStyle } from '../cockpitVisionPolicy.js';
|
||||
@@ -60,8 +62,11 @@ export class CockpitCoordinator {
|
||||
regionalDistanceM,
|
||||
weatherCodeLabel,
|
||||
acquireOrbitImagery,
|
||||
cockpitSubjects,
|
||||
} = services;
|
||||
this._cockpitDisplayPortal = null;
|
||||
// The application's own subjects (services.cockpitSubjects), checked once.
|
||||
const subjectProviders = cockpitSubjectProviders(cockpitSubjects ?? []);
|
||||
this.cockpitView = new CockpitViewController(viewer, {
|
||||
services: {
|
||||
flightsLayer,
|
||||
@@ -108,6 +113,21 @@ export class CockpitCoordinator {
|
||||
vesselsEnabled: !!this._dataManager?.isEnabled('ais-live-vessels'),
|
||||
contextModeChanging: this._contextModeChanging,
|
||||
}),
|
||||
subjectProviders,
|
||||
// A provider's subject needs its own layer on, no Context change in
|
||||
// flight, and the provider's own say.
|
||||
isSubjectEntryAllowed: (provider, candidate) =>
|
||||
subjectEntryAllowed({
|
||||
layerEnabled: this._isLayerEnabled(provider.layerId),
|
||||
contextModeChanging: this._contextModeChanging,
|
||||
providerAllows:
|
||||
this.cockpitView?.callSubject(
|
||||
provider,
|
||||
'isEntryAllowed',
|
||||
[candidate],
|
||||
false,
|
||||
) === true,
|
||||
}),
|
||||
isOrbitEntryAllowed: () =>
|
||||
orbitEntryAllowed({
|
||||
satellitesEnabled: !!this._dataManager?.isEnabled('satellites'),
|
||||
@@ -197,6 +217,9 @@ export class CockpitCoordinator {
|
||||
this.cockpitView.subjectKind === 'satellite'
|
||||
)
|
||||
return 'Cockpit is in an orbital view — exit it first, then track an aircraft to enter Cockpit';
|
||||
// And in an application's own first-person view.
|
||||
if (this.cockpitView?.active && this.cockpitView.subjectProvider)
|
||||
return 'Cockpit is in another first-person view — exit it first, then track an aircraft to enter Cockpit';
|
||||
if (!this._aircraftLayerEnabled)
|
||||
return 'No aircraft layer is on — turn on Flights or Military Flights and track an aircraft to enter Cockpit';
|
||||
return null;
|
||||
@@ -216,6 +239,17 @@ export class CockpitCoordinator {
|
||||
active && this.cockpitView?.subjectKind === 'satellite'
|
||||
? this.cockpitView.readSatelliteInfo?.()
|
||||
: null;
|
||||
// And a provider's subject in use.
|
||||
const provided =
|
||||
active && this.cockpitView?.subjectProvider
|
||||
? {
|
||||
kind: this.cockpitView.subjectProvider.kind,
|
||||
id: this.cockpitView.subjectId,
|
||||
layerId: this.cockpitView.subjectProvider.layerId,
|
||||
callsign: null,
|
||||
name: this.cockpitView.lastSubjectFrame?.name ?? null,
|
||||
}
|
||||
: null;
|
||||
const gateOpen = Boolean(this.cockpitView?.isEntryAllowed?.());
|
||||
// "Could Cockpit be ENTERED right now" — so it is false while already
|
||||
// inside, unconditionally. Cockpit takes the entity off
|
||||
@@ -244,30 +278,32 @@ export class CockpitCoordinator {
|
||||
? 'subject-layer-off'
|
||||
: 'no-tracked-aircraft',
|
||||
visionMode: this.cockpitView?.visionMode || null,
|
||||
subject: satellite
|
||||
? {
|
||||
kind: 'satellite',
|
||||
id: satellite.id,
|
||||
layerId: satellite.layerId,
|
||||
callsign: null,
|
||||
name: satellite.name,
|
||||
}
|
||||
: vessel
|
||||
subject: provided
|
||||
? provided
|
||||
: satellite
|
||||
? {
|
||||
kind: 'vessel',
|
||||
id: vessel.id,
|
||||
layerId: vessel.layerId,
|
||||
kind: 'satellite',
|
||||
id: satellite.id,
|
||||
layerId: satellite.layerId,
|
||||
callsign: null,
|
||||
name: vessel.name,
|
||||
name: satellite.name,
|
||||
}
|
||||
: info
|
||||
: vessel
|
||||
? {
|
||||
kind: 'aircraft',
|
||||
id: info.icao24 || info.id || null,
|
||||
layerId: info.layerId || null,
|
||||
callsign: info.callsign || null,
|
||||
kind: 'vessel',
|
||||
id: vessel.id,
|
||||
layerId: vessel.layerId,
|
||||
callsign: null,
|
||||
name: vessel.name,
|
||||
}
|
||||
: null,
|
||||
: info
|
||||
? {
|
||||
kind: 'aircraft',
|
||||
id: info.icao24 || info.id || null,
|
||||
layerId: info.layerId || null,
|
||||
callsign: info.callsign || null,
|
||||
}
|
||||
: null,
|
||||
navigation: snapshot
|
||||
? {
|
||||
canPrevious: Boolean(snapshot.navigation?.canPrevious),
|
||||
|
||||
@@ -55,8 +55,11 @@ function fixture(
|
||||
changing = false,
|
||||
dataManager: suppliedManager = null,
|
||||
readContext = null,
|
||||
subjects = [],
|
||||
vessel = null,
|
||||
} = {},
|
||||
) {
|
||||
let selectedVessel = vessel;
|
||||
document.body.replaceChildren();
|
||||
const host = document.body.appendChild(document.createElement('div'));
|
||||
const pinia = createPinia();
|
||||
@@ -101,7 +104,13 @@ function fixture(
|
||||
services: {
|
||||
flightsLayer: { getTrackedInfo: trackedFrom('flights') },
|
||||
militaryFlightsLayer: { getTrackedInfo: trackedFrom('military') },
|
||||
aisLiveVesselsLayer: { getCockpitSubject: () => null },
|
||||
// Like the layer, no subject while Live AIS Vessels is off.
|
||||
aisLiveVesselsLayer: {
|
||||
getCockpitSubject: () =>
|
||||
selectedVessel && layers.has('ais-live-vessels')
|
||||
? { ...selectedVessel }
|
||||
: null,
|
||||
},
|
||||
// Like the layer, no subject while Satellites is off.
|
||||
satellitesLayer: {
|
||||
getCockpitSubject: () =>
|
||||
@@ -113,6 +122,7 @@ function fixture(
|
||||
isTr3b: () => false,
|
||||
holdContinuousRender() {},
|
||||
releaseContinuousRender() {},
|
||||
cockpitSubjects: subjects,
|
||||
},
|
||||
elements: {},
|
||||
operations: {
|
||||
@@ -147,6 +157,7 @@ function fixture(
|
||||
'cockpit-mode',
|
||||
'cockpit-bridge',
|
||||
'cockpit-orbit',
|
||||
'cockpit-subject',
|
||||
);
|
||||
});
|
||||
/** Turn a layer off and tell the Context owner, as the data manager does. */
|
||||
@@ -171,10 +182,35 @@ function fixture(
|
||||
viewer.trackedEntity = entityFor(subject);
|
||||
entities.add(viewer.trackedEntity);
|
||||
};
|
||||
/** Select a vessel on the map, or none. */
|
||||
const selectVessel = (info) => {
|
||||
selectedVessel = info;
|
||||
};
|
||||
const $ = (selector) => document.querySelector(selector);
|
||||
return { $, coordinator, cockpit, store, layers, disable, retrack, pinia };
|
||||
return {
|
||||
$,
|
||||
coordinator,
|
||||
cockpit,
|
||||
store,
|
||||
layers,
|
||||
disable,
|
||||
retrack,
|
||||
selectVessel,
|
||||
pinia,
|
||||
};
|
||||
}
|
||||
|
||||
/** A selected vessel as the AIS layer gives it to the bridge view. */
|
||||
const VESSEL = Object.freeze({
|
||||
id: '211000001',
|
||||
name: 'EXAMPLE',
|
||||
latitude: 54,
|
||||
longitude: 10,
|
||||
headingDeg: 90,
|
||||
courseDeg: 90,
|
||||
speedMps: 5,
|
||||
});
|
||||
|
||||
test('a civilian aircraft enters with Live Flights alone: no Contacts, no Military', (t) => {
|
||||
const { coordinator, cockpit } = fixture(t, {
|
||||
enabled: ['flights'],
|
||||
@@ -567,6 +603,32 @@ test('the readout entry reads BRIDGE for a selected vessel', async (t) => {
|
||||
assert.match(readoutEntry.textContent, /BRIDGE/);
|
||||
});
|
||||
|
||||
test('without providers the built-in order decides: a vessel selected after an aircraft still reads COCKPIT', async (t) => {
|
||||
const { $, cockpit, store, selectVessel } = fixture(t, {
|
||||
enabled: ['flights', 'ais-live-vessels'],
|
||||
tracked: { layerId: 'flights', info: CIVIL },
|
||||
});
|
||||
cockpit.syncEntry();
|
||||
assert.equal(store.presence.entryKind, 'aircraft');
|
||||
await new Promise((resolve) => setTimeout(resolve, 2));
|
||||
selectVessel(VESSEL);
|
||||
cockpit.syncEntry();
|
||||
await nextTick();
|
||||
assert.equal(store.presence.entryKind, 'aircraft');
|
||||
assert.match($('#cockpit-entry-readout').textContent, /COCKPIT/);
|
||||
// And the other way round: an aircraft tracked after the vessel.
|
||||
const later = fixture(t, {
|
||||
enabled: ['flights', 'ais-live-vessels'],
|
||||
vessel: VESSEL,
|
||||
});
|
||||
later.cockpit.syncEntry();
|
||||
assert.equal(later.store.presence.entryKind, 'vessel');
|
||||
await new Promise((resolve) => setTimeout(resolve, 2));
|
||||
later.retrack({ layerId: 'flights', info: CIVIL });
|
||||
later.cockpit.syncEntry();
|
||||
assert.equal(later.store.presence.entryKind, 'aircraft');
|
||||
});
|
||||
|
||||
test('a tracked satellite needs Satellites on for the ORBIT entry', async (t) => {
|
||||
const { $, cockpit } = fixture(t, { satellite: SATELLITE });
|
||||
cockpit.syncEntry();
|
||||
@@ -648,3 +710,148 @@ test('turning Satellites off ends the orbital view', (t) => {
|
||||
disable('satellites');
|
||||
assert.equal(cockpit.active, false);
|
||||
});
|
||||
|
||||
/** An application provider whose subject sits on `example-layer`. */
|
||||
function exampleSubject() {
|
||||
const released = [];
|
||||
return {
|
||||
released,
|
||||
provider: {
|
||||
kind: 'example-kind',
|
||||
layerId: 'example-layer',
|
||||
entryFace: { icon: 'commute', label: 'RIDE' },
|
||||
labels: { view: 'Example view', exit: 'Exit example', exitText: 'EXIT' },
|
||||
candidate: () => ({ id: 'a1', name: 'Example 12' }),
|
||||
hold: () => true,
|
||||
read: () => ({
|
||||
id: 'a1',
|
||||
name: 'Example 12',
|
||||
latitude: 30,
|
||||
longitude: -97,
|
||||
heightM: 200,
|
||||
headingDeg: 90,
|
||||
eye: { upM: 2 },
|
||||
}),
|
||||
hud: () => ({ title: 'Example 12' }),
|
||||
release: (id, { restore }) => released.push([id, restore]),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
test("a provider's subject needs only its own layer, and never a Context change in flight", async (t) => {
|
||||
const { provider } = exampleSubject();
|
||||
let changing = false;
|
||||
const off = fixture(t, { subjects: [provider] });
|
||||
off.cockpit.syncEntry();
|
||||
await nextTick();
|
||||
assert.equal(off.$('#cockpit-entry').hidden, true, 'its layer is off');
|
||||
assert.equal(off.cockpit.enter(), false);
|
||||
const on = fixture(t, {
|
||||
enabled: ['example-layer'],
|
||||
subjects: [provider],
|
||||
readContext: () => ({ mode: null, changing }),
|
||||
});
|
||||
changing = true;
|
||||
on.cockpit.syncEntry();
|
||||
await nextTick();
|
||||
assert.equal(on.$('#cockpit-entry').hidden, true, 'Context is changing');
|
||||
changing = false;
|
||||
on.cockpit.syncEntry();
|
||||
await nextTick();
|
||||
assert.equal(on.$('#cockpit-entry').hidden, false);
|
||||
assert.match(on.$('#cockpit-entry').textContent, /RIDE/);
|
||||
assert.match(on.$('#cockpit-entry-readout').textContent, /commute/);
|
||||
});
|
||||
|
||||
test("a provider's view reports its subject, refuses voice entry and ends with its layer", async (t) => {
|
||||
const { provider, released } = exampleSubject();
|
||||
const { cockpit, coordinator, disable } = fixture(t, {
|
||||
enabled: ['example-layer', 'flights'],
|
||||
subjects: [provider],
|
||||
});
|
||||
cockpit.syncEntry();
|
||||
assert.equal(cockpit.enter(), true);
|
||||
const state = coordinator.getCockpitState();
|
||||
assert.equal(state.active, true);
|
||||
assert.deepEqual(state.subject, {
|
||||
kind: 'example-kind',
|
||||
id: 'a1',
|
||||
layerId: 'example-layer',
|
||||
callsign: null,
|
||||
name: 'Example 12',
|
||||
});
|
||||
assert.equal(coordinator.controlCockpit('enter').ok, false);
|
||||
assert.match(coordinator._cockpitEntryRefusal(), /another first-person view/);
|
||||
disable('flights');
|
||||
assert.equal(cockpit.active, true, 'another layer is free to go off');
|
||||
disable('example-layer');
|
||||
assert.equal(cockpit.active, false, 'its own layer going off ends it');
|
||||
assert.deepEqual(released, [['a1', false]]);
|
||||
});
|
||||
|
||||
test("a provider's guards: a throwing candidate, gate or release, and a gate that is not true", async (t) => {
|
||||
const warned = [];
|
||||
t.mock.method(console, 'warn', (message) => warned.push(String(message)));
|
||||
const entered = (provider) => {
|
||||
const { cockpit } = fixture(t, {
|
||||
enabled: ['example-layer'],
|
||||
subjects: [provider],
|
||||
});
|
||||
cockpit.syncEntry();
|
||||
return { cockpit, entered: cockpit.enter() };
|
||||
};
|
||||
const { provider: base } = exampleSubject();
|
||||
// A candidate() that throws offers nothing.
|
||||
const noCandidate = entered({
|
||||
...base,
|
||||
candidate: () => {
|
||||
throw new Error('candidate failed');
|
||||
},
|
||||
});
|
||||
assert.equal(noCandidate.entered, false);
|
||||
assert.equal(noCandidate.cockpit.resolveEntry(), null);
|
||||
// An isEntryAllowed() that throws, or answers anything but true, shuts
|
||||
// the gate.
|
||||
for (const isEntryAllowed of [
|
||||
() => {
|
||||
throw new Error('gate failed');
|
||||
},
|
||||
() => 1,
|
||||
() => 'yes',
|
||||
() => ({}),
|
||||
]) {
|
||||
const gated = entered({ ...base, isEntryAllowed });
|
||||
assert.equal(gated.entered, false, String(isEntryAllowed));
|
||||
assert.equal(gated.cockpit.active, false);
|
||||
}
|
||||
// A release() that throws still ends the view.
|
||||
const { provider } = exampleSubject();
|
||||
const releasing = entered({
|
||||
...provider,
|
||||
release: () => {
|
||||
throw new Error('release failed');
|
||||
},
|
||||
});
|
||||
assert.equal(releasing.entered, true);
|
||||
assert.equal(releasing.cockpit.exit(), true);
|
||||
assert.equal(releasing.cockpit.active, false);
|
||||
assert.equal(document.body.classList.contains('cockpit-subject'), false);
|
||||
for (const method of ['candidate', 'isEntryAllowed', 'release'])
|
||||
assert.ok(
|
||||
warned.some((line) => line.includes(`${method}() failed`)),
|
||||
method,
|
||||
);
|
||||
});
|
||||
|
||||
test('a malformed provider is left out and the built-in kinds are unchanged', async (t) => {
|
||||
t.mock.method(console, 'warn', () => {});
|
||||
const { cockpit } = fixture(t, {
|
||||
enabled: ['flights'],
|
||||
tracked: { layerId: 'flights', info: CIVIL },
|
||||
subjects: [{ kind: 'aircraft', layerId: 'flights' }],
|
||||
});
|
||||
assert.deepEqual(cockpit.subjectProviders, []);
|
||||
cockpit.syncEntry();
|
||||
assert.equal(cockpit.enter(), true);
|
||||
assert.equal(cockpit.subjectKind, 'aircraft');
|
||||
});
|
||||
@@ -41,6 +41,9 @@ function subjectWorldPosition(kind) {
|
||||
}
|
||||
if (kind === 'satellite')
|
||||
return this.services.satellitesLayer?.getCockpitPosition?.() ?? null;
|
||||
// An application's subject has no position before its view is entered:
|
||||
// the selected vessel's sprite must not stand in for it.
|
||||
if (kind !== 'vessel') return null;
|
||||
const info = this.readVesselInfo();
|
||||
if (!Number.isFinite(info?.latitude) || !Number.isFinite(info?.longitude))
|
||||
return null;
|
||||
@@ -189,7 +192,7 @@ const LOOK_KEY_OWNERS = [
|
||||
* @returns {boolean} True when the key was taken.
|
||||
*/
|
||||
function handleLookKey(event) {
|
||||
if (!this.active || this.subjectKind !== 'vessel') return false;
|
||||
if (!this.looksAround) return false;
|
||||
if (event.metaKey || event.ctrlKey || event.altKey) return false;
|
||||
const step = lookKeyStep(event.key, event.shiftKey);
|
||||
const reset = !event.repeat && (event.key === 'Home' || event.key === '0');
|
||||
@@ -245,6 +248,9 @@ export function onKeyDown(event) {
|
||||
if (event.target?.closest?.('.cesium-credit-lightbox')) return;
|
||||
// An open Display or Radio popover takes Escape itself.
|
||||
if (this.isUtilityDisclosureOpen?.()) return;
|
||||
// So do the Data Layers search field and filter menu.
|
||||
if (event.target?.closest?.('.layer-finder__field, .layer-finder__menu'))
|
||||
return;
|
||||
if (this.context?.contains(event.target) && !this.contextCollapsed) {
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
|
||||
@@ -52,7 +52,7 @@ function createRimState(value) {
|
||||
*/
|
||||
export function createInstrumentState() {
|
||||
return {
|
||||
// 'aircraft' or 'vessel': which readouts the HUD labels and shows.
|
||||
// 'aircraft', 'vessel' or 'subject': which readouts the HUD shows.
|
||||
kind: 'aircraft',
|
||||
layer: null,
|
||||
callsign: t('AIRCRAFT'),
|
||||
@@ -76,6 +76,19 @@ export function createInstrumentState() {
|
||||
look: { offset: false, yawDeg: 0, readout: '' },
|
||||
clock: '--:--:--Z',
|
||||
position: '--° · --°',
|
||||
// A provider subject's HUD (kind 'subject', cockpitSubjectProviders.js):
|
||||
// its kicker, speed unit and tag, readouts, sources, banner, veil and
|
||||
// progress line, all worded by the provider.
|
||||
kicker: '',
|
||||
speedUnit: '',
|
||||
speedTag: '',
|
||||
speedTone: 'normal',
|
||||
readouts: [],
|
||||
sources: [],
|
||||
banner: null,
|
||||
veil: null,
|
||||
progress: null,
|
||||
lookEnabled: false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -86,8 +99,10 @@ export function createInstrumentState() {
|
||||
*/
|
||||
export function createRouteState() {
|
||||
return {
|
||||
// A vessel's card shows only the free-text AIS destination.
|
||||
// A vessel's card shows only the free-text AIS destination; a provider's
|
||||
// subject's (kind 'subject') carries its own title.
|
||||
kind: 'aircraft',
|
||||
title: '',
|
||||
visible: false,
|
||||
from: t('UNKNOWN'),
|
||||
to: t('UNKNOWN'),
|
||||
|
||||
@@ -35,6 +35,7 @@ import {
|
||||
vesselCameraProfile,
|
||||
} from '../cockpitSubjects.js';
|
||||
import { lookIsOffset, lookReadoutParts, wrapLookYaw } from '../cockpitLook.js';
|
||||
import { cockpitSubjectHudView } from '../cockpitSubjectProviders.js';
|
||||
import {
|
||||
RADAR_MAX_CONTACTS,
|
||||
radarPicture,
|
||||
@@ -90,6 +91,13 @@ export function publishInstrumentsView() {
|
||||
compass: view.compass.map((division) => ({ ...division })),
|
||||
compassMarkers: { ...view.compassMarkers },
|
||||
look: { ...view.look },
|
||||
// A provider's view model is rebuilt on each HUD update, never edited
|
||||
// in place, so it is published as it stands.
|
||||
readouts: view.readouts,
|
||||
sources: view.sources,
|
||||
banner: view.banner,
|
||||
veil: view.veil,
|
||||
progress: view.progress,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -118,24 +126,162 @@ function wordLook({ side, bearingDeg, elevation, angleDeg }) {
|
||||
*/
|
||||
export function presentLook() {
|
||||
const target = this.lookTarget;
|
||||
// A provider's view words its own readout (its HUD view's `lookReadout`).
|
||||
const provider = Boolean(this.subjectProvider);
|
||||
const rest = provider ? this.lookRestPitch : VESSEL_BRIDGE_PITCH_DEG;
|
||||
const offset =
|
||||
this.active &&
|
||||
this.subjectKind === 'vessel' &&
|
||||
lookIsOffset(target, VESSEL_BRIDGE_PITCH_DEG);
|
||||
(this.active && this.subjectKind === 'vessel') ||
|
||||
(provider && this.looksAround)
|
||||
? lookIsOffset(target, rest)
|
||||
: false;
|
||||
this.instruments.look = offset
|
||||
? {
|
||||
offset: true,
|
||||
yawDeg: wrapLookYaw(target.yawDeg),
|
||||
readout: wordLook(lookReadoutParts(target, VESSEL_BRIDGE_PITCH_DEG)),
|
||||
readout: provider
|
||||
? (this.subjectHud?.lookReadout ?? '')
|
||||
: wordLook(lookReadoutParts(target, VESSEL_BRIDGE_PITCH_DEG)),
|
||||
}
|
||||
: { offset: false, yawDeg: 0, readout: '' };
|
||||
}
|
||||
|
||||
/** Live Signals' tone for a provider's signal row. */
|
||||
const SUBJECT_SIGNAL_TONES = Object.freeze({
|
||||
warning: 'warning',
|
||||
alert: 'warning',
|
||||
});
|
||||
|
||||
/**
|
||||
* Present a provider subject's HUD: its view model (cockpitSubjectHudView)
|
||||
* in the generic readouts, the compass at the camera's heading, the route
|
||||
* card, and its signals in Live Signals. A HUD view that is null, a `hud()`
|
||||
* that throws, or a view whose reading throws keeps the last one. Contact
|
||||
* navigation stays with aircraft, so the Contact card is withdrawn.
|
||||
*/
|
||||
function updateSubjectHud(info, nowMs, forceContext) {
|
||||
const provider = this.subjectProvider;
|
||||
this.lastSubjectInfo = info;
|
||||
const frame = this.lastSubjectFrame;
|
||||
const look = {
|
||||
yawDeg: this.lookTarget?.yawDeg ?? 0,
|
||||
pitchDeg: this.lookTarget?.pitchDeg ?? 0,
|
||||
offset:
|
||||
this.looksAround && lookIsOffset(this.lookTarget, this.lookRestPitch),
|
||||
};
|
||||
const raw = frame
|
||||
? this.callSubject(
|
||||
provider,
|
||||
'hud',
|
||||
[frame, Object.freeze({ ...this.subjectContext(), look })],
|
||||
null,
|
||||
)
|
||||
: null;
|
||||
if (raw != null)
|
||||
this.subjectHud = cockpitSubjectHudView(raw) ?? this.subjectHud;
|
||||
const hud = this.subjectHud ?? cockpitSubjectHudView(null);
|
||||
const view = this.instruments;
|
||||
view.kind = 'subject';
|
||||
view.trackSource = null;
|
||||
view.kicker = hud.kicker || provider.labels.kicker;
|
||||
view.callsign = hud.title || info.name || '';
|
||||
// While the floor under a subject with no height is acquired
|
||||
// (cockpitCamera.js), the meta line says so in place of the provider's.
|
||||
const acquiring = this.surfaceAcquiring === true;
|
||||
view.meta.text = acquiring ? t('ACQUIRING SURFACE') : hud.meta.text;
|
||||
view.meta.tone = acquiring ? 'warning' : hud.meta.tone;
|
||||
view.meta.emergency = !acquiring && hud.meta.tone === 'alert';
|
||||
const speed = hud.speed?.value ?? null;
|
||||
view.speed = hud.speed
|
||||
? {
|
||||
text: speed === null ? '---' : formatNumber(Math.round(speed)),
|
||||
value: speed === null ? null : Math.round(speed),
|
||||
immediate: forceContext,
|
||||
}
|
||||
: null;
|
||||
view.speedUnit = hud.speed?.unit ?? '';
|
||||
view.speedTag = hud.speed?.tag ?? '';
|
||||
view.speedTone = hud.speed?.tone ?? 'normal';
|
||||
view.speedRim.unavailable = true;
|
||||
view.altitude = null;
|
||||
view.altitudeRim.unavailable = true;
|
||||
view.course = null;
|
||||
const heading = normalizeHeading(this.heading ?? info.track ?? 0);
|
||||
view.heading = {
|
||||
text: formatHeadingReadout(heading),
|
||||
value: heading,
|
||||
immediate: forceContext,
|
||||
};
|
||||
const viewHeading = normalizeHeading(
|
||||
heading + (provider.look ? (this.lookView?.yawDeg ?? 0) : 0),
|
||||
);
|
||||
view.compass = scrollingCompassDivisions(viewHeading).map((division) => ({
|
||||
slot: division.slot,
|
||||
heading: division.heading,
|
||||
active: division.nearest,
|
||||
label: compassPointLabel(formatCompassDivision(division.heading)),
|
||||
}));
|
||||
view.compassMarkers = {
|
||||
prograde: compassMarkerSlot(heading, viewHeading),
|
||||
retrograde: compassMarkerSlot(heading + 180, viewHeading),
|
||||
};
|
||||
view.clock = new Date().toISOString().slice(11, 19) + 'Z';
|
||||
view.position = `${formatCockpitCoordinate(info.latitude, 'N', 'S')} · ${formatCockpitCoordinate(info.longitude, 'E', 'W')}`;
|
||||
view.readouts = hud.readouts;
|
||||
view.sources = hud.sources;
|
||||
view.banner = hud.banner;
|
||||
view.veil = hud.veil;
|
||||
view.progress = hud.progress;
|
||||
view.lookEnabled = Boolean(provider.look);
|
||||
view.layer = provider.layerId;
|
||||
this.presentLook();
|
||||
this.publishInstrumentsView();
|
||||
const route = this.routeView;
|
||||
route.kind = 'subject';
|
||||
route.title = hud.route?.title ?? '';
|
||||
route.from = hud.route?.from ?? '';
|
||||
route.to = hud.route?.to ?? '';
|
||||
route.status = hud.route?.status ?? '';
|
||||
route.visible = Boolean(hud.route);
|
||||
// No destination arrow; clearing also publishes the card.
|
||||
this.clearPredictiveRoute();
|
||||
if (
|
||||
forceContext ||
|
||||
cockpitUiUpdateDue(
|
||||
nowMs,
|
||||
this.lastContextUpdateMs,
|
||||
COCKPIT_CONTEXT_UPDATE_MS,
|
||||
)
|
||||
) {
|
||||
this.lastContextUpdateMs = nowMs;
|
||||
this.updateLocalPosition(info);
|
||||
this.maybeRefreshRegionalBrief(info);
|
||||
this.showContextCard(false);
|
||||
const keys = new Set();
|
||||
for (const signal of hud.signals) {
|
||||
const key = `subject:${signal.id}`;
|
||||
keys.add(key);
|
||||
this.pushCockpitSignal(
|
||||
key,
|
||||
SUBJECT_SIGNAL_TONES[signal.tone] ?? 'info',
|
||||
signal.title,
|
||||
signal.detail || signal.title,
|
||||
);
|
||||
}
|
||||
for (const key of this.subjectSignalKeys ?? [])
|
||||
if (!keys.has(key)) this.dropCockpitSignal(key);
|
||||
this.subjectSignalKeys = keys;
|
||||
}
|
||||
}
|
||||
|
||||
export function updateHud(
|
||||
info,
|
||||
nowMs = performance.now(),
|
||||
forceContext = false,
|
||||
) {
|
||||
if (this.subjectProvider && info?.generic === true) {
|
||||
updateSubjectHud.call(this, info, nowMs, forceContext);
|
||||
return;
|
||||
}
|
||||
if (info?.kind === 'vessel') {
|
||||
updateVesselHud.call(this, info, nowMs, forceContext);
|
||||
return;
|
||||
|
||||
@@ -45,7 +45,7 @@ function fixture(t) {
|
||||
test('the orbital HUD is hidden until a satellite view is published', async (t) => {
|
||||
const f = fixture(t);
|
||||
assert.equal(f.section().hidden, true);
|
||||
assert.equal(f.section().querySelector('#cockpit-orbital-zoom-in'), null);
|
||||
assert.equal(f.section().querySelector('#cockpit-orbital-zoom-in') === null, true);
|
||||
});
|
||||
|
||||
test('a published orbital view renders its readouts and zoom controls', async (t) => {
|
||||
@@ -97,7 +97,7 @@ test('an unknown velocity leaves its row out', async (t) => {
|
||||
const f = fixture(t);
|
||||
f.store.publishOrbital({ ...VIEW, velocityMps: null });
|
||||
await nextTick();
|
||||
assert.equal(f.section().querySelector('.cockpit-orbital-velocity'), null);
|
||||
assert.equal(f.section().querySelector('.cockpit-orbital-velocity') === null, true);
|
||||
assert.equal(f.text('.cockpit-orbital-altitude'), '418 KM');
|
||||
});
|
||||
|
||||
@@ -145,7 +145,7 @@ test('publishing null hides the orbital HUD again', async (t) => {
|
||||
f.store.publishOrbital(null);
|
||||
await nextTick();
|
||||
assert.equal(f.section().hidden, true);
|
||||
assert.equal(f.section().querySelector('.cockpit-orbital-name'), null);
|
||||
assert.equal(f.section().querySelector('.cockpit-orbital-name') === null, true);
|
||||
});
|
||||
|
||||
const ISS_TLE = Object.freeze({
|
||||
@@ -160,7 +160,7 @@ test('the place below shows at the top once known', async (t) => {
|
||||
const f = fixture(t);
|
||||
f.store.publishOrbital({ ...VIEW, place: undefined });
|
||||
await nextTick();
|
||||
assert.equal(f.section().querySelector('#cockpit-orbital-over'), null);
|
||||
assert.equal(f.section().querySelector('#cockpit-orbital-over') === null, true);
|
||||
const over = () =>
|
||||
f.section().querySelector('#cockpit-orbital-over strong')?.textContent;
|
||||
f.store.publishOrbital({
|
||||
@@ -195,7 +195,7 @@ test('the place below shows at the top once known', async (t) => {
|
||||
// says nothing rather than call land open ocean.
|
||||
f.store.publishOrbital({ ...VIEW, place: null });
|
||||
await nextTick();
|
||||
assert.equal(document.querySelector('#cockpit-orbital-over'), null);
|
||||
assert.equal(document.querySelector('#cockpit-orbital-over') === null, true);
|
||||
});
|
||||
|
||||
test('an owner country shows its flag from the sheet, or its code if the sheet will not load', async (t) => {
|
||||
@@ -216,7 +216,7 @@ test('an owner country shows its flag from the sheet, or its code if the sheet w
|
||||
owner: { countryCode: 'US', label: 'USA' },
|
||||
});
|
||||
await nextTick();
|
||||
assert.equal(f.section().querySelector('.cockpit-orbital-flag'), null);
|
||||
assert.equal(f.section().querySelector('.cockpit-orbital-flag') === null, true);
|
||||
assert.equal(images.length, 1, 'the sheet is asked for');
|
||||
images[0].onerror();
|
||||
await settle();
|
||||
@@ -244,7 +244,7 @@ test('an owner country shows its flag from the sheet, or its code if the sheet w
|
||||
flag.style.backgroundPosition,
|
||||
ownerFlagStyle('FR').backgroundPosition,
|
||||
);
|
||||
assert.equal(f.section().querySelector('.cockpit-orbital-owner-badge'), null);
|
||||
assert.equal(f.section().querySelector('.cockpit-orbital-owner-badge') === null, true);
|
||||
});
|
||||
|
||||
test('the readout names the owner, operator and element set', async (t) => {
|
||||
@@ -327,7 +327,7 @@ test('unknown identity fields leave their rows out', async (t) => {
|
||||
'.cockpit-orbital-ident',
|
||||
'#cockpit-orbital-tle',
|
||||
])
|
||||
assert.equal(f.section().querySelector(selector), null, selector);
|
||||
assert.equal(f.section().querySelector(selector) === null, true, selector);
|
||||
// An element set with no NORAD id still dates itself.
|
||||
f.store.publishOrbital({ ...VIEW, tle: ISS_TLE });
|
||||
await nextTick();
|
||||
|
||||
@@ -994,7 +994,7 @@ test('a place that lands after the exit is dropped', async (t) => {
|
||||
assert.equal(store.orbital, null, 'no HUD comes back for a stale answer');
|
||||
});
|
||||
|
||||
test('a tracked aircraft takes entry before a tracked satellite', async (t) => {
|
||||
test('an aircraft and a satellite first seen in one sync: the aircraft takes entry, by the fixed order', async (t) => {
|
||||
const aircraftInfo = {
|
||||
icao24: 'abc123',
|
||||
callsign: 'TEST1',
|
||||
@@ -1007,6 +1007,9 @@ test('a tracked aircraft takes entry before a tracked satellite', async (t) => {
|
||||
};
|
||||
const { cockpit, viewer, aircraft, store } = fixture(t, { aircraftInfo });
|
||||
viewer.trackedEntity = aircraft;
|
||||
// The satellite and the aircraft are both new to this sync; the fixed order
|
||||
// decides between subjects first seen together. Selected one after the
|
||||
// other, the later one takes entry (cockpitEntryGate.test.mjs).
|
||||
cockpit.syncEntry();
|
||||
assert.equal(store.presence.entryKind, 'aircraft');
|
||||
});
|
||||
|
||||
@@ -27,9 +27,11 @@ export const COCKPIT_UTILITY_REC_GAP_PX = 12;
|
||||
|
||||
export const COCKPIT_UTILITY_SIGNAL_GAP_PX = 8;
|
||||
|
||||
export const COCKPIT_UTILITY_MIN_TOP_PX = 96;
|
||||
// Display and Radio start where the left rail does (max(206px, 22vh) in
|
||||
// cockpit-panels.css), so the two rails' tops line up.
|
||||
export const COCKPIT_UTILITY_MIN_TOP_PX = 206;
|
||||
|
||||
export const COCKPIT_UTILITY_MIN_TOP_RATIO = 0.12;
|
||||
export const COCKPIT_UTILITY_MIN_TOP_RATIO = 0.22;
|
||||
|
||||
export const COCKPIT_UTILITY_LAUNCHER_MIN_HEIGHT_PX = 50;
|
||||
|
||||
@@ -184,11 +186,15 @@ const COCKPIT_ENTRY_FACES = Object.freeze({
|
||||
});
|
||||
|
||||
/**
|
||||
* The entry's glyph and localized label for the subject it would ride.
|
||||
* @param {'aircraft'|'vessel'|'satellite'|null|undefined} kind
|
||||
* The entry's glyph and localized label for the subject it would ride. An
|
||||
* application provider's subject brings its own face, already in the page's
|
||||
* language (`presence.entryFace`).
|
||||
* @param {string|null|undefined} kind
|
||||
* @param {{icon: string, label: string}|null} [face]
|
||||
* @returns {{icon: string, label: string}}
|
||||
*/
|
||||
export function cockpitEntryFace(kind) {
|
||||
const face = COCKPIT_ENTRY_FACES[kind] ?? COCKPIT_ENTRY_FACES.aircraft;
|
||||
return { icon: face.icon, label: t(face.label) };
|
||||
export function cockpitEntryFace(kind, face = null) {
|
||||
if (face?.icon && face?.label) return { icon: face.icon, label: face.label };
|
||||
const known = COCKPIT_ENTRY_FACES[kind] ?? COCKPIT_ENTRY_FACES.aircraft;
|
||||
return { icon: known.icon, label: t(known.label) };
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -5,6 +5,10 @@ import {
|
||||
normalizeHeading,
|
||||
resolveTrackedAircraftInfo,
|
||||
} from '../cockpitMath.js';
|
||||
import {
|
||||
cockpitSubjectCandidate,
|
||||
cockpitSubjectFrame,
|
||||
} from '../cockpitSubjectProviders.js';
|
||||
|
||||
/** The camera's own heading in degrees, or 0 when it has none. */
|
||||
function cameraHeadingDeg(camera) {
|
||||
@@ -33,15 +37,187 @@ export function readSatelliteInfo() {
|
||||
return this.services.satellitesLayer?.getCockpitSubject?.() || null;
|
||||
}
|
||||
|
||||
/**
|
||||
* What an application subject provider would have entry ride now, or null.
|
||||
* @param {object} provider A provider from cockpitSubjectProviders.
|
||||
* @returns {{id: string, name: string, face: object|null}|null}
|
||||
*/
|
||||
export function readSubjectCandidate(provider) {
|
||||
return cockpitSubjectCandidate(
|
||||
this.callSubject(provider, 'candidate', [], null),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* What a provider's `read` and `hud` receive besides the frame: the shared
|
||||
* ground floor at a point (metres, or null), a way to warm its cells, and the
|
||||
* floor service's lift.
|
||||
*/
|
||||
export function subjectContext() {
|
||||
this._subjectContext ??= Object.freeze({
|
||||
groundHeightAt: (latitude, longitude) => {
|
||||
const height = this.services.cachedGroundFloor?.(latitude, longitude);
|
||||
return Number.isFinite(height) ? height : null;
|
||||
},
|
||||
warmGround: (points) => {
|
||||
this.services.warmGroundFloor?.(points);
|
||||
},
|
||||
liftM: Number.isFinite(this.services.GROUND_FLOOR_LIFT_M)
|
||||
? this.services.GROUND_FLOOR_LIFT_M
|
||||
: 0,
|
||||
});
|
||||
return this._subjectContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* The ridden provider subject as the camera and HUD read it: the frame's
|
||||
* place and motion, named like the built-in kinds' info.
|
||||
* @param {object} frame From cockpitSubjectFrame.
|
||||
*/
|
||||
export function subjectInfo(frame) {
|
||||
return {
|
||||
kind: this.subjectProvider?.kind ?? null,
|
||||
generic: true,
|
||||
layerId: this.subjectProvider?.layerId ?? null,
|
||||
id: frame.id,
|
||||
name: frame.name,
|
||||
latitude: frame.latitude,
|
||||
longitude: frame.longitude,
|
||||
track: frame.headingDeg,
|
||||
motionCourse: frame.courseDeg,
|
||||
velocityMps: frame.speedMps ?? 0,
|
||||
stale: frame.stale,
|
||||
groundClamp: frame.groundClamp,
|
||||
anchor: frame.anchor,
|
||||
onGround: false,
|
||||
};
|
||||
}
|
||||
|
||||
/** The built-in kinds' fixed entry order. */
|
||||
const BUILT_IN_ENTRY_ORDER = Object.freeze({
|
||||
aircraft: 0,
|
||||
satellite: 1,
|
||||
vessel: 2,
|
||||
});
|
||||
|
||||
/**
|
||||
* Every subject entry could ride now, in entry order: a tracked aircraft,
|
||||
* the tracked satellite, the selected vessel and each provider's candidate.
|
||||
* The built-in kinds keep their fixed order (aircraft, satellite, vessel),
|
||||
* whenever each was selected. A provider's candidate goes ahead of them only
|
||||
* when it was selected after every built-in one present: a train picked
|
||||
* after an aircraft was tracked takes entry, an aircraft tracked after it
|
||||
* takes it back. Providers' candidates are ordered most recently selected
|
||||
* first, then by priority. A candidate's time is when this controller first
|
||||
* saw it (it looks on its entry cadence and on tracking changes), or saw it
|
||||
* selected again: another subject of a built-in kind, a provider candidate
|
||||
* whose `selectedAt` changes, or one without a `selectedAt` whose id changes.
|
||||
* A new id under the same `selectedAt` is the same selection, as when a
|
||||
* train's selection moves to another feed's copy of it. One
|
||||
* first seen together with a built-in candidate comes after it. With no
|
||||
* provider, entry is the built-in order alone. Each carries `allowed()`, its
|
||||
* kind's entry gate.
|
||||
* @param {number} [nowMs]
|
||||
* @returns {Array<{kind: string, id: string, seenAtMs: number, order: number,
|
||||
* allowed: () => boolean, provider?: object, candidate?: object}>}
|
||||
*/
|
||||
export function entryCandidates(nowMs = performance.now()) {
|
||||
const seen = (this._entrySeen ??= new Map());
|
||||
const list = [];
|
||||
const note = (kind, id, entry, selectedAt = null) => {
|
||||
const last = seen.get(kind);
|
||||
// A provider's token says when its subject was selected: a new id under
|
||||
// the same token (a train handed to another feed's copy of it) is not a
|
||||
// new selection. Without a token, a new id is.
|
||||
if (
|
||||
!last ||
|
||||
last.selectedAt !== selectedAt ||
|
||||
(selectedAt === null && last.id !== id)
|
||||
)
|
||||
seen.set(kind, { id, selectedAt, atMs: nowMs });
|
||||
else if (last.id !== id) seen.set(kind, { ...last, id });
|
||||
list.push({ kind, id, seenAtMs: seen.get(kind).atMs, ...entry });
|
||||
};
|
||||
const aircraft = this.readAircraftInfo();
|
||||
if (aircraft && this.viewer.trackedEntity?.position)
|
||||
note(
|
||||
'aircraft',
|
||||
String(
|
||||
this.viewer.trackedEntity.gevTrackedId ||
|
||||
aircraft.icao24 ||
|
||||
aircraft.id ||
|
||||
'aircraft',
|
||||
),
|
||||
{
|
||||
order: BUILT_IN_ENTRY_ORDER.aircraft,
|
||||
allowed: () => this.isEntryAllowed(),
|
||||
},
|
||||
);
|
||||
const satellite = this.readSatelliteInfo();
|
||||
if (satellite)
|
||||
note('satellite', String(satellite.noradId ?? satellite.id ?? ''), {
|
||||
order: BUILT_IN_ENTRY_ORDER.satellite,
|
||||
allowed: () => this.isOrbitEntryAllowed(),
|
||||
});
|
||||
const vessel = this.readVesselInfo();
|
||||
if (vessel)
|
||||
note('vessel', String(vessel.id ?? ''), {
|
||||
order: BUILT_IN_ENTRY_ORDER.vessel,
|
||||
allowed: () => this.isBridgeEntryAllowed(),
|
||||
});
|
||||
this.subjectProviders.forEach((provider, index) => {
|
||||
const candidate = this.readSubjectCandidate(provider);
|
||||
if (candidate)
|
||||
note(
|
||||
provider.kind,
|
||||
candidate.id,
|
||||
{
|
||||
order: 3 + index,
|
||||
provider,
|
||||
candidate,
|
||||
allowed: () => this.isSubjectEntryAllowed(provider, candidate),
|
||||
},
|
||||
candidate.selectedAt,
|
||||
);
|
||||
});
|
||||
// A subject gone and back counts as selected again.
|
||||
for (const kind of [...seen.keys()])
|
||||
if (!list.some((entry) => entry.kind === kind)) seen.delete(kind);
|
||||
const builtIns = list
|
||||
.filter((entry) => !entry.provider)
|
||||
.sort((a, b) => a.order - b.order);
|
||||
const provided = list
|
||||
.filter((entry) => entry.provider)
|
||||
.sort((a, b) => b.seenAtMs - a.seenAtMs || a.order - b.order);
|
||||
const builtInSeenAtMs = Math.max(
|
||||
-Infinity,
|
||||
...builtIns.map((entry) => entry.seenAtMs),
|
||||
);
|
||||
const later = provided.filter((entry) => entry.seenAtMs > builtInSeenAtMs);
|
||||
const earlier = provided.filter((entry) => entry.seenAtMs <= builtInSeenAtMs);
|
||||
return [...later, ...builtIns, ...earlier];
|
||||
}
|
||||
|
||||
/**
|
||||
* The subject entry would ride: the first in entry order (entryCandidates).
|
||||
* It decides alone, so when its own gate is shut entry is unavailable rather
|
||||
* than taken by the next one.
|
||||
* @returns {object|null} An entry of entryCandidates, or null.
|
||||
*/
|
||||
export function resolveEntry(nowMs = performance.now()) {
|
||||
return this.entryCandidates(nowMs)[0] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The layer the active view rides: Live AIS Vessels on a bridge, Satellites
|
||||
* in orbit, else the aircraft's own layer. It is read from the tracked
|
||||
* entity's id once the layer has dropped its tracking, so a layer turned off
|
||||
* still names itself.
|
||||
* @returns {'flights'|'military'|'ais-live-vessels'|'satellites'|null}
|
||||
* in orbit, a provider's own layer, else the aircraft's own layer. It is read
|
||||
* from the tracked entity's id once the layer has dropped its tracking, so a
|
||||
* layer turned off still names itself.
|
||||
* @returns {string|null}
|
||||
*/
|
||||
export function readSubjectLayerId() {
|
||||
if (!this.active) return null;
|
||||
if (this.subjectProvider) return this.subjectProvider.layerId;
|
||||
if (this.subjectKind === 'vessel') return 'ais-live-vessels';
|
||||
if (this.subjectKind === 'satellite') return 'satellites';
|
||||
const layerId = this.readAircraftInfo()?.layerId;
|
||||
@@ -51,23 +227,20 @@ export function readSubjectLayerId() {
|
||||
}
|
||||
|
||||
/**
|
||||
* The subject entry would take: a Cesium-tracked aircraft first, then the
|
||||
* tracked satellite, else the selected vessel. Vessels never take Cesium
|
||||
* tracking, so an aircraft and a vessel cannot be live through the same owner.
|
||||
* @returns {'aircraft'|'satellite'|'vessel'|null}
|
||||
* The kind entry would take, the first in entry order's (resolveEntry): a
|
||||
* Cesium-tracked aircraft, the tracked satellite, the selected vessel or a
|
||||
* provider's candidate.
|
||||
* @returns {string|null}
|
||||
*/
|
||||
export function resolveEntryKind() {
|
||||
if (this.readAircraftInfo() && this.viewer.trackedEntity?.position)
|
||||
return 'aircraft';
|
||||
if (this.readSatelliteInfo()) return 'satellite';
|
||||
return this.readVesselInfo() ? 'vessel' : null;
|
||||
return this.resolveEntry()?.kind ?? null;
|
||||
}
|
||||
|
||||
export function dispatchCockpitModeChanged(active, info = null) {
|
||||
const subjectId = active
|
||||
? String(
|
||||
info?.icao24 ||
|
||||
(info?.kind === 'vessel' ? info.id : '') ||
|
||||
(info?.kind === 'vessel' || info?.generic === true ? info.id : '') ||
|
||||
info?.noradId ||
|
||||
'',
|
||||
)
|
||||
@@ -76,9 +249,13 @@ export function dispatchCockpitModeChanged(active, info = null) {
|
||||
: null;
|
||||
const layerId =
|
||||
active &&
|
||||
['flights', 'military', 'ais-live-vessels', 'satellites'].includes(
|
||||
(['flights', 'military', 'ais-live-vessels', 'satellites'].includes(
|
||||
info?.layerId,
|
||||
)
|
||||
) ||
|
||||
(info?.generic === true &&
|
||||
this.subjectProviders.some(
|
||||
(provider) => provider.layerId === info.layerId,
|
||||
)))
|
||||
? info.layerId
|
||||
: null;
|
||||
window.dispatchEvent(
|
||||
@@ -127,40 +304,60 @@ export function syncTr3bToggle(info) {
|
||||
this.publishPresenceView();
|
||||
}
|
||||
|
||||
/**
|
||||
* Word the ridden provider subject's labels and Look ahead button again,
|
||||
* after a change of the page's language: a provider may give them as
|
||||
* functions (cockpitSubjectProviders).
|
||||
*/
|
||||
export function refreshSubjectWords() {
|
||||
const provider = this.subjectProvider;
|
||||
if (!this.active || !provider) return;
|
||||
this.presence.subjectLabels = { ...provider.labels };
|
||||
const look = provider.look;
|
||||
this.presence.subjectLook = look ? { aheadLabel: look.aheadLabel } : null;
|
||||
this.publishPresenceView();
|
||||
}
|
||||
|
||||
export function syncEntry() {
|
||||
if (this.destroyed) return false;
|
||||
if (this.active) return;
|
||||
const info = this.readAircraftInfo();
|
||||
const trackedContact = !!(info && this.viewer.trackedEntity?.position);
|
||||
this.syncTr3bToggle(trackedContact ? info : null);
|
||||
const orbitContact = !trackedContact && !!this.readSatelliteInfo();
|
||||
const bridgeContact =
|
||||
!trackedContact && !orbitContact && !!this.readVesselInfo();
|
||||
let entryKind = null;
|
||||
if (trackedContact) entryKind = this.isEntryAllowed() ? 'aircraft' : null;
|
||||
else if (orbitContact)
|
||||
entryKind = this.isOrbitEntryAllowed() ? 'satellite' : null;
|
||||
else if (bridgeContact)
|
||||
entryKind = this.isBridgeEntryAllowed() ? 'vessel' : null;
|
||||
const candidates = this.entryCandidates(performance.now());
|
||||
const tracked = candidates.some(({ kind }) => kind === 'aircraft');
|
||||
this.syncTr3bToggle(tracked ? this.readAircraftInfo() : null);
|
||||
// The first in entry order decides alone (resolveEntry).
|
||||
const chosen = candidates[0] ?? null;
|
||||
const entryKind = chosen?.allowed() ? chosen.kind : null;
|
||||
const face =
|
||||
entryKind && chosen.provider
|
||||
? (chosen.candidate.face ?? chosen.provider.entryFace)
|
||||
: null;
|
||||
const available = entryKind !== null;
|
||||
// Change-only publishes: this runs on a preUpdate cadence, and a fresh
|
||||
// presence every frame would re-render the views even when nothing
|
||||
// changed. (perf item 9)
|
||||
if (
|
||||
this.presence.entryAvailable === available &&
|
||||
this.presence.entryKind === entryKind
|
||||
this.presence.entryKind === entryKind &&
|
||||
this.presence.entryFace?.icon === face?.icon &&
|
||||
this.presence.entryFace?.label === face?.label
|
||||
)
|
||||
return;
|
||||
this.presence.entryAvailable = available;
|
||||
this.presence.entryKind = entryKind;
|
||||
this.presence.entryFace = face && { icon: face.icon, label: face.label };
|
||||
this.publishPresenceView();
|
||||
}
|
||||
|
||||
export function navigateContext(direction, options = {}) {
|
||||
if (this.destroyed) return false;
|
||||
// Contact navigation moves between aircraft; a bridge does not jump ship
|
||||
// and an orbital view stays with its satellite.
|
||||
if (this.subjectKind === 'vessel' || this.subjectKind === 'satellite')
|
||||
// Contact navigation moves between aircraft; a bridge does not jump ship,
|
||||
// an orbital view stays with its satellite and a provider's view with its
|
||||
// subject.
|
||||
if (
|
||||
this.subjectKind === 'vessel' ||
|
||||
this.subjectKind === 'satellite' ||
|
||||
this.subjectProvider
|
||||
)
|
||||
return false;
|
||||
const method = direction < 0 ? 'navigatePrevious' : 'navigateNext';
|
||||
const wasActive = this.active;
|
||||
@@ -180,9 +377,14 @@ export function navigateContext(direction, options = {}) {
|
||||
}
|
||||
|
||||
export function _adoptTrackedEntity(nowMs, suppliedInfo = null) {
|
||||
// An aircraft tracked from the bridge or from orbit ends that view (see the
|
||||
// vessel and orbital camera updates); it is never adopted as its subject.
|
||||
if (this.subjectKind === 'vessel' || this.subjectKind === 'satellite')
|
||||
// An aircraft tracked from the bridge, from orbit or from a provider's view
|
||||
// ends that view (see the camera updates); it is never adopted as its
|
||||
// subject.
|
||||
if (
|
||||
this.subjectKind === 'vessel' ||
|
||||
this.subjectKind === 'satellite' ||
|
||||
this.subjectProvider
|
||||
)
|
||||
return false;
|
||||
const nextEntity = this.viewer.trackedEntity;
|
||||
if (
|
||||
@@ -213,16 +415,153 @@ export function _adoptTrackedEntity(nowMs, suppliedInfo = null) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter first person on a tracked aircraft or, with none tracked, the
|
||||
* tracked satellite's orbital view or the selected vessel's bridge.
|
||||
* @param {{kind?: 'aircraft'|'satellite'|'vessel'|null}} [options] Restrict
|
||||
* entry to one subject kind; voice entry is aircraft-only.
|
||||
* Enter a provider's view on its candidate: hold it, read a first frame, then
|
||||
* take the camera as the built-in views do. Entry fails when the gate is shut,
|
||||
* the hold answers anything but `true` or no frame comes; past the gate, a
|
||||
* failed entry releases the subject, since the hold may have taken it.
|
||||
* @param {object} provider From cockpitSubjectProviders.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function enterSubject(provider) {
|
||||
const candidate = this.readSubjectCandidate(provider);
|
||||
if (!candidate || !this.isSubjectEntryAllowed(provider, candidate))
|
||||
return false;
|
||||
const failed = {};
|
||||
const release = () =>
|
||||
this.callSubject(provider, 'release', [candidate.id, { restore: false }]);
|
||||
// An asynchronous hold may land after it was refused: it is released
|
||||
// again once it settles, unless this subject is being ridden by then.
|
||||
const releaseLate = () => {
|
||||
if (
|
||||
this.active &&
|
||||
this.subjectProvider === provider &&
|
||||
this.subjectId === candidate.id
|
||||
)
|
||||
return;
|
||||
release();
|
||||
};
|
||||
const held = this.callSubject(
|
||||
provider,
|
||||
'hold',
|
||||
[candidate.id],
|
||||
failed,
|
||||
releaseLate,
|
||||
);
|
||||
if (held !== true) {
|
||||
// `false` refuses entry; a hold that threw, returned a promise or
|
||||
// answered anything else (warned of once) may still have taken the
|
||||
// subject. Each is released.
|
||||
if (held !== false && held !== failed)
|
||||
this.callSubject.warnOnce(
|
||||
provider,
|
||||
'hold',
|
||||
'must return true or false; entry refused',
|
||||
held,
|
||||
);
|
||||
release();
|
||||
return false;
|
||||
}
|
||||
const frame = cockpitSubjectFrame(
|
||||
this.callSubject(
|
||||
provider,
|
||||
'read',
|
||||
[performance.now(), this.subjectContext()],
|
||||
null,
|
||||
),
|
||||
candidate.id,
|
||||
);
|
||||
if (!frame) {
|
||||
this.callSubject(provider, 'release', [candidate.id, { restore: false }]);
|
||||
return false;
|
||||
}
|
||||
this.entryFocusOrigin =
|
||||
document.activeElement instanceof HTMLElement
|
||||
? document.activeElement
|
||||
: null;
|
||||
this.onCameraTakeover?.();
|
||||
this.viewer.camera.cancelFlight();
|
||||
this.subjectKind = provider.kind;
|
||||
this.subjectProvider = provider;
|
||||
this.subjectId = candidate.id;
|
||||
this.lastSubjectFrame = frame;
|
||||
this.subjectHud = null;
|
||||
this.subjectSignalKeys = new Set();
|
||||
this.vesselWaterline = null;
|
||||
this.vesselFix = null;
|
||||
this.trackedEntity = null;
|
||||
this.heading = normalizeHeading(
|
||||
frame.headingDeg ?? cameraHeadingDeg(this.viewer.camera),
|
||||
);
|
||||
this.lastFrameMs = performance.now();
|
||||
this.lastCameraUpdateMs = 0;
|
||||
this.lastHudUpdateMs = 0;
|
||||
this.lastContextUpdateMs = 0;
|
||||
this.contextNavigationDeadlineMs = 0;
|
||||
this.lastGroundProbeMs = 0;
|
||||
this.surfaceWaitStartedMs = 0;
|
||||
this.surfaceAcquiring = false;
|
||||
this.surfaceFallback = false;
|
||||
this.cockpitAnchorValid = false;
|
||||
this.subjectHeightM = null;
|
||||
this.lookRestPitchDeg = provider.look?.restPitchDeg ?? null;
|
||||
this.resetLook({ immediate: true });
|
||||
this.active = true;
|
||||
this.services.holdContinuousRender('cockpit');
|
||||
this.viewer.trackedEntity = undefined;
|
||||
this.viewer.scene.screenSpaceCameraController.enableInputs = false;
|
||||
document.body.classList.add('cockpit-mode', 'cockpit-subject');
|
||||
this._tr3bSignature = null;
|
||||
Object.assign(this.presence, {
|
||||
active: true,
|
||||
entryAvailable: false,
|
||||
entryKind: null,
|
||||
entryFace: null,
|
||||
subjectKind: provider.kind,
|
||||
subjectGeneric: true,
|
||||
subjectLabels: { ...provider.labels },
|
||||
subjectLook: provider.look
|
||||
? { aheadLabel: provider.look.aheadLabel }
|
||||
: null,
|
||||
tr3b: null,
|
||||
});
|
||||
this.publishPresenceView();
|
||||
this.publishRadar(null);
|
||||
this.signalItems = [];
|
||||
this.signalSignatures.clear();
|
||||
this.showBriefPage(0);
|
||||
this.startBriefRotation();
|
||||
this.pushCockpitSignal('track', 'track', t('TRACK ACQUIRED'), frame.name);
|
||||
const info = this.subjectInfo(frame);
|
||||
this.updateHud(info, performance.now(), true);
|
||||
this.setVisionMode(this.getInitialVisionMode());
|
||||
this.scheduleContextLayout();
|
||||
Promise.resolve().then(() => {
|
||||
if (this.active && !this.destroyed)
|
||||
this.mapViewButton?.focus({ preventScroll: true });
|
||||
});
|
||||
this.onEntered?.();
|
||||
this.onRide?.(provider.layerId);
|
||||
this.dispatchCockpitModeChanged(true, info);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter first person on the first subject in entry order (resolveEntry): a
|
||||
* tracked aircraft, the tracked satellite's orbital view, the selected
|
||||
* vessel's bridge or an application provider's subject.
|
||||
* @param {{kind?: string|null}} [options] Restrict entry to one subject kind;
|
||||
* voice entry is aircraft-only.
|
||||
* @returns {boolean} True when the view was entered.
|
||||
*/
|
||||
export function enter({ kind = null } = {}) {
|
||||
if (this.destroyed) return false;
|
||||
if (this.active) return false;
|
||||
const subjectKind = kind ?? this.resolveEntryKind() ?? 'aircraft';
|
||||
const provider = this.subjectProviders.find(
|
||||
(entry) => entry.kind === subjectKind,
|
||||
);
|
||||
if (provider) return enterSubject.call(this, provider);
|
||||
if (!['aircraft', 'satellite', 'vessel'].includes(subjectKind)) return false;
|
||||
const vessel = subjectKind === 'vessel';
|
||||
const satellite = subjectKind === 'satellite';
|
||||
const allowed = vessel
|
||||
@@ -371,11 +710,17 @@ export function enter({ kind = null } = {}) {
|
||||
export function exit({ restoreTracking = true } = {}) {
|
||||
if (!this.active) return false;
|
||||
const entity = this.trackedEntity;
|
||||
const provider = this.subjectProvider;
|
||||
const providerSubject = provider ? this.subjectId : null;
|
||||
const vesselSubject = this.subjectKind === 'vessel' ? this.subjectId : null;
|
||||
const satelliteSubject =
|
||||
this.subjectKind === 'satellite' ? this.subjectId : null;
|
||||
this.active = false;
|
||||
this.subjectKind = null;
|
||||
this.subjectProvider = null;
|
||||
this.lastSubjectFrame = null;
|
||||
this.subjectHud = null;
|
||||
this.lookRestPitchDeg = null;
|
||||
this.vesselWaterline = null;
|
||||
this.vesselFix = null;
|
||||
this.subjectId = null;
|
||||
@@ -399,6 +744,7 @@ export function exit({ restoreTracking = true } = {}) {
|
||||
'cockpit-mode',
|
||||
'cockpit-bridge',
|
||||
'cockpit-orbit',
|
||||
'cockpit-subject',
|
||||
);
|
||||
// The camera's own field of view returns before any follow resumes.
|
||||
this.endOrbital();
|
||||
@@ -406,6 +752,9 @@ export function exit({ restoreTracking = true } = {}) {
|
||||
this.publishUtilityLayout(null);
|
||||
this.presence.active = false;
|
||||
this.presence.subjectKind = null;
|
||||
this.presence.subjectGeneric = false;
|
||||
this.presence.subjectLabels = null;
|
||||
this.presence.subjectLook = null;
|
||||
this.publishPresenceView();
|
||||
this.routeView.visible = false;
|
||||
this.clearPredictiveRoute();
|
||||
@@ -419,6 +768,13 @@ export function exit({ restoreTracking = true } = {}) {
|
||||
this.services.aisLiveVesselsLayer?.setCockpitSubject?.(null);
|
||||
if (satelliteSubject !== null)
|
||||
this.services.satellitesLayer?.setCockpitSubject?.(null);
|
||||
// The provider gives its subject back; `restore` asks it to bring the map
|
||||
// back to it, as the built-in kinds' refocus does.
|
||||
if (provider)
|
||||
this.callSubject(provider, 'release', [
|
||||
providerSubject,
|
||||
{ restore: restoreTracking === true },
|
||||
]);
|
||||
this.dispatchCockpitModeChanged(false);
|
||||
if (restoreTracking && entity && this.viewer.entities.contains(entity)) {
|
||||
this.viewer.trackedEntity = entity;
|
||||
|
||||
@@ -450,3 +450,42 @@ test('the real layout pass drives the mounted controls: compact hides the collap
|
||||
assert.equal(cockpit.utilityLayout.top, '120.00px');
|
||||
assert.equal(strip.classList.contains('layout-primary-only'), false);
|
||||
});
|
||||
|
||||
test('the rail opens one panel at a time and reads as a disclosure', async (t) => {
|
||||
const { $, controls } = fixture(t);
|
||||
const item = (kind) =>
|
||||
document.querySelector(`[data-cockpit-rail-item="${kind}"]`);
|
||||
item('display').click();
|
||||
await nextTick();
|
||||
assert.equal($('cockpit-display-panel').hidden, false);
|
||||
assert.equal(item('display').getAttribute('aria-expanded'), 'true');
|
||||
assert.equal(
|
||||
item('display').getAttribute('aria-controls'),
|
||||
'cockpit-display-panel',
|
||||
);
|
||||
item('radio').click();
|
||||
await nextTick();
|
||||
assert.equal($('cockpit-display-panel').hidden, true);
|
||||
assert.equal($('cockpit-radio-panel').hidden, false);
|
||||
assert.equal(item('display').getAttribute('aria-expanded'), 'false');
|
||||
assert.equal(item('radio').getAttribute('aria-expanded'), 'true');
|
||||
item('radio').click();
|
||||
await nextTick();
|
||||
assert.equal(controls._cockpitDisclosureOpen('radio'), false);
|
||||
assert.equal(controls._cockpitDisclosureOpen('display'), false);
|
||||
});
|
||||
|
||||
test('collapsing an open panel hands focus to the rail when its toggle is hidden', async (t) => {
|
||||
const { $, controls } = fixture(t);
|
||||
const railItem = document.querySelector('[data-cockpit-rail-item="radio"]');
|
||||
// happy-dom lays nothing out: show the rail and hide the launcher's toggle
|
||||
// as the desktop look does.
|
||||
railItem.getClientRects = () => [{ width: 32, height: 32 }];
|
||||
$('cockpit-radio-toggle-btn').getClientRects = () => [];
|
||||
controls._setCockpitDisclosure('radio', true);
|
||||
await nextTick();
|
||||
document.querySelector('.cockpit-utility-collapse').click();
|
||||
await nextTick();
|
||||
assert.equal($('cockpit-radio-panel').hidden, true);
|
||||
assert.equal(document.activeElement, railItem);
|
||||
});
|
||||
@@ -142,7 +142,7 @@ test('the map source row renders the published chips and selects through the con
|
||||
assert.equal(osm.classList.contains('active'), true);
|
||||
assert.equal(osm.getAttribute('aria-pressed'), 'true');
|
||||
assert.equal(osm.hasAttribute('aria-label'), false);
|
||||
assert.equal(esri.querySelector('.map-stack-chip-req'), null);
|
||||
assert.equal(esri.querySelector('.map-stack-chip-req') === null, true);
|
||||
bing.click();
|
||||
esri.click();
|
||||
assert.deepEqual(selected, ['esri-imagery']);
|
||||
|
||||
@@ -56,6 +56,8 @@ import {
|
||||
isScopeMaskEnabled,
|
||||
setScopeMaskFeather,
|
||||
getScopeMaskFeather,
|
||||
setScopeMaskOpacity,
|
||||
getScopeMaskOpacity,
|
||||
setScopeTerminusOverride,
|
||||
getScopeTerminusOverride,
|
||||
clampScopeTerminusPct,
|
||||
@@ -112,6 +114,8 @@ export class StyleManager extends ApplicationShell {
|
||||
isScopeMaskEnabled,
|
||||
setScopeMaskFeather,
|
||||
getScopeMaskFeather,
|
||||
setScopeMaskOpacity,
|
||||
getScopeMaskOpacity,
|
||||
setScopeTerminusOverride,
|
||||
getScopeTerminusOverride,
|
||||
clampScopeTerminusPct,
|
||||
|
||||
@@ -51,6 +51,8 @@ export class ContextControls {
|
||||
this._contextRestoreState = null;
|
||||
this._contextLayerReactionPromises = new Set();
|
||||
this._preservePanelStateDuringLayerClear = false;
|
||||
/** Layers Context isolation is switching off right now. */
|
||||
this._isolatingLayerIds = new Set();
|
||||
this._userFacingContextNotificationTokens = new Set();
|
||||
this._clearSelectedLayersPromise = null;
|
||||
this._clearSelectedLayersManagerPromise = null;
|
||||
@@ -59,6 +61,16 @@ export class ContextControls {
|
||||
showToast(...args) {
|
||||
if (!this.destroyed) this.actions.showToast(...args);
|
||||
}
|
||||
/**
|
||||
* Whether Context isolation is switching this layer off right now: it is
|
||||
* suspended, and leaving the mode restores it. A switch-off by the user,
|
||||
* inside the mode or out of it, is not.
|
||||
* @param {string} layerId Layer id.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
suspendsLayer(layerId) {
|
||||
return this._isolatingLayerIds.has(layerId);
|
||||
}
|
||||
setClearBusy(...args) {
|
||||
if (!this.destroyed) this.actions.setClearBusy(...args);
|
||||
}
|
||||
|
||||
@@ -153,3 +153,56 @@ test('a rejected tracked reaction settles without an unhandled rejection', async
|
||||
await controls._waitForContextLayerSettlement();
|
||||
assert.equal(controls._contextLayerReactionPromises.size, 0);
|
||||
});
|
||||
|
||||
test('only a layer Context isolation is switching off is suspended', async (t) => {
|
||||
const { controls } = fixture(t);
|
||||
const enabled = new Set(['cctv']);
|
||||
// What the CCTV panel is told at each visibility change of its layer.
|
||||
const seen = [];
|
||||
controls._dataManager = {
|
||||
layers: new Map([['cctv', {}]]),
|
||||
getEnabledLayerIds: () => [...enabled],
|
||||
getLayerParams: () => null,
|
||||
setLayerParams() {},
|
||||
isEnabled: (layerId) => enabled.has(layerId),
|
||||
isEffectivelyEnabled: (layerId) => enabled.has(layerId),
|
||||
async setEnabled(layerId, next) {
|
||||
// The layer tells its panel it is off while it is being disabled.
|
||||
if (next) enabled.add(layerId);
|
||||
else enabled.delete(layerId);
|
||||
seen.push([layerId, next, controls.suspendsLayer(layerId)]);
|
||||
return true;
|
||||
},
|
||||
async restoreEnabledLayerIds(layerIds) {
|
||||
for (const layerId of layerIds) await this.setEnabled(layerId, true);
|
||||
},
|
||||
};
|
||||
assert.equal(controls.suspendsLayer('cctv'), false);
|
||||
controls._captureContextSessionSnapshot();
|
||||
await controls._clearLayersOutsideContextMode('flights');
|
||||
assert.deepEqual(seen, [['cctv', false, true]]);
|
||||
assert.equal(controls.suspendsLayer('cctv'), false, 'only while isolating');
|
||||
// Inside the mode the user turns CCTV back on, then off: their own.
|
||||
await controls._dataManager.setEnabled('cctv', true);
|
||||
await controls._dataManager.setEnabled('cctv', false);
|
||||
assert.deepEqual(seen.at(-1), ['cctv', false, false]);
|
||||
await controls._restoreContextSession();
|
||||
assert.equal(enabled.has('cctv'), true);
|
||||
// A switch-off after the mode is left is the user's own too.
|
||||
await controls._dataManager.setEnabled('cctv', false);
|
||||
assert.deepEqual(seen.at(-1), ['cctv', false, false]);
|
||||
});
|
||||
|
||||
test('a failed isolation leaves no layer suspended', async (t) => {
|
||||
const { controls } = fixture(t);
|
||||
controls._dataManager = {
|
||||
layers: new Map([['cctv', {}]]),
|
||||
isEffectivelyEnabled: () => true,
|
||||
isEnabled: () => true,
|
||||
setEnabled: async () => {
|
||||
throw new Error('disable failed');
|
||||
},
|
||||
};
|
||||
await assert.rejects(controls._clearLayersOutsideContextMode('flights'));
|
||||
assert.equal(controls.suspendsLayer('cctv'), false);
|
||||
});
|
||||
@@ -240,25 +240,35 @@ export async function _clearLayersOutsideContextMode(
|
||||
) {
|
||||
const allowed = contextAllowedLayerIds(mode);
|
||||
const pending = [];
|
||||
for (const [layerId] of this._dataManager.layers || []) {
|
||||
// Effective visibility: a disallowed layer still mid-ENABLING must be
|
||||
// isolated too, or it settles ON inside the exclusive mode.
|
||||
if (
|
||||
!allowed.has(layerId) &&
|
||||
this._dataManager.isEffectivelyEnabled(layerId)
|
||||
) {
|
||||
pending.push({
|
||||
layerId,
|
||||
transition: this._dataManager.setEnabled(layerId, false, {
|
||||
notificationToken,
|
||||
...(signal ? { signal } : {}),
|
||||
}),
|
||||
});
|
||||
// Panels read this while their layer goes off (suspendsLayer): a layer
|
||||
// isolation switches off is suspended, not switched off by the user.
|
||||
const isolating = [];
|
||||
let results;
|
||||
try {
|
||||
for (const [layerId] of this._dataManager.layers || []) {
|
||||
// Effective visibility: a disallowed layer still mid-ENABLING must be
|
||||
// isolated too, or it settles ON inside the exclusive mode.
|
||||
if (
|
||||
!allowed.has(layerId) &&
|
||||
this._dataManager.isEffectivelyEnabled(layerId)
|
||||
) {
|
||||
if (!this._isolatingLayerIds.has(layerId)) {
|
||||
this._isolatingLayerIds.add(layerId);
|
||||
isolating.push(layerId);
|
||||
}
|
||||
pending.push({
|
||||
layerId,
|
||||
transition: this._dataManager.setEnabled(layerId, false, {
|
||||
notificationToken,
|
||||
...(signal ? { signal } : {}),
|
||||
}),
|
||||
});
|
||||
}
|
||||
}
|
||||
results = await Promise.all(pending.map(({ transition }) => transition));
|
||||
} finally {
|
||||
for (const layerId of isolating) this._isolatingLayerIds.delete(layerId);
|
||||
}
|
||||
const results = await Promise.all(
|
||||
pending.map(({ transition }) => transition),
|
||||
);
|
||||
const failed = pending
|
||||
.filter(
|
||||
({ layerId }, index) =>
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
import { getScopeMaskFeather, isScopeMaskEnabled, setScopeMaskEnabled, setScopeMaskFeather } from '../scopeMask.js';
|
||||
import {
|
||||
getScopeMaskFeather,
|
||||
getScopeMaskOpacity,
|
||||
isScopeMaskEnabled,
|
||||
setScopeMaskEnabled,
|
||||
setScopeMaskFeather,
|
||||
setScopeMaskOpacity,
|
||||
} from '../scopeMask.js';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import test from 'node:test';
|
||||
@@ -282,7 +289,7 @@ test('scope choice and expanded feather survive every HUD layout and both restor
|
||||
let shown = null;
|
||||
owner.store = { publish: (view) => (shown = view.scope) };
|
||||
await owner.restoreShareState({ scopeEnabled: false, scopeFeatherPct: 200 });
|
||||
assert.deepEqual(shown, { enabled: false, featherPct: 200 });
|
||||
assert.deepEqual(shown, { enabled: false, featherPct: 200, opacityPct: 100 });
|
||||
for (const layout of ['minimal', 'cyber', 'tactical']) {
|
||||
owner._setHudVariant(layout, { applyVisualDefaults: true });
|
||||
assert.equal(isScopeMaskEnabled(), false, layout);
|
||||
@@ -292,10 +299,44 @@ test('scope choice and expanded feather survive every HUD layout and both restor
|
||||
await owner.applyVisualState({ scope: { enabled: true, featherPct: 175 } });
|
||||
assert.equal(isScopeMaskEnabled(), true);
|
||||
assert.equal(getScopeMaskFeather(), 1.75);
|
||||
assert.deepEqual(shown, { enabled: true, featherPct: 175 });
|
||||
assert.deepEqual(shown, { enabled: true, featherPct: 175, opacityPct: 100 });
|
||||
await owner.applyVisualState({ scope: { featherPct: 500 } });
|
||||
assert.equal(getScopeMaskFeather(), 2);
|
||||
assert.deepEqual(shown, { enabled: true, featherPct: 200 });
|
||||
assert.deepEqual(shown, { enabled: true, featherPct: 200, opacityPct: 100 });
|
||||
});
|
||||
|
||||
test('a shared scope opacity is restored and rides in the next share state', async (t) => {
|
||||
const { owner } = styleOwner(t, 'tactical');
|
||||
const previous = getScopeMaskOpacity();
|
||||
t.after(() => setScopeMaskOpacity(previous));
|
||||
Object.assign(owner.services, {
|
||||
setScopeMaskEnabled() {},
|
||||
setScopeMaskFeather() {},
|
||||
setScopeMaskOpacity,
|
||||
});
|
||||
let shown = null;
|
||||
owner.store = { publish: (view) => (shown = view.scope) };
|
||||
await owner.restoreShareState({ scopeOpacityPct: 60 });
|
||||
assert.equal(getScopeMaskOpacity(), 0.6);
|
||||
assert.equal(shown.opacityPct, 60);
|
||||
// A state without it leaves the opacity alone.
|
||||
await owner.restoreShareState({ scopeFeatherPct: 80 });
|
||||
assert.equal(getScopeMaskOpacity(), 0.6);
|
||||
assert.equal(shown.opacityPct, 60);
|
||||
Object.assign(owner.services, {
|
||||
getDetectionTuning: () => ({ allocationStrategy: 'ELASTIC' }),
|
||||
getDetectionMode: () => 'OFF',
|
||||
isScopeMaskEnabled: () => true,
|
||||
getScopeMaskFeather: () => 0.8,
|
||||
getScopeMaskOpacity,
|
||||
getScopeTerminusOverride: () => null,
|
||||
});
|
||||
owner.readCelestialRing = () => null;
|
||||
assert.equal(owner._readShareState().options.scopeOpacityPct, 60);
|
||||
// A link asking for less than the floor opens at the floor, and says so.
|
||||
await owner.restoreShareState({ scopeOpacityPct: 20 });
|
||||
assert.equal(getScopeMaskOpacity(), 0.5);
|
||||
assert.equal(owner._readShareState().options.scopeOpacityPct, 50);
|
||||
});
|
||||
|
||||
test('a scene shot saved with the retired Snow style plays on Normal', async (t) => {
|
||||
|
||||
@@ -105,6 +105,11 @@ export class DisplayBindings {
|
||||
this._setScope({ featherPct: value });
|
||||
this._syncShareState();
|
||||
},
|
||||
setScopeOpacity: (value) => {
|
||||
this.shareLinkManager?.claimRestoreLane?.('visual');
|
||||
this._setScope({ opacityPct: Number(value) });
|
||||
this._syncShareState();
|
||||
},
|
||||
setSharpenIntensity: (pct) => {
|
||||
this.shareLinkManager?.claimRestoreLane?.('visual');
|
||||
this._setSharpenIntensity(pct);
|
||||
@@ -168,6 +173,28 @@ export class DisplayBindings {
|
||||
this._syncModels3dModeRow();
|
||||
},
|
||||
setModelsMode: (mode) => this._setModels3dMode(mode),
|
||||
// Back to the out-of-the-box look: Normal style, the global post
|
||||
// defaults (bloom, sharpen, HUD, labels, celestial), scope on at full
|
||||
// feather and opacity, 3D aircraft on in Proximity.
|
||||
resetVisual: () => {
|
||||
this.shareLinkManager?.claimRestoreLane?.('visual');
|
||||
this.setStyle('normal', { userInitiated: true });
|
||||
// The HUD layout follows the Normal style, as choosing it does: the
|
||||
// Cyber HUD stays Cyber.
|
||||
this._applyGlobalPostDefaults({ keepHudVariant: true });
|
||||
this._setDetectionAllocation('ELASTIC');
|
||||
this._setScope({ enabled: true, featherPct: 100, opacityPct: 100 });
|
||||
this._setModels3dEnabled(true);
|
||||
this._setModels3dMode('proximity');
|
||||
this._syncModels3dModeRow?.();
|
||||
// Inside Contacts the detection shown is lent for the session, and
|
||||
// leaving puts back the state from before. A reset there is the user's
|
||||
// choice, so the defaults become what leaving puts back and what a
|
||||
// share link carries.
|
||||
this.claimDetection();
|
||||
this._adoptDetectionAsRestore?.();
|
||||
this._syncShareState();
|
||||
},
|
||||
});
|
||||
this._detachDisplayControls = () => store.detach(token);
|
||||
}
|
||||
|
||||
@@ -108,7 +108,11 @@ test('bloom and sharpen render their state, slider and readout', async (t) => {
|
||||
await nextTick();
|
||||
assert.equal($('bloom-toggle').classList.contains('active'), false);
|
||||
assert.equal($('bloom-slider-row').classList.contains('visible'), false);
|
||||
assert.equal($('bloom-intensity-value').textContent, '140%', 'the amount stays');
|
||||
assert.equal(
|
||||
$('bloom-intensity-value').textContent,
|
||||
'140%',
|
||||
'the amount stays',
|
||||
);
|
||||
});
|
||||
|
||||
test('a publish never rewrites a slider the user is dragging', async (t) => {
|
||||
@@ -314,6 +318,73 @@ test('Scope and Celestial render what VisualSettings shows', async (t) => {
|
||||
assert.equal(celestial.title, 'Celestial ring — reveal the full globe');
|
||||
});
|
||||
|
||||
test('scope opacity renders what VisualSettings shows and sets the mask', async (t) => {
|
||||
const { store, $ } = fixture(t);
|
||||
const { owner } = settings(store);
|
||||
const mask = { opacity: 1 };
|
||||
owner.services = {
|
||||
...owner.services,
|
||||
setScopeMaskEnabled() {},
|
||||
setScopeMaskOpacity: (value) => (mask.opacity = value),
|
||||
};
|
||||
assert.equal($('scope-opacity-slider').value, '100');
|
||||
assert.equal($('scope-opacity-value').textContent, '100%');
|
||||
|
||||
owner._setScope({ opacityPct: 62.4 });
|
||||
await nextTick();
|
||||
assert.equal(mask.opacity, 0.62);
|
||||
assert.equal($('scope-opacity-slider').value, '62');
|
||||
assert.equal($('scope-opacity-value').textContent, '62%');
|
||||
assert.equal(store.view.scope.opacityPct, 62);
|
||||
|
||||
// No fainter than the floor, where the view would read as Scope off.
|
||||
owner._setScope({ opacityPct: 10 });
|
||||
await nextTick();
|
||||
assert.equal(mask.opacity, 0.5, 'floored');
|
||||
assert.equal($('scope-opacity-value').textContent, '50%');
|
||||
assert.equal($('scope-opacity-slider').min, '50');
|
||||
|
||||
// A value that is not a number changes nothing.
|
||||
owner._setScope({ opacityPct: Number.NaN });
|
||||
await nextTick();
|
||||
assert.equal($('scope-opacity-value').textContent, '50%');
|
||||
|
||||
owner._setScope({ opacityPct: 180 });
|
||||
await nextTick();
|
||||
assert.equal(mask.opacity, 1, 'clamped');
|
||||
assert.equal($('scope-opacity-value').textContent, '100%');
|
||||
|
||||
owner._setScope({ opacityPct: 70 }, { apply: false });
|
||||
await nextTick();
|
||||
assert.equal(mask.opacity, 1, 'only shown');
|
||||
assert.equal($('scope-opacity-value').textContent, '70%');
|
||||
|
||||
owner._setScope({ enabled: false });
|
||||
await nextTick();
|
||||
assert.equal($('scope-opacity-slider').disabled, true, 'off with the scope');
|
||||
assert.equal(store.view.scope.opacityPct, 70, 'kept while off');
|
||||
});
|
||||
|
||||
test('the Visual panel groups its controls and words its on/off pills', (t) => {
|
||||
const { $ } = fixture(t);
|
||||
const panel = $('pp-toggles');
|
||||
assert.deepEqual(
|
||||
[
|
||||
...panel.querySelectorAll(
|
||||
'.pp-section-heading, .visual-presets__heading',
|
||||
),
|
||||
].map((el) => el.textContent.trim()),
|
||||
['Look', 'MAP SOURCE 3D', 'Overlay', 'Effects'],
|
||||
);
|
||||
assert.equal(panel.querySelector('.pp-header-label').textContent, 'VISUAL');
|
||||
const body = panel.querySelector('.pp-panel-body');
|
||||
assert.equal(body.style.getPropertyValue('--pp-pill-on'), '"ON"');
|
||||
assert.equal(body.style.getPropertyValue('--pp-pill-off'), '"OFF"');
|
||||
const reset = panel.querySelector('.pp-reset-btn');
|
||||
assert.equal(reset, body.lastElementChild, 'the reset closes the panel');
|
||||
assert.equal(reset.textContent.trim(), 'restart_altReset to default');
|
||||
});
|
||||
|
||||
test('the 3D aircraft group renders what AircraftDisplay shows', async (t) => {
|
||||
const { store, $ } = fixture(t);
|
||||
const params = [];
|
||||
@@ -331,7 +402,10 @@ test('the 3D aircraft group renders what AircraftDisplay shows', async (t) => {
|
||||
assert.equal(coreClasses(button), 'pp-toggle-btn active');
|
||||
assert.equal(button.getAttribute('aria-pressed'), 'true');
|
||||
assert.equal(row.classList.contains('visible'), true);
|
||||
assert.equal($('models3d-mode-proximity').getAttribute('aria-checked'), 'true');
|
||||
assert.equal(
|
||||
$('models3d-mode-proximity').getAttribute('aria-checked'),
|
||||
'true',
|
||||
);
|
||||
|
||||
// The button leaves the row to its own sync.
|
||||
owner._setModels3dEnabled(false);
|
||||
@@ -347,7 +421,10 @@ test('the 3D aircraft group renders what AircraftDisplay shows', async (t) => {
|
||||
await nextTick();
|
||||
assert.equal(all.classList.contains('active'), true);
|
||||
assert.equal(all.getAttribute('aria-checked'), 'true');
|
||||
assert.equal($('models3d-mode-proximity').classList.contains('active'), false);
|
||||
assert.equal(
|
||||
$('models3d-mode-proximity').classList.contains('active'),
|
||||
false,
|
||||
);
|
||||
assert.deepEqual(params.at(-1), ['military', { models3dMode: 'all' }]);
|
||||
|
||||
owner._syncModels3dFromLayerState({
|
||||
@@ -376,12 +453,18 @@ test('the Draw controls render what the draw tool publishes', async (t) => {
|
||||
assert.equal(segment('area').getAttribute('aria-label'), 'Area');
|
||||
assert.equal(segment('area').title, 'Area');
|
||||
assert.equal(segment('area').textContent, 'pentagon');
|
||||
const swatch = (color) => document.querySelector(`#draw-colors [data-color="${color}"]`);
|
||||
const swatch = (color) =>
|
||||
document.querySelector(`#draw-colors [data-color="${color}"]`);
|
||||
assert.equal(swatch('primary').getAttribute('aria-checked'), 'true');
|
||||
assert.equal(swatch('amber').getAttribute('aria-label'), 'Amber');
|
||||
assert.equal($('draw-hint').textContent, '');
|
||||
|
||||
store.publishDraw({ active: true, shape: 'line', color: 'amber', hint: 'Click to add points.' });
|
||||
store.publishDraw({
|
||||
active: true,
|
||||
shape: 'line',
|
||||
color: 'amber',
|
||||
hint: 'Click to add points.',
|
||||
});
|
||||
await nextTick();
|
||||
assert.equal(swatch('amber').getAttribute('aria-checked'), 'true');
|
||||
assert.equal(swatch('primary').classList.contains('active'), false);
|
||||
@@ -477,7 +560,10 @@ test('the imported files render what the file import publishes and keep focus',
|
||||
assert.equal(document.activeElement === button(first, 'toggle'), true);
|
||||
assert.equal(button(first, 'toggle').getAttribute('aria-pressed'), 'true');
|
||||
assert.equal(button(first, 'fly').title, 'Fly to <b>a</b>.geojson');
|
||||
assert.equal(button(first, 'remove').getAttribute('aria-label'), 'Remove <b>a</b>.geojson');
|
||||
assert.equal(
|
||||
button(first, 'remove').getAttribute('aria-label'),
|
||||
'Remove <b>a</b>.geojson',
|
||||
);
|
||||
|
||||
await press(button(first, 'remove'));
|
||||
assert.equal(rowsNow().length, 1);
|
||||
@@ -593,7 +679,11 @@ test('VisualSettings publishes a style’s parameters and writes a moved slider
|
||||
assert.equal(store.parameters, null, 'the sliders go with their owner');
|
||||
assert.equal($('param-slider-panel').classList.contains('active'), false);
|
||||
assert.equal(store.act('setStyleParameter', 'grainAmt', 0.2), undefined);
|
||||
assert.equal(owner.stages.noir.uniforms.grainAmt, 0.3, 'a stopped owner no longer answers');
|
||||
assert.equal(
|
||||
owner.stages.noir.uniforms.grainAmt,
|
||||
0.3,
|
||||
'a stopped owner no longer answers',
|
||||
);
|
||||
// An older owner's stop leaves a newer owner's rows.
|
||||
const newer = { style: 'noir', rows: [] };
|
||||
owner._parameters = { style: 'noir', rows: [] };
|
||||
@@ -605,10 +695,16 @@ test('VisualSettings publishes a style’s parameters and writes a moved slider
|
||||
test('the four Cockpit groups teleport to the published slots and back to their places', async (t) => {
|
||||
const { store, $ } = fixture(t);
|
||||
const groupOf = (id) => $(id).closest('.pp-toggle-group') ?? $(id);
|
||||
const ids = ['hud-toggle', 'detection-toggle', 'param-slider-panel', 'models3d-toggle'];
|
||||
const ids = [
|
||||
'hud-toggle',
|
||||
'detection-toggle',
|
||||
'param-slider-panel',
|
||||
'models3d-toggle',
|
||||
];
|
||||
const body = $('pp-toggles').querySelector('.pp-panel-body');
|
||||
const order = () =>
|
||||
[...body.children].filter((el) => el.matches('.pp-toggle-group, #param-slider-panel'))
|
||||
[...body.children]
|
||||
.filter((el) => el.matches('.pp-toggle-group, #param-slider-panel'))
|
||||
.map((el) => el.id || el.querySelector('[id]')?.id);
|
||||
const home = order();
|
||||
const popover = document.body.appendChild(document.createElement('div'));
|
||||
|
||||
@@ -8,6 +8,7 @@ import { createApp, h, nextTick } from 'vue';
|
||||
import { createPinia } from 'pinia';
|
||||
import { useDisplayStore } from './stores/display.js';
|
||||
import { DisplayBindings } from './displayBindings.js';
|
||||
import { VisualSettings } from './visualSettings.js';
|
||||
import CommandDockView from './views/CommandDockView.vue';
|
||||
import DisplayControlsView from './views/DisplayControlsView.vue';
|
||||
import DrawControls from './views/panels/DrawControls.vue';
|
||||
@@ -231,3 +232,125 @@ test('several owners answer their own actions, the newest first', (t) => {
|
||||
['display', 'toggleBloom'],
|
||||
]);
|
||||
});
|
||||
|
||||
test('the Visual panel’s scope opacity, reset and presets call their actions', async (t) => {
|
||||
const store = mount(t);
|
||||
const { calls } = recorder(store);
|
||||
const selected = [];
|
||||
store.connectMapSource({ select: async (id) => selected.push(id) });
|
||||
store.publishMapSource({
|
||||
status: { text: 'OSM', warn: false },
|
||||
chips: [
|
||||
{ id: 'photoreal', label: 'Google 3D', available: false },
|
||||
{ id: 'osm', label: 'OSM', available: true, active: true },
|
||||
],
|
||||
});
|
||||
await nextTick();
|
||||
input($('scope-opacity-slider'), 60);
|
||||
document.querySelector('#pp-toggles .pp-reset-btn').click();
|
||||
const presets = document.querySelector('#pp-toggles .visual-presets');
|
||||
presets.querySelector('[data-style="noir"]').click();
|
||||
const chips = presets.querySelectorAll('.visual-presets__chip');
|
||||
chips[0].click();
|
||||
chips[1].click();
|
||||
assert.deepEqual(calls, [
|
||||
['setScopeOpacity', 60],
|
||||
['resetVisual'],
|
||||
['setStyle', 'noir'],
|
||||
]);
|
||||
assert.deepEqual(selected, ['osm'], 'an unavailable source is not selected');
|
||||
// The presets follow the published style, as the dock's do.
|
||||
assert.equal(
|
||||
presets.querySelector('[data-style="normal"]').getAttribute('aria-pressed'),
|
||||
'true',
|
||||
);
|
||||
store.publishStyle({ name: 'noir', label: 'NOIR' });
|
||||
await nextTick();
|
||||
assert.equal(
|
||||
presets.querySelector('[data-style="noir"]').getAttribute('aria-pressed'),
|
||||
'true',
|
||||
);
|
||||
assert.equal(
|
||||
presets.querySelector('[data-style="normal"]').getAttribute('aria-pressed'),
|
||||
'false',
|
||||
);
|
||||
// The dock keeps its own presets and map source beside them.
|
||||
assert.ok(
|
||||
document.querySelector('#control-panel .style-btn[data-style="noir"]'),
|
||||
);
|
||||
assert.ok($('map-stack-chips'));
|
||||
});
|
||||
|
||||
test('DisplayBindings sets the scope opacity and resets Visual to its defaults', (t) => {
|
||||
const store = mount(t);
|
||||
const calls = [];
|
||||
const bindings = new DisplayBindings({
|
||||
viewer: null,
|
||||
services: { isScopeMaskEnabled: () => true, cycleDetectionMode: () => {} },
|
||||
elements: { _locationSearch: document.createElement('input') },
|
||||
operations: {
|
||||
setStyle: (style, options) => calls.push(['style', style, options]),
|
||||
_applyGlobalPostDefaults: (options) =>
|
||||
calls.push(['postDefaults', options]),
|
||||
_setDetectionAllocation: (value) => calls.push(['allocation', value]),
|
||||
_setScope: (scope) => calls.push(['scope', scope]),
|
||||
_setModels3dEnabled: (on) => calls.push(['models3d', on]),
|
||||
_setModels3dMode: (mode) => calls.push(['models3dMode', mode]),
|
||||
_syncModels3dModeRow: () => calls.push(['models3dRow']),
|
||||
_syncShareState: () => calls.push(['share']),
|
||||
_adoptDetectionAsRestore: () => calls.push(['adoptDetection']),
|
||||
},
|
||||
readState: () => ({
|
||||
shareLinkManager: {
|
||||
claimRestoreLane: (lane) => calls.push(['claim', lane]),
|
||||
},
|
||||
}),
|
||||
claimDetection: () => calls.push(['claimDetection']),
|
||||
displayStore: store,
|
||||
});
|
||||
bindings._initUI();
|
||||
t.after(() => bindings.destroy());
|
||||
calls.length = 0;
|
||||
input($('scope-opacity-slider'), 65);
|
||||
assert.deepEqual(calls, [
|
||||
['claim', 'visual'],
|
||||
['scope', { opacityPct: 65 }],
|
||||
['share'],
|
||||
]);
|
||||
calls.length = 0;
|
||||
document.querySelector('#pp-toggles .pp-reset-btn').click();
|
||||
assert.deepEqual(calls, [
|
||||
['claim', 'visual'],
|
||||
['style', 'normal', { userInitiated: true }],
|
||||
['postDefaults', { keepHudVariant: true }],
|
||||
['allocation', 'ELASTIC'],
|
||||
['scope', { enabled: true, featherPct: 100, opacityPct: 100 }],
|
||||
['models3d', true],
|
||||
['models3dMode', 'proximity'],
|
||||
['models3dRow'],
|
||||
['claimDetection'],
|
||||
['adoptDetection'],
|
||||
['share'],
|
||||
]);
|
||||
});
|
||||
|
||||
test('a reset inside Contacts makes the shown detection what leaving puts back', () => {
|
||||
const adopt = VisualSettings.prototype.adoptDetectionAsRestore;
|
||||
const live = { detectionMode: 'DENSE', densityPct: 75 };
|
||||
const inContacts = {
|
||||
_contactsDetectionRestore: { mode: 'OFF', densityPct: 50 },
|
||||
getDetectionState: () => live,
|
||||
};
|
||||
adopt.call(inContacts);
|
||||
assert.deepEqual(inContacts._contactsDetectionRestore, {
|
||||
mode: 'DENSE',
|
||||
densityPct: 75,
|
||||
});
|
||||
// Outside Contacts there is no saved state to change.
|
||||
const outside = {
|
||||
_contactsDetectionRestore: null,
|
||||
getDetectionState: () => live,
|
||||
};
|
||||
adopt.call(outside);
|
||||
assert.equal(outside._contactsDetectionRestore, null);
|
||||
});
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup>
|
||||
import { vClassToggle } from '../rail/classToggle.js';
|
||||
import UiPanelEdge from './UiPanelEdge.vue';
|
||||
import UiPanelToggle from './UiPanelToggle.vue';
|
||||
|
||||
// Core's panel, with a name, title, slots and v-model:collapsed. It draws Core's panel markup
|
||||
@@ -57,6 +58,7 @@ const emit = defineEmits(['update:collapsed']);
|
||||
<slot name="badge" />
|
||||
<span class="panel-divider"></span>
|
||||
<slot name="actions" />
|
||||
<UiPanelEdge v-if="props.collapsible" />
|
||||
<UiPanelToggle
|
||||
v-if="props.collapsible"
|
||||
:target="props.id"
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<script setup>
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { t } from '../../i18n/index.js';
|
||||
import { panelEdge, panelSide, togglePanelEdge } from '../panelEdge.js';
|
||||
|
||||
// A panel header's edge switch: it slides this side's panels over their rail
|
||||
// to the screen edge, and back. The side comes from the column the panel is in.
|
||||
const button = ref(null);
|
||||
const side = ref('left');
|
||||
const on = computed(() => panelEdge.value[side.value]);
|
||||
function toggle() {
|
||||
side.value = panelSide(button.value);
|
||||
togglePanelEdge(side.value);
|
||||
}
|
||||
function sync() {
|
||||
side.value = panelSide(button.value);
|
||||
}
|
||||
// The layout moves some panels to the right column after they mount, so the
|
||||
// side is read again once that has happened.
|
||||
onMounted(() => {
|
||||
sync();
|
||||
globalThis.requestAnimationFrame?.(sync);
|
||||
});
|
||||
const icon = computed(() =>
|
||||
side.value === 'right' ? 'align_horizontal_right' : 'align_horizontal_left',
|
||||
);
|
||||
const label = computed(() =>
|
||||
on.value
|
||||
? t('Move panels back beside the rail')
|
||||
: t('Move panels over the rail, to the edge'),
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<button
|
||||
ref="button"
|
||||
type="button"
|
||||
class="ui-panel-edge panel-edge-btn"
|
||||
:aria-pressed="String(on)"
|
||||
:aria-label="label"
|
||||
:title="label"
|
||||
@pointerenter="sync"
|
||||
@focus="sync"
|
||||
@click="toggle"
|
||||
>
|
||||
<span class="material-symbols-outlined" aria-hidden="true">{{ icon }}</span>
|
||||
</button>
|
||||
</template>
|
||||
@@ -0,0 +1,200 @@
|
||||
// src/ui/layerFinder.test.mjs — the Data Layers finder and section index work
|
||||
// on the rows LayerRows renders: search, the On/Off and category filter,
|
||||
// Escape, the clear request voice sends, and the group ticks.
|
||||
import '../testSupport/registerDom.mjs';
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { createApp, h, nextTick } from 'vue';
|
||||
import LayerFinder, {
|
||||
LAYER_FINDER_CLEAR_EVENT,
|
||||
} from './views/panels/LayerFinder.vue';
|
||||
import LayerSectionIndex from './views/panels/LayerSectionIndex.vue';
|
||||
|
||||
const ROWS = [
|
||||
{ group: 'movement', heading: 'Movement' },
|
||||
{ id: 'flights', name: 'Live Flights', english: 'Live Flights', on: true },
|
||||
{ id: 'ships', name: 'Ships', english: 'Ships', on: false },
|
||||
{ group: 'weather', heading: 'Weather' },
|
||||
{ id: 'radar', name: 'Radar météo', english: 'Weather Radar', on: false },
|
||||
];
|
||||
|
||||
const flush = async () => {
|
||||
await nextTick();
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
await nextTick();
|
||||
};
|
||||
|
||||
function fixture(t) {
|
||||
document.body.replaceChildren();
|
||||
// Frames run at once, so the observers' batching does not hold a test up.
|
||||
globalThis.requestAnimationFrame = (fn) => setTimeout(fn, 0);
|
||||
globalThis.cancelAnimationFrame = (id) => clearTimeout(id);
|
||||
const panel = document.body.appendChild(document.createElement('section'));
|
||||
panel.id = 'data-panel';
|
||||
const header = panel.appendChild(document.createElement('div'));
|
||||
const bar = panel.appendChild(document.createElement('div'));
|
||||
const list = panel.appendChild(document.createElement('div'));
|
||||
list.id = 'data-toggles';
|
||||
for (const row of ROWS) {
|
||||
if (row.heading) {
|
||||
const heading = list.appendChild(document.createElement('h3'));
|
||||
heading.className = 'data-layer-group-heading';
|
||||
heading.dataset.group = row.group;
|
||||
heading.textContent = row.heading;
|
||||
continue;
|
||||
}
|
||||
const el = list.appendChild(document.createElement('div'));
|
||||
el.className = 'data-toggle-row';
|
||||
el.dataset.layerId = row.id;
|
||||
el.dataset.layerName = row.english;
|
||||
el.innerHTML = `<span class="data-name">${row.name}</span><button class="data-toggle-btn${row.on ? ' active' : ''}"></button>`;
|
||||
}
|
||||
const index = panel.appendChild(document.createElement('div'));
|
||||
const apps = [
|
||||
createApp(() => h(LayerFinder, { part: 'buttons' })),
|
||||
createApp(() => h(LayerFinder, { part: 'bar' })),
|
||||
createApp(LayerSectionIndex),
|
||||
];
|
||||
apps[0].mount(header);
|
||||
apps[1].mount(bar);
|
||||
apps[2].mount(index);
|
||||
t.after(async () => {
|
||||
document.dispatchEvent(new CustomEvent(LAYER_FINDER_CLEAR_EVENT));
|
||||
for (const app of apps) app.unmount();
|
||||
});
|
||||
const shown = () =>
|
||||
[...list.querySelectorAll('.data-toggle-row:not(.is-filtered)')].map(
|
||||
(row) => row.dataset.layerId,
|
||||
);
|
||||
const search = async (text) => {
|
||||
if (!document.getElementById('layer-finder-input')) {
|
||||
document.getElementById('layer-finder-search-btn').click();
|
||||
await flush();
|
||||
}
|
||||
const input = document.getElementById('layer-finder-input');
|
||||
input.value = text;
|
||||
input.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
await flush();
|
||||
};
|
||||
const openFilter = async () => {
|
||||
document.querySelector('[aria-controls="layer-finder-menu"]').click();
|
||||
await flush();
|
||||
return document.getElementById('layer-finder-menu');
|
||||
};
|
||||
return { list, panel, shown, search, openFilter };
|
||||
}
|
||||
|
||||
test('search finds a layer by the name on screen or its English name', async (t) => {
|
||||
const { shown, search, list } = fixture(t);
|
||||
await search('météo');
|
||||
assert.deepEqual(shown(), ['radar']);
|
||||
await search('weather radar');
|
||||
assert.deepEqual(shown(), ['radar']);
|
||||
// The Movement heading has no rows left, so it is hidden too.
|
||||
assert.equal(
|
||||
list
|
||||
.querySelector('[data-group="movement"]')
|
||||
.classList.contains('is-filtered'),
|
||||
true,
|
||||
);
|
||||
await search('nothing like it');
|
||||
assert.deepEqual(shown(), []);
|
||||
assert.match(
|
||||
document.querySelector('.layer-finder__empty')?.textContent || '',
|
||||
/No layers match/,
|
||||
);
|
||||
});
|
||||
|
||||
test('On and Off follow whether the layer is enabled', async (t) => {
|
||||
const { shown, openFilter } = fixture(t);
|
||||
const menu = await openFilter();
|
||||
const on = [...menu.querySelectorAll('button')].find((b) =>
|
||||
b.textContent.trim().endsWith('On'),
|
||||
);
|
||||
on.click();
|
||||
await flush();
|
||||
assert.deepEqual(shown(), ['flights']);
|
||||
assert.equal(on.getAttribute('aria-pressed'), 'true');
|
||||
});
|
||||
|
||||
test('a chosen category survives its heading being translated', async (t) => {
|
||||
const { shown, openFilter, list } = fixture(t);
|
||||
const menu = await openFilter();
|
||||
[...menu.querySelectorAll('button')]
|
||||
.find((b) => b.textContent.trim().endsWith('Weather'))
|
||||
.click();
|
||||
await flush();
|
||||
assert.deepEqual(shown(), ['radar']);
|
||||
list.querySelector('[data-group="weather"]').textContent = 'Météo';
|
||||
await flush();
|
||||
assert.deepEqual(shown(), ['radar']);
|
||||
assert.match(
|
||||
document.querySelector('.layer-finder__chip').textContent,
|
||||
/Météo/,
|
||||
);
|
||||
});
|
||||
|
||||
test('Escape in the search field closes it without reaching the panel', async (t) => {
|
||||
const { search, panel } = fixture(t);
|
||||
let reached = false;
|
||||
panel.addEventListener('keydown', () => (reached = true));
|
||||
await search('ships');
|
||||
document
|
||||
.getElementById('layer-finder-input')
|
||||
.dispatchEvent(
|
||||
new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }),
|
||||
);
|
||||
await flush();
|
||||
assert.equal(reached, false);
|
||||
assert.equal(document.getElementById('layer-finder-input') === null, true);
|
||||
assert.equal(document.activeElement?.id, 'layer-finder-search-btn');
|
||||
});
|
||||
|
||||
test('the filter menu takes focus, moves with the arrows and closes on Escape', async (t) => {
|
||||
const { openFilter } = fixture(t);
|
||||
const menu = await openFilter();
|
||||
const buttons = [...menu.querySelectorAll('button')];
|
||||
assert.equal(document.activeElement, buttons[0]);
|
||||
menu.dispatchEvent(
|
||||
new KeyboardEvent('keydown', { key: 'ArrowDown', bubbles: true }),
|
||||
);
|
||||
assert.equal(document.activeElement, buttons[1]);
|
||||
menu.dispatchEvent(
|
||||
new KeyboardEvent('keydown', { key: 'End', bubbles: true }),
|
||||
);
|
||||
assert.equal(document.activeElement, buttons.at(-1));
|
||||
menu.dispatchEvent(
|
||||
new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }),
|
||||
);
|
||||
await flush();
|
||||
assert.equal(document.getElementById('layer-finder-menu') === null, true);
|
||||
assert.equal(
|
||||
document.activeElement,
|
||||
document.querySelector('[aria-controls="layer-finder-menu"]'),
|
||||
);
|
||||
});
|
||||
|
||||
test('a clear request shows every row again', async (t) => {
|
||||
const { shown, search } = fixture(t);
|
||||
await search('ships');
|
||||
assert.deepEqual(shown(), ['ships']);
|
||||
document.dispatchEvent(new CustomEvent(LAYER_FINDER_CLEAR_EVENT));
|
||||
await flush();
|
||||
assert.deepEqual(shown(), ['flights', 'ships', 'radar']);
|
||||
});
|
||||
|
||||
test('the section index has a tick per group and drops filtered groups', async (t) => {
|
||||
const { search } = fixture(t);
|
||||
await flush();
|
||||
assert.equal(
|
||||
document.querySelectorAll('.layer-section-index__tick').length,
|
||||
2,
|
||||
);
|
||||
await search('ships');
|
||||
await flush();
|
||||
// One group left: no index.
|
||||
assert.equal(
|
||||
document.querySelectorAll('.layer-section-index__tick').length,
|
||||
0,
|
||||
);
|
||||
});
|
||||
@@ -22,9 +22,11 @@ defineProps({
|
||||
|
||||
<template>
|
||||
<template v-for="item in items" :key="item.key"
|
||||
><h3 v-if="item.heading" class="data-layer-group-heading">{{
|
||||
item.heading
|
||||
}}</h3
|
||||
><h3
|
||||
v-if="item.heading"
|
||||
class="data-layer-group-heading"
|
||||
:data-group="item.key"
|
||||
>{{ item.heading }}</h3
|
||||
><div
|
||||
v-else
|
||||
class="data-toggle-row"
|
||||
|
||||
+11
-1
@@ -60,6 +60,7 @@ export function layoutLeftPanelRail({
|
||||
stack.style.removeProperty('--left-stack-safe-bottom');
|
||||
stack.style.removeProperty('--left-stack-centered-height');
|
||||
stack.style.removeProperty('--panel-rail-offset');
|
||||
stack.style.removeProperty('--panel-rail-lift');
|
||||
stack.classList.remove('layout-exclusive');
|
||||
stack.dataset.layoutMode = 'mobile';
|
||||
settleSideAccordion({ panels, enabled: false, onCollapse });
|
||||
@@ -282,10 +283,19 @@ export function layoutLeftPanelRail({
|
||||
getComputedStyle(stack)
|
||||
.getPropertyValue?.('--panel-stack-top-pinned')
|
||||
?.trim() === '1';
|
||||
const railOffset = `${(topPinned ? 0 : safeTop - layoutTop).toFixed(1)}px`;
|
||||
// The stack itself rises by the lift below, by a different amount for a
|
||||
// tall panel than at rest; the rail takes up the difference.
|
||||
const lift = (top) => Math.min(0, obstacleSafeTop - top);
|
||||
const railOffset = `${(topPinned ? 0 : safeTop + lift(safeTop) - layoutTop - lift(layoutTop)).toFixed(1)}px`;
|
||||
if (stack.style.getPropertyValue('--panel-rail-offset') !== railOffset) {
|
||||
stack.style.setProperty('--panel-rail-offset', railOffset);
|
||||
}
|
||||
// How far the column can rise before it meets the HUD readout, so the rail
|
||||
// and any open panel sit just under it, whether or not a panel is open.
|
||||
const railLift = `${(topPinned ? 0 : lift(layoutTop)).toFixed(1)}px`;
|
||||
if (stack.style.getPropertyValue('--panel-rail-lift') !== railLift) {
|
||||
stack.style.setProperty('--panel-rail-lift', railLift);
|
||||
}
|
||||
stack.style.removeProperty('--left-stack-centered-height');
|
||||
for (const panel of panels)
|
||||
panel.style.removeProperty('--left-panel-allocated-height');
|
||||
|
||||
@@ -340,12 +340,12 @@ test('the provider settings corner shows the picker only while the shell publish
|
||||
app.mount(host);
|
||||
t.after(() => app.unmount());
|
||||
const store = useLocaleStore(pinia);
|
||||
assert.equal(document.getElementById('locale-picker'), null);
|
||||
assert.equal(document.getElementById('locale-picker') === null, true);
|
||||
store.publishPicker({ current: 'de', onSelect() {} });
|
||||
await nextTick();
|
||||
const code = document.querySelector('#corner-actions .locale-picker-code');
|
||||
assert.equal(code?.textContent, 'DE');
|
||||
store.publishPicker(null);
|
||||
await nextTick();
|
||||
assert.equal(document.getElementById('locale-picker'), null);
|
||||
assert.equal(document.getElementById('locale-picker') === null, true);
|
||||
});
|
||||
@@ -368,7 +368,8 @@ export function initMobileShell({
|
||||
: sheet === 'search'
|
||||
? [dock]
|
||||
: sheet === 'more'
|
||||
? [element('right-context-rail'), dock]
|
||||
? // Visual lives in the left stack; the dock holds the presets.
|
||||
[element('left-panel-stack'), dock]
|
||||
: [element('right-context-rail')];
|
||||
return roots.find((root) => root?.contains(target));
|
||||
};
|
||||
|
||||
@@ -623,7 +623,7 @@ test('the phone shell keeps the required attribution visible', () => {
|
||||
);
|
||||
const openDock = rule('body.mobile-shell[data-mobile-sheet] #command-dock');
|
||||
const railSheet = rule(
|
||||
"body.mobile-shell[data-mobile-sheet='more'] #right-context-rail",
|
||||
"body.mobile-shell[data-mobile-sheet='more'] #left-panel-stack",
|
||||
);
|
||||
assert.ok(z(sheetCredit) > z(openDock));
|
||||
assert.ok(z(sheetCredit) > z(railSheet));
|
||||
|
||||
+11
-11
@@ -156,7 +156,7 @@ test('the panel shows the last 24 h as event cards and opens once', () => {
|
||||
assert.equal(img.getAttribute('referrerpolicy'), 'no-referrer');
|
||||
assert.equal(first.querySelector('.news-card__credit').textContent, 'A');
|
||||
// A lone report has no picture.
|
||||
assert.equal(second.querySelector('.news-card__thumb'), null);
|
||||
assert.equal(second.querySelector('.news-card__thumb') === null, true);
|
||||
// A later update does not reopen a panel the reader collapsed.
|
||||
panel.classList.add('collapsed');
|
||||
news.update(view());
|
||||
@@ -192,8 +192,8 @@ test('a card click flies there; open, it links the source and closes', () => {
|
||||
test('filters, the Local section and empty or failed reads', () => {
|
||||
const { news, panel, calls } = fixture();
|
||||
news.update(view());
|
||||
assert.equal(panel.querySelector('[aria-label="Local"]'), null);
|
||||
assert.equal(panel.querySelector('.news-toggle'), null);
|
||||
assert.equal(panel.querySelector('[aria-label="Local"]') === null, true);
|
||||
assert.equal(panel.querySelector('.news-toggle') === null, true);
|
||||
const severity = panel.querySelector('select[aria-label="Severity"]');
|
||||
assert.equal(severity.value, '2');
|
||||
severity.value = '3';
|
||||
@@ -214,7 +214,7 @@ test('filters, the Local section and empty or failed reads', () => {
|
||||
panel.textContent,
|
||||
/No news matches these filters in the last 24 h/,
|
||||
);
|
||||
assert.equal(panel.querySelector('.news-readout__footer button'), null);
|
||||
assert.equal(panel.querySelector('.news-readout__footer button') === null, true);
|
||||
|
||||
// Local: no hotspot chips or severity floor, and its own empty states.
|
||||
const localView = (inView) =>
|
||||
@@ -225,9 +225,9 @@ test('filters, the Local section and empty or failed reads', () => {
|
||||
news.update(localView({ active: false }));
|
||||
const section = panel.querySelector('[aria-label="Local"]');
|
||||
assert.match(section.textContent, /Zoom in to see local news/);
|
||||
assert.equal(panel.querySelector('[data-chip-id="ua-ru-war"]'), null);
|
||||
assert.equal(panel.querySelector('select[aria-label="Severity"]'), null);
|
||||
assert.equal(panel.querySelector('[aria-label="Latest news"]'), null);
|
||||
assert.equal(panel.querySelector('[data-chip-id="ua-ru-war"]') === null, true);
|
||||
assert.equal(panel.querySelector('select[aria-label="Severity"]') === null, true);
|
||||
assert.equal(panel.querySelector('[aria-label="Latest news"]') === null, true);
|
||||
assert.equal(document.getElementById('news-panel-count').textContent, '0');
|
||||
news.update(
|
||||
localView({ active: true, items: [feedCardView(report('near'), NOW)] }),
|
||||
@@ -320,7 +320,7 @@ test('a card credits the service its report came through', () => {
|
||||
credited.querySelector('.news-card__via').textContent,
|
||||
'via GDELT Project',
|
||||
);
|
||||
assert.equal(own.querySelector('.news-card__via'), null);
|
||||
assert.equal(own.querySelector('.news-card__via') === null, true);
|
||||
news.destroy();
|
||||
});
|
||||
|
||||
@@ -370,7 +370,7 @@ test('scrolling to the end asks once per page, again after a filter change or a
|
||||
test('the window choice offers shorter windows; the longest is the server window', () => {
|
||||
const { news, panel, calls } = fixture();
|
||||
news.update(view({ windowHours: 12, windowChoices: [12, 6, 3, 1] }));
|
||||
assert.equal(panel.querySelector('.news-readout__window'), null);
|
||||
assert.equal(panel.querySelector('.news-readout__window') === null, true);
|
||||
const choice = panel.querySelector('select[aria-label="Time window"]');
|
||||
assert.deepEqual(
|
||||
[...choice.options].map((option) => option.textContent),
|
||||
@@ -410,7 +410,7 @@ test('a clip waits behind its picture and plays, on request, in the open card',
|
||||
news.update(view({ items: [feedCardView(clipped, NOW)] }));
|
||||
const card = panel.querySelector('.news-card');
|
||||
assert.equal(card.querySelector('.news-card__play').textContent, '▶');
|
||||
assert.equal(card.querySelector('video'), null);
|
||||
assert.equal(card.querySelector('video') === null, true);
|
||||
news.update(
|
||||
view({
|
||||
items: [feedCardView(clipped, NOW)],
|
||||
@@ -436,6 +436,6 @@ test('a clip waits behind its picture and plays, on request, in the open card',
|
||||
selected: feedCardView(clipped, NOW),
|
||||
}),
|
||||
);
|
||||
assert.equal(panel.querySelector('.news-card.is-open video'), null);
|
||||
assert.equal(panel.querySelector('.news-card.is-open video') === null, true);
|
||||
news.destroy();
|
||||
});
|
||||
@@ -141,6 +141,7 @@ test("UiPanel draws Core's panel markup and asks for the other state", async (t)
|
||||
'demo-badge',
|
||||
'panel-divider',
|
||||
'demo-action',
|
||||
'panel-edge-btn',
|
||||
'panel-collapse-btn',
|
||||
],
|
||||
);
|
||||
@@ -165,8 +166,8 @@ test('UiPanel without collapsible has no button, and glow is optional', (t) => {
|
||||
});
|
||||
const panel = document.getElementById('plain-panel');
|
||||
assert.equal(panel.tagName, 'SECTION');
|
||||
assert.equal(panel.querySelector('.panel-glow'), null);
|
||||
assert.equal(panel.querySelector('.panel-collapse-btn'), null);
|
||||
assert.equal(panel.querySelector('.panel-glow') === null, true);
|
||||
assert.equal(panel.querySelector('.panel-collapse-btn') === null, true);
|
||||
});
|
||||
|
||||
test('RailPanel follows the store, forwards clicks, and never restores a class its owner removed', async (t) => {
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import { ref } from 'vue';
|
||||
|
||||
// Panels can slide over their rail to the screen edge, one setting per side:
|
||||
// the left column moves onto the left rail, the right column onto the right
|
||||
// rail. Each panel header has the switch (UiPanelEdge); the choice is kept
|
||||
// for the next visit and shows as a body class the stylesheet reads.
|
||||
const KEY = 'gev.panelEdge';
|
||||
function read() {
|
||||
try {
|
||||
const saved = JSON.parse(globalThis.localStorage?.getItem(KEY) || '{}');
|
||||
return { left: saved.left === true, right: saved.right === true };
|
||||
} catch {
|
||||
return { left: false, right: false };
|
||||
}
|
||||
}
|
||||
|
||||
export const panelEdge = ref(read());
|
||||
|
||||
function apply() {
|
||||
const body = globalThis.document?.body;
|
||||
if (!body) return;
|
||||
body.classList.toggle('panels-edge-left', panelEdge.value.left);
|
||||
body.classList.toggle('panels-edge-right', panelEdge.value.right);
|
||||
}
|
||||
apply();
|
||||
|
||||
/** Which side a panel element sits on, from the column it is in. */
|
||||
export function panelSide(element) {
|
||||
return element?.closest?.('#right-context-rail, #cockpit-utility-controls')
|
||||
? 'right'
|
||||
: 'left';
|
||||
}
|
||||
|
||||
export function togglePanelEdge(side) {
|
||||
panelEdge.value = { ...panelEdge.value, [side]: !panelEdge.value[side] };
|
||||
try {
|
||||
globalThis.localStorage?.setItem(KEY, JSON.stringify(panelEdge.value));
|
||||
} catch {
|
||||
// Without storage the choice lasts for this visit.
|
||||
}
|
||||
apply();
|
||||
}
|
||||
@@ -189,7 +189,11 @@ export class PanelLayoutController {
|
||||
const stack = this._rightPanelStack;
|
||||
if (!stack || !this._ppToggles) return;
|
||||
|
||||
stack.prepend(this._ppToggles);
|
||||
// Visual (presets and display settings) is the last panel of the left
|
||||
// column, after the other tools, and opens from the left rail like them.
|
||||
if (typeof this._leftPanelStack?.append === 'function')
|
||||
this._leftPanelStack.append(this._ppToggles);
|
||||
else stack.prepend(this._ppToggles);
|
||||
const globalContextPanel = document.getElementById('global-context-panel');
|
||||
for (const panel of [
|
||||
this._cctvPanel,
|
||||
@@ -201,6 +205,9 @@ export class PanelLayoutController {
|
||||
if (!panel) continue;
|
||||
stack.insertBefore(panel, globalContextPanel);
|
||||
}
|
||||
// Context leads the right column: it is the panel for whatever is picked,
|
||||
// and the camera panels follow it.
|
||||
if (globalContextPanel) stack.prepend(globalContextPanel);
|
||||
if (typeof ResizeObserver !== 'undefined') {
|
||||
this._rightStackResizeObserver = new ResizeObserver(() => {
|
||||
this._scheduleRightPanelLayout();
|
||||
|
||||
@@ -6,9 +6,20 @@
|
||||
* @returns {number} Natural height in CSS pixels.
|
||||
*/
|
||||
export function measurePanelNaturalHeight(panel, getComputedStyle) {
|
||||
const inner = [...panel.children].find(
|
||||
const content = [...panel.children].filter(
|
||||
(child) => !child.classList.contains('panel-glow'),
|
||||
);
|
||||
// A panel built as a header row and a body (Visual) scrolls as a whole, so
|
||||
// its full scroll height is its natural height.
|
||||
if (content.length > 1) {
|
||||
const panelStyle = getComputedStyle(panel);
|
||||
return Math.ceil(
|
||||
panel.scrollHeight +
|
||||
(parseFloat(panelStyle.borderTopWidth) || 0) +
|
||||
(parseFloat(panelStyle.borderBottomWidth) || 0),
|
||||
);
|
||||
}
|
||||
const inner = content[0];
|
||||
if (!inner)
|
||||
return Math.ceil(
|
||||
panel.scrollHeight || panel.getBoundingClientRect().height,
|
||||
|
||||
@@ -9,7 +9,7 @@ export const PANEL_RAIL_FALLBACK_ICON = 'more_horiz';
|
||||
/**
|
||||
* How each side panel appears on its rail. Labels are the panels' own titles.
|
||||
* `shownBy` names a class the panel needs to be shown at all (`f` toggles
|
||||
* Data Layers' `active`).
|
||||
* Data Layers' `active`). `context` is the label's translation context.
|
||||
*/
|
||||
export const PANEL_RAIL_ITEMS = Object.freeze({
|
||||
'data-panel': {
|
||||
@@ -19,7 +19,9 @@ export const PANEL_RAIL_ITEMS = Object.freeze({
|
||||
},
|
||||
'utilities-panel': { icon: 'handyman', label: msg('UTILITIES') },
|
||||
'scene-panel': { icon: 'movie', label: msg('AUTHORING') },
|
||||
'pp-toggles': { icon: 'tune', label: msg('DISPLAY') },
|
||||
// `context` keeps the panel's name apart from the satellite class of the
|
||||
// same English word.
|
||||
'pp-toggles': { icon: 'palette', label: msg('VISUAL'), context: 'panel' },
|
||||
'cctv-panel': { icon: 'videocam', label: msg('CCTV') },
|
||||
'weather-panel': { icon: 'partly_cloudy_day', label: msg('WEATHER') },
|
||||
'news-panel': { icon: 'public', label: msg('NEWS') },
|
||||
|
||||
@@ -359,14 +359,23 @@ test('right rail aligns to the left rail buttons while the left stack is offset'
|
||||
assert.equal(f.stack.dataset.safeTop, '286.7');
|
||||
});
|
||||
|
||||
test('left rail buttons hold still while a tall panel moves the stack', () => {
|
||||
test('left rail buttons hold still whether the open panel is short or tall', () => {
|
||||
// Where the rail sits: the stack's top, the stack's rise, and the rail's
|
||||
// own offset inside the stack.
|
||||
const railTop = (stack) =>
|
||||
(parseFloat(stack.style.getPropertyValue('--left-stack-safe-top')) * 900) /
|
||||
100 +
|
||||
parseFloat(stack.style.getPropertyValue('--panel-rail-lift')) +
|
||||
parseFloat(stack.style.getPropertyValue('--panel-rail-offset'));
|
||||
const short = fixture('left');
|
||||
short.expand(short.first, 250);
|
||||
short.run();
|
||||
const f = fixture('left');
|
||||
f.expand(f.first, 900);
|
||||
f.run();
|
||||
assert.equal(f.stack.dataset.layoutMode, 'focus');
|
||||
assert.ok(
|
||||
parseFloat(f.stack.style.getPropertyValue('--panel-rail-offset')) > 0,
|
||||
);
|
||||
assert.notEqual(short.stack.dataset.layoutMode, 'focus');
|
||||
assert.ok(Math.abs(railTop(f.stack) - railTop(short.stack)) < 0.2);
|
||||
|
||||
// A theme that pins the stack's top (Cyber) leaves nothing to offset.
|
||||
f.stack.computed.getPropertyValue = (name) =>
|
||||
@@ -447,13 +456,17 @@ test('natural height includes visible content, margins and wrapper chrome, exclu
|
||||
// Outside measurement, CCTV is 391 px in focus and 629 px in normal mode;
|
||||
// Removing only the allocation leaves focus CSS active: its next reading is
|
||||
// 422 px, so the old decision exits focus and then re-enters on the 629 px read.
|
||||
function thrashingRightRail({ focused = false, weatherOpen = false } = {}) {
|
||||
function thrashingRightRail({
|
||||
focused = false,
|
||||
weatherOpen = false,
|
||||
tallId = 'cctv-panel',
|
||||
} = {}) {
|
||||
const f = fixture('right');
|
||||
f.options.windowRef.innerHeight = 920;
|
||||
f.options.leftStack.rect.top = 439.6;
|
||||
f.stack.computed.rowGap = '8px';
|
||||
const display = element('pp-toggles', { collapsed: true });
|
||||
const cctv = element('cctv-panel', { height: 629 });
|
||||
const cctv = element(tallId, { height: 629 });
|
||||
const weather = element('weather-panel', {
|
||||
height: 444,
|
||||
collapsed: !weatherOpen,
|
||||
@@ -524,8 +537,10 @@ for (const focused of [false, true]) {
|
||||
});
|
||||
}
|
||||
|
||||
// The hysteresis applies to panels that size to their content; CCTV and
|
||||
// Context take the column's full height whenever they are open.
|
||||
test('right rail keeps focus through 30 px content growth inside the hysteresis band', () => {
|
||||
const f = thrashingRightRail();
|
||||
const f = thrashingRightRail({ tallId: 'news-panel' });
|
||||
f.run();
|
||||
// Header + gap contribute 52 px: need moves 420 -> 450 -> 420.
|
||||
for (const height of [368, 398, 368, 398, 368]) {
|
||||
@@ -542,7 +557,7 @@ test('right rail keeps focus through 30 px content growth inside the hysteresis
|
||||
});
|
||||
|
||||
test('right rail enters focus only above available height and leaves below the full deadband', () => {
|
||||
const f = thrashingRightRail();
|
||||
const f = thrashingRightRail({ tallId: 'news-panel' });
|
||||
f.options.windowRef.innerHeight = 1000;
|
||||
f.options.leftStack.rect.top = 500;
|
||||
f.cctv.intrinsicHeight = 408; // Need equals available (460 px).
|
||||
@@ -559,6 +574,16 @@ test('right rail enters focus only above available height and leaves below the f
|
||||
assert.equal(f.stack.classList.contains('layout-focus'), false);
|
||||
});
|
||||
|
||||
test('an open CCTV panel takes the full column however short its content', () => {
|
||||
const f = thrashingRightRail();
|
||||
f.cctv.intrinsicHeight = 200;
|
||||
f.run();
|
||||
assert.equal(f.stack.classList.contains('layout-focus'), true);
|
||||
f.cctv.classList.add('collapsed');
|
||||
f.run();
|
||||
assert.equal(f.stack.classList.contains('layout-focus'), false);
|
||||
});
|
||||
|
||||
test('right rail settles a second tall panel through the accordion in one pass', () => {
|
||||
const f = thrashingRightRail({ weatherOpen: true });
|
||||
const modes = [];
|
||||
|
||||
@@ -135,8 +135,8 @@ test('the chip counts what is missing and the rows render from the status', asyn
|
||||
);
|
||||
assert.equal(field.type, 'password');
|
||||
assert.equal(field.placeholder, 'paste GOOGLE_MAPS_API_KEY');
|
||||
assert.equal(google.querySelector('.key-setup-remove'), null);
|
||||
assert.equal(google.querySelector('.key-setup-cloud-auth'), null);
|
||||
assert.equal(google.querySelector('.key-setup-remove') === null, true);
|
||||
assert.equal(google.querySelector('.key-setup-cloud-auth') === null, true);
|
||||
|
||||
const openai = $('[data-key-id="openai"]');
|
||||
assert.equal(openai.dataset.managed, 'file');
|
||||
@@ -159,7 +159,7 @@ test('the chip counts what is missing and the rows render from the status', asyn
|
||||
firms.querySelector('.key-setup-external').textContent,
|
||||
'configured externally',
|
||||
);
|
||||
assert.equal(firms.querySelector('.key-setup-fields'), null);
|
||||
assert.equal(firms.querySelector('.key-setup-fields') === null, true);
|
||||
});
|
||||
|
||||
test('the chip opens the dialog onto its first field; closing fades it and restores the status line', async (t) => {
|
||||
@@ -337,12 +337,12 @@ test('Cyber moves the chip into the top toolbar and other themes return it to th
|
||||
await wait();
|
||||
await nextTick();
|
||||
assert.equal(toolbar.lastElementChild?.id, 'key-setup-chip');
|
||||
assert.equal(corner.querySelector('#key-setup-chip'), null);
|
||||
assert.equal(corner.querySelector('#key-setup-chip') === null, true);
|
||||
document.documentElement.dataset.uiTheme = 'tactical';
|
||||
await wait();
|
||||
await nextTick();
|
||||
assert.equal(corner.firstElementChild?.id, 'key-setup-chip');
|
||||
assert.equal(toolbar.querySelector('#key-setup-chip'), null);
|
||||
assert.equal(toolbar.querySelector('#key-setup-chip') === null, true);
|
||||
delete document.documentElement.dataset.uiTheme;
|
||||
});
|
||||
|
||||
|
||||
@@ -188,5 +188,5 @@ test('the refresh timer reloads with a cache-buster, skips hidden tabs, and stop
|
||||
ui.overlay.dispose();
|
||||
assert.equal(ui.intervals.size, 0);
|
||||
assert.equal(ui.renderListeners.size, 0);
|
||||
assert.equal(ui.window.document.querySelector('.qci-panel'), null);
|
||||
assert.equal(ui.window.document.querySelector('.qci-panel') === null, true);
|
||||
});
|
||||
+22
-4
@@ -27,10 +27,18 @@ export function bindRadioControls() {
|
||||
this.store?.publishUtility({ ...this._cockpitDisclosure });
|
||||
if (displayOpen) this.actions.revealStyleParameters();
|
||||
if (!expanded && returnFocus) {
|
||||
(kind === 'display'
|
||||
? this._cockpitDisplayToggleBtn
|
||||
: this._cockpitRadioToggleBtn
|
||||
)?.focus({ preventScroll: true });
|
||||
// The desktop cockpit hides the launchers' toggles behind its rail, so
|
||||
// focus goes to whichever of the two is shown.
|
||||
const toggle =
|
||||
kind === 'display'
|
||||
? this._cockpitDisplayToggleBtn
|
||||
: this._cockpitRadioToggleBtn;
|
||||
const railItem = toggle?.ownerDocument?.querySelector?.(
|
||||
`[data-cockpit-rail-item="${kind}"]`,
|
||||
);
|
||||
(toggle?.getClientRects?.().length ? toggle : railItem || toggle)?.focus({
|
||||
preventScroll: true,
|
||||
});
|
||||
}
|
||||
if (
|
||||
!displayOpen &&
|
||||
@@ -444,6 +452,16 @@ export function bindRadioControls() {
|
||||
),
|
||||
toggleCockpitRadio: () =>
|
||||
setCockpitDisclosure('radio', !this._cockpitDisclosureOpen('radio')),
|
||||
/**
|
||||
* Open or close the cockpit's Display or Radio panel; opening one closes
|
||||
* the other.
|
||||
* @param {'display'|'radio'} kind
|
||||
* @param {{ returnFocus?: boolean }} [options]
|
||||
*/
|
||||
toggleCockpitUtility: (kind, { returnFocus = false } = {}) => {
|
||||
const open = !this._cockpitDisclosureOpen(kind);
|
||||
setCockpitDisclosure(kind, open, { returnFocus: !open && returnFocus });
|
||||
},
|
||||
/**
|
||||
* @param {string} filter
|
||||
* @returns {string} The station tag the filter shows afterwards.
|
||||
|
||||
@@ -1,178 +0,0 @@
|
||||
<script setup>
|
||||
import { computed, onBeforeUnmount, shallowRef, watch } from 'vue';
|
||||
import { formatUtcDayMonth, t } from '../../i18n/index.js';
|
||||
import { utcClock } from './utcClock.js';
|
||||
import UiSlider from '../kit/UiSlider.js';
|
||||
|
||||
// Stable native transport with local preview and a coalesced 150 ms drag
|
||||
// commit. While the handle is dragged the slider keeps the ticks it was
|
||||
// dragged over; the owner's updates apply once the drag ends.
|
||||
const props = defineProps({
|
||||
state: { type: Object, required: true },
|
||||
sliderClassName: { type: String, default: '' },
|
||||
heading: { type: Boolean, default: true },
|
||||
onCommit: { type: Function, default: () => {} },
|
||||
onPreview: { type: Function, default: () => {} },
|
||||
onStep: { type: Function, default: () => {} },
|
||||
onLatest: { type: Function, default: () => {} },
|
||||
onPlay: { type: Function, default: () => {} },
|
||||
});
|
||||
|
||||
const utc = (tick) =>
|
||||
Number.isFinite(Date.parse(tick))
|
||||
? `${formatUtcDayMonth(tick)} ${utcClock(tick)}`
|
||||
: '';
|
||||
|
||||
// What the slider shows: the owner's ticks, index and readout, frozen while
|
||||
// dragging.
|
||||
const shown = shallowRef({ ticks: [], index: 0, readout: '' });
|
||||
let dragging = false;
|
||||
let timer = null;
|
||||
let pending = null;
|
||||
let live = true;
|
||||
|
||||
const cancel = () => {
|
||||
if (timer !== null) clearTimeout(timer);
|
||||
timer = null;
|
||||
};
|
||||
const sync = () => {
|
||||
if (dragging) return;
|
||||
const ticks = [...props.state.ticks];
|
||||
shown.value = {
|
||||
ticks,
|
||||
index: Math.max(0, Math.min(props.state.index, ticks.length - 1)),
|
||||
readout: props.state.readout || '',
|
||||
};
|
||||
};
|
||||
watch(
|
||||
() => props.state,
|
||||
(state) => {
|
||||
if (state.disabled) {
|
||||
cancel();
|
||||
pending = null;
|
||||
dragging = false;
|
||||
}
|
||||
sync();
|
||||
},
|
||||
{ immediate: true, flush: 'sync' },
|
||||
);
|
||||
onBeforeUnmount(() => {
|
||||
live = false;
|
||||
cancel();
|
||||
});
|
||||
|
||||
const disabled = computed(() => Boolean(props.state.disabled));
|
||||
const latestActive = computed(() => props.state.mode === 'latest');
|
||||
const playing = computed(() => Boolean(props.state.playing));
|
||||
|
||||
function commit() {
|
||||
cancel();
|
||||
const value = pending;
|
||||
pending = null;
|
||||
if (live && value && !props.state.disabled)
|
||||
props.onCommit(value.tick, value.index);
|
||||
}
|
||||
function preview(event) {
|
||||
if (props.state.disabled) return;
|
||||
dragging = true;
|
||||
const index = Number(event.target.value);
|
||||
const tick = shown.value.ticks[index];
|
||||
if (!tick) return;
|
||||
pending = { tick, index };
|
||||
// Shown before the owner hears of it: an update from inside onPreview
|
||||
// must not move the handle back.
|
||||
shown.value = { ...shown.value, index };
|
||||
const readout = props.onPreview(tick, index);
|
||||
// The owner may have ended the drag (disabled) from inside onPreview.
|
||||
if (!dragging) return;
|
||||
if (typeof readout === 'string') shown.value = { ...shown.value, readout };
|
||||
if (timer === null) timer = setTimeout(commit, 150);
|
||||
}
|
||||
// The handle shows the shown index again. A drag that ends where it began
|
||||
// (an input and a cancel, or a refused commit, before the next render)
|
||||
// leaves the slider's model unchanged, so it would not render.
|
||||
const place = (input) => {
|
||||
const index = String(shown.value.index);
|
||||
if (input && input.value !== index) input.value = index;
|
||||
};
|
||||
function change(event) {
|
||||
if (props.state.disabled) return;
|
||||
const index = Number(event.target.value);
|
||||
pending = { tick: shown.value.ticks[index], index };
|
||||
dragging = false;
|
||||
commit();
|
||||
sync();
|
||||
place(event.target);
|
||||
}
|
||||
function reset(event) {
|
||||
cancel();
|
||||
pending = null;
|
||||
dragging = false;
|
||||
sync();
|
||||
place(event?.target);
|
||||
}
|
||||
function blur(event) {
|
||||
if (dragging) change(event);
|
||||
}
|
||||
const act = (fn) => {
|
||||
reset();
|
||||
if (live && !props.state.disabled) fn();
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="rail-timeline"
|
||||
><div v-if="heading" class="panel-title">{{ t('Observed history') }}</div
|
||||
><div class="rail-timeline-track"
|
||||
><button
|
||||
type="button"
|
||||
class="data-toggle-chip"
|
||||
:title="t('Earlier observation')"
|
||||
:disabled="disabled || state.index <= 0"
|
||||
@click="act(() => onStep(-1))"
|
||||
>‹</button
|
||||
><UiSlider
|
||||
:class="sliderClassName || undefined"
|
||||
min="0"
|
||||
:max="String(Math.max(0, shown.ticks.length - 1))"
|
||||
step="1"
|
||||
:model-value="String(shown.index)"
|
||||
:disabled="disabled"
|
||||
:aria-label="t('Observed history')"
|
||||
:aria-valuetext="utc(shown.ticks[shown.index])"
|
||||
@input="preview"
|
||||
@change="change"
|
||||
@pointercancel="reset"
|
||||
@blur="blur"
|
||||
/><button
|
||||
type="button"
|
||||
class="data-toggle-chip"
|
||||
:title="t('Later observation')"
|
||||
:disabled="disabled || state.index >= state.ticks.length - 1"
|
||||
@click="act(() => onStep(1))"
|
||||
>›</button
|
||||
><div class="rail-timeline-endpoints"
|
||||
><span>{{ utcClock(shown.ticks[0]) }}</span
|
||||
><span>{{ utcClock(shown.ticks.at(-1)) }}</span></div
|
||||
></div
|
||||
><div class="rail-timeline-controls"
|
||||
><button
|
||||
type="button"
|
||||
:class="`data-toggle-chip${latestActive ? ' active' : ''}`"
|
||||
:title="t('Newest frame per product')"
|
||||
:disabled="disabled"
|
||||
:aria-pressed="String(latestActive)"
|
||||
@click="act(onLatest)"
|
||||
>{{ t('Latest') }}</button
|
||||
><button
|
||||
type="button"
|
||||
:class="`data-toggle-chip${playing ? ' active' : ''}`"
|
||||
:title="t('Replay observed history')"
|
||||
:disabled="disabled"
|
||||
:aria-pressed="String(playing)"
|
||||
@click="act(onPlay)"
|
||||
>{{ playing ? t('Pause') : t('Play') }}</button
|
||||
><span class="rail-timeline-readout">{{ shown.readout }}</span></div
|
||||
></section
|
||||
>
|
||||
</template>
|
||||
@@ -0,0 +1,393 @@
|
||||
// Edge scrolling for the side rails. While the pointer is in a screen edge's
|
||||
// strip (from the edge to just past its rail), that rail's border lights up,
|
||||
// and the scroll wheel steps to the next or previous panel on that side
|
||||
// instead of zooming the globe, wrapping round at either end. The open item's
|
||||
// highlight slides between items however the panel changes, and a panel
|
||||
// opened by the wheel slides in from the direction of travel.
|
||||
|
||||
/** How far past the rail the strip reaches, in pixels. */
|
||||
const STRIP_MARGIN = 16;
|
||||
/** Wheel travel (pixels) that counts as one step. */
|
||||
const STEP_DELTA = 40;
|
||||
/**
|
||||
* A pause this long (ms) with no wheel events ends a scroll gesture. One
|
||||
* gesture moves one step, however long it runs, trackpad coasting included.
|
||||
*/
|
||||
const GESTURE_GAP_MS = 180;
|
||||
/** After a step, how long (ms) before the same motion can count as a new flick. */
|
||||
const STEP_COOLDOWN_MS = 220;
|
||||
/**
|
||||
* The least time (ms) between two steps, whatever the wheel does. A motion
|
||||
* that would step sooner waits and steps once the gap has passed (one step
|
||||
* held at most), so panels never switch back to back and no step is lost.
|
||||
*/
|
||||
const STEP_GAP_MS = 500;
|
||||
/** A wheel event this large (pixels) is a mouse wheel notch, not a trackpad. */
|
||||
const NOTCH_DELTA = 100;
|
||||
/** The widest the strip gets, measured from the screen edge, whatever shape the rail takes. */
|
||||
const STRIP_MAX = 84;
|
||||
/**
|
||||
* After a step, how long (ms) the rest of that gesture is still swallowed once
|
||||
* the pointer has left the strip, so trackpad coasting does not go on to zoom
|
||||
* the globe. Past it, the wheel belongs to whatever is under the pointer.
|
||||
*/
|
||||
const COAST_MAX_MS = 800;
|
||||
/** Pixels per wheel line, for mice that report lines rather than pixels. */
|
||||
const LINE_PX = 16;
|
||||
/**
|
||||
* Things in the strip that keep their own pointer and wheel behaviour: any
|
||||
* control, and every panel in either side's stack (a panel scrolls itself).
|
||||
*/
|
||||
const OWN_CONTROLS =
|
||||
'a, button, input, select, textarea, dialog, [role="dialog"], .ui-panel, #left-panel-stack > :not(.gev-panel-rail), #right-context-rail > :not(.gev-panel-rail), #first-run-launcher, #cesium-credits, #world-timeline';
|
||||
|
||||
/**
|
||||
* @param {Document} [doc]
|
||||
* @returns {() => void} removes the listeners and observers
|
||||
*/
|
||||
export function installRailEdgeScroll(doc = globalThis.document) {
|
||||
const win = doc?.defaultView;
|
||||
if (!doc || !win) return () => {};
|
||||
const coarse = win.matchMedia?.('(pointer: coarse)');
|
||||
|
||||
let hot = null;
|
||||
let travel = 0;
|
||||
let lastWheel = 0;
|
||||
let lastSpeed = 0;
|
||||
let stepped = false;
|
||||
/** When the last step was taken, the fastest the gesture has been, and whether it has slowed since. */
|
||||
let steppedAt = 0;
|
||||
/** A step waiting for the gap to pass, if any. */
|
||||
let heldStep = 0;
|
||||
let peakSpeed = 0;
|
||||
let slowed = false;
|
||||
let frame = 0;
|
||||
/** Set once removed, so frames already queued do nothing. */
|
||||
let removed = false;
|
||||
|
||||
// Clean view and recording hide the rails with visibility and opacity,
|
||||
// which keep their boxes, so a box alone does not mean the rail shows.
|
||||
const showing = (node) =>
|
||||
node.getBoundingClientRect().width > 0 &&
|
||||
(typeof node.checkVisibility !== 'function' ||
|
||||
node.checkVisibility({
|
||||
visibilityProperty: true,
|
||||
opacityProperty: true,
|
||||
}));
|
||||
|
||||
// Which screen edge a rail is on comes from where it is, not its name: in a
|
||||
// right-to-left language the left stack sits on the right.
|
||||
const rails = () =>
|
||||
['left', 'right']
|
||||
.map((name) => doc.querySelector(`.ui-rail--${name}`))
|
||||
.filter((rail) => rail && showing(rail))
|
||||
.map((rail) => {
|
||||
const box = rail.getBoundingClientRect();
|
||||
const middle = doc.documentElement.clientWidth / 2;
|
||||
return {
|
||||
side: box.left + box.width / 2 < middle ? 'left' : 'right',
|
||||
rail,
|
||||
};
|
||||
});
|
||||
|
||||
const items = (rail) =>
|
||||
// Only items that show: a theme or mode may hide some, and the wheel must
|
||||
// not open those.
|
||||
[...rail.querySelectorAll('.ui-rail__item')].filter(
|
||||
(item) => !item.disabled && showing(item),
|
||||
);
|
||||
|
||||
// ── The sliding highlight ──
|
||||
// Each rail draws it as a ::before under its items, placed by custom
|
||||
// properties; the open item's own background steps aside while it shows.
|
||||
// Vue rewrites a rail's class list when it folds its labels, so whether the
|
||||
// highlight is showing is kept here, and the classes are put back each time.
|
||||
const gliding = new WeakSet();
|
||||
|
||||
function glide(rail) {
|
||||
if (removed) return;
|
||||
rail.classList.toggle('ui-rail--edge-hot', rail === hot);
|
||||
const on = rail.querySelector('.ui-rail__item[aria-pressed="true"]');
|
||||
if (!on?.offsetWidth) {
|
||||
gliding.delete(rail);
|
||||
rail.classList.remove('ui-rail--glide');
|
||||
return;
|
||||
}
|
||||
const railBox = rail.getBoundingClientRect();
|
||||
const box = on.getBoundingClientRect();
|
||||
const shown = gliding.has(rail);
|
||||
// A rail opening its first panel folds its labelled pills to icons, the
|
||||
// buttons shrinking over a few frames; the highlight waits until the open
|
||||
// button is an icon again (square) rather than fading in at a pill's
|
||||
// width and then shrinking.
|
||||
if (
|
||||
!shown &&
|
||||
(rail.classList.contains('ui-rail--expanded') ||
|
||||
box.width > box.height + 2)
|
||||
)
|
||||
return;
|
||||
// Appearing from nothing: jump into place, then fade in.
|
||||
rail.classList.toggle('ui-rail--glide-jump', !shown);
|
||||
rail.style.setProperty(
|
||||
'--rail-glide-x',
|
||||
`${box.left - railBox.left - rail.clientLeft}px`,
|
||||
);
|
||||
rail.style.setProperty(
|
||||
'--rail-glide-y',
|
||||
`${box.top - railBox.top - rail.clientTop}px`,
|
||||
);
|
||||
rail.style.setProperty('--rail-glide-w', `${box.width}px`);
|
||||
rail.style.setProperty('--rail-glide-h', `${box.height}px`);
|
||||
rail.classList.add('ui-rail--glide');
|
||||
gliding.add(rail);
|
||||
if (!shown)
|
||||
win.requestAnimationFrame(() =>
|
||||
rail.classList.remove('ui-rail--glide-jump'),
|
||||
);
|
||||
}
|
||||
|
||||
// Follow the rails for a few frames after any change, as their items
|
||||
// resize while labels fold away.
|
||||
function follow(frames = 24) {
|
||||
win.cancelAnimationFrame(frame);
|
||||
let left = frames;
|
||||
const tick = () => {
|
||||
if (removed) return;
|
||||
watchRails();
|
||||
doc.querySelectorAll('.ui-rail').forEach(glide);
|
||||
if ((left -= 1) > 0) frame = win.requestAnimationFrame(tick);
|
||||
};
|
||||
tick();
|
||||
}
|
||||
|
||||
const observer =
|
||||
typeof win.MutationObserver === 'function'
|
||||
? new win.MutationObserver((records) => {
|
||||
// A rail item opened or closed. Nothing here writes aria-pressed,
|
||||
// and the work waits for the next frame, so this never feeds itself.
|
||||
if (
|
||||
records.some((record) =>
|
||||
record.target.classList?.contains('ui-rail__item'),
|
||||
)
|
||||
)
|
||||
win.requestAnimationFrame(() => follow());
|
||||
})
|
||||
: null;
|
||||
observer?.observe(doc.body, {
|
||||
subtree: true,
|
||||
attributes: true,
|
||||
attributeFilter: ['aria-pressed'],
|
||||
});
|
||||
|
||||
// A rail also changes shape with nothing pressed or released: hidden and
|
||||
// shown again (Context docked and undocked), or turned from a column to a
|
||||
// row (panels moved to the screen edge). Its highlight is placed again
|
||||
// whenever its size changes, so it is never left where an icon was.
|
||||
const sized =
|
||||
typeof win.ResizeObserver === 'function'
|
||||
? new win.ResizeObserver(() => follow(2))
|
||||
: null;
|
||||
const watched = new WeakSet();
|
||||
const watchRails = () => {
|
||||
if (!sized) return;
|
||||
doc.querySelectorAll('.ui-rail').forEach((rail) => {
|
||||
if (watched.has(rail)) return;
|
||||
watched.add(rail);
|
||||
sized.observe(rail);
|
||||
});
|
||||
};
|
||||
watchRails();
|
||||
|
||||
// ── The edge strip ──
|
||||
/** The rail whose strip holds the point, unless a control there owns it. */
|
||||
function railAt(x, target) {
|
||||
if (doc.body.classList.contains('mobile-shell') || coarse?.matches)
|
||||
return null;
|
||||
for (const { side, rail } of rails()) {
|
||||
const box = rail.getBoundingClientRect();
|
||||
// From the screen edge to just past the rail, but never wider than a
|
||||
// rail's own column: a rail laid out as a row across the top of its
|
||||
// panels would otherwise claim most of the panel's width.
|
||||
const width = doc.documentElement.clientWidth;
|
||||
const inStrip =
|
||||
side === 'left'
|
||||
? x <= Math.min(box.right + STRIP_MARGIN, STRIP_MAX)
|
||||
: x >= Math.max(box.left - STRIP_MARGIN, width - STRIP_MAX);
|
||||
if (!inStrip) continue;
|
||||
if (rail.contains(target)) return rail;
|
||||
if (target?.closest?.(OWN_CONTROLS)) return null;
|
||||
return rail;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function setHot(rail) {
|
||||
if (rail === hot) return;
|
||||
// A held step belongs to the strip it was made in; leaving drops it, so
|
||||
// coming back later does not set it off with no wheel turned.
|
||||
if (heldStep) {
|
||||
win.clearTimeout(heldStep);
|
||||
heldStep = 0;
|
||||
}
|
||||
hot?.classList.remove('ui-rail--edge-hot');
|
||||
hot = rail;
|
||||
travel = 0;
|
||||
hot?.classList.add('ui-rail--edge-hot');
|
||||
follow(2);
|
||||
}
|
||||
|
||||
function onMove(event) {
|
||||
setHot(railAt(event.clientX, event.target));
|
||||
}
|
||||
|
||||
function onLeave(event) {
|
||||
if (!event.relatedTarget) setHot(null);
|
||||
}
|
||||
|
||||
function step(direction) {
|
||||
const list = items(hot);
|
||||
if (!list.length) return;
|
||||
const current = list.findIndex(
|
||||
(item) => item.getAttribute('aria-pressed') === 'true',
|
||||
);
|
||||
// Past either end, carry on from the other.
|
||||
const nextIndex =
|
||||
current < 0
|
||||
? direction > 0
|
||||
? 0
|
||||
: list.length - 1
|
||||
: (current + direction + list.length) % list.length;
|
||||
if (nextIndex === current) return;
|
||||
const target = list[nextIndex];
|
||||
target.click();
|
||||
const panel = doc.getElementById(target.dataset.railItem);
|
||||
if (panel) {
|
||||
panel.classList.remove('rail-switch-down', 'rail-switch-up');
|
||||
void panel.offsetWidth;
|
||||
panel.classList.add(
|
||||
direction > 0 ? 'rail-switch-down' : 'rail-switch-up',
|
||||
);
|
||||
// The classes come off when the slide ends, or after a moment where
|
||||
// there is no slide to end (reduced motion).
|
||||
const settle = () => {
|
||||
win.clearTimeout(timer);
|
||||
panel.removeEventListener('animationend', settle);
|
||||
panel.classList.remove('rail-switch-down', 'rail-switch-up');
|
||||
};
|
||||
const timer = win.setTimeout(settle, 600);
|
||||
panel.addEventListener('animationend', settle);
|
||||
}
|
||||
follow();
|
||||
}
|
||||
|
||||
function onWheel(event) {
|
||||
// Pinch zoom, and sideways or empty moves (trackpads send them mid-swipe),
|
||||
// are left alone: they neither step nor turn a gesture round.
|
||||
if (event.ctrlKey || !event.deltaY) return;
|
||||
const now = win.performance?.now?.() ?? Date.now();
|
||||
const inGesture = now - lastWheel <= GESTURE_GAP_MS;
|
||||
// Recheck: the pointer may not have moved since the panels changed.
|
||||
const stillHot =
|
||||
Boolean(hot) && railAt(event.clientX, event.target) === hot;
|
||||
if (!stillHot) {
|
||||
setHot(null);
|
||||
// The rest of a gesture that has already stepped is used up here, so
|
||||
// its coasting does not go on to zoom the globe or scroll what opened
|
||||
// under the pointer.
|
||||
if (stepped && inGesture && now - steppedAt <= COAST_MAX_MS) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
lastWheel = now;
|
||||
}
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
// Line- and page-based wheels report far smaller numbers than pixels.
|
||||
const deltaY =
|
||||
event.deltaMode === 1
|
||||
? event.deltaY * LINE_PX
|
||||
: event.deltaMode === 2
|
||||
? event.deltaY * win.innerHeight
|
||||
: event.deltaY;
|
||||
const speed = Math.abs(deltaY);
|
||||
// A new gesture: after a pause, after turning round, a mouse wheel notch,
|
||||
// or a fresh flick while the last one is still coasting. A flick is a
|
||||
// rise in speed after the gesture has clearly slowed, and not in the
|
||||
// moment after a step: a swipe is still speeding up when it first steps.
|
||||
const turned = travel && Math.sign(deltaY) !== Math.sign(travel);
|
||||
const cooled = now - steppedAt > STEP_COOLDOWN_MS;
|
||||
// Every event from a line- or page-based wheel is a notch.
|
||||
const notch =
|
||||
stepped && cooled && (speed >= NOTCH_DELTA || event.deltaMode > 0);
|
||||
const flick =
|
||||
stepped && cooled && slowed && speed > Math.max(8, lastSpeed * 1.8);
|
||||
if (!inGesture || turned || notch || flick) {
|
||||
// A held step belongs to the motion it came from; a reversal or a new
|
||||
// flick replaces it rather than queueing behind it.
|
||||
if (turned && heldStep) {
|
||||
win.clearTimeout(heldStep);
|
||||
heldStep = 0;
|
||||
}
|
||||
travel = 0;
|
||||
stepped = false;
|
||||
peakSpeed = 0;
|
||||
slowed = false;
|
||||
}
|
||||
lastWheel = now;
|
||||
lastSpeed = speed;
|
||||
peakSpeed = Math.max(peakSpeed, speed);
|
||||
if (stepped) {
|
||||
if (speed < peakSpeed * 0.5) slowed = true;
|
||||
return;
|
||||
}
|
||||
travel += deltaY;
|
||||
if (Math.abs(travel) < STEP_DELTA) return;
|
||||
stepped = true;
|
||||
const direction = Math.sign(travel);
|
||||
const wait = STEP_GAP_MS - (now - steppedAt);
|
||||
if (wait <= 0) {
|
||||
steppedAt = now;
|
||||
step(direction);
|
||||
return;
|
||||
}
|
||||
// Too soon after the last step: hold this one until the gap has passed.
|
||||
if (heldStep) return;
|
||||
const heldRail = hot;
|
||||
heldStep = win.setTimeout(() => {
|
||||
heldStep = 0;
|
||||
// The pointer may have left the strip, or moved to the other rail,
|
||||
// meanwhile; then nothing steps.
|
||||
if (!hot || hot !== heldRail) return;
|
||||
steppedAt = win.performance?.now?.() ?? Date.now();
|
||||
step(direction);
|
||||
}, wait);
|
||||
}
|
||||
|
||||
const onResize = () => follow(2);
|
||||
doc.addEventListener('pointermove', onMove, { passive: true });
|
||||
doc.addEventListener('pointerout', onLeave, { passive: true });
|
||||
win.addEventListener('wheel', onWheel, { capture: true, passive: false });
|
||||
win.addEventListener('resize', onResize, { passive: true });
|
||||
follow();
|
||||
|
||||
return () => {
|
||||
removed = true;
|
||||
win.clearTimeout(heldStep);
|
||||
setHot(null);
|
||||
observer?.disconnect();
|
||||
sized?.disconnect();
|
||||
win.cancelAnimationFrame(frame);
|
||||
doc.removeEventListener('pointermove', onMove);
|
||||
doc.removeEventListener('pointerout', onLeave);
|
||||
win.removeEventListener('wheel', onWheel, { capture: true });
|
||||
win.removeEventListener('resize', onResize);
|
||||
doc.querySelectorAll('.ui-rail').forEach((rail) => {
|
||||
rail.classList.remove(
|
||||
'ui-rail--glide',
|
||||
'ui-rail--glide-jump',
|
||||
'ui-rail--edge-hot',
|
||||
);
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { Window } from 'happy-dom';
|
||||
import { installRailEdgeScroll } from './railEdgeScroll.js';
|
||||
|
||||
// A page with a left and a right rail of three items each, laid out by hand:
|
||||
// happy-dom does no layout, so boxes and the clock are stubbed.
|
||||
function page({ rtl = false } = {}) {
|
||||
const window = new Window({ width: 1600, height: 900 });
|
||||
const doc = window.document;
|
||||
let now = 1000;
|
||||
const timers = new Map();
|
||||
let nextTimer = 1;
|
||||
window.performance.now = () => now;
|
||||
window.setTimeout = (fn, ms) => {
|
||||
const id = nextTimer++;
|
||||
timers.set(id, { fn, at: now + ms });
|
||||
return id;
|
||||
};
|
||||
window.clearTimeout = (id) => timers.delete(id);
|
||||
window.requestAnimationFrame = () => 0;
|
||||
window.cancelAnimationFrame = () => {};
|
||||
Object.defineProperty(doc.documentElement, 'clientWidth', { value: 1600 });
|
||||
const box = (el, left, top, width, height) => {
|
||||
el.getBoundingClientRect = () => ({
|
||||
left,
|
||||
top,
|
||||
width,
|
||||
height,
|
||||
right: left + width,
|
||||
bottom: top + height,
|
||||
});
|
||||
Object.defineProperty(el, 'offsetWidth', { get: () => width });
|
||||
};
|
||||
const clicks = [];
|
||||
const rail = (name, left) => {
|
||||
const el = doc.createElement('div');
|
||||
el.className = `ui-rail ui-rail--${name}`;
|
||||
box(el, left, 200, 40, 120);
|
||||
for (let i = 0; i < 3; i++) {
|
||||
const item = doc.createElement('button');
|
||||
item.className = 'ui-rail__item';
|
||||
item.dataset.railItem = `${name}-${i}`;
|
||||
item.setAttribute('aria-pressed', i === 0 ? 'true' : 'false');
|
||||
box(item, left + 4, 204 + i * 40, 32, 32);
|
||||
item.addEventListener('click', () => {
|
||||
clicks.push(item.dataset.railItem);
|
||||
for (const other of el.children)
|
||||
other.setAttribute('aria-pressed', String(other === item));
|
||||
});
|
||||
el.append(item);
|
||||
}
|
||||
doc.body.append(el);
|
||||
return el;
|
||||
};
|
||||
// In a right-to-left language the left stack's rail is on the right edge.
|
||||
const left = rail('left', rtl ? 1550 : 10);
|
||||
const right = rail('right', rtl ? 10 : 1550);
|
||||
const remove = installRailEdgeScroll(doc);
|
||||
const wheel = (x, deltaY, { deltaMode = 0, target = doc.body } = {}) => {
|
||||
// happy-dom leaves clientX off these events, so it is set by hand.
|
||||
const at = (event) => Object.defineProperty(event, 'clientX', { value: x });
|
||||
target.dispatchEvent(
|
||||
at(new window.PointerEvent('pointermove', { bubbles: true })),
|
||||
);
|
||||
const event = at(
|
||||
new window.WheelEvent('wheel', {
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
deltaY,
|
||||
deltaMode,
|
||||
}),
|
||||
);
|
||||
target.dispatchEvent(event);
|
||||
return event;
|
||||
};
|
||||
const advance = (ms) => {
|
||||
now += ms;
|
||||
for (const [id, timer] of [...timers]) {
|
||||
if (timer.at > now) continue;
|
||||
timers.delete(id);
|
||||
timer.fn();
|
||||
}
|
||||
};
|
||||
return { window, doc, left, right, clicks, wheel, advance, remove };
|
||||
}
|
||||
|
||||
test('a wheel in the left strip steps that rail and keeps the globe from zooming', () => {
|
||||
const p = page();
|
||||
const event = p.wheel(20, 120);
|
||||
assert.equal(event.defaultPrevented, true);
|
||||
assert.deepEqual(p.clicks, ['left-1']);
|
||||
p.remove();
|
||||
});
|
||||
|
||||
test('a line-based mouse wheel steps one panel per notch', () => {
|
||||
const p = page();
|
||||
p.wheel(20, 3, { deltaMode: 1 });
|
||||
p.advance(600);
|
||||
p.wheel(20, 3, { deltaMode: 1 });
|
||||
assert.deepEqual(p.clicks, ['left-1', 'left-2']);
|
||||
p.remove();
|
||||
});
|
||||
|
||||
test('a rail hidden by clean view or recording leaves the wheel to the globe', () => {
|
||||
const p = page();
|
||||
p.left.checkVisibility = () => false;
|
||||
const event = p.wheel(20, 120);
|
||||
assert.equal(event.defaultPrevented, false);
|
||||
assert.deepEqual(p.clicks, []);
|
||||
p.remove();
|
||||
});
|
||||
|
||||
test('right to left: the wheel at each screen edge steps the rail on that edge', () => {
|
||||
const p = page({ rtl: true });
|
||||
p.wheel(1580, 120);
|
||||
p.advance(600);
|
||||
p.wheel(20, 120);
|
||||
assert.deepEqual(p.clicks, ['left-1', 'right-1']);
|
||||
p.remove();
|
||||
});
|
||||
|
||||
test('after a step, the wheel goes back to the page once the coasting is over', () => {
|
||||
const p = page();
|
||||
p.wheel(20, 120);
|
||||
// The pointer moves off the strip while the gesture still coasts.
|
||||
let event;
|
||||
for (let i = 0; i < 20; i++) {
|
||||
p.advance(100);
|
||||
event = p.wheel(800, 30);
|
||||
}
|
||||
assert.equal(event.defaultPrevented, false);
|
||||
assert.deepEqual(p.clicks, ['left-1']);
|
||||
p.remove();
|
||||
});
|
||||
|
||||
test('a held step is dropped when the pointer leaves the strip, even if it comes back', () => {
|
||||
const p = page();
|
||||
p.wheel(20, 120);
|
||||
p.advance(250);
|
||||
p.wheel(20, -120); // turns round: a second step, held for the gap
|
||||
p.wheel(800, 0); // leaves the strip
|
||||
p.wheel(20, 0); // and returns before the gap ends
|
||||
p.advance(600);
|
||||
assert.deepEqual(p.clicks, ['left-1']);
|
||||
p.remove();
|
||||
});
|
||||
|
||||
test('removing it stops edge scrolling', () => {
|
||||
const p = page();
|
||||
p.remove();
|
||||
const event = p.wheel(20, 120);
|
||||
assert.equal(event.defaultPrevented, false);
|
||||
assert.deepEqual(p.clicks, []);
|
||||
});
|
||||
|
||||
test('a sideways move mid-swipe neither turns the gesture round nor steps again', () => {
|
||||
const p = page();
|
||||
p.wheel(20, 60);
|
||||
p.advance(50);
|
||||
const sideways = p.wheel(20, 0);
|
||||
p.advance(50);
|
||||
p.wheel(20, 40); // the same swipe coasting on
|
||||
assert.equal(sideways.defaultPrevented, false);
|
||||
assert.deepEqual(p.clicks, ['left-1']);
|
||||
p.remove();
|
||||
});
|
||||
|
||||
test('an open dialog near the edge keeps its own wheel', () => {
|
||||
const p = page();
|
||||
const dialog = p.doc.createElement('dialog');
|
||||
p.doc.body.append(dialog);
|
||||
const event = p.wheel(20, 120, { target: dialog });
|
||||
assert.equal(event.defaultPrevented, false);
|
||||
assert.deepEqual(p.clicks, []);
|
||||
p.remove();
|
||||
});
|
||||
@@ -1,56 +0,0 @@
|
||||
import { h, render } from 'vue';
|
||||
import RailTimeline from './rail/RailTimeline.vue';
|
||||
|
||||
export { utcClock } from './rail/utcClock.js';
|
||||
|
||||
/**
|
||||
* Stable native transport with local preview and a coalesced 150 ms drag
|
||||
* commit. Renders the RailTimeline component into `container` and patches it
|
||||
* synchronously on every update.
|
||||
*/
|
||||
export function createRailTimeline({
|
||||
container,
|
||||
document = container?.ownerDocument,
|
||||
sliderClassName = '',
|
||||
heading = true,
|
||||
onCommit = () => {},
|
||||
onPreview = () => {},
|
||||
onStep = () => {},
|
||||
onLatest = () => {},
|
||||
onPlay = () => {},
|
||||
} = {}) {
|
||||
if (!document?.createElement || !container) return null;
|
||||
let destroyed = false;
|
||||
const paint = (state) =>
|
||||
render(
|
||||
h(RailTimeline, {
|
||||
state,
|
||||
sliderClassName,
|
||||
heading,
|
||||
onCommit,
|
||||
onPreview,
|
||||
onStep,
|
||||
onLatest,
|
||||
onPlay,
|
||||
}),
|
||||
container,
|
||||
);
|
||||
paint({
|
||||
ticks: [],
|
||||
index: 0,
|
||||
mode: 'latest',
|
||||
playing: false,
|
||||
readout: '',
|
||||
disabled: true,
|
||||
});
|
||||
return {
|
||||
update(state) {
|
||||
if (!destroyed) paint(state);
|
||||
},
|
||||
destroy() {
|
||||
if (destroyed) return;
|
||||
destroyed = true;
|
||||
render(null, container);
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -1,178 +0,0 @@
|
||||
import '../testSupport/registerDom.mjs';
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { assertSameNode } from '../testSupport/domAssert.mjs';
|
||||
import { nextTick } from 'vue';
|
||||
import { createRailTimeline } from './railTimeline.js';
|
||||
import { railDocumentFixture as railFixture } from './railTestFixture.mjs';
|
||||
const ticks = [
|
||||
'2026-09-22T01:00:00Z',
|
||||
'2026-09-22T01:05:00Z',
|
||||
'2026-09-22T01:10:00Z',
|
||||
];
|
||||
const props = {
|
||||
ticks,
|
||||
index: 2,
|
||||
mode: 'latest',
|
||||
playing: false,
|
||||
readout: 'Latest',
|
||||
disabled: false,
|
||||
};
|
||||
test('preview is immediate, commits are coalesced and the drag DOM and tick mapping stay stable', async (t) => {
|
||||
t.mock.timers.enable({ apis: ['setTimeout'] });
|
||||
const f = railFixture();
|
||||
const previews = [];
|
||||
const commits = [];
|
||||
const view = createRailTimeline({
|
||||
...f,
|
||||
onPreview: (tick) => {
|
||||
previews.push(tick);
|
||||
return tick;
|
||||
},
|
||||
onCommit: (tick) => commits.push(tick),
|
||||
});
|
||||
view.update(props);
|
||||
const slider = f.find((n) => n.tagName === 'INPUT');
|
||||
const row = slider.parentElement;
|
||||
assert.equal(slider.getAttribute('aria-label'), 'Observed history');
|
||||
slider.value = '0';
|
||||
slider.dispatchEvent(new Event('input'));
|
||||
assert.deepEqual(commits, []);
|
||||
assert.deepEqual(previews, [ticks[0]]);
|
||||
await nextTick();
|
||||
assert.equal(slider.getAttribute('aria-valuetext'), '09-22 01:00 UTC');
|
||||
view.update({
|
||||
...props,
|
||||
ticks: ticks.slice(1),
|
||||
index: 1,
|
||||
readout: 'Refresh',
|
||||
});
|
||||
assertSameNode(slider.parentElement, row);
|
||||
assertSameNode(row.children[1], slider);
|
||||
assert.equal(slider.value, '0');
|
||||
assert.equal(slider.max, '2');
|
||||
assert.equal(
|
||||
f.find((n) => n.className === 'rail-timeline-readout').textContent,
|
||||
ticks[0],
|
||||
);
|
||||
t.mock.timers.tick(149);
|
||||
assert.equal(commits.length, 0);
|
||||
slider.value = '1';
|
||||
slider.dispatchEvent(new Event('input'));
|
||||
t.mock.timers.tick(1);
|
||||
assert.deepEqual(commits, [ticks[1]]);
|
||||
slider.value = '2';
|
||||
slider.dispatchEvent(new Event('input'));
|
||||
slider.dispatchEvent(new Event('change'));
|
||||
assert.deepEqual(commits, [ticks[1], ticks[2]]);
|
||||
t.mock.timers.tick(150);
|
||||
assert.equal(commits.length, 2);
|
||||
await nextTick();
|
||||
assert.equal(slider.max, '1', 'release applies the latest update');
|
||||
view.destroy();
|
||||
});
|
||||
test('identical updates write nothing; controls call actions and destruction cancels commits', (t) => {
|
||||
t.mock.timers.enable({ apis: ['setTimeout'] });
|
||||
const f = railFixture();
|
||||
const calls = [];
|
||||
const view = createRailTimeline({
|
||||
...f,
|
||||
onCommit: () => calls.push('commit'),
|
||||
onStep: (n) => calls.push(n),
|
||||
onLatest: () => calls.push('latest'),
|
||||
onPlay: () => calls.push('play'),
|
||||
});
|
||||
view.update({ ...props, index: 1 });
|
||||
f.writes();
|
||||
view.update({ ...props, index: 1 });
|
||||
assert.equal(f.writes(), 0);
|
||||
for (const label of ['‹', '›', 'Latest', 'Play'])
|
||||
f.find((n) => n.textContent === label).click();
|
||||
assert.deepEqual(calls, [-1, 1, 'latest', 'play']);
|
||||
view.update({ ...props, playing: true });
|
||||
assert.ok(f.find((n) => n.textContent === 'Pause'));
|
||||
const slider = f.find((n) => n.tagName === 'INPUT');
|
||||
slider.value = '0';
|
||||
slider.dispatchEvent(new Event('change'));
|
||||
assert.equal(calls.at(-1), 'commit');
|
||||
slider.dispatchEvent(new Event('input'));
|
||||
view.destroy();
|
||||
t.mock.timers.tick(150);
|
||||
assert.equal(calls.length, 5);
|
||||
assert.equal(f.container.children.length, 0);
|
||||
});
|
||||
|
||||
test('observed history label and endpoint times track the advertised tick range', () => {
|
||||
const f = railFixture();
|
||||
const view = createRailTimeline(f);
|
||||
view.update(props);
|
||||
assert.equal(
|
||||
f.find((n) => n.className === 'panel-title').textContent,
|
||||
'Observed history',
|
||||
);
|
||||
const endpoints = f.find((n) => n.className === 'rail-timeline-endpoints');
|
||||
assert.equal(endpoints.parentElement.className, 'rail-timeline-track');
|
||||
assert.deepEqual(
|
||||
[...endpoints.children].map((n) => n.textContent),
|
||||
['01:00 UTC', '01:10 UTC'],
|
||||
);
|
||||
view.update({ ...props, ticks: ticks.slice(1) });
|
||||
assert.equal(endpoints.children[0].textContent, '01:05 UTC');
|
||||
view.destroy();
|
||||
});
|
||||
|
||||
test('an update from inside the preview neither moves the handle back nor survives a disable', async () => {
|
||||
const f = railFixture();
|
||||
let view;
|
||||
let next = null;
|
||||
const commits = [];
|
||||
view = createRailTimeline({
|
||||
...f,
|
||||
onPreview: () => {
|
||||
if (next) view.update(next);
|
||||
return 'preview';
|
||||
},
|
||||
onCommit: (tick, index) => commits.push(index),
|
||||
});
|
||||
view.update(props);
|
||||
const slider = f.find((n) => n.tagName === 'INPUT');
|
||||
next = { ...props, readout: 'Refresh' };
|
||||
slider.value = '0';
|
||||
slider.dispatchEvent(new Event('input'));
|
||||
assert.equal(slider.value, '0');
|
||||
slider.dispatchEvent(new Event('change'));
|
||||
assert.deepEqual(commits, [0]);
|
||||
next = { ...props, disabled: true };
|
||||
slider.value = '1';
|
||||
slider.dispatchEvent(new Event('input'));
|
||||
await nextTick();
|
||||
assert.equal(slider.value, '2', 'the disabled owner keeps its position');
|
||||
assert.equal(slider.getAttribute('aria-valuetext'), '09-22 01:10 UTC');
|
||||
view.destroy();
|
||||
});
|
||||
test('a drag that ends where it began puts the handle back on the shown index', async (t) => {
|
||||
t.mock.timers.enable({ apis: ['setTimeout'] });
|
||||
const f = railFixture();
|
||||
const commits = [];
|
||||
const view = createRailTimeline({
|
||||
...f,
|
||||
onCommit: (tick) => commits.push(tick),
|
||||
});
|
||||
view.update(props);
|
||||
await nextTick();
|
||||
const slider = f.find((n) => n.tagName === 'INPUT');
|
||||
slider.value = '0';
|
||||
slider.dispatchEvent(new Event('input'));
|
||||
slider.dispatchEvent(new Event('pointercancel'));
|
||||
await nextTick();
|
||||
assert.equal(slider.value, '2', 'a cancelled drag');
|
||||
assert.deepEqual(commits, []);
|
||||
// A refused commit: the owner keeps its index.
|
||||
slider.value = '1';
|
||||
slider.dispatchEvent(new Event('input'));
|
||||
slider.dispatchEvent(new Event('change'));
|
||||
await nextTick();
|
||||
assert.deepEqual(commits, [ticks[1]]);
|
||||
assert.equal(slider.value, '2', 'a refused commit');
|
||||
view.destroy();
|
||||
});
|
||||
@@ -72,7 +72,7 @@ test('a lost context offers Reload, and a panel that cannot reload offers nothin
|
||||
document.getElementById('render-failure-message').textContent,
|
||||
/3D graphics/,
|
||||
);
|
||||
assert.equal(notice().querySelector('.render-failure-detail'), null);
|
||||
assert.equal(notice().querySelector('.render-failure-detail') === null, true);
|
||||
assert.deepEqual(buttons(), ['Reload', 'Reset view']);
|
||||
store.publishRenderFailure({
|
||||
reason: 'context-lost',
|
||||
@@ -82,7 +82,7 @@ test('a lost context offers Reload, and a panel that cannot reload offers nothin
|
||||
});
|
||||
await nextTick();
|
||||
assert.deepEqual(buttons(), []);
|
||||
assert.equal(notice().querySelector('.render-failure-hint'), null);
|
||||
assert.equal(notice().querySelector('.render-failure-hint') === null, true);
|
||||
});
|
||||
|
||||
const failure = () => ({
|
||||
|
||||
@@ -31,6 +31,20 @@ function settledLeftRailTop(leftStack, viewportHeight, getComputedStyle) {
|
||||
return Number.isFinite(targetPct) ? (targetPct * viewportHeight) / 100 : top;
|
||||
}
|
||||
|
||||
/**
|
||||
* An element's CSS `top` in pixels where it will settle: the end of a running
|
||||
* `top` transition, else its computed value. NaN when it cannot be read.
|
||||
*/
|
||||
function settledCssTop(element, getComputedStyle) {
|
||||
if (!element) return NaN;
|
||||
const transition = element
|
||||
.getAnimations?.()
|
||||
.find((animation) => animation.transitionProperty === 'top');
|
||||
const target = parseFloat(transition?.effect?.getKeyframes?.().at(-1)?.top);
|
||||
if (Number.isFinite(target)) return target;
|
||||
return parseFloat(getComputedStyle(element).top);
|
||||
}
|
||||
|
||||
/**
|
||||
* Measure and place the right panel rail for one synchronous layout pass.
|
||||
* The caller owns scheduling, obstacle selection, disclosure preferences and
|
||||
@@ -126,9 +140,20 @@ export function layoutRightPanelRail({
|
||||
viewportHeight,
|
||||
getComputedStyle,
|
||||
);
|
||||
// Align with the left rail's buttons, which hold still while its stack moves.
|
||||
const leftRailOffset =
|
||||
parseFloat(leftStack?.style.getPropertyValue('--panel-rail-offset')) || 0;
|
||||
// Align with the left rail's buttons, which hold still while its stack moves:
|
||||
// the rail's own settled `top` inside the stack, so every left layout is
|
||||
// followed (a layout may pin the rail to the stack's top whatever the
|
||||
// offset says). The stack's offset is the fallback when there is no rail.
|
||||
const leftRailInset = settledCssTop(
|
||||
leftStack?.querySelector?.('.gev-panel-rail') ?? null,
|
||||
getComputedStyle,
|
||||
);
|
||||
// A rail that sits lower in its stack has only made room above itself for
|
||||
// the open panel's own icon, which stays at the stack's top: the column's
|
||||
// top has not moved, so that inset is not followed.
|
||||
const leftRailOffset = Number.isFinite(leftRailInset)
|
||||
? Math.min(0, leftRailInset)
|
||||
: parseFloat(leftStack?.style.getPropertyValue('--panel-rail-offset')) || 0;
|
||||
const alignedTop = Number.isFinite(leftStackTop)
|
||||
? leftStackTop + leftRailOffset
|
||||
: viewportHeight * 0.26;
|
||||
@@ -206,6 +231,18 @@ export function layoutRightPanelRail({
|
||||
0,
|
||||
) +
|
||||
gap * Math.max(0, measuredPanels.length - 1);
|
||||
// An open Context panel takes the column's full height: up to just under
|
||||
// the HUD readouts at the top of the screen, down to the usual bottom.
|
||||
// CCTV does the same, so its feed and controls have the room.
|
||||
const FULL_HEIGHT = new Set(['global-context-panel', 'cctv-panel']);
|
||||
const contextOpen = panels.some(
|
||||
(panel) =>
|
||||
FULL_HEIGHT.has(panel.id) && !panel.classList.contains('collapsed'),
|
||||
);
|
||||
// Every panel starts level with the left rail, open or not, so the two
|
||||
// rails line up in every HUD layout (Minimal has no top-right readout to
|
||||
// push this column down) and switching between Context, CCTV and Street
|
||||
// Level does not move it. Only the two above also stretch to the bottom.
|
||||
const layout = resolveHudRailLayout({
|
||||
viewportHeight,
|
||||
panelHeight: naturalHeight,
|
||||
@@ -221,9 +258,11 @@ export function layoutRightPanelRail({
|
||||
const { safeTop, safeBottom, maxHeight: availableHeight } = layout;
|
||||
const stabilityBand = Math.max(48, viewportHeight * 0.06);
|
||||
const wasFocused = stack.classList.contains('layout-focus');
|
||||
const shouldFocus = wasFocused
|
||||
? naturalHeight >= availableHeight - stabilityBand
|
||||
: naturalHeight > availableHeight;
|
||||
const shouldFocus =
|
||||
contextOpen ||
|
||||
(wasFocused
|
||||
? naturalHeight >= availableHeight - stabilityBand
|
||||
: naturalHeight > availableHeight);
|
||||
const layoutTop = shouldFocus ? safeTop : layout.top;
|
||||
const collapsedHeight = visiblePanels.reduce(
|
||||
(total, panel) =>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import * as Cesium from 'cesium';
|
||||
import { trackedDisplayPositionForCamera } from '../data/trackedCamera.js';
|
||||
import { createFrameWait } from '../time/frameWait.js';
|
||||
import {
|
||||
SHARE_VIEW_ENTITY_KINDS,
|
||||
SHARE_VIEW_FOLLOW_RANGE_MAX_M,
|
||||
@@ -17,7 +18,8 @@ import {
|
||||
const KIND_BY_LAYER = new Map(
|
||||
SHARE_VIEW_ENTITY_KINDS.map((entry) => [entry.layerId, entry.kind]),
|
||||
);
|
||||
const MAX_FRAMES = 120;
|
||||
/** Drawn time (ms) to wait for the follow to frame the entity. */
|
||||
const MAX_FRAMING_WAIT_MS = 2_000;
|
||||
|
||||
/** `position`'s local east/north/up offset from `origin`, in metres. */
|
||||
function enuOffset(origin, position) {
|
||||
@@ -136,6 +138,7 @@ export function applyShareFollowOffset(viewer, entity, offset) {
|
||||
return () => {};
|
||||
const local = followOffsetToEnu(offset);
|
||||
let frames = 0;
|
||||
const framingWait = createFrameWait(MAX_FRAMING_WAIT_MS);
|
||||
let remove = null;
|
||||
const stop = () => {
|
||||
remove?.();
|
||||
@@ -160,7 +163,7 @@ export function applyShareFollowOffset(viewer, entity, offset) {
|
||||
)
|
||||
: null;
|
||||
if (!target) {
|
||||
if (frames >= MAX_FRAMES) stop();
|
||||
if (framingWait.tick()) stop();
|
||||
return;
|
||||
}
|
||||
// The offset is east/north/up at the entity; the follow's own frame may
|
||||
|
||||
@@ -891,6 +891,10 @@ export class ShellFacade {
|
||||
return this._contextControls?._preservePanelStateDuringLayerClear ?? false;
|
||||
}
|
||||
|
||||
_contextSuspendsLayer(layerId) {
|
||||
return this._contextControls?.suspendsLayer(layerId) ?? false;
|
||||
}
|
||||
|
||||
_runUserFacingContextAction(...args) {
|
||||
return this._contextControls?._runUserFacingContextAction(...args);
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ test('recording restores the original HUD after repeated entry and revokes retai
|
||||
}
|
||||
});
|
||||
|
||||
test('weather rail orders between CCTV and Context, observes and presents chrome', (t) => {
|
||||
test('Context leads the right rail, weather follows CCTV, observes and presents chrome', (t) => {
|
||||
const f = fixture();
|
||||
const observed = new Set();
|
||||
const previousResizeObserver = globalThis.ResizeObserver;
|
||||
@@ -319,7 +319,7 @@ test('weather rail orders between CCTV and Context, observes and presents chrome
|
||||
owner._initRightPanelAdaptiveLayout();
|
||||
assert.deepEqual(
|
||||
stack.children.map((panel) => panel.id),
|
||||
['pp-toggles', 'cctv-panel', 'weather-panel', 'global-context-panel'],
|
||||
['global-context-panel', 'pp-toggles', 'cctv-panel', 'weather-panel'],
|
||||
);
|
||||
assert.ok(observed.has(weather));
|
||||
// Moving a panel into the rail leaves its state as it was.
|
||||
|
||||
+39
-13
@@ -8,6 +8,11 @@ const LIVE_TICK_MS = 1000;
|
||||
const LIVE_EDGE = 0.005;
|
||||
/** The least that counts as at now, past the readout's own second. */
|
||||
const LIVE_EDGE_MS = 5000;
|
||||
/**
|
||||
* The most that counts as at now, however long the track: on a track that
|
||||
* runs over years, a share of it would take whole days back to live.
|
||||
*/
|
||||
const LIVE_EDGE_MAX_MS = 2 * 60_000;
|
||||
/** The speeds play offers, in world ms per real ms. */
|
||||
export const WORLD_TIME_SPEEDS = Object.freeze({
|
||||
real: 1,
|
||||
@@ -22,7 +27,8 @@ export const WORLD_TIME_SPEEDS = Object.freeze({
|
||||
* buffering, timeMs, supported, span}`, where `supported` says a layer that moves with the clock
|
||||
* has time to show and `span` is the stretch the timeline runs over: the
|
||||
* time those layers cover, reaching to now and to the world time, with their
|
||||
* marks. It follows the page's world clock, which tells it of every move, and
|
||||
* marks (`marks`, their times; `markDetails`, each `{time, label?, id?,
|
||||
* kind?}`, as the world clock's coverage gives them). It follows the page's world clock, which tells it of every move, and
|
||||
* of the time a few times a second while it plays on its own. While a
|
||||
* timeline shows, it reads the clock each second itself, so live and the
|
||||
* track's end keep up with now.
|
||||
@@ -37,6 +43,7 @@ export const useWorldTimeStore = defineStore('gev-world-time', () => {
|
||||
start: Math.min(coverage.start, now),
|
||||
end: Math.max(coverage.end, now),
|
||||
marks: coverage.marks,
|
||||
markDetails: coverage.markDetails,
|
||||
};
|
||||
};
|
||||
const spanOf = (state) => {
|
||||
@@ -47,11 +54,12 @@ export const useWorldTimeStore = defineStore('gev-world-time', () => {
|
||||
start: Math.min(covered.start, state.timeMs),
|
||||
end: Math.max(covered.end, state.timeMs),
|
||||
marks: covered.marks,
|
||||
markDetails: covered.markDetails,
|
||||
});
|
||||
};
|
||||
const nearNow = (ms, length) =>
|
||||
Math.abs(ms - worldClock.wallNow()) <=
|
||||
Math.max(LIVE_EDGE_MS, length * LIVE_EDGE);
|
||||
Math.max(LIVE_EDGE_MS, Math.min(LIVE_EDGE_MAX_MS, length * LIVE_EDGE));
|
||||
// Whether the track ends at now (and moves on with it), not past it.
|
||||
const endsAtNow = (covered) =>
|
||||
covered.end - worldClock.wallNow() <= LIVE_EDGE_MS;
|
||||
@@ -88,8 +96,20 @@ export const useWorldTimeStore = defineStore('gev-world-time', () => {
|
||||
span: spanOf(state),
|
||||
});
|
||||
const time = shallowRef(read());
|
||||
const speed = shallowRef('real');
|
||||
const rate = () => WORLD_TIME_SPEEDS[speed.value];
|
||||
// The speed shown follows the world clock's rate, whoever set it: a rate
|
||||
// not among those offered shows as the nearest that is (by ratio), while
|
||||
// play still runs at the clock's own rate.
|
||||
const speedFor = (clockRate) => {
|
||||
let best = 'real';
|
||||
for (const key of Object.keys(WORLD_TIME_SPEEDS))
|
||||
if (
|
||||
Math.abs(Math.log(WORLD_TIME_SPEEDS[key] / clockRate)) <
|
||||
Math.abs(Math.log(WORLD_TIME_SPEEDS[best] / clockRate))
|
||||
)
|
||||
best = key;
|
||||
return best;
|
||||
};
|
||||
const speed = shallowRef(speedFor(worldClock.getRate()));
|
||||
let ticker = null;
|
||||
const syncTicker = () => {
|
||||
// Playing, the clock tells of the time itself.
|
||||
@@ -104,6 +124,8 @@ export const useWorldTimeStore = defineStore('gev-world-time', () => {
|
||||
}
|
||||
};
|
||||
const unsubscribe = worldClock.subscribe((state) => {
|
||||
if (speed.value !== speedFor(state.rate))
|
||||
speed.value = speedFor(state.rate);
|
||||
if (stopAtEnd(state)) return;
|
||||
time.value = read(state);
|
||||
syncTicker();
|
||||
@@ -118,10 +140,11 @@ export const useWorldTimeStore = defineStore('gev-world-time', () => {
|
||||
return {
|
||||
time,
|
||||
/**
|
||||
* Play runs the track at the speed chosen, from the start when it is at
|
||||
* Play runs the track at the world clock's rate (the speed chosen, which
|
||||
* sets it), from the start when it is at
|
||||
* its end (at live, say), as a video plays again from the top. It runs
|
||||
* the clock itself, past weather's own replay: weather follows the time
|
||||
* frame by frame like every other layer the track covers.
|
||||
* the clock itself: weather follows the time frame by frame like every
|
||||
* other layer the track covers.
|
||||
*/
|
||||
togglePlay() {
|
||||
const { playing, live, timeMs, span } = time.value;
|
||||
@@ -129,22 +152,25 @@ export const useWorldTimeStore = defineStore('gev-world-time', () => {
|
||||
const covered = reach();
|
||||
if (span && covered && (live || timeMs >= covered.end))
|
||||
worldClock.seek(span.start);
|
||||
worldClock.play({ rate: rate(), continuous: true });
|
||||
// At the clock's rate: the speed chosen, or a host's own.
|
||||
worldClock.play({ continuous: true });
|
||||
},
|
||||
speed,
|
||||
/**
|
||||
* Choose how fast play runs; playing, it changes at once. Weather's own
|
||||
* replay steps at its own pace, so a speed chosen while it plays takes
|
||||
* Choose how fast play runs: the world clock keeps it, so any play runs
|
||||
* at it (a layer's own Play too), and playing, it changes at once. A
|
||||
* driver steps at its own pace, so a speed chosen while one plays takes
|
||||
* playback over from where it is.
|
||||
*/
|
||||
setSpeed(next) {
|
||||
if (!Object.hasOwn(WORLD_TIME_SPEEDS, next)) return;
|
||||
speed.value = next;
|
||||
// The clock's rate first: the speed shown follows it from here on.
|
||||
worldClock.setRate(WORLD_TIME_SPEEDS[next]);
|
||||
const { playing, stepping } = worldClock.getState();
|
||||
if (!playing) return;
|
||||
if (!stepping) return worldClock.setRate(rate());
|
||||
if (!playing || !stepping) return;
|
||||
worldClock.pause();
|
||||
worldClock.play({ rate: rate(), continuous: true });
|
||||
worldClock.play({ continuous: true });
|
||||
},
|
||||
goLive: () => worldClock.goLive(),
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,693 @@
|
||||
/* ── Cockpit side windows in the app's panel look ───────────────────────
|
||||
Contact (left), the briefing carousel (right) and the Display / Radio
|
||||
controls get the same smoked glass, 16px corners and card rows as the
|
||||
main panels. They keep cockpit.css's slight 3D slant toward the centre,
|
||||
and stand the same height. The text glow goes; the state colours on the
|
||||
top edge (uncertain, lost) stay. */
|
||||
|
||||
.cockpit-context-window,
|
||||
.cockpit-signal-window {
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
border-top-color: rgba(255, 255, 255, 0.14);
|
||||
border-radius: 16px;
|
||||
background: rgba(12, 12, 20, 0.72);
|
||||
box-shadow:
|
||||
0 8px 32px rgba(0, 0, 0, 0.42),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.04);
|
||||
backdrop-filter: blur(24px) saturate(1.4);
|
||||
-webkit-backdrop-filter: blur(24px) saturate(1.4);
|
||||
text-shadow: none;
|
||||
scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
|
||||
}
|
||||
|
||||
/* Open, both windows share one compact size; their lists scroll. */
|
||||
.cockpit-context-window:not([data-collapsed='true']),
|
||||
.cockpit-signal-window:not([data-collapsed='true']) {
|
||||
width: min(280px, 23vw);
|
||||
height: min(27vh, 260px);
|
||||
}
|
||||
|
||||
/* Contact's header: the buttons share the kicker's row, so the subject runs
|
||||
the full width on at most two lines instead of wrapping beside them. */
|
||||
.cockpit-context-window:not([data-collapsed='true'])
|
||||
.cockpit-context-header
|
||||
> div {
|
||||
display: contents;
|
||||
}
|
||||
|
||||
.cockpit-context-window:not([data-collapsed='true']) .cockpit-context-kicker {
|
||||
grid-column: 1;
|
||||
grid-row: 1;
|
||||
}
|
||||
|
||||
.cockpit-context-window:not([data-collapsed='true']) .cockpit-context-actions {
|
||||
grid-column: 2;
|
||||
grid-row: 1;
|
||||
}
|
||||
|
||||
.cockpit-context-window:not([data-collapsed='true']) #cockpit-context-subject {
|
||||
display: -webkit-box;
|
||||
grid-column: 1 / -1;
|
||||
grid-row: 2;
|
||||
overflow: hidden;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
line-clamp: 2;
|
||||
}
|
||||
|
||||
/* Their foot sits just above the bottom HUD readouts (MGRS / GSD), which
|
||||
stand at clamp(84px, 11vh, 118px) and are about 38px tall. */
|
||||
.cockpit-context-window,
|
||||
.cockpit-signal-window {
|
||||
bottom: calc(clamp(84px, 11vh, 118px) + 54px);
|
||||
}
|
||||
|
||||
.cockpit-context-window[data-state='uncertain'] {
|
||||
border-top-color: rgba(116, 219, 255, 0.72);
|
||||
}
|
||||
|
||||
.cockpit-context-window[data-state='lost'] {
|
||||
border-top-color: rgba(213, 168, 99, 0.72);
|
||||
}
|
||||
|
||||
.cockpit-context-window[data-collapsed='true'],
|
||||
.cockpit-signal-window[data-collapsed='true'] {
|
||||
border-radius: 12px;
|
||||
background: rgba(12, 12, 20, 0.66);
|
||||
}
|
||||
|
||||
/* Headers: a quiet hairline like the panel headers. */
|
||||
.cockpit-card-header {
|
||||
border-bottom-color: rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
.cockpit-card-actions button {
|
||||
border-color: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 6px;
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
color: rgba(224, 236, 242, 0.82);
|
||||
}
|
||||
|
||||
.cockpit-card-actions button:hover,
|
||||
.cockpit-card-actions button:focus-visible {
|
||||
border-color: rgba(0, 212, 255, 0.45);
|
||||
background: rgba(0, 212, 255, 0.1);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* Rows and tiles inside: the card style used in Context and Visual. */
|
||||
.cockpit-context-cohorts > div,
|
||||
.cockpit-signal-list li,
|
||||
.cockpit-news-list li,
|
||||
.cockpit-local-grid > div {
|
||||
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||
border-radius: 10px;
|
||||
background: rgba(255, 255, 255, 0.035);
|
||||
}
|
||||
|
||||
/* The weather tiles stand apart as cards, with no lit grid behind them,
|
||||
and are short enough to fit the shorter window. */
|
||||
.cockpit-local-grid {
|
||||
gap: 5px;
|
||||
background: none;
|
||||
}
|
||||
|
||||
.cockpit-local-grid > div {
|
||||
min-height: 0;
|
||||
gap: 2px;
|
||||
padding: 6px 9px;
|
||||
}
|
||||
|
||||
.cockpit-route-card {
|
||||
border-bottom-color: rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
/* Display / Radio: the closed launchers and the open panels match too. */
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-control.is-expanded {
|
||||
border-color: rgba(255, 255, 255, 0.08);
|
||||
border-radius: 16px;
|
||||
background: rgba(12, 12, 20, 0.72);
|
||||
box-shadow:
|
||||
0 8px 32px rgba(0, 0, 0, 0.42),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.04);
|
||||
}
|
||||
|
||||
/* ── Cockpit uses the main page's rails ───────────────────────────────
|
||||
The left rail shows Data Layers only (Authoring has no place in first
|
||||
person, Utilities has nothing to do there, and the cockpit's own Display
|
||||
panel stands in for Visual), one panel opens beside it, and the collapsed
|
||||
header strips the cockpit used instead are hidden. */
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
#left-panel-stack
|
||||
> .gev-panel-rail--left {
|
||||
display: block;
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
#left-panel-stack
|
||||
> .gev-panel-rail--left
|
||||
:is(
|
||||
[data-rail-item='scene-panel'],
|
||||
[data-rail-item='utilities-panel'],
|
||||
[data-rail-item='pp-toggles']
|
||||
),
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
#left-panel-stack
|
||||
> .gev-panel-rail--left
|
||||
.ui-tooltip:has(
|
||||
> :is(
|
||||
[data-rail-item='scene-panel'],
|
||||
[data-rail-item='utilities-panel'],
|
||||
[data-rail-item='pp-toggles']
|
||||
)
|
||||
) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* With some icons hidden, the runs between them break up: with a panel
|
||||
open, each icon left is its own island. */
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
#left-panel-stack
|
||||
> .gev-panel-rail--left
|
||||
.ui-rail--collapsible:not(.ui-rail--expanded):has(.ui-rail__item--on)
|
||||
> .ui-tooltip::before {
|
||||
inset: -4px -5px;
|
||||
border-width: 1px;
|
||||
border-radius: 14px;
|
||||
}
|
||||
|
||||
/* Authoring, Utilities or Visual may still be open underneath; its hidden icon must
|
||||
not split the rail into islands. */
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
#left-panel-stack
|
||||
> .gev-panel-rail--left
|
||||
.ui-rail:has(
|
||||
:is(
|
||||
[data-rail-item='scene-panel'],
|
||||
[data-rail-item='utilities-panel'],
|
||||
[data-rail-item='pp-toggles']
|
||||
)[aria-pressed='true']
|
||||
)
|
||||
> .ui-tooltip::before,
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
#left-panel-stack
|
||||
> .gev-panel-rail--left
|
||||
.ui-rail:has(
|
||||
:is(
|
||||
[data-rail-item='scene-panel'],
|
||||
[data-rail-item='utilities-panel'],
|
||||
[data-rail-item='pp-toggles']
|
||||
)[aria-pressed='true']
|
||||
)::before {
|
||||
/* Nor may the sliding highlight stay where the hidden icon was. */
|
||||
display: none;
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
#left-panel-stack
|
||||
> .gev-panel-rail--left
|
||||
.ui-rail:has(
|
||||
:is(
|
||||
[data-rail-item='scene-panel'],
|
||||
[data-rail-item='utilities-panel'],
|
||||
[data-rail-item='pp-toggles']
|
||||
)[aria-pressed='true']
|
||||
) {
|
||||
background: rgba(16, 20, 28, 0.82) !important;
|
||||
border-color: rgba(255, 255, 255, 0.14) !important;
|
||||
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45) !important;
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
#left-panel-stack
|
||||
> [data-panel-id].collapsed,
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
#left-panel-stack
|
||||
> :is(
|
||||
[data-panel-id='scene-panel'],
|
||||
[data-panel-id='utilities-panel'],
|
||||
[data-panel-id='pp-toggles']
|
||||
) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Both rails start at one height, just under the top HUD text, so their top
|
||||
edges line up; the cockpit layout pass places Display and Radio at the
|
||||
same height (COCKPIT_UTILITY_MIN_TOP_PX / _RATIO in cockpitPresentation.js). */
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
#left-panel-stack {
|
||||
top: max(206px, 22vh) !important;
|
||||
}
|
||||
|
||||
/* Bottom HUD readouts: scale from their foot, and drop the three-line right
|
||||
block (GSD / ALT / AIS) by one scaled line so both start level, as on the
|
||||
main page. */
|
||||
body.cockpit-mode #intel-hud .hud-bottom-left {
|
||||
transform-origin: left bottom;
|
||||
}
|
||||
|
||||
body.cockpit-mode #intel-hud .hud-bottom-right {
|
||||
bottom: calc(clamp(84px, 11vh, 118px) - 20px);
|
||||
transform-origin: right bottom;
|
||||
}
|
||||
|
||||
/* ── Live signals rows ──────────────────────────────────────────────────
|
||||
Callsign on the left, time small at the top right, the detail under it.
|
||||
The status colour is a slim inset bar (cyan for the aircraft you ride,
|
||||
white for nearby, amber for military / warnings), not a bent border. */
|
||||
.cockpit-signal-list {
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.cockpit-signal-list li {
|
||||
position: relative;
|
||||
display: block;
|
||||
padding: 5px 10px 5px 12px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||
box-shadow: inset 2px 0 0 rgba(244, 251, 255, 0.22);
|
||||
}
|
||||
|
||||
.cockpit-signal-list li:is(.track, .current) {
|
||||
border-color: rgba(0, 212, 255, 0.22);
|
||||
background: rgba(0, 212, 255, 0.06);
|
||||
box-shadow: inset 2px 0 0 var(--cockpit-accent, #00d4ff);
|
||||
}
|
||||
|
||||
.cockpit-signal-list li:is(.nearby) {
|
||||
border-color: rgba(255, 255, 255, 0.06);
|
||||
box-shadow: inset 2px 0 0 rgba(244, 251, 255, 0.55);
|
||||
}
|
||||
|
||||
.cockpit-signal-list li:is(.military, .warning) {
|
||||
border-color: rgba(255, 255, 255, 0.06);
|
||||
box-shadow: inset 2px 0 0 #d5a863;
|
||||
}
|
||||
|
||||
.cockpit-signal-list li.actionable:is(:hover, :focus-within) {
|
||||
border-color: rgba(0, 212, 255, 0.3);
|
||||
background: rgba(0, 212, 255, 0.08);
|
||||
}
|
||||
|
||||
.cockpit-signal-list time {
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
inset-inline-end: 28px;
|
||||
color: rgba(224, 236, 242, 0.4);
|
||||
font: 7px/1 var(--font-mono);
|
||||
letter-spacing: 0.06em;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.cockpit-signal-list li > div {
|
||||
gap: 1px;
|
||||
}
|
||||
|
||||
.cockpit-signal-target {
|
||||
grid-template-columns: minmax(0, 1fr) 14px;
|
||||
gap: 8px;
|
||||
font-size: 10.5px;
|
||||
letter-spacing: 0.1em;
|
||||
}
|
||||
|
||||
.cockpit-signal-target-rule {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.cockpit-signal-target-chevron {
|
||||
justify-self: end;
|
||||
color: rgba(224, 236, 242, 0.5) !important;
|
||||
}
|
||||
|
||||
.cockpit-signal-list
|
||||
li.actionable:is(:hover, :focus-within)
|
||||
.cockpit-signal-target-chevron {
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.cockpit-signal-list span:not([class]) {
|
||||
color: rgba(224, 236, 242, 0.62);
|
||||
font-size: 8px;
|
||||
letter-spacing: 0.08em;
|
||||
}
|
||||
|
||||
/* Keep a long callsign clear of the time at the row's end. */
|
||||
.cockpit-signal-list .cockpit-signal-target-label {
|
||||
margin-inline-end: 50px;
|
||||
}
|
||||
|
||||
/* ── Briefing content fits the narrower window ────────────────────────── */
|
||||
.cockpit-signal-window {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.cockpit-signal-window > *,
|
||||
.cockpit-brief-stage,
|
||||
.cockpit-brief-stage > section,
|
||||
.cockpit-signal-list,
|
||||
.cockpit-signal-list li {
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Route: a quiet heading, endpoints that truncate. */
|
||||
.cockpit-route-card {
|
||||
padding-inline: 4px;
|
||||
}
|
||||
|
||||
.cockpit-route-heading {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
#cockpit-route-status {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.cockpit-route-airport strong {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* Header: the title on one line, the controls on the row under it. */
|
||||
.cockpit-signal-window:not([data-collapsed='true']) .cockpit-signal-header {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
gap: 6px;
|
||||
padding-inline: 4px;
|
||||
}
|
||||
|
||||
.cockpit-signal-window:not([data-collapsed='true']) .cockpit-brief-heading {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: baseline;
|
||||
gap: 2px 8px;
|
||||
}
|
||||
|
||||
.cockpit-signal-window:not([data-collapsed='true']) .cockpit-signal-kicker {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.cockpit-signal-window:not([data-collapsed='true']) .cockpit-brief-actions {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.cockpit-signal-window:not([data-collapsed='true']) #cockpit-signal-toggle {
|
||||
margin-inline-start: auto;
|
||||
}
|
||||
|
||||
/* ── Open Display / Radio panels: the main panels' header and size ───── */
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-control.is-expanded {
|
||||
min-width: 295px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-control.is-expanded
|
||||
.cockpit-utility-launcher {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 4px 4px 10px 8px;
|
||||
color: rgba(224, 236, 242, 0.78);
|
||||
font: 9px/1 var(--font-mono);
|
||||
letter-spacing: 0.22em;
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-control.is-expanded
|
||||
.cockpit-utility-divider {
|
||||
flex: 0 1 22px;
|
||||
height: 1px;
|
||||
margin-right: auto;
|
||||
background: rgba(255, 255, 255, 0.18);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/* The launcher's own toggle steps aside: the rail and "−" open and close
|
||||
the panel instead. */
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-control.is-expanded
|
||||
.cockpit-utility-glyph {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-collapse {
|
||||
display: grid;
|
||||
flex: none;
|
||||
place-items: center;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
padding: 0;
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
border-radius: 6px;
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
color: rgba(206, 232, 239, 0.75);
|
||||
font: 13px/1 var(--font-mono);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-collapse:hover,
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-collapse:focus-visible {
|
||||
border-color: rgba(0, 212, 255, 0.45);
|
||||
color: #fff;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* ── Right rail as on the left: an icon column that stays, labels beside it
|
||||
while nothing is open, and the open panel to its left. The launchers'
|
||||
own strips give way to it. ─────────────────────────────────────────── */
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-controls {
|
||||
display: grid;
|
||||
grid-template-columns: auto auto;
|
||||
align-items: start;
|
||||
justify-content: end;
|
||||
column-gap: 6px;
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-control:not(.is-expanded) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-control.is-expanded {
|
||||
grid-column: 1;
|
||||
grid-row: 1;
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
|
||||
/* Cyber and the phone keep the launchers' own toggles, so the rail and "−"
|
||||
are for the desktop look only. */
|
||||
.cockpit-utility-rail,
|
||||
.cockpit-utility-collapse {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-rail {
|
||||
grid-column: 2;
|
||||
grid-row: 1;
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
align-items: stretch;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
:is(.cockpit-utility-rail__labels, .cockpit-utility-rail__icons) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
padding: 4px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.14);
|
||||
border-radius: 14px;
|
||||
background: rgba(16, 20, 28, 0.82);
|
||||
box-shadow:
|
||||
0 6px 20px rgba(0, 0, 0, 0.45),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.05);
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-rail__labels {
|
||||
box-sizing: border-box;
|
||||
width: 170px;
|
||||
padding-inline: 14px;
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-rail__labels
|
||||
> span {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 32px;
|
||||
color: rgba(225, 236, 242, 0.82);
|
||||
font:
|
||||
500 9.28px/1 Inter,
|
||||
-apple-system,
|
||||
system-ui,
|
||||
sans-serif;
|
||||
letter-spacing: 2.08px;
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-rail.is-open
|
||||
.cockpit-utility-rail__labels {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-rail__item {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
padding: 0;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 10px;
|
||||
background: transparent;
|
||||
color: var(--text-secondary, rgba(206, 232, 239, 0.75));
|
||||
cursor: pointer;
|
||||
transition:
|
||||
color var(--transition-fast, 120ms),
|
||||
background var(--transition-fast, 120ms),
|
||||
border-color var(--transition-fast, 120ms);
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-rail__item
|
||||
.material-symbols-outlined {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-rail__item:hover {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
color: var(--text-primary, #fff);
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-rail__item.is-on,
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-rail__item.is-on:hover {
|
||||
border-color: rgba(0, 212, 255, 0.15);
|
||||
background: rgba(0, 212, 255, 0.15);
|
||||
color: #00d4ff;
|
||||
}
|
||||
|
||||
/* With a panel open, each icon is its own island, as on the main rails. */
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-rail.is-open
|
||||
.cockpit-utility-rail__icons {
|
||||
border-color: transparent;
|
||||
background: none;
|
||||
box-shadow: none;
|
||||
backdrop-filter: none;
|
||||
-webkit-backdrop-filter: none;
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-rail.is-open
|
||||
.cockpit-utility-rail__item {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-rail.is-open
|
||||
.cockpit-utility-rail__item::before {
|
||||
position: absolute;
|
||||
inset: -5px;
|
||||
z-index: -1;
|
||||
border: 1px solid rgba(255, 255, 255, 0.14);
|
||||
border-radius: 14px;
|
||||
background: rgba(16, 20, 28, 0.82);
|
||||
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
content: '';
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Hovering an icon lights its label too, as on the left. */
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-rail:has(.cockpit-utility-rail__item:nth-child(1):hover)
|
||||
.cockpit-utility-rail__labels
|
||||
> span:nth-child(1),
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-rail:has(.cockpit-utility-rail__item:nth-child(2):hover)
|
||||
.cockpit-utility-rail__labels
|
||||
> span:nth-child(2) {
|
||||
color: var(--text-primary, #fff);
|
||||
}
|
||||
|
||||
/* Mirror the left rail's 52px inset, clear of the HUD's vertical readouts. */
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-controls {
|
||||
right: 52px;
|
||||
}
|
||||
|
||||
/* Like the cockpit's other windows (rtl.css), the rail keeps its physical
|
||||
side in a right-to-left language: icons at the screen edge, the open panel
|
||||
inside them. Only the text reads right to left. */
|
||||
html[dir='rtl']:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
.cockpit-utility-controls {
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
html[dir='rtl']:not([data-ui-theme='cyber'])
|
||||
body.cockpit-mode:not(.mobile-shell)
|
||||
:is(.cockpit-utility-control.is-expanded, .cockpit-utility-rail__labels) {
|
||||
direction: rtl;
|
||||
}
|
||||
@@ -0,0 +1,315 @@
|
||||
/* An application provider's first-person view
|
||||
(src/cockpitSubjectProviders.js): a window view with the provider's board,
|
||||
sources, banner, darkening veil and progress line. Every rule is scoped to
|
||||
the generic view, so the built-in views keep their own looks. */
|
||||
#cockpit-hud[data-generic] {
|
||||
--cockpit-subject-panel: rgba(0, 7, 12, 0.66);
|
||||
--cockpit-subject-live: var(--cockpit-accent);
|
||||
--cockpit-subject-estimate: #c9b6ff;
|
||||
--cockpit-subject-warning: #ffb800;
|
||||
--cockpit-subject-alert: var(--cockpit-emergency);
|
||||
--cockpit-subject-progress-band: 46px;
|
||||
}
|
||||
#cockpit-hud[data-generic] [data-tone='muted'] {
|
||||
opacity: 0.62;
|
||||
}
|
||||
#cockpit-hud[data-generic] [data-tone='live'] {
|
||||
color: var(--cockpit-subject-live);
|
||||
}
|
||||
#cockpit-hud[data-generic] [data-tone='estimate'] {
|
||||
color: var(--cockpit-subject-estimate);
|
||||
}
|
||||
#cockpit-hud[data-generic] [data-tone='warning'] {
|
||||
color: var(--cockpit-subject-warning);
|
||||
}
|
||||
#cockpit-hud[data-generic] [data-tone='alert'] {
|
||||
color: var(--cockpit-subject-alert);
|
||||
}
|
||||
|
||||
/* The veil darkens the picture under the HUD; its streaks are lights
|
||||
passing the window. */
|
||||
#cockpit-hud[data-generic] .cockpit-veil {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: #000;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.25s linear;
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-veil.streaks::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 34% -40% 46%;
|
||||
background: repeating-linear-gradient(
|
||||
90deg,
|
||||
transparent 0 22%,
|
||||
rgba(255, 214, 150, 0.16) 23%,
|
||||
rgba(255, 236, 200, 0.42) 24%,
|
||||
rgba(255, 214, 150, 0.16) 25%,
|
||||
transparent 26% 48%
|
||||
);
|
||||
filter: blur(3px);
|
||||
animation: cockpit-veil-streaks 1.4s linear infinite;
|
||||
}
|
||||
@keyframes cockpit-veil-streaks {
|
||||
from {
|
||||
transform: translateX(0);
|
||||
}
|
||||
to {
|
||||
transform: translateX(-26%);
|
||||
}
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
#cockpit-hud[data-generic] .cockpit-veil.streaks::before {
|
||||
animation: none;
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-veil {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* The banner: top centre, below the top line. */
|
||||
#cockpit-hud[data-generic] .cockpit-banner {
|
||||
position: absolute;
|
||||
top: clamp(92px, 13vh, 128px);
|
||||
left: 50%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
max-width: min(560px, 80vw);
|
||||
padding: 6px 14px;
|
||||
border: 1px solid color-mix(in srgb, var(--cockpit-accent) 56%, transparent);
|
||||
border-radius: 2px;
|
||||
background: var(--cockpit-subject-panel);
|
||||
text-align: center;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-banner strong {
|
||||
font-size: 15px;
|
||||
letter-spacing: 0.14em;
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-banner small {
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.08em;
|
||||
}
|
||||
|
||||
/* The board: cards on the left, below the page's left rail and the Intel
|
||||
HUD's top corner (both stay on in first person), the sources under them. */
|
||||
#cockpit-hud[data-generic] {
|
||||
--cockpit-subject-board-top: max(23rem, 41vh);
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-board {
|
||||
position: absolute;
|
||||
top: var(--cockpit-subject-board-top);
|
||||
left: clamp(22px, 4vw, 58px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
width: min(320px, 30vw);
|
||||
min-width: 220px;
|
||||
max-height: calc(100vh - var(--cockpit-subject-board-top) - 11rem);
|
||||
overflow: hidden;
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-board-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
padding: 6px 10px;
|
||||
border-left: 2px solid
|
||||
color-mix(in srgb, var(--cockpit-accent) 72%, transparent);
|
||||
background: var(--cockpit-subject-panel);
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-board-card small {
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.16em;
|
||||
opacity: 0.78;
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-board-card strong {
|
||||
font-size: 17px;
|
||||
letter-spacing: 0.04em;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-board-card span {
|
||||
font-size: 12px;
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-sources {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
margin: 0;
|
||||
padding: 6px 10px;
|
||||
background: rgba(0, 7, 12, 0.5);
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-sources div {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-sources dt {
|
||||
flex: none;
|
||||
min-width: 64px;
|
||||
opacity: 0.7;
|
||||
letter-spacing: 0.14em;
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-sources dd {
|
||||
margin: 0;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
/* The speed's tag (live or estimated) sits where a label would. */
|
||||
#cockpit-hud[data-generic] .cockpit-speed-tag {
|
||||
font-weight: 700;
|
||||
}
|
||||
/* With no speed readout the heading still holds the middle of the row. */
|
||||
#cockpit-hud[data-generic] .cockpit-heading-value {
|
||||
grid-column: 2;
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-aircraft-meta[data-tone='warning'],
|
||||
#cockpit-hud[data-generic] .cockpit-aircraft-meta[data-tone='alert'] {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/* Look-around: the readout and LOOK AHEAD centred under the style switcher,
|
||||
in the sky over the forward view; the bottom corners hold the position
|
||||
readouts. Styled as on a bridge. */
|
||||
#cockpit-hud[data-generic] .cockpit-look {
|
||||
position: absolute;
|
||||
top: calc(clamp(22px, 4vh, 42px) + 70px);
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-look[hidden] {
|
||||
display: none;
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-look-readout {
|
||||
padding: 2px 6px;
|
||||
border: 1px solid color-mix(in srgb, var(--cockpit-accent) 46%, transparent);
|
||||
border-radius: 2px;
|
||||
background: rgba(0, 7, 12, 0.62);
|
||||
color: var(--cockpit-accent);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.12em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-look-ahead {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 3px 8px;
|
||||
border: 1px solid color-mix(in srgb, var(--cockpit-accent) 64%, transparent);
|
||||
border-radius: 2px;
|
||||
background: rgba(0, 7, 12, 0.78);
|
||||
color: #f4fbff;
|
||||
font: inherit;
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.14em;
|
||||
cursor: pointer;
|
||||
pointer-events: auto;
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-look-ahead:hover {
|
||||
border-color: var(--cockpit-accent);
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-look-ahead:focus-visible {
|
||||
outline: 2px solid var(--cockpit-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* The progress line takes a band along the bottom edge; the readouts that
|
||||
sit there move up above it. */
|
||||
#cockpit-hud[data-generic][data-progress]
|
||||
:is(.cockpit-help, .cockpit-position-readout) {
|
||||
bottom: calc(
|
||||
clamp(22px, 4vh, 42px) + var(--cockpit-subject-progress-band) - 14px
|
||||
);
|
||||
}
|
||||
#cockpit-hud[data-generic][data-progress] .cockpit-compass {
|
||||
bottom: calc(clamp(44px, 7vh, 72px) + var(--cockpit-subject-progress-band));
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-progress {
|
||||
position: absolute;
|
||||
right: clamp(22px, 4vw, 58px);
|
||||
bottom: 6px;
|
||||
left: clamp(22px, 4vw, 58px);
|
||||
height: var(--cockpit-subject-progress-band);
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-progress-line {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 8px;
|
||||
left: 0;
|
||||
height: 2px;
|
||||
background: color-mix(in srgb, var(--cockpit-accent) 78%, transparent);
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-progress-travelled {
|
||||
position: absolute;
|
||||
inset: 0 auto 0 0;
|
||||
background: rgba(0, 7, 12, 0.72);
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-progress-tick {
|
||||
position: absolute;
|
||||
bottom: 5px;
|
||||
width: 2px;
|
||||
height: 8px;
|
||||
margin-left: -1px;
|
||||
background: currentColor;
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-progress-tick.labelled {
|
||||
height: 12px;
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-progress-tick.merged {
|
||||
width: 4px;
|
||||
margin-left: -2px;
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-progress-tick.travelled {
|
||||
opacity: 0.45;
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-progress-label {
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.06em;
|
||||
line-height: 1.2;
|
||||
white-space: nowrap;
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-progress-label[data-align='center'] {
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-progress-label[data-align='end'] {
|
||||
align-items: flex-end;
|
||||
text-align: end;
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-progress-label small {
|
||||
opacity: 0.82;
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-progress-marker {
|
||||
position: absolute;
|
||||
bottom: 4px;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
margin-left: -5px;
|
||||
border-radius: 50%;
|
||||
background: var(--cockpit-accent);
|
||||
box-shadow: 0 0 10px var(--cockpit-accent);
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-progress-marker.dwell {
|
||||
background: transparent;
|
||||
border: 2px solid var(--cockpit-accent);
|
||||
}
|
||||
#cockpit-hud[data-generic] .cockpit-progress-tag {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: -2px;
|
||||
font-size: 9px;
|
||||
letter-spacing: 0.14em;
|
||||
opacity: 0.7;
|
||||
}
|
||||
@@ -599,7 +599,10 @@ html:not([lang='en']):not(:lang(zh)):not(:lang(ja))
|
||||
|
||||
#pp-toggles.collapsed .pp-toggle-group,
|
||||
#pp-toggles.collapsed #clean-view-toggle,
|
||||
#pp-toggles.collapsed #param-slider-panel {
|
||||
#pp-toggles.collapsed #param-slider-panel,
|
||||
#pp-toggles.collapsed .visual-presets,
|
||||
#pp-toggles.collapsed .pp-section-heading,
|
||||
#pp-toggles.collapsed .pp-reset-btn {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
/* ── Data Layers search and filter ── */
|
||||
.layer-finder__btn {
|
||||
display: grid;
|
||||
flex: none;
|
||||
place-items: center;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
padding: 0;
|
||||
color: rgba(206, 232, 239, 0.65);
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.layer-finder__btn .material-symbols-outlined {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.layer-finder__btn:hover,
|
||||
.layer-finder__btn:focus-visible {
|
||||
color: #fff;
|
||||
border-color: rgba(255, 255, 255, 0.24);
|
||||
}
|
||||
|
||||
.layer-finder__btn.active {
|
||||
color: #36dcff;
|
||||
background: rgba(54, 220, 255, 0.12);
|
||||
border-color: rgba(54, 220, 255, 0.45);
|
||||
}
|
||||
|
||||
.layer-finder__filter {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
.layer-finder__menu {
|
||||
position: absolute;
|
||||
top: calc(100% + 6px);
|
||||
right: 0;
|
||||
z-index: 20;
|
||||
display: grid;
|
||||
min-width: 140px;
|
||||
padding: 4px;
|
||||
background: rgba(16, 20, 28, 0.96);
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.layer-finder__menu button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.45rem;
|
||||
padding: 0.4rem 0.55rem;
|
||||
color: rgba(225, 236, 242, 0.85);
|
||||
font-size: 0.72rem;
|
||||
text-align: start;
|
||||
background: none;
|
||||
border: 0;
|
||||
border-radius: 7px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.layer-finder__menu button .material-symbols-outlined {
|
||||
font-size: 14px;
|
||||
color: rgba(199, 214, 222, 0.6);
|
||||
}
|
||||
|
||||
.layer-finder__menu button:hover {
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
|
||||
.layer-finder__menu button.active,
|
||||
.layer-finder__menu button.active .material-symbols-outlined {
|
||||
color: #7af0ff;
|
||||
}
|
||||
|
||||
.layer-finder__bar {
|
||||
display: flex;
|
||||
flex: none;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
margin: 0.2rem 0 0.5rem;
|
||||
}
|
||||
|
||||
.layer-finder__field {
|
||||
display: flex;
|
||||
flex: 1 1 auto;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
padding: 0 0.55rem;
|
||||
height: 30px;
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
border: 1px solid rgba(54, 220, 255, 0.3);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.layer-finder__field .material-symbols-outlined {
|
||||
color: rgba(199, 214, 222, 0.6);
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.layer-finder__field input {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
color: rgba(236, 244, 248, 0.95);
|
||||
font-size: 0.75rem;
|
||||
background: none;
|
||||
border: 0;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* Focus shows on the field's frame, as a soft ring, in place of the hard
|
||||
keyboard outline round the bare input. */
|
||||
.layer-finder__field input:focus,
|
||||
.layer-finder__field input:focus-visible {
|
||||
outline: none !important;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.layer-finder__field:focus-within {
|
||||
border-color: rgba(54, 220, 255, 0.7);
|
||||
box-shadow: 0 0 0 3px rgba(54, 220, 255, 0.1);
|
||||
}
|
||||
|
||||
.layer-finder__chip {
|
||||
display: inline-flex;
|
||||
flex: none;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
height: 26px;
|
||||
padding: 0 0.5rem;
|
||||
color: #7af0ff;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.56rem;
|
||||
letter-spacing: 0.1rem;
|
||||
text-transform: uppercase;
|
||||
background: rgba(54, 220, 255, 0.12);
|
||||
border: 1px solid rgba(54, 220, 255, 0.45);
|
||||
border-radius: 999px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.layer-finder__chip .material-symbols-outlined {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* Rows and group headings the search or filter leaves out. */
|
||||
#data-toggles .is-filtered {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.layer-finder__empty {
|
||||
flex-basis: 100%;
|
||||
margin: 0;
|
||||
padding: 0.6rem 0.5rem;
|
||||
color: rgba(199, 214, 222, 0.5);
|
||||
font-size: 0.72rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.layer-finder__menu {
|
||||
max-height: 60vh;
|
||||
box-sizing: border-box;
|
||||
overflow-y: auto;
|
||||
min-width: 170px;
|
||||
}
|
||||
|
||||
.layer-finder__menu-head {
|
||||
padding: 0.45rem 0.55rem 0.2rem;
|
||||
color: rgba(199, 214, 222, 0.5);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.52rem;
|
||||
letter-spacing: 0.14rem;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
/* Each group of options lays out as part of the menu's grid. */
|
||||
.layer-finder__menu > span {
|
||||
display: contents;
|
||||
}
|
||||
|
||||
.layer-finder__menu > span + span > .layer-finder__menu-head {
|
||||
margin-top: 0.2rem;
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
/* Several chips can show at once. */
|
||||
.layer-finder__bar {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
/* Chips sized like the rows' ON/OFF switches: small and square. */
|
||||
.layer-finder__chip {
|
||||
height: 20px;
|
||||
gap: 0.2rem;
|
||||
padding: 0 6px 0 8px;
|
||||
font-size: 9px;
|
||||
letter-spacing: 0.08rem;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.layer-finder__chip .material-symbols-outlined {
|
||||
font-size: 11px;
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
/* ── Data Layers group index: ticks along the panel's right edge ─────── */
|
||||
#data-panel {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.layer-section-index {
|
||||
position: absolute;
|
||||
top: 64px;
|
||||
inset-inline-end: 2px;
|
||||
bottom: 24px;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
width: 10px;
|
||||
}
|
||||
|
||||
#data-panel.collapsed .layer-section-index {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.layer-section-index__tick {
|
||||
position: relative;
|
||||
width: 10px;
|
||||
height: 16px;
|
||||
padding: 0;
|
||||
background: none;
|
||||
border: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.layer-section-index__tick::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
bottom: 2px;
|
||||
left: 4px;
|
||||
width: 2px;
|
||||
border-radius: 2px;
|
||||
background: rgba(199, 214, 222, 0.32);
|
||||
transition:
|
||||
background 140ms ease,
|
||||
box-shadow 140ms ease,
|
||||
transform 140ms ease;
|
||||
}
|
||||
|
||||
.layer-section-index__tick:hover::before,
|
||||
.layer-section-index__tick:focus-visible::before {
|
||||
background: rgba(236, 244, 248, 0.85);
|
||||
transform: scaleX(1.5);
|
||||
}
|
||||
|
||||
.layer-section-index__tick.is-current::before {
|
||||
background: #36dcff;
|
||||
box-shadow: 0 0 6px rgba(54, 220, 255, 0.6);
|
||||
}
|
||||
|
||||
.layer-section-index__tick:focus-visible {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* The group's name, drawn on the page just outside the panel's edge while a
|
||||
tick is pointed at or focused, so it covers none of the rows. */
|
||||
.layer-section-index__label {
|
||||
position: fixed;
|
||||
z-index: 30;
|
||||
padding: 0.25rem 0.5rem;
|
||||
color: rgba(236, 244, 248, 0.92);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.56rem;
|
||||
letter-spacing: 0.12rem;
|
||||
text-transform: uppercase;
|
||||
white-space: nowrap;
|
||||
background: rgba(12, 12, 20, 0.88);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
border-radius: 6px;
|
||||
transform: translateY(-50%);
|
||||
pointer-events: none;
|
||||
animation: layer-section-index-label 120ms ease both;
|
||||
}
|
||||
|
||||
/* Drawn before the tick when there is no room after it. */
|
||||
.layer-section-index__label--before {
|
||||
transform: translate(-100%, -50%);
|
||||
}
|
||||
|
||||
@keyframes layer-section-index-label {
|
||||
from {
|
||||
opacity: 0;
|
||||
translate: -4px 0;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
translate: 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.layer-section-index__label {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
|
||||
body.mobile-shell .layer-section-index {
|
||||
display: none;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/* Visual in the left column: it takes clicks (the column itself lets them
|
||||
through to the globe) and stays inside the column, scrolling as a whole. */
|
||||
#left-panel-stack > #pp-toggles {
|
||||
position: relative;
|
||||
inset: auto;
|
||||
flex: 0 1 var(--left-panel-allocated-height, auto);
|
||||
min-height: 0;
|
||||
max-height: var(--left-panel-allocated-height, 100%);
|
||||
overflow-y: auto;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
#left-panel-stack > #pp-toggles.collapsed {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* ── Expanded panel width ───────────────────────────────────────────────
|
||||
Data Layers opens 15px wider than it used to (280 → 295px), and that is
|
||||
the narrowest any side panel opens to; wider ones (Context, CCTV,
|
||||
Authoring) keep their own width. */
|
||||
:root {
|
||||
--side-panel-min-expanded-width: 295px;
|
||||
}
|
||||
|
||||
#data-panel,
|
||||
#utilities-panel {
|
||||
--panel-expanded-width: var(--side-panel-min-expanded-width);
|
||||
}
|
||||
|
||||
#left-panel-stack > #pp-toggles:not(.collapsed) {
|
||||
--pp-expanded-width: var(--side-panel-min-expanded-width);
|
||||
width: var(--side-panel-min-expanded-width);
|
||||
}
|
||||
|
||||
:is(#left-panel-stack, #right-context-rail) > [data-panel-id]:not(.collapsed) {
|
||||
min-width: var(--side-panel-min-expanded-width);
|
||||
}
|
||||
@@ -129,7 +129,9 @@ body.mobile-shell #right-context-rail {
|
||||
body.mobile-shell[data-mobile-sheet='layers'] #left-panel-stack,
|
||||
body.mobile-shell[data-mobile-sheet='cameras'] #right-context-rail,
|
||||
body.mobile-shell[data-mobile-sheet='context'] #right-context-rail,
|
||||
body.mobile-shell[data-mobile-sheet='more'] #right-context-rail {
|
||||
/* Visual opens from the left rail on wider screens, so it lives in the left
|
||||
stack and the More sheet is that stack showing Visual alone. */
|
||||
body.mobile-shell[data-mobile-sheet='more'] #left-panel-stack {
|
||||
position: fixed;
|
||||
top: auto;
|
||||
right: 0;
|
||||
@@ -189,7 +191,7 @@ body.mobile-shell[data-mobile-sheet='context']
|
||||
body.mobile-shell[data-mobile-sheet='context']
|
||||
#right-context-rail
|
||||
> #recent-imagery-panel:not([hidden]),
|
||||
body.mobile-shell[data-mobile-sheet='more'] #right-context-rail > #pp-toggles {
|
||||
body.mobile-shell[data-mobile-sheet='more'] #left-panel-stack > #pp-toggles {
|
||||
position: relative;
|
||||
inset: auto;
|
||||
display: block;
|
||||
|
||||
@@ -310,8 +310,10 @@
|
||||
bottom: 12vh;
|
||||
}
|
||||
|
||||
/* Minimal keeps its coordinates in the corner block, where the other layouts
|
||||
have them; the full-width strip would only repeat the same position. */
|
||||
#intel-hud[data-variant='minimal'] .hud-bottom-bar {
|
||||
display: flex;
|
||||
display: none;
|
||||
bottom: calc(12vh + 4rem);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/* ── Panels over the rail ───────────────────────────────────────────────
|
||||
Each panel header's edge switch (UiPanelEdge) slides that side's open
|
||||
panels over their rail to the screen edge; the rail stays underneath. */
|
||||
.ui-panel-edge {
|
||||
display: grid;
|
||||
flex: none;
|
||||
place-items: center;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
padding: 0;
|
||||
color: rgba(206, 232, 239, 0.6);
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ui-panel-edge .material-symbols-outlined {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.ui-panel-edge:hover,
|
||||
.ui-panel-edge:focus-visible {
|
||||
color: var(--text-primary, #e8eaed);
|
||||
border-color: rgba(255, 255, 255, 0.24);
|
||||
}
|
||||
|
||||
.ui-panel-edge[aria-pressed='true'] {
|
||||
color: #36dcff;
|
||||
background: rgba(54, 220, 255, 0.12);
|
||||
border-color: rgba(54, 220, 255, 0.45);
|
||||
}
|
||||
|
||||
/* Collapsed panels hide the switch; it only means something once open. */
|
||||
.panel-collapsible.collapsed .ui-panel-edge {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Right: open panels move right by the rail's width and sit over it. */
|
||||
body.panels-edge-right:not(.mobile-shell):not(.cockpit-mode)
|
||||
#right-context-rail
|
||||
> :not(.gev-panel-rail) {
|
||||
z-index: 2;
|
||||
transform: translateX(var(--panel-rail-clearance, 48px));
|
||||
}
|
||||
|
||||
/* Left: the same, moving left. */
|
||||
body.panels-edge-left:not(.mobile-shell):not(.cockpit-mode)
|
||||
#left-panel-stack
|
||||
> :not(.gev-panel-rail) {
|
||||
z-index: 2;
|
||||
transform: translateX(calc(-1 * var(--panel-rail-clearance, 48px)));
|
||||
}
|
||||
|
||||
body.mobile-shell .ui-panel-edge,
|
||||
body.cockpit-mode .ui-panel-edge {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* ── Edge mode with a panel open: the rail's icons move to a row along the
|
||||
top of the panel, and the panel steps down to make room. ── */
|
||||
:root {
|
||||
--edge-rail-row: 50px;
|
||||
}
|
||||
|
||||
body.panels-edge-left:not(.mobile-shell):not(.cockpit-mode)
|
||||
.gev-panel-rail--left:has(.ui-rail--collapsible:not(.ui-rail--expanded)),
|
||||
body.panels-edge-right:not(.mobile-shell):not(.cockpit-mode)
|
||||
.gev-panel-rail--right:has(.ui-rail--collapsible:not(.ui-rail--expanded)) {
|
||||
top: 0 !important;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
body.panels-edge-left:not(.mobile-shell):not(.cockpit-mode)
|
||||
.gev-panel-rail--left
|
||||
.ui-rail--collapsible:not(.ui-rail--expanded),
|
||||
body.panels-edge-right:not(.mobile-shell):not(.cockpit-mode)
|
||||
.gev-panel-rail--right
|
||||
.ui-rail--collapsible:not(.ui-rail--expanded) {
|
||||
flex-direction: row;
|
||||
width: max-content;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
body.panels-edge-left:not(.mobile-shell):not(.cockpit-mode)
|
||||
#left-panel-stack
|
||||
> :not(.gev-panel-rail):not(.collapsed) {
|
||||
transform: translate(
|
||||
calc(-1 * var(--panel-rail-clearance, 48px)),
|
||||
var(--edge-rail-row)
|
||||
);
|
||||
max-height: calc(100% - var(--edge-rail-row)) !important;
|
||||
}
|
||||
|
||||
body.panels-edge-right:not(.mobile-shell):not(.cockpit-mode)
|
||||
#right-context-rail
|
||||
> :not(.gev-panel-rail):not(.collapsed) {
|
||||
transform: translate(var(--panel-rail-clearance, 48px), var(--edge-rail-row));
|
||||
max-height: calc(100% - var(--edge-rail-row)) !important;
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/* ── Side rails: sliding highlight and edge scrolling ──────────────────
|
||||
The open item's highlight is drawn once per rail, under the icons, and
|
||||
slides from item to item when the panel changes. With the pointer in a
|
||||
screen edge's strip, the rail's border lights up a little to say the wheel
|
||||
now steps through its panels; the panel that opens slides in from the
|
||||
direction of travel. */
|
||||
.ui-rail {
|
||||
position: relative;
|
||||
transition:
|
||||
border-color 240ms ease,
|
||||
border-radius var(--transition-fast);
|
||||
}
|
||||
|
||||
.ui-rail.ui-rail--edge-hot {
|
||||
border-color: rgba(48, 194, 224, 0.4);
|
||||
}
|
||||
|
||||
/* The highlight itself, matching an open item's own look. */
|
||||
.ui-rail::before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 0;
|
||||
width: var(--rail-glide-w, 32px);
|
||||
height: var(--rail-glide-h, 32px);
|
||||
background: var(--accent-dim);
|
||||
border: 1px solid var(--accent-dim);
|
||||
border-radius: var(--btn-radius);
|
||||
box-sizing: border-box;
|
||||
content: '';
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transform: translate(var(--rail-glide-x, 0), var(--rail-glide-y, 0));
|
||||
/* Only the position slides. The size follows at once: it changes only
|
||||
when the rail changes shape (its labelled pills folding to icons as a
|
||||
panel opens), and a size easing there reads as a stretch. */
|
||||
transition:
|
||||
transform 380ms cubic-bezier(0.22, 1, 0.36, 1),
|
||||
border-radius var(--transition-fast),
|
||||
opacity 200ms ease;
|
||||
}
|
||||
|
||||
.ui-rail--expanded::before {
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
.ui-rail.ui-rail--glide::before {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.ui-rail.ui-rail--glide-jump::before {
|
||||
transition: opacity 200ms ease;
|
||||
}
|
||||
|
||||
/* While the shared highlight shows, the items stay clear and sit above it;
|
||||
the open item keeps its accent colour, which eases in as it arrives. */
|
||||
.ui-rail--glide .ui-rail__item {
|
||||
z-index: 1;
|
||||
transition:
|
||||
color 300ms ease,
|
||||
background var(--transition-fast),
|
||||
border-color var(--transition-fast),
|
||||
border-radius var(--transition-fast);
|
||||
}
|
||||
|
||||
.ui-rail--glide .ui-rail__item--on,
|
||||
.ui-rail--glide .ui-rail__item--on:hover:not(:disabled) {
|
||||
background: transparent;
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
.rail-switch-down {
|
||||
animation: rail-switch-down 340ms cubic-bezier(0.22, 1, 0.36, 1);
|
||||
}
|
||||
|
||||
.rail-switch-up {
|
||||
animation: rail-switch-up 340ms cubic-bezier(0.22, 1, 0.36, 1);
|
||||
}
|
||||
|
||||
@keyframes rail-switch-down {
|
||||
from {
|
||||
opacity: 0;
|
||||
translate: 0 16px;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes rail-switch-up {
|
||||
from {
|
||||
opacity: 0;
|
||||
translate: 0 -16px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.ui-rail::before {
|
||||
transition: opacity 200ms ease;
|
||||
}
|
||||
|
||||
.rail-switch-down,
|
||||
.rail-switch-up {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,282 @@
|
||||
/* The left rail's icons keep their places whether or not a panel is open;
|
||||
only the highlight moves to the open one. */
|
||||
|
||||
/* With nothing open, the icons and their names split into two glass panels
|
||||
side by side: the plain icon rail, and a name panel beside it with one row
|
||||
per icon. A name is part of its button, so clicking it opens that panel. */
|
||||
.gev-panel-rail--left .ui-rail--expanded {
|
||||
position: relative;
|
||||
border-radius: calc(var(--btn-radius) + 4px);
|
||||
}
|
||||
|
||||
.gev-panel-rail--left .ui-rail--expanded .ui-rail__item {
|
||||
width: 32px;
|
||||
border-radius: var(--btn-radius);
|
||||
}
|
||||
|
||||
.gev-panel-rail--left .ui-rail--expanded::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -1px;
|
||||
bottom: -1px;
|
||||
left: calc(100% + 6px);
|
||||
width: 170px;
|
||||
border: 1px solid var(--glass-border);
|
||||
border-radius: calc(var(--btn-radius) + 4px);
|
||||
background: var(--glass-bg);
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.gev-panel-rail--left .ui-rail--expanded .ui-rail__label {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
/* Past the rail's padding and border, the 6px gap, and the name panel's
|
||||
border and inner padding. */
|
||||
left: calc(100% + 24px);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
max-width: 150px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.gev-panel-rail--left .ui-rail--expanded .ui-rail__item:hover .ui-rail__label {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
/* The column rises to sit just under the HUD readout instead of leaving a
|
||||
gap above it, with or without a panel open, so opening one doesn't move
|
||||
the rail down. */
|
||||
#left-panel-stack {
|
||||
top: calc(
|
||||
var(--left-stack-safe-top, var(--left-stack-top)) +
|
||||
var(--panel-rail-lift, 0px)
|
||||
);
|
||||
}
|
||||
|
||||
/* The right rail splits the same way with nothing open, mirrored: the icon
|
||||
rail stays on the screen edge and the name panel sits to its left. */
|
||||
.gev-panel-rail--right .ui-rail--expanded {
|
||||
position: relative;
|
||||
border-radius: calc(var(--btn-radius) + 4px);
|
||||
}
|
||||
|
||||
.gev-panel-rail--right .ui-rail--expanded .ui-rail__item {
|
||||
width: 32px;
|
||||
border-radius: var(--btn-radius);
|
||||
}
|
||||
|
||||
.gev-panel-rail--right .ui-rail--expanded::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -1px;
|
||||
bottom: -1px;
|
||||
right: calc(100% + 6px);
|
||||
width: 170px;
|
||||
border: 1px solid var(--glass-border);
|
||||
border-radius: calc(var(--btn-radius) + 4px);
|
||||
background: var(--glass-bg);
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.gev-panel-rail--right .ui-rail--expanded .ui-rail__label {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
/* From the button's left edge back past the rail's padding and border,
|
||||
the 6px gap and the 170px name panel, to the panel's inner padding. */
|
||||
left: -168px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
max-width: 150px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.gev-panel-rail--right .ui-rail--expanded .ui-rail__item:hover .ui-rail__label {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
/* In clean view the screen-edge gutters stay empty: the HUD's vertical edge
|
||||
readouts (ONA / COLL on the left, BAND / BITS / LVL on the right) are not
|
||||
shown. Cyber lays its HUD out differently and keeps them. */
|
||||
:root:not([data-ui-theme='cyber']) body.ui-clean-view #intel-hud .hud-edge {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* The bottom-right readout (GSD / ALT / AIS) has one more line than the
|
||||
bottom-left one (MGRS / coordinates); it drops by that line so the two
|
||||
corners start level. */
|
||||
#intel-hud[data-variant='tactical'] .hud-bottom-right {
|
||||
bottom: calc(2vh + 6.5rem - 26px);
|
||||
}
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
#intel-hud[data-variant='tactical'] .hud-bottom-right {
|
||||
bottom: calc(4.2rem - 26px);
|
||||
}
|
||||
}
|
||||
|
||||
/* ── Contrast: rails and name panels read clearly over dark space as well
|
||||
as bright imagery. ── */
|
||||
:is(.gev-panel-rail--left, .gev-panel-rail--right) .ui-rail {
|
||||
background: rgba(16, 20, 28, 0.82) !important;
|
||||
border-color: rgba(255, 255, 255, 0.14) !important;
|
||||
box-shadow:
|
||||
0 6px 20px rgba(0, 0, 0, 0.45),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
|
||||
:is(.gev-panel-rail--left, .gev-panel-rail--right) .ui-rail--expanded::after {
|
||||
background: rgba(16, 20, 28, 0.82) !important;
|
||||
border-color: rgba(255, 255, 255, 0.14) !important;
|
||||
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
|
||||
:is(.gev-panel-rail--left, .gev-panel-rail--right) .ui-rail__item {
|
||||
color: rgba(225, 236, 242, 0.88);
|
||||
}
|
||||
|
||||
:is(.gev-panel-rail--left, .gev-panel-rail--right) .ui-rail__label {
|
||||
color: rgba(225, 236, 242, 0.82) !important;
|
||||
}
|
||||
|
||||
:is(.gev-panel-rail--left, .gev-panel-rail--right) .ui-rail__item:hover {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* The open item takes the accent colour; its highlight is the rail's shared
|
||||
one, which slides to it. The button carries no fill of its own: as a rail
|
||||
folds its labelled pills to icons, a fill on the shrinking button would
|
||||
read as the highlight stretching. */
|
||||
:is(.gev-panel-rail--left, .gev-panel-rail--right)
|
||||
.ui-rail__item.ui-rail__item--on {
|
||||
color: #00d4ff !important;
|
||||
}
|
||||
|
||||
:is(.gev-panel-rail--left, .gev-panel-rail--right)
|
||||
.ui-rail:not(.ui-rail--glide)
|
||||
.ui-rail__item.ui-rail__item--on {
|
||||
background: none;
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
:is(.gev-panel-rail--left, .gev-panel-rail--right) .ui-rail::before {
|
||||
background: rgba(0, 212, 255, 0.15);
|
||||
border-color: rgba(0, 212, 255, 0.28);
|
||||
}
|
||||
|
||||
/* ── The open icon is its own island ──
|
||||
With a panel open, the rail's glass is drawn in pieces behind its icons:
|
||||
one piece for the open icon, and one for each run of icons above and below
|
||||
it. The icons keep their places, open or not; the spacing between them is
|
||||
what leaves room for the break. */
|
||||
:is(.gev-panel-rail--left, .gev-panel-rail--right) .ui-rail {
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
:is(
|
||||
body:not(.panels-edge-left) .gev-panel-rail--left,
|
||||
body:not(.panels-edge-right) .gev-panel-rail--right
|
||||
)
|
||||
.ui-rail--collapsible:not(.ui-rail--expanded):has(.ui-rail__item--on) {
|
||||
background: none !important;
|
||||
border-color: transparent !important;
|
||||
box-shadow: none !important;
|
||||
backdrop-filter: none;
|
||||
-webkit-backdrop-filter: none;
|
||||
}
|
||||
|
||||
:is(
|
||||
body:not(.panels-edge-left) .gev-panel-rail--left,
|
||||
body:not(.panels-edge-right) .gev-panel-rail--right
|
||||
)
|
||||
.ui-rail--collapsible:not(.ui-rail--expanded):has(.ui-rail__item--on)
|
||||
> .ui-tooltip::before {
|
||||
position: absolute;
|
||||
inset: -6px -5px;
|
||||
z-index: -1;
|
||||
background: rgba(16, 20, 28, 0.82);
|
||||
border: solid rgba(255, 255, 255, 0.14);
|
||||
border-width: 0 1px;
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
content: '';
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* The ends of the rail. */
|
||||
:is(
|
||||
body:not(.panels-edge-left) .gev-panel-rail--left,
|
||||
body:not(.panels-edge-right) .gev-panel-rail--right
|
||||
)
|
||||
.ui-rail--collapsible:not(.ui-rail--expanded):has(.ui-rail__item--on)
|
||||
> .ui-tooltip:first-child::before {
|
||||
top: -5px;
|
||||
border-top-width: 1px;
|
||||
border-top-left-radius: 14px;
|
||||
border-top-right-radius: 14px;
|
||||
}
|
||||
|
||||
:is(
|
||||
body:not(.panels-edge-left) .gev-panel-rail--left,
|
||||
body:not(.panels-edge-right) .gev-panel-rail--right
|
||||
)
|
||||
.ui-rail--collapsible:not(.ui-rail--expanded):has(.ui-rail__item--on)
|
||||
> .ui-tooltip:last-child::before {
|
||||
bottom: -5px;
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-left-radius: 14px;
|
||||
border-bottom-right-radius: 14px;
|
||||
}
|
||||
|
||||
/* The runs stop short of the open icon. */
|
||||
:is(
|
||||
body:not(.panels-edge-left) .gev-panel-rail--left,
|
||||
body:not(.panels-edge-right) .gev-panel-rail--right
|
||||
)
|
||||
.ui-rail--collapsible:not(.ui-rail--expanded):has(.ui-rail__item--on)
|
||||
> .ui-tooltip:has(+ .ui-tooltip > .ui-rail__item--on)::before {
|
||||
bottom: -1px;
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-left-radius: 14px;
|
||||
border-bottom-right-radius: 14px;
|
||||
}
|
||||
|
||||
:is(
|
||||
body:not(.panels-edge-left) .gev-panel-rail--left,
|
||||
body:not(.panels-edge-right) .gev-panel-rail--right
|
||||
)
|
||||
.ui-rail--collapsible:not(.ui-rail--expanded):has(.ui-rail__item--on)
|
||||
> .ui-tooltip:has(> .ui-rail__item--on)
|
||||
+ .ui-tooltip::before {
|
||||
top: -1px;
|
||||
border-top-width: 1px;
|
||||
border-top-left-radius: 14px;
|
||||
border-top-right-radius: 14px;
|
||||
}
|
||||
|
||||
/* The open icon's own piece. */
|
||||
:is(
|
||||
body:not(.panels-edge-left) .gev-panel-rail--left,
|
||||
body:not(.panels-edge-right) .gev-panel-rail--right
|
||||
)
|
||||
.ui-rail--collapsible:not(.ui-rail--expanded):has(.ui-rail__item--on)
|
||||
> .ui-tooltip:has(> .ui-rail__item--on)::before {
|
||||
inset: -4px -5px;
|
||||
border-width: 1px;
|
||||
border-radius: 14px;
|
||||
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
|
||||
/* The side rails fold their labels away at once when a panel opens, and back
|
||||
when it closes: easing the labels' width made every button visibly
|
||||
stretch and shrink. Only their fade eases. */
|
||||
:is(.gev-panel-rail--left, .gev-panel-rail--right) .ui-rail__label {
|
||||
transition: opacity var(--transition-fast);
|
||||
}
|
||||
@@ -242,3 +242,47 @@ html[dir='rtl'] select.gev-field--compact {
|
||||
html[dir='rtl'] .rail-card-scale {
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
/* ── Side rails, mirrored ──────────────────────────────────────────────
|
||||
The left stack sits on the right edge, so the left rail's name panel
|
||||
opens to its left and the right rail's to its right, each toward the
|
||||
middle of the screen, as they do in left-to-right. */
|
||||
html[dir='rtl'] .gev-panel-rail--left .ui-rail--expanded::after {
|
||||
right: calc(100% + 6px);
|
||||
left: auto;
|
||||
}
|
||||
html[dir='rtl'] .gev-panel-rail--left .ui-rail--expanded .ui-rail__label {
|
||||
right: calc(100% + 24px);
|
||||
left: auto;
|
||||
}
|
||||
html[dir='rtl'] .gev-panel-rail--right .ui-rail--expanded::after {
|
||||
right: auto;
|
||||
left: calc(100% + 6px);
|
||||
}
|
||||
html[dir='rtl'] .gev-panel-rail--right .ui-rail--expanded .ui-rail__label {
|
||||
right: auto;
|
||||
left: calc(100% + 24px);
|
||||
}
|
||||
|
||||
/* Panels moved to the screen edge slide over their rail toward that edge. */
|
||||
html[dir='rtl']
|
||||
body.panels-edge-left:not(.mobile-shell):not(.cockpit-mode)
|
||||
#left-panel-stack
|
||||
> :not(.gev-panel-rail) {
|
||||
transform: translateX(var(--panel-rail-clearance, 48px));
|
||||
}
|
||||
html[dir='rtl']
|
||||
body.panels-edge-left:not(.mobile-shell):not(.cockpit-mode)
|
||||
#left-panel-stack
|
||||
> :not(.gev-panel-rail):not(.collapsed) {
|
||||
transform: translate(var(--panel-rail-clearance, 48px), var(--edge-rail-row));
|
||||
}
|
||||
html[dir='rtl']
|
||||
body.panels-edge-right:not(.mobile-shell):not(.cockpit-mode)
|
||||
#right-context-rail
|
||||
> :not(.gev-panel-rail) {
|
||||
transform: translate(
|
||||
calc(-1 * var(--panel-rail-clearance, 48px)),
|
||||
var(--edge-rail-row)
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/* With Scope off the map fills the whole screen. The HUD keeps its black
|
||||
plates (overlays.css); the glass chrome lifts off the map with a soft
|
||||
drop shadow. */
|
||||
:root[data-scope-mask='off'] {
|
||||
--scope-off-panel-shadow:
|
||||
0 10px 30px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
|
||||
/* Glass surfaces (rails, the rails' name panels, open panels and
|
||||
the dock) get a lift so their edges hold against bright imagery. */
|
||||
:root[data-scope-mask='off'] .ui-rail,
|
||||
:root[data-scope-mask='off'] .gev-panel-rail .ui-rail--expanded::after,
|
||||
:root[data-scope-mask='off']
|
||||
:is(.data-panel-inner, .utilities-panel-inner, .ui-panel__inner),
|
||||
:root[data-scope-mask='off'] #left-panel-stack > #pp-toggles,
|
||||
:root[data-scope-mask='off']
|
||||
#right-context-rail
|
||||
> [data-panel-id]:not(.collapsed),
|
||||
:root[data-scope-mask='off'] #command-dock > * {
|
||||
box-shadow: var(--scope-off-panel-shadow);
|
||||
}
|
||||
|
||||
:root[data-scope-mask='off'] .ui-rail__label,
|
||||
:root[data-scope-mask='off'] .ui-rail__item .ui-icon {
|
||||
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
|
||||
}
|
||||
@@ -0,0 +1,349 @@
|
||||
/* ── Visual panel: sections and one card style for every control ───────
|
||||
Look · Map source · Overlay (HUD, detection, 3D, Scope, Clean UI) ·
|
||||
Effects (Celestial, Bloom, Sharpen) · Reset. Each control is a card: a
|
||||
header row with its icon, name and an on/off pill, and its settings
|
||||
underneath. */
|
||||
|
||||
/* ── Presets and map source at the top of the panel ─────────────────── */
|
||||
.visual-presets {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
padding: 2px 0 12px;
|
||||
margin-bottom: 10px;
|
||||
border-bottom: 1px solid var(--glass-border);
|
||||
}
|
||||
|
||||
.visual-presets__heading {
|
||||
margin: 4px 0 0;
|
||||
color: var(--text-secondary);
|
||||
font: 600 10px/1.2 var(--font-mono);
|
||||
letter-spacing: 0.14em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.visual-presets__heading--row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.visual-presets__status {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.visual-presets__status.warn {
|
||||
color: #ff9f43;
|
||||
}
|
||||
|
||||
.visual-presets__grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.visual-presets__style {
|
||||
position: relative;
|
||||
display: grid;
|
||||
justify-items: center;
|
||||
gap: 4px;
|
||||
padding: 9px 4px 7px;
|
||||
color: var(--text-secondary);
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border: 1px solid var(--glass-border);
|
||||
border-radius: var(--btn-radius);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.visual-presets__style:hover {
|
||||
color: var(--text-primary);
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
|
||||
.visual-presets__style.active {
|
||||
color: var(--accent);
|
||||
background: var(--accent-dim);
|
||||
border-color: var(--accent-dim);
|
||||
}
|
||||
|
||||
.visual-presets__icon {
|
||||
font-size: 15px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.visual-presets__label {
|
||||
font: 500 11px/1 var(--font-sans);
|
||||
}
|
||||
|
||||
.visual-presets__key {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
inset-inline-end: 5px;
|
||||
color: var(--text-secondary);
|
||||
font: 9px/1 var(--font-mono);
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.visual-presets__chips {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.visual-presets__chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 5px 9px;
|
||||
color: var(--text-secondary);
|
||||
font: 500 11px/1.2 var(--font-sans);
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border: 1px solid var(--glass-border);
|
||||
border-radius: 999px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.visual-presets__chip small {
|
||||
font-size: 9px;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.visual-presets__chip:hover {
|
||||
color: var(--text-primary);
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
|
||||
.visual-presets__chip.active {
|
||||
color: var(--accent);
|
||||
background: var(--accent-dim);
|
||||
border-color: var(--accent-dim);
|
||||
}
|
||||
|
||||
.visual-presets__chip.unavailable {
|
||||
opacity: 0.45;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* The phone's More sheet shows the dock's Visual Presets tray right above
|
||||
Visual, so the panel leaves out its own copy there. */
|
||||
body.mobile-shell #pp-toggles .visual-presets {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* The body is display: contents, so its children are the panel's own flex
|
||||
items: keep them full width and unshrunk. */
|
||||
#pp-toggles .pp-panel-body > * {
|
||||
flex: none !important;
|
||||
align-self: stretch !important;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#pp-toggles .pp-panel-body > .pp-toggle-group,
|
||||
#pp-toggles .pp-panel-body > .pp-toggle-btn {
|
||||
margin-bottom: 0.4rem !important;
|
||||
}
|
||||
|
||||
#pp-toggles .pp-section-heading,
|
||||
#pp-toggles .visual-presets__heading {
|
||||
margin: 0.7rem 2px 0.35rem;
|
||||
text-align: start;
|
||||
color: rgba(199, 214, 222, 0.55);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.56rem;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.14rem;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
#pp-toggles .visual-presets__heading:first-child {
|
||||
margin-top: 0.2rem;
|
||||
}
|
||||
|
||||
/* The card skin below is the default look; the Cyber HUD keeps its own red
|
||||
skin for these controls (cyber.css), so the skin stands aside there. */
|
||||
:root:not([data-ui-theme='cyber']) #pp-toggles .pp-toggle-group {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border: 1px solid rgba(255, 255, 255, 0.07);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
/* The header row of a card, and the lone Clean UI button. */
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
#pp-toggles
|
||||
.pp-toggle-group
|
||||
> .pp-toggle-btn,
|
||||
:root:not([data-ui-theme='cyber']) #pp-toggles .pp-panel-body > .pp-toggle-btn {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
min-height: 38px;
|
||||
padding: 0 12px;
|
||||
gap: 10px;
|
||||
background: transparent !important;
|
||||
border: 0 !important;
|
||||
border-radius: 0 !important;
|
||||
box-shadow: none !important;
|
||||
backdrop-filter: none;
|
||||
-webkit-backdrop-filter: none;
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber']) #pp-toggles .pp-panel-body > .pp-toggle-btn {
|
||||
background: rgba(255, 255, 255, 0.03) !important;
|
||||
border: 1px solid rgba(255, 255, 255, 0.07) !important;
|
||||
border-radius: 10px !important;
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber']) #pp-toggles .pp-toggle-btn .pp-icon {
|
||||
width: 18px;
|
||||
font-size: 15px;
|
||||
text-align: center;
|
||||
color: rgba(199, 214, 222, 0.75);
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber']) #pp-toggles .pp-toggle-btn .pp-label {
|
||||
color: rgba(236, 244, 248, 0.9);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.62rem;
|
||||
letter-spacing: 0.12rem;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
/* An on/off pill at the right of every button header (Scope keeps its
|
||||
checkbox, which already says it). */
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
#pp-toggles
|
||||
.pp-toggle-group
|
||||
> button.pp-toggle-btn::after,
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
#pp-toggles
|
||||
.pp-panel-body
|
||||
> button.pp-toggle-btn::after {
|
||||
/* The state is the button's own (aria-pressed); the pill only shows it. */
|
||||
content: var(--pp-pill-off, 'OFF') / '';
|
||||
margin-inline-start: auto;
|
||||
padding: 2px 8px;
|
||||
color: rgba(199, 214, 222, 0.5);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.5rem;
|
||||
letter-spacing: 0.12rem;
|
||||
border: 1px solid rgba(255, 255, 255, 0.14);
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
#pp-toggles
|
||||
.pp-toggle-group
|
||||
> button.pp-toggle-btn.active::after,
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
#pp-toggles
|
||||
.pp-toggle-group
|
||||
> button.pp-toggle-btn[aria-pressed='true']::after,
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
#pp-toggles
|
||||
.pp-panel-body
|
||||
> button.pp-toggle-btn.active::after {
|
||||
content: var(--pp-pill-on, 'ON') / '';
|
||||
color: #7af0ff;
|
||||
border-color: rgba(54, 220, 255, 0.5);
|
||||
background: rgba(54, 220, 255, 0.1);
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber']) #pp-toggles .pp-toggle-btn.active .pp-icon,
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
#pp-toggles
|
||||
.pp-toggle-btn[aria-pressed='true']
|
||||
.pp-icon,
|
||||
:root:not([data-ui-theme='cyber']) #pp-toggles .pp-toggle-btn.active .pp-label,
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
#pp-toggles
|
||||
.pp-toggle-btn[aria-pressed='true']
|
||||
.pp-label {
|
||||
color: #7af0ff;
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
#pp-toggles
|
||||
.pp-toggle-group
|
||||
> .pp-toggle-btn:hover,
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
#pp-toggles
|
||||
.pp-panel-body
|
||||
> .pp-toggle-btn:hover {
|
||||
background: rgba(255, 255, 255, 0.04) !important;
|
||||
}
|
||||
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
#pp-toggles
|
||||
.pp-scope-toggle
|
||||
input[type='checkbox'] {
|
||||
margin-inline-start: auto;
|
||||
}
|
||||
|
||||
/* Settings inside a card: separated by hairlines, no boxes of their own. */
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
#pp-toggles
|
||||
.pp-toggle-group
|
||||
.pp-slider-row.visible,
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
#pp-toggles
|
||||
.pp-toggle-group
|
||||
.pp-slider-row:not([class*='cyber-sonar']):is(
|
||||
.visible,
|
||||
#scope-slider-row,
|
||||
#scope-opacity-row
|
||||
) {
|
||||
margin: 0;
|
||||
padding: 7px 12px;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.05);
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
/* The Dense button lights green elsewhere; in a card it uses the shared pill. */
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
#pp-toggles
|
||||
.pp-toggle-group
|
||||
> .pp-toggle-btn.panoptic,
|
||||
:root:not([data-ui-theme='cyber'])
|
||||
#pp-toggles
|
||||
.pp-toggle-group
|
||||
> .pp-toggle-btn.active {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
/* Reset to default, at the foot of the Visual panel. */
|
||||
#pp-toggles .pp-reset-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.4rem;
|
||||
margin: 0.6rem 0 0.2rem !important;
|
||||
padding: 0.55rem;
|
||||
color: rgba(225, 236, 242, 0.85);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.6rem;
|
||||
letter-spacing: 0.12rem;
|
||||
text-transform: uppercase;
|
||||
background: transparent;
|
||||
border: 1px dashed rgba(255, 255, 255, 0.18);
|
||||
border-radius: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#pp-toggles .pp-reset-btn .material-symbols-outlined {
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
#pp-toggles .pp-reset-btn:hover,
|
||||
#pp-toggles .pp-reset-btn:focus-visible {
|
||||
color: #fff;
|
||||
border-color: rgba(54, 220, 255, 0.5);
|
||||
background: rgba(54, 220, 255, 0.06);
|
||||
}
|
||||
|
||||
/* Clean UI is an action, not a setting, so it has no on/off pill. */
|
||||
#pp-toggles #clean-view-toggle::after {
|
||||
content: none;
|
||||
}
|
||||
@@ -56,8 +56,7 @@
|
||||
}
|
||||
/* Card typography follows the layer rows and app tokens. */
|
||||
.weather-readout,
|
||||
.rail-card,
|
||||
.rail-timeline {
|
||||
.rail-card {
|
||||
min-width: 0;
|
||||
color: var(--text-dim);
|
||||
font: 9px/1.45 var(--font-mono);
|
||||
@@ -128,7 +127,7 @@
|
||||
text-align: right;
|
||||
}
|
||||
.rail-card-line,
|
||||
.rail-timeline-readout {
|
||||
.weather-frame-time {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 9px;
|
||||
letter-spacing: 0.5px;
|
||||
@@ -188,54 +187,13 @@ html:not([lang='en']) .weather-card [data-line-id='status'] {
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
.rail-card [hidden],
|
||||
.weather-timeline-block[hidden],
|
||||
.weather-frame-time[hidden],
|
||||
.weather-observed-group[hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
.rail-timeline {
|
||||
.weather-frame-time {
|
||||
padding: 5px;
|
||||
border-bottom: 1px solid var(--weather-card-border);
|
||||
}
|
||||
.rail-timeline-track {
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(0, 1fr) auto;
|
||||
align-items: center;
|
||||
gap: 3px 8px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
.rail-timeline-track input {
|
||||
min-width: 0;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
.rail-timeline-endpoints {
|
||||
display: flex;
|
||||
grid-column: 2;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
gap: 3px 8px;
|
||||
font: 8px/1.45 var(--font-mono);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.rail-timeline-endpoints span {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.rail-timeline-endpoints span:last-child {
|
||||
margin-left: auto;
|
||||
}
|
||||
.rail-timeline-controls .data-toggle-chip {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
.rail-timeline-controls {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
.rail-timeline-readout {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
overflow-wrap: anywhere;
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: var(--text-secondary);
|
||||
|
||||
@@ -135,7 +135,7 @@ body.cockpit-mode #world-timeline {
|
||||
}
|
||||
}
|
||||
|
||||
/* The track: ticks for each launch or frame, the elapsed fill, and a native
|
||||
/* The track: ticks for each launch or strong earthquake, the elapsed fill, and a native
|
||||
range input on top for dragging and the keyboard. */
|
||||
#world-timeline .world-timeline-track {
|
||||
position: relative;
|
||||
@@ -194,6 +194,31 @@ body.cockpit-mode #world-timeline {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* A tick's label, shown over the time's bubble while the pointer is on the
|
||||
tick (or the handle rests on its mark). It slides across itself as the
|
||||
bubble does, so it stays within the track, and is never wider than the
|
||||
track: a long label ends in an ellipsis. */
|
||||
#world-timeline .world-timeline-mark-label {
|
||||
position: absolute;
|
||||
box-sizing: border-box;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
bottom: calc(100% + 30px);
|
||||
left: calc(100% * var(--at));
|
||||
z-index: 1;
|
||||
padding: 2px 8px;
|
||||
border: 1px solid rgba(0, 212, 255, 0.4);
|
||||
border-radius: 6px;
|
||||
background: var(--glass-bg);
|
||||
color: var(--text-primary);
|
||||
font-size: 11px;
|
||||
line-height: 1.4;
|
||||
white-space: pre;
|
||||
transform: translateX(calc(var(--at) * -100%));
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Zoomed, the track drags along. */
|
||||
#world-timeline .world-timeline-track.is-zoomed {
|
||||
cursor: grab;
|
||||
|
||||
@@ -13,6 +13,7 @@ import { useGlobeActionsStore } from '../stores/globeActions.js';
|
||||
import CockpitBriefing from './panels/CockpitBriefing.vue';
|
||||
import CockpitContext from './panels/CockpitContext.vue';
|
||||
import CockpitOrbital from './panels/CockpitOrbital.vue';
|
||||
import CockpitProgress from './panels/CockpitProgress.vue';
|
||||
import CockpitRadar from './panels/CockpitRadar.vue';
|
||||
import CockpitRollingValue from './panels/CockpitRollingValue.vue';
|
||||
import CockpitUtilityControls from './panels/CockpitUtilityControls.vue';
|
||||
@@ -29,30 +30,58 @@ const active = computed(() => Boolean(presence.value?.active));
|
||||
const bridge = computed(() => presence.value?.subjectKind === 'vessel');
|
||||
// A satellite subject keeps only its orbital HUD over the nadir picture.
|
||||
const orbital = computed(() => presence.value?.subjectKind === 'satellite');
|
||||
// An application provider's subject (src/cockpitSubjectProviders.js): a
|
||||
// window view whose readouts, labels and texts the provider words.
|
||||
const generic = computed(() => presence.value?.subjectGeneric === true);
|
||||
const labels = computed(() => presence.value?.subjectLabels ?? null);
|
||||
const subject = computed(() =>
|
||||
bridge.value ? 'vessel' : orbital.value ? 'satellite' : 'aircraft',
|
||||
generic.value
|
||||
? presence.value.subjectKind
|
||||
: bridge.value
|
||||
? 'vessel'
|
||||
: orbital.value
|
||||
? 'satellite'
|
||||
: 'aircraft',
|
||||
);
|
||||
const hudLabel = computed(() =>
|
||||
bridge.value
|
||||
? t('Ship bridge view')
|
||||
: orbital.value
|
||||
? t('Satellite orbital view')
|
||||
: t('Aircraft cockpit view'),
|
||||
generic.value
|
||||
? labels.value?.view
|
||||
: bridge.value
|
||||
? t('Ship bridge view')
|
||||
: orbital.value
|
||||
? t('Satellite orbital view')
|
||||
: t('Aircraft cockpit view'),
|
||||
);
|
||||
const exitLabel = computed(() =>
|
||||
bridge.value
|
||||
? t('Exit bridge view')
|
||||
: orbital.value
|
||||
? t('Exit orbital view')
|
||||
: t('Exit cockpit view'),
|
||||
generic.value
|
||||
? labels.value?.exit
|
||||
: bridge.value
|
||||
? t('Exit bridge view')
|
||||
: orbital.value
|
||||
? t('Exit orbital view')
|
||||
: t('Exit cockpit view'),
|
||||
);
|
||||
const exitText = computed(() =>
|
||||
bridge.value
|
||||
? t('EXIT BRIDGE')
|
||||
: orbital.value
|
||||
? t('EXIT ORBIT')
|
||||
: t('EXIT COCKPIT'),
|
||||
generic.value
|
||||
? labels.value?.exitText
|
||||
: bridge.value
|
||||
? t('EXIT BRIDGE')
|
||||
: orbital.value
|
||||
? t('EXIT ORBIT')
|
||||
: t('EXIT COCKPIT'),
|
||||
);
|
||||
// Look-around: on a bridge, or in a provider's view that has it.
|
||||
const looks = computed(
|
||||
() => bridge.value || (generic.value && Boolean(presence.value?.subjectLook)),
|
||||
);
|
||||
const aheadLabel = computed(() =>
|
||||
generic.value
|
||||
? presence.value?.subjectLook?.aheadLabel
|
||||
: t('Look ahead: turn the bridge view back to the bow'),
|
||||
);
|
||||
const veilStyle = computed(() => ({
|
||||
opacity: String(hud.value.veil?.level ?? 0),
|
||||
}));
|
||||
const globe = useGlobeActionsStore();
|
||||
const { resetBusy } = storeToRefs(globe);
|
||||
const initialInstruments = createInstrumentState();
|
||||
@@ -92,7 +121,9 @@ const tickStyle = (tick) =>
|
||||
|
||||
<template>
|
||||
<!-- Aircraft first-person view, a vessel's bridge or a satellite's nadir view. It can be entered from the visible view switcher. -->
|
||||
<section id="cockpit-hud" :aria-label="hudLabel" :hidden="!active" :data-subject="subject" :style="utilityStyle" v-class-toggle="{ 'signals-active': active, 'context-active': Boolean(presence?.context) }" :data-layer="orbital ? 'satellites' : hud.layer ?? undefined">
|
||||
<section id="cockpit-hud" :aria-label="hudLabel" :hidden="!active" :data-subject="subject" :data-generic="generic ? '' : undefined" :data-progress="generic && hud.progress ? '' : undefined" :style="utilityStyle" v-class-toggle="{ 'signals-active': active, 'context-active': Boolean(presence?.context) }" :data-layer="orbital ? 'satellites' : hud.layer ?? undefined">
|
||||
<!-- A provider's view may darken the picture (a veil), the HUD above it. -->
|
||||
<div v-if="generic && hud.veil" class="cockpit-veil" :class="{ streaks: hud.veil.streaks }" :style="veilStyle" aria-hidden="true"></div>
|
||||
<!-- In orbit the picture keeps only the nadir reticle, readout and zoom. -->
|
||||
<CockpitOrbital v-if="orbital" />
|
||||
<!-- One optical coordinate system: every targeting mark shares this center.
|
||||
@@ -106,7 +137,7 @@ const tickStyle = (tick) =>
|
||||
<path d="M0 600H324 M876 600H1200"/>
|
||||
</g>
|
||||
</svg>
|
||||
<svg v-else-if="!orbital" class="cockpit-frame-lines" viewBox="0 0 1200 720" preserveAspectRatio="none" aria-hidden="true" focusable="false">
|
||||
<svg v-else-if="!orbital && !generic" class="cockpit-frame-lines" viewBox="0 0 1200 720" preserveAspectRatio="none" aria-hidden="true" focusable="false">
|
||||
<g fill="none" stroke="currentColor">
|
||||
<path d="M42 106H234L266 126H334 M866 126H934L966 106H1158 M42 114H226L258 136H318 M882 136H942L974 114H1158"/>
|
||||
<path d="M42 616H226L254 598H320 M880 598H946L974 616H1158 M42 624H238L266 606H330 M870 606H934L962 624H1158"/>
|
||||
@@ -116,7 +147,7 @@ const tickStyle = (tick) =>
|
||||
<path class="cockpit-frame-warning" d="M338 645H476L490 654H710L724 645H862" fill="none"/>
|
||||
<path class="cockpit-frame-meter" d="M372 642H418 M782 642H828"/>
|
||||
</svg>
|
||||
<div v-if="!bridge && !orbital" class="cockpit-scan-array" aria-hidden="true">
|
||||
<div v-if="!bridge && !orbital && !generic" class="cockpit-scan-array" aria-hidden="true">
|
||||
<svg class="cockpit-target-geometry" viewBox="0 0 600 600" fill="none" focusable="false">
|
||||
<g class="cockpit-target-hairline">
|
||||
<circle cx="300" cy="300" r="276"/>
|
||||
@@ -150,7 +181,7 @@ const tickStyle = (tick) =>
|
||||
</div>
|
||||
<div v-if="!orbital" class="cockpit-visor-shell" aria-hidden="true">
|
||||
<!-- A ship's bridge keeps no roll arc or pitch ladder. -->
|
||||
<div v-if="!bridge" class="cockpit-roll-arc">
|
||||
<div v-if="!bridge && !generic" class="cockpit-roll-arc">
|
||||
<span style="--slot:-3;--depth:3">−30</span>
|
||||
<span style="--slot:-2;--depth:2">−20</span>
|
||||
<span style="--slot:-1;--depth:1">−10</span>
|
||||
@@ -159,10 +190,10 @@ const tickStyle = (tick) =>
|
||||
<span style="--slot:2;--depth:2">+20</span>
|
||||
<span style="--slot:3;--depth:3">+30</span>
|
||||
</div>
|
||||
<div v-if="!bridge" class="cockpit-pitch-rail cockpit-pitch-rail-left">
|
||||
<div v-if="!bridge && !generic" class="cockpit-pitch-rail cockpit-pitch-rail-left">
|
||||
<span>+20</span><span>+10</span><span class="active">00</span><span>−10</span><span>−20</span>
|
||||
</div>
|
||||
<div v-if="!bridge" class="cockpit-pitch-rail cockpit-pitch-rail-right">
|
||||
<div v-if="!bridge && !generic" class="cockpit-pitch-rail cockpit-pitch-rail-right">
|
||||
<span>+20</span><span>+10</span><span class="active">00</span><span>−10</span><span>−20</span>
|
||||
</div>
|
||||
<div class="cockpit-horizon-guide">
|
||||
@@ -174,10 +205,10 @@ const tickStyle = (tick) =>
|
||||
</svg>
|
||||
<small id="cockpit-route-direction-label">{{ direction.label }}</small>
|
||||
</div>
|
||||
<div class="cockpit-visor-status cockpit-visor-status-left">{{ bridge ? t('BRIDGE WINDOW · FWD') : t('OPTICAL PLANE · 01') }}</div>
|
||||
<div class="cockpit-visor-status cockpit-visor-status-right">{{ bridge ? (hud.trackSource === 'course' ? t('COURSE HOLD · AIS') : hud.trackSource === 'heading' ? t('HEADING HOLD · AIS') : t('NO HEADING · AIS')) : t('VISOR LOCK · ACTIVE') }}</div>
|
||||
<div v-if="!generic" class="cockpit-visor-status cockpit-visor-status-left">{{ bridge ? t('BRIDGE WINDOW · FWD') : t('OPTICAL PLANE · 01') }}</div>
|
||||
<div v-if="!generic" class="cockpit-visor-status cockpit-visor-status-right">{{ bridge ? (hud.trackSource === 'course' ? t('COURSE HOLD · AIS') : hud.trackSource === 'heading' ? t('HEADING HOLD · AIS') : t('NO HEADING · AIS')) : t('VISOR LOCK · ACTIVE') }}</div>
|
||||
</div>
|
||||
<div v-if="!orbital" id="cockpit-speed-rim" class="cockpit-altitude-rim cockpit-speed-rim" v-class-toggle="{ unavailable: hud.speedRim.unavailable }">
|
||||
<div v-if="!orbital && !generic" id="cockpit-speed-rim" class="cockpit-altitude-rim cockpit-speed-rim" v-class-toggle="{ unavailable: hud.speedRim.unavailable }">
|
||||
<span class="cockpit-altitude-rim-label">{{ bridge ? t('SPEED OVER GROUND · KTS') : t('GROUND SPEED · KTS') }}</span>
|
||||
<div class="cockpit-altitude-rim-rail"></div>
|
||||
<div class="cockpit-altitude-rim-scale">
|
||||
@@ -188,7 +219,7 @@ const tickStyle = (tick) =>
|
||||
<strong id="cockpit-speed-rim-value">{{ hud.speedRim.value }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="!orbital" id="cockpit-altitude-rim" class="cockpit-altitude-rim" :hidden="bridge" v-class-toggle="{ unavailable: hud.altitudeRim.unavailable }">
|
||||
<div v-if="!orbital && !generic" id="cockpit-altitude-rim" class="cockpit-altitude-rim" :hidden="bridge" v-class-toggle="{ unavailable: hud.altitudeRim.unavailable }">
|
||||
<span class="cockpit-altitude-rim-label">{{ t('ALTITUDE · FT') }}</span>
|
||||
<div class="cockpit-altitude-rim-rail"></div>
|
||||
<div class="cockpit-altitude-rim-scale">
|
||||
@@ -201,9 +232,9 @@ const tickStyle = (tick) =>
|
||||
</div>
|
||||
<div class="cockpit-topline">
|
||||
<div>
|
||||
<span class="cockpit-kicker">{{ bridge ? t('BRIDGE VIEW') : t('FIRST PERSON') }}</span>
|
||||
<span class="cockpit-kicker">{{ generic ? hud.kicker : bridge ? t('BRIDGE VIEW') : t('FIRST PERSON') }}</span>
|
||||
<strong id="cockpit-callsign">{{ hud.callsign }}</strong>
|
||||
<span id="cockpit-aircraft-meta" v-class-toggle="{ emergency: hud.meta.emergency }" class="cockpit-aircraft-meta">{{ hud.meta.text }}</span>
|
||||
<span id="cockpit-aircraft-meta" v-class-toggle="{ emergency: hud.meta.emergency }" class="cockpit-aircraft-meta" :data-tone="generic ? hud.meta.tone : undefined">{{ hud.meta.text }}</span>
|
||||
</div>
|
||||
<div class="cockpit-vision-controls" role="group" :aria-label="t('Cockpit vision style')">
|
||||
<button id="cockpit-vision-previous" class="cockpit-vision-nav" type="button" :aria-label="t('Previous cockpit vision style')" :title="t('Previous vision style')">
|
||||
@@ -220,20 +251,27 @@ const tickStyle = (tick) =>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="!orbital" class="cockpit-reticle material-symbols-outlined" aria-hidden="true">my_location</div>
|
||||
<!-- A bridge view turned off the bow says where it looks and offers the way back. -->
|
||||
<div v-if="bridge" class="cockpit-look" :hidden="!look.offset">
|
||||
<div v-if="!orbital && !generic" class="cockpit-reticle material-symbols-outlined" aria-hidden="true">my_location</div>
|
||||
<!-- A provider's banner: a status that names where the subject is. -->
|
||||
<div v-if="generic && hud.banner" class="cockpit-banner" role="status" :data-tone="hud.banner.tone">
|
||||
<strong>{{ hud.banner.title }}</strong>
|
||||
<small v-if="hud.banner.detail">{{ hud.banner.detail }}</small>
|
||||
</div>
|
||||
<!-- A view turned off its rest says where it looks and offers the way back. -->
|
||||
<div v-if="looks" class="cockpit-look" :hidden="!look.offset">
|
||||
<span id="cockpit-look-readout" class="cockpit-look-readout" aria-live="polite">{{ look.readout }}</span>
|
||||
<button id="cockpit-look-ahead" type="button" class="cockpit-look-ahead" :aria-label="t('Look ahead: turn the bridge view back to the bow')" :title="t('Look ahead (Home or 0)')" aria-keyshortcuts="Home 0">
|
||||
<button id="cockpit-look-ahead" type="button" class="cockpit-look-ahead" :aria-label="aheadLabel" :title="t('Look ahead (Home or 0)')" aria-keyshortcuts="Home 0">
|
||||
<span>{{ t('LOOK AHEAD') }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div v-if="!orbital" class="cockpit-compass" :aria-label="bridge ? t('Current vessel heading') : t('Current aircraft heading')">
|
||||
<div v-if="!orbital" class="cockpit-compass" :aria-label="generic ? hudLabel : bridge ? t('Current vessel heading') : t('Current aircraft heading')">
|
||||
<div class="cockpit-instrument-row">
|
||||
<div class="cockpit-readout cockpit-speed">
|
||||
<span class="cockpit-readout-label">{{ bridge ? t('SPEED OVER GROUND') : t('GROUND SPEED') }}</span>
|
||||
<!-- A provider's HUD view without a speed has no speed readout. -->
|
||||
<div v-if="!generic || hud.speed" class="cockpit-readout cockpit-speed">
|
||||
<span v-if="!generic" class="cockpit-readout-label">{{ bridge ? t('SPEED OVER GROUND') : t('GROUND SPEED') }}</span>
|
||||
<span v-else-if="hud.speedTag" class="cockpit-readout-label cockpit-speed-tag" :data-tone="hud.speedTone">{{ hud.speedTag }}</span>
|
||||
<CockpitRollingValue id="cockpit-speed-value" tag="strong" :reading="hud.speed" placeholder="---" />
|
||||
<span class="cockpit-readout-unit">{{ t('KTS') }}</span>
|
||||
<span class="cockpit-readout-unit">{{ generic ? hud.speedUnit : t('KTS') }}</span>
|
||||
</div>
|
||||
<div class="cockpit-heading-value"><CockpitRollingValue id="cockpit-heading-value" :reading="hud.heading" placeholder="---" :circular-range="360" /><small>°</small></div>
|
||||
<div v-if="bridge" class="cockpit-readout cockpit-altitude cockpit-course">
|
||||
@@ -241,7 +279,7 @@ const tickStyle = (tick) =>
|
||||
<CockpitRollingValue id="cockpit-course-value" tag="strong" :reading="hud.course" placeholder="---" :circular-range="360" />
|
||||
<span class="cockpit-readout-unit">°</span>
|
||||
</div>
|
||||
<div v-else class="cockpit-readout cockpit-altitude">
|
||||
<div v-else-if="!generic" class="cockpit-readout cockpit-altitude">
|
||||
<span class="cockpit-readout-label">{{ t('ALTITUDE') }}</span>
|
||||
<CockpitRollingValue id="cockpit-altitude-value" tag="strong" :reading="hud.altitude" placeholder="-----" />
|
||||
<span class="cockpit-readout-unit">{{ t('FT') }}</span>
|
||||
@@ -254,6 +292,21 @@ const tickStyle = (tick) =>
|
||||
<span id="cockpit-clock">{{ hud.clock }}</span>
|
||||
<span id="cockpit-position">{{ hud.position }}</span>
|
||||
</div>
|
||||
<!-- A provider's board: its readout cards, then the sources of what they show. -->
|
||||
<div v-if="generic && (hud.readouts.length || hud.sources.length)" class="cockpit-board">
|
||||
<div v-for="row in hud.readouts" :key="row.id" class="cockpit-board-card" :data-readout="row.id" :data-tone="row.tone">
|
||||
<small v-if="row.label">{{ row.label }}</small>
|
||||
<strong v-if="row.value">{{ row.value }}</strong>
|
||||
<span v-if="row.detail">{{ row.detail }}</span>
|
||||
</div>
|
||||
<dl v-if="hud.sources.length" class="cockpit-sources">
|
||||
<div v-for="row in hud.sources" :key="row.id" :data-source="row.id" :data-tone="row.tone">
|
||||
<dt v-if="row.label">{{ row.label }}</dt>
|
||||
<dd>{{ row.text }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
<CockpitProgress v-if="generic && hud.progress" :progress="hud.progress" />
|
||||
<CockpitContext />
|
||||
<CockpitBriefing />
|
||||
<!-- The bridge radar's console: bottom right, below the briefing card. -->
|
||||
@@ -261,7 +314,7 @@ const tickStyle = (tick) =>
|
||||
<CockpitRadar />
|
||||
</div>
|
||||
<CockpitUtilityControls />
|
||||
<div class="cockpit-help"><bdi>{{ t('ESC EXIT') }}</bdi><template v-if="bridge"> <span>·</span> <bdi>{{ t('ARROWS LOOK') }}</bdi> <span>·</span> <bdi>{{ t('HOME RESET') }}</bdi></template><template v-if="orbital"> <span>·</span> <bdi>{{ t('+/− ZOOM') }}</bdi> <span>·</span> <bdi>{{ t('ARROWS TILT') }}</bdi> <span>·</span> <bdi>{{ t('HOME NADIR') }}</bdi></template></div>
|
||||
<div class="cockpit-help"><bdi>{{ t('ESC EXIT') }}</bdi><template v-if="looks"> <span>·</span> <bdi>{{ t('ARROWS LOOK') }}</bdi> <span>·</span> <bdi>{{ t('HOME RESET') }}</bdi></template><template v-if="orbital"> <span>·</span> <bdi>{{ t('+/− ZOOM') }}</bdi> <span>·</span> <bdi>{{ t('ARROWS TILT') }}</bdi> <span>·</span> <bdi>{{ t('HOME NADIR') }}</bdi></template></div>
|
||||
</section>
|
||||
|
||||
<nav id="view-switcher" :aria-label="t('View switcher')">
|
||||
|
||||
@@ -21,7 +21,9 @@ import { cockpitEntryFace } from '../cockpitPresentation.js';
|
||||
const { view: ctx } = storeToRefs(useContextStore());
|
||||
const { presence: cockpit } = storeToRefs(useCockpitStore());
|
||||
// The entry names the subject it would ride (cockpitEntryFace).
|
||||
const entry = computed(() => cockpitEntryFace(cockpit.value?.entryKind));
|
||||
const entry = computed(() =>
|
||||
cockpitEntryFace(cockpit.value?.entryKind, cockpit.value?.entryFace),
|
||||
);
|
||||
// While the Bhote Koshi event is on, its panel is the rail's only content.
|
||||
const { panel: bhotePanel } = storeToRefs(useBhoteKoshiPanelStore());
|
||||
// The Scene runtime chip SceneControls presents while a scene plays.
|
||||
|
||||
@@ -17,7 +17,9 @@ const view = computed(() => hud.value ?? EMPTY);
|
||||
// answers its clicks.
|
||||
const { presence: cockpit } = storeToRefs(useCockpitStore());
|
||||
// The entry names the subject it would ride (cockpitEntryFace).
|
||||
const entry = computed(() => cockpitEntryFace(cockpit.value?.entryKind));
|
||||
const entry = computed(() =>
|
||||
cockpitEntryFace(cockpit.value?.entryKind, cockpit.value?.entryFace),
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -14,6 +14,8 @@ import StreetLevelPanel from './panels/StreetLevelPanel.vue';
|
||||
import DrawControls from './panels/DrawControls.vue';
|
||||
import GeoImport from './panels/GeoImport.vue';
|
||||
import UiSelect from '../kit/UiSelect.js';
|
||||
import LayerSectionIndex from './panels/LayerSectionIndex.vue';
|
||||
import LayerFinder from './panels/LayerFinder.vue';
|
||||
import DataLibraryBrowse from './panels/DataLibraryBrowse.vue';
|
||||
|
||||
// Scene sharing (src/scenes/sharing.js) offers its authoring bar and presents
|
||||
@@ -43,7 +45,10 @@ async function importChosen(event) {
|
||||
<div id="left-panel-stack" class="ui-scroll">
|
||||
<!-- Data Layer Toggle Panel -->
|
||||
<RailPanel id="data-panel" start-collapsed class="active" :title="t('DATA LAYERS')">
|
||||
<template #actions><LayerFinder part="buttons" /></template>
|
||||
<LayerFinder part="bar" />
|
||||
<div id="data-toggles" class="data-toggle-list ui-scroll"></div>
|
||||
<LayerSectionIndex />
|
||||
<!-- Data Library: Browse and its dialog (src/ui/libraryBrowser.js). -->
|
||||
<DataLibraryBrowse />
|
||||
</RailPanel>
|
||||
|
||||
@@ -25,7 +25,7 @@ test('omitted views lose their hosts and the rest render', () => {
|
||||
page(['welcome', 'provider-settings']);
|
||||
mountApplicationViews(document, { omit: ['provider-settings'] });
|
||||
assert.deepEqual(hostNames(), ['welcome']);
|
||||
assert.equal(document.getElementById('key-setup-chip'), null);
|
||||
assert.equal(document.getElementById('key-setup-chip') === null, true);
|
||||
assert.ok(
|
||||
document.querySelector('[data-gev-view="welcome"]').children.length,
|
||||
);
|
||||
@@ -37,7 +37,7 @@ test('a view an earlier call rendered is unmounted when a later call omits it',
|
||||
assert.ok(document.getElementById('key-setup-chip'));
|
||||
mountApplicationViews(document, { omit: ['provider-settings'] });
|
||||
assert.deepEqual(hostNames(), ['welcome']);
|
||||
assert.equal(document.getElementById('key-setup-chip'), null);
|
||||
assert.equal(document.getElementById('key-setup-chip') === null, true);
|
||||
});
|
||||
|
||||
test('unknown view names are refused, in the page or in the omit list', () => {
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
<script setup>
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue';
|
||||
import { cockpitProgressLayout } from '../../../cockpitProgress.js';
|
||||
|
||||
// A provider subject's progress line (src/cockpitSubjectProviders.js): a thin
|
||||
// line along the bottom of the view, its ticks, labels and marker laid out
|
||||
// at the line's own width (src/cockpitProgress.js). The part before the
|
||||
// marker is dimmed. Everything it shows is worded by the provider. It is an
|
||||
// image named by the provider's summary; with no summary it is decoration,
|
||||
// hidden from assistive technology.
|
||||
|
||||
const props = defineProps({
|
||||
progress: { type: Object, required: true },
|
||||
});
|
||||
|
||||
/** The width laid out at before the line is measured (px). */
|
||||
const FALLBACK_WIDTH_PX = 960;
|
||||
|
||||
const root = ref(null);
|
||||
const widthPx = ref(0);
|
||||
let observer = null;
|
||||
|
||||
const measure = () => {
|
||||
widthPx.value = root.value?.clientWidth || 0;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
measure();
|
||||
if (typeof ResizeObserver === 'function' && root.value) {
|
||||
observer = new ResizeObserver(measure);
|
||||
observer.observe(root.value);
|
||||
}
|
||||
});
|
||||
onBeforeUnmount(() => observer?.disconnect());
|
||||
|
||||
const width = computed(() => widthPx.value || FALLBACK_WIDTH_PX);
|
||||
const layout = computed(() =>
|
||||
cockpitProgressLayout(props.progress, width.value),
|
||||
);
|
||||
// Positions as shares of the line, so a resize between measurements keeps
|
||||
// every mark in place.
|
||||
const percent = (x) => `${((x / width.value) * 100).toFixed(3)}%`;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div ref="root" class="cockpit-progress" :role="progress.summary ? 'img' : undefined" :aria-label="progress.summary || undefined" :aria-hidden="progress.summary ? undefined : 'true'">
|
||||
<template v-if="layout">
|
||||
<div class="cockpit-progress-line" aria-hidden="true">
|
||||
<span class="cockpit-progress-travelled" :style="{ width: percent(layout.travelledX) }"></span>
|
||||
</div>
|
||||
<i v-for="(tick, index) in layout.ticks" :key="`t${index}`" class="cockpit-progress-tick" :class="{ labelled: tick.labelled, merged: tick.count > 1, travelled: tick.x <= layout.travelledX }" :data-tone="tick.tone" :style="{ left: percent(tick.x) }" aria-hidden="true"></i>
|
||||
<span v-for="(label, index) in layout.labels" :key="`l${index}`" class="cockpit-progress-label" :data-align="label.align" :data-tone="label.tone" :style="{ left: percent(label.left), width: `${label.width}px` }" aria-hidden="true"><b>{{ label.text }}</b><small v-if="label.detail">{{ label.detail }}</small></span>
|
||||
<i v-if="layout.marker" class="cockpit-progress-marker" :class="{ dwell: layout.marker.dwell }" :style="{ left: percent(layout.marker.x) }" aria-hidden="true"></i>
|
||||
<span v-if="layout.tag" class="cockpit-progress-tag" aria-hidden="true">{{ layout.tag }}</span>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
@@ -11,12 +11,27 @@ import { useCockpitStore } from '../../stores/cockpit.js';
|
||||
const { route } = storeToRefs(useCockpitStore());
|
||||
const initial = createRouteState();
|
||||
const r = computed(() => route.value ?? initial);
|
||||
// A provider subject's card is titled by its provider, in the page's language.
|
||||
const kicker = computed(() =>
|
||||
r.value.kind === 'subject'
|
||||
? r.value.title
|
||||
: r.value.kind === 'vessel'
|
||||
? t('REPORTED VOYAGE')
|
||||
: t('ESTIMATED FLIGHT PLAN'),
|
||||
);
|
||||
const label = computed(() =>
|
||||
r.value.kind === 'subject'
|
||||
? r.value.title || undefined
|
||||
: r.value.kind === 'vessel'
|
||||
? t('Reported voyage')
|
||||
: t('Estimated flight plan'),
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section id="cockpit-route" class="cockpit-route-card" :aria-label="r.kind === 'vessel' ? t('Reported voyage') : t('Estimated flight plan')" :hidden="!r.visible">
|
||||
<section id="cockpit-route" class="cockpit-route-card" :aria-label="label" :hidden="!r.visible">
|
||||
<div class="cockpit-route-heading">
|
||||
<span class="cockpit-route-kicker">{{ r.kind === 'vessel' ? t('REPORTED VOYAGE') : t('ESTIMATED FLIGHT PLAN') }}</span>
|
||||
<span class="cockpit-route-kicker">{{ kicker }}</span>
|
||||
<small id="cockpit-route-status">{{ r.status }}</small>
|
||||
</div>
|
||||
<div class="cockpit-route-endpoints">
|
||||
|
||||
@@ -9,10 +9,12 @@ import { useCockpitStore } from '../../stores/cockpit.js';
|
||||
import { useDisplayStore } from '../../stores/display.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
|
||||
// The Cockpit's Display and Radio launchers and their popovers. RadioControls
|
||||
// presents which popover is open and the compact Radio controls; until it
|
||||
// does, both are closed and the controls show their initial state. The
|
||||
// controls call RadioControls through the store. The Display popover's slots
|
||||
// The Cockpit's Display and Radio launchers and their popovers, and the
|
||||
// desktop look's rail, whose icons stay at the edge and open one panel at a
|
||||
// time as the main page's rails do. RadioControls presents which popover is
|
||||
// open and the compact Radio controls; until it does, both are closed and the
|
||||
// controls show their initial state. The controls call RadioControls through
|
||||
// the store. The Display popover's slots
|
||||
// are static: the Display panel teleports its real controls into them while
|
||||
// the Cockpit display portal publishes them.
|
||||
const store = useRadioStore();
|
||||
@@ -52,6 +54,7 @@ const radioLabel = computed(() =>
|
||||
<div class="cockpit-utility-launcher" data-cockpit-launcher="display">
|
||||
<span>{{ t('DISPLAY') }}</span>
|
||||
<span class="cockpit-utility-divider" aria-hidden="true"></span>
|
||||
<button v-if="open.display" type="button" class="cockpit-utility-collapse" :aria-label="t('Collapse panel')" :title="t('Collapse panel')" @click="act('toggleCockpitUtility', 'display', { returnFocus: true })">−</button>
|
||||
<button id="cockpit-display-toggle-btn" class="cockpit-utility-glyph" type="button" :aria-expanded="String(open.display)" aria-controls="cockpit-display-panel" :aria-label="displayLabel" :title="displayLabel">{{ open.display ? '▶' : '◀' }}</button>
|
||||
</div>
|
||||
<div id="cockpit-display-panel" class="cockpit-utility-popover ui-scroll" v-class-toggle="{ 'uses-shared-display-controls': !!cockpitPortal }" role="group" :aria-label="t('Cockpit display options')" :hidden="!open.display">
|
||||
@@ -65,6 +68,7 @@ const radioLabel = computed(() =>
|
||||
<div class="cockpit-utility-launcher" data-cockpit-launcher="radio">
|
||||
<span>{{ t('RADIO') }}</span>
|
||||
<span class="cockpit-utility-divider" aria-hidden="true"></span>
|
||||
<button v-if="open.radio" type="button" class="cockpit-utility-collapse" :aria-label="t('Collapse panel')" :title="t('Collapse panel')" @click="act('toggleCockpitUtility', 'radio', { returnFocus: true })">−</button>
|
||||
<button id="cockpit-radio-toggle-btn" @click="act('toggleCockpitRadio')" class="cockpit-utility-glyph" type="button" :aria-expanded="String(open.radio)" aria-controls="cockpit-radio-panel" :aria-label="radioLabel" :title="radioLabel">{{ open.radio ? '▶' : '◀' }}</button>
|
||||
</div>
|
||||
<div id="cockpit-radio-panel" class="cockpit-utility-popover cockpit-radio-compact" role="group" :aria-label="t('Cockpit compact Radio controls')" :hidden="!open.radio">
|
||||
@@ -82,5 +86,15 @@ const radioLabel = computed(() =>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cockpit-utility-rail" :class="{ 'is-open': open.display || open.radio }">
|
||||
<span class="cockpit-utility-rail__labels" aria-hidden="true">
|
||||
<span>{{ t('DISPLAY') }}</span>
|
||||
<span>{{ t('RADIO') }}</span>
|
||||
</span>
|
||||
<span class="cockpit-utility-rail__icons">
|
||||
<button type="button" class="cockpit-utility-rail__item" data-cockpit-rail-item="display" :class="{ 'is-on': open.display }" :aria-expanded="String(open.display)" aria-controls="cockpit-display-panel" :aria-label="displayLabel" :title="displayLabel" @click="act('toggleCockpitUtility', 'display')"><span class="material-symbols-outlined" aria-hidden="true">tune</span></button>
|
||||
<button type="button" class="cockpit-utility-rail__item" data-cockpit-rail-item="radio" :class="{ 'is-on': open.radio }" :aria-expanded="String(open.radio)" aria-controls="cockpit-radio-panel" :aria-label="radioLabel" :title="radioLabel" @click="act('toggleCockpitUtility', 'radio')"><span class="material-symbols-outlined" aria-hidden="true">radio</span></button>
|
||||
</span>
|
||||
</div>
|
||||
</aside>
|
||||
</template>
|
||||
@@ -5,12 +5,14 @@ import { t } from '../../../i18n/index.js';
|
||||
import { vPanelState } from '../../rail/panelState.js';
|
||||
import { vClassToggle } from '../../rail/classToggle.js';
|
||||
import PanelCollapseButton from '../../rail/PanelCollapseButton.vue';
|
||||
import UiPanelEdge from '../../kit/UiPanelEdge.vue';
|
||||
import UiSegmented from '../../kit/UiSegmented.vue';
|
||||
import UiSlider from '../../kit/UiSlider.js';
|
||||
import { useDisplayStore } from '../../stores/display.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiSelect from '../../kit/UiSelect.js';
|
||||
import { StyleParameterRows } from '../../styleParameters.js';
|
||||
import VisualPresets from './VisualPresets.vue';
|
||||
|
||||
// The Display panel. VisualSettings presents the HUD, Sonar, Scope,
|
||||
// Celestial, detection, bloom and sharpen and AircraftDisplay the 3D group,
|
||||
@@ -21,6 +23,12 @@ const { view, models3d, parameters, cockpitPortal } = storeToRefs(display);
|
||||
// A control's change goes to its owner (DisplayBindings).
|
||||
const act = (name, ...args) => display.act(name, ...args);
|
||||
const pct = (value) => `${value}%`;
|
||||
// The words of the on/off pill each card header draws (visual-panel.css), as
|
||||
// CSS strings.
|
||||
const pillWords = computed(() => ({
|
||||
'--pp-pill-on': JSON.stringify(t('ON')),
|
||||
'--pp-pill-off': JSON.stringify(t('OFF')),
|
||||
}));
|
||||
const hud = computed(() => view.value?.hud ?? null);
|
||||
const sonar = computed(() => view.value?.sonar ?? null);
|
||||
const sonarOn = computed(() => sonar.value?.enabled ?? true);
|
||||
@@ -29,6 +37,7 @@ const detectButton = computed(() => detection.value?.button ?? null);
|
||||
const allocation = computed(() => detection.value?.allocation ?? 'ELASTIC');
|
||||
const scopeOn = computed(() => view.value?.scope.enabled ?? true);
|
||||
const scopeFeather = computed(() => view.value?.scope.featherPct ?? 100);
|
||||
const scopeOpacity = computed(() => view.value?.scope.opacityPct ?? 100);
|
||||
const celestial = computed(() => view.value?.celestial ?? null);
|
||||
const celestialTitle = computed(() =>
|
||||
celestial.value && !celestial.value.supported
|
||||
@@ -51,15 +60,18 @@ const allocationOptions = computed(() => [
|
||||
<!-- Post-processing toggles (top-right) -->
|
||||
<div id="pp-toggles" v-panel-state="'pp-toggles'" class="panel-collapsible collapsed ui-scroll" data-panel-id="pp-toggles">
|
||||
<div class="compact pp-header-row">
|
||||
<span class="pp-header-label">{{ t('DISPLAY') }}</span>
|
||||
<span class="pp-header-label">{{ t('VISUAL', { context: 'panel' }) }}</span>
|
||||
<span class="panel-divider" aria-hidden="true"></span>
|
||||
<PanelCollapseButton class="pp-collapse-btn" target="pp-toggles" :name="t('DISPLAY')" sideways start-collapsed />
|
||||
<UiPanelEdge />
|
||||
<PanelCollapseButton class="pp-collapse-btn" target="pp-toggles" :name="t('VISUAL', { context: 'panel' })" sideways start-collapsed />
|
||||
</div>
|
||||
<div class="pp-panel-body ui-scroll" data-rail-scroller>
|
||||
<div class="pp-panel-body ui-scroll" data-rail-scroller :style="pillWords">
|
||||
<VisualPresets />
|
||||
<!-- Cockpit shows these four groups in its Display popover: each teleports to the slot the Cockpit display portal publishes. While disabled a Teleport stays in place; its 'body' target only keeps server rendering from dropping it. -->
|
||||
<p class="pp-section-heading">{{ t('Overlay') }}</p>
|
||||
<Teleport :to="cockpitPortal?.hud ?? 'body'" :disabled="!cockpitPortal?.hud">
|
||||
<div class="pp-toggle-group">
|
||||
<button class="pp-toggle-btn" :class="{ active: hud?.visible }" id="hud-toggle" @click="act('toggleHud')" :title="t('Intelligence HUD (H)')">
|
||||
<button class="pp-toggle-btn" :class="{ active: hud?.visible }" :aria-pressed="String(Boolean(hud?.visible))" id="hud-toggle" @click="act('toggleHud')" :title="t('Intelligence HUD (H)')">
|
||||
<span class="pp-icon">◎</span>
|
||||
<span class="pp-label" translate="no">HUD</span>
|
||||
</button>
|
||||
@@ -168,19 +180,25 @@ const allocationOptions = computed(() => [
|
||||
<UiSlider class="pp-slider" id="scope-feather-slider" @update:model-value="act('setScopeFeather', $event)" min="0" max="200" :model-value="scopeFeather" :disabled="!scopeOn" :aria-label="t('Scope edge feather')" :title="t('Scope edge feather as a percentage of the keyhole radius')" />
|
||||
<span class="pp-slider-value" id="scope-feather-value">{{ pct(scopeFeather) }}</span>
|
||||
</div>
|
||||
<div class="pp-slider-row visible" id="scope-opacity-row">
|
||||
<span class="pp-slider-mini-label">{{ t('Opacity') }}</span>
|
||||
<UiSlider class="pp-slider" id="scope-opacity-slider" @update:model-value="act('setScopeOpacity', $event)" min="50" max="100" :model-value="scopeOpacity" :disabled="!scopeOn" :aria-label="t('Scope opacity')" :title="t('How dark the scope shades the view outside the keyhole')" />
|
||||
<span class="pp-slider-value" id="scope-opacity-value">{{ pct(scopeOpacity) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<button class="pp-toggle-btn" id="clean-view-toggle" @click="act('toggleCleanView')" :title="t('Hide UI chrome')">
|
||||
<span class="pp-icon">□</span>
|
||||
<span class="pp-label">{{ t('Clean UI') }}</span>
|
||||
</button>
|
||||
<p class="pp-section-heading">{{ t('Effects') }}</p>
|
||||
<div class="pp-toggle-group">
|
||||
<UiButton class="pp-toggle-btn" :pressed="celestial?.active ?? false" pressed-class="active" id="celestial-toggle" @click="act('toggleCelestial')" :title="celestialTitle" :disabled="celestial ? !celestial.supported : undefined" :aria-disabled="celestial ? String(!celestial.supported) : undefined">
|
||||
<span class="pp-icon material-symbols-outlined" aria-hidden="true">flare</span>
|
||||
<span class="pp-label">{{ t('Celestial') }}</span>
|
||||
</UiButton>
|
||||
</div>
|
||||
<button class="pp-toggle-btn" id="clean-view-toggle" @click="act('toggleCleanView')" :title="t('Hide UI chrome')">
|
||||
<span class="pp-icon">□</span>
|
||||
<span class="pp-label">{{ t('Clean UI') }}</span>
|
||||
</button>
|
||||
<div class="pp-toggle-group">
|
||||
<button class="pp-toggle-btn" :class="{ active: view?.bloom.active }" id="bloom-toggle" @click="act('toggleBloom')" :title="t('Bloom / Glow')">
|
||||
<button class="pp-toggle-btn" :class="{ active: view?.bloom.active }" :aria-pressed="String(Boolean(view?.bloom.active))" id="bloom-toggle" @click="act('toggleBloom')" :title="t('Bloom / Glow')">
|
||||
<span class="pp-icon">✨</span>
|
||||
<span class="pp-label">{{ t('Bloom') }}</span>
|
||||
</button>
|
||||
@@ -190,7 +208,7 @@ const allocationOptions = computed(() => [
|
||||
</div>
|
||||
</div>
|
||||
<div class="pp-toggle-group">
|
||||
<button class="pp-toggle-btn" :class="{ active: view?.sharpen.active }" id="sharpen-toggle" @click="act('toggleSharpen')" :title="t('Sharpening')">
|
||||
<button class="pp-toggle-btn" :class="{ active: view?.sharpen.active }" :aria-pressed="String(Boolean(view?.sharpen.active))" id="sharpen-toggle" @click="act('toggleSharpen')" :title="t('Sharpening')">
|
||||
<span class="pp-icon">🔍</span>
|
||||
<span class="pp-label">{{ t('Sharpen') }}</span>
|
||||
</button>
|
||||
@@ -199,6 +217,9 @@ const allocationOptions = computed(() => [
|
||||
<span class="pp-slider-value" id="sharpen-intensity-value">{{ pct(view?.sharpen.intensity ?? 49) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="pp-reset-btn" :title="t('Reset Visual to its defaults: Normal look, HUD, scope, labels and effects')" @click="act('resetVisual')">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">restart_alt</span>{{ t('Reset to default') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -77,7 +77,7 @@ test('an application\'s row actions sit before fly to, labelled, and act on thei
|
||||
const note = row('a1').querySelector('.draw-mark-note');
|
||||
assert.equal(note.getAttribute('role'), 'status');
|
||||
assert.equal(note.textContent, '');
|
||||
assert.equal(row('a2').querySelector('.draw-mark-note'), null, 'a row without actions has no note');
|
||||
assert.equal(row('a2').querySelector('.draw-mark-note') === null, true, 'a row without actions has no note');
|
||||
const line = { ...LINE, path: [[0, 0], [1, 0]] };
|
||||
store.publishDraw({ active: true, shape: 'area', color: 'primary', hint: '', marks: presentDrawMarks([line], drawMarkActions([tag]), new Map([['a1', { busy: true, text: '' }]])) });
|
||||
await nextTick();
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
<script>
|
||||
import { ref as moduleRef } from 'vue';
|
||||
|
||||
/** Voice and other callers ask for this event to show every row again. */
|
||||
export const LAYER_FINDER_CLEAR_EVENT = 'gev:layer-finder-clear';
|
||||
|
||||
// The header buttons and the bar under the header are two instances that
|
||||
// share one finder.
|
||||
const finder = {
|
||||
query: moduleRef(''),
|
||||
show: moduleRef('all'),
|
||||
searching: moduleRef(false),
|
||||
filtering: moduleRef(false),
|
||||
// A group's stable key (LayerRows' `data-group`), not its translated name,
|
||||
// so a language change keeps the choice.
|
||||
category: moduleRef(''),
|
||||
categories: moduleRef([]),
|
||||
shown: moduleRef(0),
|
||||
};
|
||||
</script>
|
||||
|
||||
<script setup>
|
||||
import { nextTick, onBeforeUnmount, onMounted, ref, watch, computed } from 'vue';
|
||||
import { msg, t } from '../../../i18n/index.js';
|
||||
|
||||
// Search and filter for the Data Layers list. The rows are rendered elsewhere
|
||||
// (LayerRows), so this works on the list as it stands: it marks rows that
|
||||
// don't match as filtered out, hides a group heading when none of its rows
|
||||
// are left, and keeps doing so as rows update.
|
||||
const props = defineProps({
|
||||
/** 'buttons' for the header, 'bar' for the row under it. */
|
||||
part: { type: String, default: 'buttons' },
|
||||
});
|
||||
|
||||
const { query, show, searching, filtering, category, categories, shown } =
|
||||
finder;
|
||||
|
||||
const SHOWS = [
|
||||
{ id: 'all', label: msg('All layers') },
|
||||
{ id: 'on', label: msg('On') },
|
||||
{ id: 'off', label: msg('Off') },
|
||||
];
|
||||
|
||||
const narrowed = computed(
|
||||
() =>
|
||||
Boolean(query.value.trim()) || show.value !== 'all' || Boolean(category.value),
|
||||
);
|
||||
const categoryLabel = computed(
|
||||
() => categories.value.find((c) => c.key === category.value)?.label || '',
|
||||
);
|
||||
|
||||
function apply() {
|
||||
const list = document.getElementById('data-toggles');
|
||||
if (!list) return;
|
||||
const q = query.value.trim().toLocaleLowerCase();
|
||||
let heading = null;
|
||||
let headingHasRows = false;
|
||||
let count = 0;
|
||||
let group = '';
|
||||
const groups = [];
|
||||
const close = () =>
|
||||
heading?.classList.toggle('is-filtered', !headingHasRows);
|
||||
for (const el of list.children) {
|
||||
if (el.classList.contains('data-layer-group-heading')) {
|
||||
close();
|
||||
heading = el;
|
||||
headingHasRows = false;
|
||||
group = el.dataset.group || el.textContent.trim();
|
||||
groups.push({ key: group, label: el.textContent.trim() });
|
||||
continue;
|
||||
}
|
||||
if (!el.classList.contains('data-toggle-row')) continue;
|
||||
// The name on screen, in the UI language, and the English name too.
|
||||
const name = [el.querySelector('.data-name')?.textContent, el.dataset.layerName]
|
||||
.filter(Boolean)
|
||||
.join(' ')
|
||||
.toLocaleLowerCase();
|
||||
// On means the layer is enabled, whatever its feed is doing.
|
||||
const on = Boolean(
|
||||
el.querySelector('.data-toggle-btn')?.classList.contains('active'),
|
||||
);
|
||||
const match =
|
||||
(!q || name.includes(q)) &&
|
||||
(show.value === 'all' || (show.value === 'on') === on) &&
|
||||
(!category.value || group === category.value);
|
||||
el.classList.toggle('is-filtered', !match);
|
||||
if (match) {
|
||||
headingHasRows = true;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
close();
|
||||
list.classList.toggle('is-filtering', narrowed.value);
|
||||
const same =
|
||||
groups.length === categories.value.length &&
|
||||
groups.every(
|
||||
(g, i) =>
|
||||
g.key === categories.value[i].key && g.label === categories.value[i].label,
|
||||
);
|
||||
if (!same) categories.value = groups;
|
||||
// A group that went away takes its filter with it.
|
||||
if (category.value && !groups.some((g) => g.key === category.value))
|
||||
category.value = '';
|
||||
shown.value = count;
|
||||
}
|
||||
|
||||
function clearAll() {
|
||||
query.value = '';
|
||||
show.value = 'all';
|
||||
category.value = '';
|
||||
searching.value = false;
|
||||
filtering.value = false;
|
||||
apply();
|
||||
}
|
||||
|
||||
let observer = null;
|
||||
let frame = 0;
|
||||
if (props.part === 'bar') {
|
||||
onMounted(() => {
|
||||
const list = document.getElementById('data-toggles');
|
||||
if (!list) return;
|
||||
// Rows repaint many times a second; filter once per frame at most.
|
||||
observer = new MutationObserver(() => {
|
||||
if (frame) return;
|
||||
frame = requestAnimationFrame(() => {
|
||||
frame = 0;
|
||||
apply();
|
||||
});
|
||||
});
|
||||
observer.observe(list, {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
characterData: true,
|
||||
attributes: true,
|
||||
attributeFilter: ['class', 'data-feed-state'],
|
||||
});
|
||||
apply();
|
||||
document.addEventListener(LAYER_FINDER_CLEAR_EVENT, clearAll);
|
||||
});
|
||||
onBeforeUnmount(() => {
|
||||
observer?.disconnect();
|
||||
cancelAnimationFrame(frame);
|
||||
document.removeEventListener(LAYER_FINDER_CLEAR_EVENT, clearAll);
|
||||
});
|
||||
watch([query, show, category], apply);
|
||||
}
|
||||
|
||||
const searchBtn = () => document.getElementById('layer-finder-search-btn');
|
||||
async function toggleSearch() {
|
||||
searching.value = !searching.value;
|
||||
if (!searching.value) query.value = '';
|
||||
await nextTick();
|
||||
if (searching.value) document.getElementById('layer-finder-input')?.focus();
|
||||
}
|
||||
// Escape in the field closes the search and stays there: it must not also
|
||||
// fold the panel or leave the cockpit.
|
||||
async function closeSearch() {
|
||||
searching.value = false;
|
||||
query.value = '';
|
||||
await nextTick();
|
||||
searchBtn()?.focus();
|
||||
}
|
||||
|
||||
// The filter is a disclosure of two groups of toggle buttons. Opening it moves
|
||||
// focus to the chosen option; Escape, or a press outside, closes it and gives
|
||||
// focus back to its button.
|
||||
const filterEl = ref(null);
|
||||
const menuEl = ref(null);
|
||||
const triggerEl = ref(null);
|
||||
const options = () => [...(menuEl.value?.querySelectorAll('button') || [])];
|
||||
async function toggleFilter() {
|
||||
filtering.value = !filtering.value;
|
||||
if (!filtering.value) return;
|
||||
await nextTick();
|
||||
const menu = menuEl.value;
|
||||
if (!menu) return;
|
||||
// Keep the menu inside the panel, which clips what leaves it.
|
||||
const panel = menu.closest('.ui-panel, [data-panel-id]');
|
||||
const room = panel
|
||||
? panel.getBoundingClientRect().bottom - menu.getBoundingClientRect().top - 8
|
||||
: 0;
|
||||
menu.style.maxHeight = room > 80 ? `${Math.floor(room)}px` : '';
|
||||
(menu.querySelector('[aria-pressed="true"]') || options()[0])?.focus();
|
||||
}
|
||||
function closeFilter({ refocus = false } = {}) {
|
||||
filtering.value = false;
|
||||
if (refocus) triggerEl.value?.focus();
|
||||
}
|
||||
function onMenuKey(event) {
|
||||
if (event.key === 'Escape') {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
closeFilter({ refocus: true });
|
||||
return;
|
||||
}
|
||||
const step = { ArrowDown: 1, ArrowUp: -1 }[event.key];
|
||||
const edge = { Home: 0, End: -1 }[event.key];
|
||||
if (step === undefined && edge === undefined) return;
|
||||
event.preventDefault();
|
||||
const all = options();
|
||||
const at = all.indexOf(document.activeElement);
|
||||
const next =
|
||||
step !== undefined
|
||||
? all[(at + step + all.length) % all.length]
|
||||
: all.at(edge);
|
||||
next?.focus();
|
||||
}
|
||||
function onOutside(e) {
|
||||
if (filtering.value && filterEl.value && !filterEl.value.contains(e.target))
|
||||
closeFilter();
|
||||
}
|
||||
function pickCategory(key) {
|
||||
category.value = category.value === key ? '' : key;
|
||||
}
|
||||
if (props.part === 'buttons') {
|
||||
onMounted(() => document.addEventListener('pointerdown', onOutside, true));
|
||||
onBeforeUnmount(() =>
|
||||
document.removeEventListener('pointerdown', onOutside, true),
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<template v-if="part === 'buttons'">
|
||||
<button id="layer-finder-search-btn" type="button" class="layer-finder__btn" :class="{ active: searching || query }" :aria-pressed="String(searching)" :aria-label="t('Search layers')" :title="t('Search layers')" @click="toggleSearch">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">search</span>
|
||||
</button>
|
||||
<span ref="filterEl" class="layer-finder__filter">
|
||||
<button ref="triggerEl" type="button" class="layer-finder__btn" :class="{ active: show !== 'all' || category }" :aria-expanded="String(filtering)" aria-controls="layer-finder-menu" :aria-label="t('Filter layers')" :title="t('Filter layers')" @click="toggleFilter">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">filter_list</span>
|
||||
</button>
|
||||
<span v-if="filtering" id="layer-finder-menu" ref="menuEl" class="layer-finder__menu" role="group" :aria-label="t('Filter layers')" @keydown="onMenuKey">
|
||||
<span role="group" :aria-label="t('Status')">
|
||||
<span class="layer-finder__menu-head" aria-hidden="true">{{ t('Status') }}</span>
|
||||
<button v-for="s in SHOWS" :key="s.id" type="button" :aria-pressed="String(show === s.id)" :class="{ active: show === s.id }" @click="show = s.id">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">{{ show === s.id ? 'radio_button_checked' : 'radio_button_unchecked' }}</span>{{ t(s.label) }}
|
||||
</button>
|
||||
</span>
|
||||
<span v-if="categories.length" role="group" :aria-label="t('Category')">
|
||||
<span class="layer-finder__menu-head" aria-hidden="true">{{ t('Category') }}</span>
|
||||
<button v-for="c in categories" :key="c.key" type="button" :aria-pressed="String(category === c.key)" :class="{ active: category === c.key }" @click="pickCategory(c.key)">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">{{ category === c.key ? 'radio_button_checked' : 'radio_button_unchecked' }}</span>{{ c.label }}
|
||||
</button>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</template>
|
||||
<div v-else-if="searching || narrowed" class="layer-finder__bar">
|
||||
<label v-if="searching" class="layer-finder__field">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">search</span>
|
||||
<input id="layer-finder-input" v-model="query" type="search" :placeholder="t('Search layers…')" :aria-label="t('Search layers')" @keydown.esc.stop.prevent="closeSearch" />
|
||||
</label>
|
||||
<button v-if="show !== 'all'" type="button" class="layer-finder__chip" @click="show = 'all'">
|
||||
{{ show === 'on' ? t('On') : t('Off') }}<span class="material-symbols-outlined" aria-hidden="true">close</span>
|
||||
</button>
|
||||
<button v-if="category" type="button" class="layer-finder__chip" @click="category = ''">
|
||||
{{ categoryLabel }}<span class="material-symbols-outlined" aria-hidden="true">close</span>
|
||||
</button>
|
||||
<p v-if="narrowed && shown === 0" class="layer-finder__empty" role="status">{{ t('No layers match') }}</p>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,124 @@
|
||||
<script setup>
|
||||
import { onBeforeUnmount, onMounted, ref } from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
|
||||
// A slim index beside the Data Layers list: one tick per group (Movement,
|
||||
// Cameras, Infrastructure…). Hovering a tick names its group, clicking it
|
||||
// scrolls the list there, and the tick for the group in view is lit. It reads
|
||||
// the list's group headings, which LayerRows renders, so it follows whatever
|
||||
// groups the layers bring.
|
||||
const sections = ref([]);
|
||||
const current = ref(0);
|
||||
let list = null;
|
||||
let observer = null;
|
||||
let resize = null;
|
||||
|
||||
function headings() {
|
||||
return list ? [...list.querySelectorAll('.data-layer-group-heading:not(.is-filtered)')] : [];
|
||||
}
|
||||
function readSections() {
|
||||
const next = headings().map((h, i) => ({ i, label: h.textContent.trim() }));
|
||||
// Live counts repaint the rows all the time; keep the ticks unless the
|
||||
// groups themselves changed.
|
||||
const same =
|
||||
next.length === sections.value.length &&
|
||||
next.every((s, i) => s.label === sections.value[i].label);
|
||||
if (!same) sections.value = next;
|
||||
syncCurrent();
|
||||
}
|
||||
// Only headings matter: a heading added, removed, renamed (a language change)
|
||||
// or filtered out. Rows' counts and states change many times a second.
|
||||
const isHeading = (node) =>
|
||||
node?.classList?.contains('data-layer-group-heading') ||
|
||||
node?.parentElement?.classList?.contains('data-layer-group-heading');
|
||||
let frame = 0;
|
||||
function onMutations(mutations) {
|
||||
if (frame) return;
|
||||
const relevant = mutations.some(
|
||||
(m) =>
|
||||
(m.type === 'childList' && m.target === list) || isHeading(m.target),
|
||||
);
|
||||
if (!relevant) return;
|
||||
frame = requestAnimationFrame(() => {
|
||||
frame = 0;
|
||||
readSections();
|
||||
});
|
||||
}
|
||||
function syncCurrent() {
|
||||
if (!list) return;
|
||||
const top = list.getBoundingClientRect().top + 8;
|
||||
let index = 0;
|
||||
headings().forEach((h, i) => {
|
||||
if (h.getBoundingClientRect().top <= top + 4) index = i;
|
||||
});
|
||||
// At the very end of the list the last group is the one in view.
|
||||
const scrolls = list.clientHeight > 0 && list.scrollHeight > list.clientHeight + 2;
|
||||
if (scrolls && list.scrollTop + list.clientHeight >= list.scrollHeight - 2) index = sections.value.length - 1;
|
||||
current.value = Math.max(0, index);
|
||||
}
|
||||
// The name of the tick being pointed at or focused. It is drawn on the page
|
||||
// itself, just outside the panel's edge: the panel clips what leaves it, and a
|
||||
// label inside would cover the rows.
|
||||
const tip = ref(null);
|
||||
function showTip(event, section) {
|
||||
const box = event.currentTarget.getBoundingClientRect();
|
||||
// Beside the tick on whichever side has room: the stack sits on the right
|
||||
// in a right-to-left language.
|
||||
const before = window.innerWidth - box.right < 180;
|
||||
tip.value = {
|
||||
label: section.label,
|
||||
before,
|
||||
left: `${Math.round(before ? box.left - 10 : box.right + 10)}px`,
|
||||
top: `${Math.round(box.top + box.height / 2)}px`,
|
||||
};
|
||||
}
|
||||
const hideTip = () => {
|
||||
tip.value = null;
|
||||
};
|
||||
function jump(i) {
|
||||
const h = headings()[i];
|
||||
if (!h || !list) return;
|
||||
list.scrollTo({ top: h.offsetTop - list.offsetTop - 4, behavior: 'smooth' });
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
list = document.getElementById('data-toggles');
|
||||
if (!list) return;
|
||||
observer = new MutationObserver(onMutations);
|
||||
observer.observe(list, { childList: true, subtree: true, characterData: true, attributes: true, attributeFilter: ['class'] });
|
||||
list.addEventListener('scroll', syncCurrent, { passive: true });
|
||||
// The list is hidden while the panel is shut; read again when it opens.
|
||||
resize = new ResizeObserver(syncCurrent);
|
||||
resize.observe(list);
|
||||
readSections();
|
||||
});
|
||||
onBeforeUnmount(() => {
|
||||
observer?.disconnect();
|
||||
resize?.disconnect();
|
||||
cancelAnimationFrame(frame);
|
||||
list?.removeEventListener('scroll', syncCurrent);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<nav v-if="sections.length > 1" class="layer-section-index" :aria-label="t('Layer groups')">
|
||||
<button
|
||||
v-for="section in sections"
|
||||
:key="section.i"
|
||||
type="button"
|
||||
class="layer-section-index__tick"
|
||||
:class="{ 'is-current': section.i === current }"
|
||||
:aria-label="t('Jump to {name}', { name: section.label })"
|
||||
:aria-current="section.i === current ? 'true' : undefined"
|
||||
@click="jump(section.i)"
|
||||
@mouseenter="showTip($event, section)"
|
||||
@mouseleave="hideTip"
|
||||
@focus="showTip($event, section)"
|
||||
@blur="hideTip"
|
||||
></button>
|
||||
<Teleport to="body">
|
||||
<span v-if="tip" class="layer-section-index__label"
|
||||
:class="{ 'layer-section-index__label--before': tip.before }" :style="{ left: tip.left, top: tip.top }" aria-hidden="true">{{ tip.label }}</span>
|
||||
</Teleport>
|
||||
</nav>
|
||||
</template>
|
||||
@@ -0,0 +1,103 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { msg, t } from '../../../i18n/index.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import { useDisplayStore } from '../../stores/display.js';
|
||||
|
||||
// The visual presets and map source at the top of the Visual panel. The same
|
||||
// choices the command dock's tray offers, through the same Display store
|
||||
// actions, so either surface stays in step with the other.
|
||||
const display = useDisplayStore();
|
||||
const { style, mapSource, mapSourceControls } = storeToRefs(display);
|
||||
|
||||
const STYLES = [
|
||||
{
|
||||
name: 'normal',
|
||||
icon: '◯',
|
||||
label: msg('Normal'),
|
||||
key: '1',
|
||||
title: msg('Show the globe without a visual filter.'),
|
||||
},
|
||||
{
|
||||
name: 'retro',
|
||||
icon: '▦',
|
||||
label: msg('CRT'),
|
||||
key: '2',
|
||||
title: msg('Emulate a green phosphor CRT with scanlines and screen curvature.'),
|
||||
},
|
||||
{
|
||||
name: 'surveillance',
|
||||
icon: '🌙',
|
||||
label: msg('NVG'),
|
||||
key: '3',
|
||||
title: msg('Simulate night-vision goggles with green intensification and a tube vignette.'),
|
||||
},
|
||||
{
|
||||
name: 'thermal',
|
||||
icon: '🌡️',
|
||||
label: msg('FLIR'),
|
||||
key: '4',
|
||||
title: msg('Simulate FLIR-style thermal contrast. Turn up Ironbow for color.'),
|
||||
},
|
||||
{
|
||||
name: 'anime',
|
||||
icon: '✦',
|
||||
label: msg('Anime'),
|
||||
key: '5',
|
||||
title: msg('Apply bright cel-shaded color and illustrated outlines.'),
|
||||
},
|
||||
{
|
||||
name: 'noir',
|
||||
icon: '◐',
|
||||
label: msg('Noir'),
|
||||
key: '6',
|
||||
title: msg('Apply high-contrast monochrome film-noir grading.'),
|
||||
},
|
||||
];
|
||||
|
||||
function selectMapSource(chip) {
|
||||
if (!chip.available) return;
|
||||
void mapSourceControls.value?.select(chip.id).catch(() => {});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="visual-presets" :aria-label="t('VISUAL PRESETS')">
|
||||
<p class="visual-presets__heading">{{ t('Look') }}</p>
|
||||
<div class="visual-presets__grid">
|
||||
<UiButton
|
||||
v-for="preset in STYLES"
|
||||
:key="preset.name"
|
||||
class="visual-presets__style"
|
||||
:pressed="(style?.name ?? 'normal') === preset.name"
|
||||
pressed-class="active"
|
||||
:data-style="preset.name"
|
||||
:title="t(preset.title)"
|
||||
@click="display.act('setStyle', preset.name)"
|
||||
>
|
||||
<span class="visual-presets__icon" aria-hidden="true">{{ preset.icon }}</span>
|
||||
<span class="visual-presets__label">{{ t(preset.label) }}</span>
|
||||
<kbd class="visual-presets__key">{{ preset.key }}</kbd>
|
||||
</UiButton>
|
||||
</div>
|
||||
<div class="visual-presets__heading visual-presets__heading--row">
|
||||
<span>{{ t('MAP SOURCE') }}</span>
|
||||
<span class="visual-presets__status" :class="{ warn: !!mapSource?.status.warn }">{{ mapSource ? mapSource.status.text : '3D' }}</span>
|
||||
</div>
|
||||
<div class="visual-presets__chips" role="group" :aria-label="t('Map source')">
|
||||
<UiButton
|
||||
v-for="chip in mapSource?.chips"
|
||||
:key="chip.id"
|
||||
class="visual-presets__chip"
|
||||
:class="{ unavailable: !chip.available }"
|
||||
:pressed="Boolean(chip.active)"
|
||||
pressed-class="active"
|
||||
:title="chip.title"
|
||||
:aria-disabled="String(!chip.available)"
|
||||
:aria-label="chip.ariaLabel"
|
||||
@click="selectMapSource(chip)"
|
||||
>{{ chip.label }}<small v-if="chip.requirement">{{ chip.requirement }}</small></UiButton
|
||||
>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
@@ -19,6 +19,8 @@ function mount(t) {
|
||||
// The store outlives the view; dispose it with its clock subscription.
|
||||
useWorldTimeStore(pinia).$dispose();
|
||||
worldClock.goLive();
|
||||
// The clock keeps its rate; the next test starts at real time.
|
||||
worldClock.setRate(1);
|
||||
});
|
||||
return () => document.getElementById('world-timeline');
|
||||
}
|
||||
@@ -79,16 +81,16 @@ test('the timeline hides while no layer with time to show is on', async (t) => {
|
||||
const bar = mount(t);
|
||||
const at = Date.UTC(2026, 9, 30, 6, 15, 42);
|
||||
await nextTick();
|
||||
assert.equal(bar(), null, 'live, nothing to play');
|
||||
assert.equal(bar() === null, true, 'live, nothing to play');
|
||||
worldClock.seek(at);
|
||||
await nextTick();
|
||||
assert.equal(bar(), null, 'away from live, but nothing to play');
|
||||
assert.equal(bar() === null, true, 'away from live, but nothing to play');
|
||||
const remove = supportingLayer(t, at);
|
||||
await nextTick();
|
||||
assert.ok(bar());
|
||||
remove();
|
||||
await nextTick();
|
||||
assert.equal(bar(), null, 'the layer went off');
|
||||
assert.equal(bar() === null, true, 'the layer went off');
|
||||
});
|
||||
|
||||
test('the track runs over the time the layers show, to now, and scrubs', async (t) => {
|
||||
@@ -149,6 +151,41 @@ test('the track runs over the time the layers show, to now, and scrubs', async (
|
||||
assert.equal(worldClock.now(), ahead);
|
||||
});
|
||||
|
||||
test('on a track that runs over years, only the last minutes are near now', async (t) => {
|
||||
const bar = mount(t);
|
||||
const now = Date.now();
|
||||
// A layer whose source covers fourteen years, up to now.
|
||||
const start = now - 14 * 365 * 86_400_000;
|
||||
const release = worldClock.hold('test-years');
|
||||
const unregister = worldClock.register({
|
||||
id: 'test-years',
|
||||
coverage: () => ({ start, end: now }),
|
||||
});
|
||||
t.after(() => {
|
||||
unregister();
|
||||
release();
|
||||
});
|
||||
await nextTick();
|
||||
const input = bar().querySelector('input[type=range]');
|
||||
|
||||
// A day back is a day back, though it is well within a share of the track.
|
||||
input.value = String(now - 86_400_000);
|
||||
input.dispatchEvent(new Event('input'));
|
||||
await nextTick();
|
||||
assert.equal(worldClock.isLive(), false, 'a day back stays off live');
|
||||
assert.equal(worldClock.now(), now - 86_400_000);
|
||||
|
||||
input.value = String(now - 10 * 60_000);
|
||||
input.dispatchEvent(new Event('input'));
|
||||
await nextTick();
|
||||
assert.equal(worldClock.isLive(), false, 'ten minutes back stays off live');
|
||||
|
||||
input.value = String(Date.now() - 60_000);
|
||||
input.dispatchEvent(new Event('input'));
|
||||
await nextTick();
|
||||
assert.equal(worldClock.isLive(), true, 'a minute back goes live');
|
||||
});
|
||||
|
||||
test('play runs in real time, from the start of the track when at live', async (t) => {
|
||||
const bar = mount(t);
|
||||
const now = Date.now();
|
||||
@@ -430,7 +467,7 @@ test('play held for a layer to load shows a spinner once the hold lasts', async
|
||||
// A clock tick (a quarter second) tells of the hold; the spinner waits on.
|
||||
await new Promise((resolve) => setTimeout(resolve, 250));
|
||||
await nextTick();
|
||||
assert.equal(bubble().querySelector('.world-timeline-spinner'), null, 'not for a quick frame');
|
||||
assert.equal(bubble().querySelector('.world-timeline-spinner') === null, true, 'not for a quick frame');
|
||||
// The clock tells of the hold on its next tick, and the bar shows it after.
|
||||
const until = async (shown) => {
|
||||
for (let waited = 0; waited < 3_000; waited += 50) {
|
||||
@@ -546,3 +583,194 @@ test('a pinch measures from where the fingers are, and a lifted finger ends it',
|
||||
assert.ok(Math.abs(length() - zoomedTo) < 1_000);
|
||||
on(input, 'pointercancel', 100, 1);
|
||||
});
|
||||
|
||||
test('a tick shows its label on hover, and a tap by it goes to its mark', async (t) => {
|
||||
const bar = mount(t);
|
||||
const now = Date.now();
|
||||
const start = now - 10 * 86_400_000;
|
||||
// Ticks a fifth and seven tenths along a 1000 px track.
|
||||
const launch = start + (now - start) * 0.2;
|
||||
const quake = start + (now - start) * 0.7;
|
||||
const release = worldClock.hold('test-launches');
|
||||
const unregister = worldClock.register({
|
||||
id: 'test-launches',
|
||||
coverage: () => ({
|
||||
start,
|
||||
end: now,
|
||||
marks: [
|
||||
start,
|
||||
{ time: launch, label: 'GAUNTLET PAYLOAD', id: 'l1', kind: 'launch' },
|
||||
{ time: quake, label: 'M6.4 · Fiji', kind: 'earthquake' },
|
||||
],
|
||||
}),
|
||||
});
|
||||
t.after(() => {
|
||||
unregister();
|
||||
release();
|
||||
});
|
||||
await nextTick();
|
||||
const track = bar().querySelector('.world-timeline-track');
|
||||
const input = bar().querySelector('input[type=range]');
|
||||
Object.defineProperty(track, 'clientWidth', { value: 1_000 });
|
||||
track.getBoundingClientRect = () => ({ left: 0, width: 1_000, top: 0, height: 24 });
|
||||
const press = (type, clientX, pointerId = 1) =>
|
||||
track.dispatchEvent(new PointerEvent(type, { bubbles: true, clientX, pointerId }));
|
||||
const tip = () => bar().querySelector('.world-timeline-mark-label');
|
||||
assert.equal(bar().querySelectorAll('.world-timeline-tick').length, 3, 'ticks stay ticks');
|
||||
assert.equal(tip()?.textContent ?? null, null);
|
||||
|
||||
// Hovering within 6 px of a tick shows its label, in place of the track's hint.
|
||||
press('pointermove', 205);
|
||||
await nextTick();
|
||||
assert.equal(tip()?.textContent, 'GAUNTLET PAYLOAD');
|
||||
assert.equal(track.hasAttribute('title'), false);
|
||||
press('pointermove', 698);
|
||||
await nextTick();
|
||||
assert.equal(tip()?.textContent, 'M6.4 · Fiji');
|
||||
// Further off, or on a tick with no label, nothing shows.
|
||||
press('pointermove', 690);
|
||||
await nextTick();
|
||||
assert.equal(tip()?.textContent ?? null, null);
|
||||
assert.equal(track.hasAttribute('title'), true);
|
||||
press('pointermove', 2);
|
||||
await nextTick();
|
||||
assert.equal(tip()?.textContent ?? null, null, 'an unlabelled mark has no label');
|
||||
press('pointermove', 205);
|
||||
track.dispatchEvent(new PointerEvent('pointerleave', { clientX: 1_100, pointerId: 1 }));
|
||||
await nextTick();
|
||||
assert.equal(tip()?.textContent ?? null, null, 'leaving the track hides it');
|
||||
|
||||
// A tap by a tick goes to its mark exactly; elsewhere, to the time there.
|
||||
press('pointerdown', 704);
|
||||
press('pointerup', 704);
|
||||
await nextTick();
|
||||
assert.equal(worldClock.now(), quake);
|
||||
assert.match(input.getAttribute('aria-valuetext'), / · M6\.4 · Fiji$/);
|
||||
press('pointerdown', 500);
|
||||
press('pointerup', 500);
|
||||
await nextTick();
|
||||
const middle = start + (now - start) / 2;
|
||||
assert.ok(Math.abs(worldClock.now() - middle) < 60_000, 'went to the middle');
|
||||
assert.notEqual(worldClock.now(), quake);
|
||||
assert.match(input.getAttribute('aria-valuetext'), /UTC$/, 'off a mark, the time alone');
|
||||
// A drag from a tick still scrubs.
|
||||
press('pointerdown', 200);
|
||||
press('pointermove', 300);
|
||||
press('pointerup', 300);
|
||||
await nextTick();
|
||||
assert.ok(Math.abs(worldClock.now() - (start + (now - start) * 0.3)) < 60_000);
|
||||
|
||||
// The arrows go to the marks and tell their labels; focused, the label shows.
|
||||
input.dispatchEvent(new Event('focus'));
|
||||
input.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowLeft' }));
|
||||
await nextTick();
|
||||
assert.equal(worldClock.now(), launch);
|
||||
assert.match(input.getAttribute('aria-valuetext'), / · GAUNTLET PAYLOAD$/);
|
||||
assert.equal(tip()?.textContent, 'GAUNTLET PAYLOAD');
|
||||
input.dispatchEvent(new Event('blur'));
|
||||
await nextTick();
|
||||
assert.equal(tip()?.textContent ?? null, null);
|
||||
});
|
||||
|
||||
test('the pointer shows the nearer of two ticks within 6 px, and a zoom or a pan clears it', async (t) => {
|
||||
const bar = mount(t);
|
||||
const now = Date.now();
|
||||
const start = now - 10 * 86_400_000;
|
||||
// Two ticks 8 px apart on a 1000 px track, at 200 and 208 px.
|
||||
const first = start + (now - start) * 0.2;
|
||||
const second = start + (now - start) * 0.208;
|
||||
const release = worldClock.hold('test-launches');
|
||||
const unregister = worldClock.register({
|
||||
id: 'test-launches',
|
||||
coverage: () => ({
|
||||
start,
|
||||
end: now,
|
||||
marks: [
|
||||
{ time: first, label: 'FIRST', kind: 'launch' },
|
||||
{ time: second, label: 'SECOND', kind: 'launch' },
|
||||
],
|
||||
}),
|
||||
});
|
||||
t.after(() => {
|
||||
unregister();
|
||||
release();
|
||||
});
|
||||
await nextTick();
|
||||
const track = bar().querySelector('.world-timeline-track');
|
||||
Object.defineProperty(track, 'clientWidth', { value: 1_000 });
|
||||
track.getBoundingClientRect = () => ({ left: 0, width: 1_000, top: 0, height: 24 });
|
||||
const pointer = (type, clientX) =>
|
||||
track.dispatchEvent(new PointerEvent(type, { bubbles: true, clientX, pointerId: 1 }));
|
||||
const tip = () => bar().querySelector('.world-timeline-mark-label');
|
||||
// Where the first tick sits now, in px along the track.
|
||||
const firstAt = () =>
|
||||
Number.parseFloat(bar().querySelector('.world-timeline-tick').style.left) * 10;
|
||||
// The handle between them, so a zoom keeps both in view.
|
||||
worldClock.seek((first + second) / 2);
|
||||
await nextTick();
|
||||
pointer('pointermove', 203);
|
||||
await nextTick();
|
||||
assert.equal(tip()?.textContent, 'FIRST');
|
||||
pointer('pointermove', 205);
|
||||
await nextTick();
|
||||
assert.equal(tip()?.textContent, 'SECOND', 'the nearer of the two');
|
||||
|
||||
// A wheel zoom moves the ticks from under the pointer: the label goes.
|
||||
track.dispatchEvent(new WheelEvent('wheel', { deltaY: -200, cancelable: true }));
|
||||
await nextTick();
|
||||
assert.equal(track.classList.contains('is-zoomed'), true);
|
||||
assert.equal(tip()?.textContent ?? null, null, 'a zoom clears the label');
|
||||
// So does a pan, by wheel or by drag.
|
||||
pointer('pointermove', firstAt());
|
||||
await nextTick();
|
||||
assert.equal(tip()?.textContent, 'FIRST');
|
||||
track.dispatchEvent(
|
||||
new WheelEvent('wheel', { deltaY: 40, shiftKey: true, cancelable: true }),
|
||||
);
|
||||
await nextTick();
|
||||
assert.equal(tip()?.textContent ?? null, null, 'a pan clears the label');
|
||||
|
||||
// A tap between them goes to the nearer mark.
|
||||
track.dispatchEvent(new MouseEvent('dblclick', { bubbles: true }));
|
||||
await nextTick();
|
||||
assert.equal(track.classList.contains('is-zoomed'), false);
|
||||
pointer('pointerdown', 205);
|
||||
pointer('pointerup', 205);
|
||||
await nextTick();
|
||||
assert.equal(worldClock.now(), second, 'a tap goes to the nearer mark');
|
||||
});
|
||||
|
||||
test('the speed shown follows the world clock, and Play runs at its rate', async (t) => {
|
||||
const bar = mount(t);
|
||||
const now = Date.now();
|
||||
const release = worldClock.hold('test-launches');
|
||||
const unregister = worldClock.register({
|
||||
id: 'test-launches',
|
||||
coverage: () => ({ start: now - 10 * 86_400_000, end: now - 86_400_000 }),
|
||||
});
|
||||
t.after(() => {
|
||||
unregister();
|
||||
release();
|
||||
});
|
||||
await nextTick();
|
||||
const select = () => bar().querySelector('select.world-timeline-speed');
|
||||
assert.equal(select().value, 'real');
|
||||
// A host sets the rate: the selector shows it.
|
||||
worldClock.setRate(86_400);
|
||||
await nextTick();
|
||||
assert.equal(select().value, 'day');
|
||||
// A rate not offered shows as the nearest offered speed, and Play keeps it.
|
||||
worldClock.setRate(5_000);
|
||||
await nextTick();
|
||||
assert.equal(select().value, 'hour');
|
||||
bar().querySelector('.world-timeline-play').click();
|
||||
assert.equal(worldClock.isPlaying(), true);
|
||||
assert.equal(worldClock.getRate(), 5_000, 'Play runs at the clock\'s own rate');
|
||||
worldClock.pause();
|
||||
// Chosen on the selector while paused, the clock takes it at once.
|
||||
select().value = 'week';
|
||||
select().dispatchEvent(new Event('change'));
|
||||
await nextTick();
|
||||
assert.equal(worldClock.getRate(), 604_800);
|
||||
assert.equal(select().value, 'week');
|
||||
});
|
||||
@@ -8,11 +8,12 @@ import UiIcon from '../../kit/UiIcon.vue';
|
||||
import UiSelect from '../../kit/UiSelect.js';
|
||||
|
||||
// The world timeline: play and pause and the speed on the left, a track
|
||||
// across the stretch the layers on can show (each launch or frame a tick)
|
||||
// with a handle to scrub and the time in a bubble over it, and the way back
|
||||
// to live on the right, lit while live. Scrolling or pinching the track
|
||||
// zooms it around the handle, dragging it moves along it, and a double-click
|
||||
// shows it all again. It shows
|
||||
// across the stretch the layers on can show (each mark, a launch or a strong
|
||||
// earthquake, a tick, its label shown over it on hover) with a handle to
|
||||
// scrub and the time in a bubble over it, and the way back to live on the
|
||||
// right, lit while live. Scrolling or pinching the track zooms it around the
|
||||
// handle, dragging it moves along it, a tap on or by a tick goes to its
|
||||
// mark's time exactly, and a double-click shows it all again. It shows
|
||||
// while a layer with a time of its own (weather, satellites, launches,
|
||||
// or one a host follows) is on with time to show; with only live feeds such
|
||||
// as flights on, the bar stays hidden.
|
||||
@@ -53,6 +54,8 @@ const ZOOM_STEP = 1.5;
|
||||
const WHEEL_ZOOM = 0.0025;
|
||||
// Two presses this close are a double-click.
|
||||
const DOUBLE_PRESS_MS = 500;
|
||||
// A tap or a hover this near a tick, in pixels, is on its mark.
|
||||
const MARK_HIT_PX = 6;
|
||||
|
||||
const readout = computed(() =>
|
||||
Number.isFinite(time.value.timeMs)
|
||||
@@ -109,8 +112,10 @@ const view = computed(() => {
|
||||
});
|
||||
const zoomed = computed(() => zoom.value !== null);
|
||||
const viewLength = () => view.value.end - view.value.start;
|
||||
// Show `length` of the span ending at `viewEnd`, held to the span.
|
||||
// Show `length` of the span ending at `viewEnd`, held to the span. A zoom
|
||||
// or a pan moves the ticks from under the pointer, so its label goes.
|
||||
function showView(length, viewEnd) {
|
||||
hovered.value = null;
|
||||
const { start, end } = span.value;
|
||||
if (length >= end - start) {
|
||||
showWhole();
|
||||
@@ -138,6 +143,7 @@ const follow = (ms) => {
|
||||
};
|
||||
const offView = (ms) => ms < view.value.start || ms > view.value.end;
|
||||
const showWhole = () => {
|
||||
hovered.value = null;
|
||||
zoom.value = null;
|
||||
panned = false;
|
||||
};
|
||||
@@ -212,6 +218,7 @@ let movedTime = false;
|
||||
const onPointerDown = (event) => {
|
||||
// Only the main button: a right-click is for the menu.
|
||||
if (event.button > 0) return;
|
||||
hovered.value = null;
|
||||
const onHandle = event.target instanceof HTMLInputElement;
|
||||
pointers.set(event.pointerId, { x: event.clientX, onHandle });
|
||||
if (pointers.size === 1) {
|
||||
@@ -241,6 +248,10 @@ const onPointerDown = (event) => {
|
||||
gesture = { kind: 'press', x: event.clientX, end: view.value.end };
|
||||
};
|
||||
const onPointerMove = (event) => {
|
||||
// A pointer hovering, none pressed, shows the label of the tick under it.
|
||||
hovered.value = pointers.size
|
||||
? null
|
||||
: (markNear(event.clientX, event.currentTarget)?.time ?? null);
|
||||
const pointer = pointers.get(event.pointerId);
|
||||
if (!pointer) return;
|
||||
pointer.x = event.clientX;
|
||||
@@ -266,8 +277,14 @@ const onPointerMove = (event) => {
|
||||
};
|
||||
const onPointerUp = (event) => {
|
||||
if (!pointers.delete(event.pointerId)) return;
|
||||
// A tap on or by a tick goes to its mark exactly; elsewhere, to the time
|
||||
// under it.
|
||||
if (gesture?.kind === 'press' && event.type === 'pointerup')
|
||||
store.scrub(timeAt(event.clientX, event.currentTarget), viewLength());
|
||||
store.scrub(
|
||||
markNear(event.clientX, event.currentTarget)?.time ??
|
||||
timeAt(event.clientX, event.currentTarget),
|
||||
viewLength(),
|
||||
);
|
||||
// A finger lifted from a pinch ends it; the other one moves nothing.
|
||||
gesture = null;
|
||||
};
|
||||
@@ -276,11 +293,66 @@ const place = (ms) => {
|
||||
const { start, end } = view.value;
|
||||
return end > start ? ((ms - start) / (end - start)) * 100 : 100;
|
||||
};
|
||||
// The labels of the marks at each time marked; a time may have none.
|
||||
const markLabels = computed(() => {
|
||||
const labels = new Map();
|
||||
for (const mark of span.value?.markDetails ?? []) {
|
||||
if (!labels.has(mark.time)) labels.set(mark.time, []);
|
||||
if (mark.label) labels.get(mark.time).push(mark.label);
|
||||
}
|
||||
return labels;
|
||||
});
|
||||
// A tick for each time marked in view: where it sits, as a share of the
|
||||
// track, and its marks' labels.
|
||||
const ticks = computed(() => {
|
||||
const { start, end } = view.value;
|
||||
return span.value.marks
|
||||
.filter((mark) => mark >= start && mark <= end)
|
||||
.map((mark) => `${place(mark)}%`);
|
||||
.map((mark) => ({
|
||||
time: mark,
|
||||
share: place(mark) / 100,
|
||||
labels: markLabels.value.get(mark) ?? [],
|
||||
}));
|
||||
});
|
||||
// The tick nearest `clientX` within MARK_HIT_PX of it, or null.
|
||||
function markNear(clientX, track) {
|
||||
if (!view.value) return null;
|
||||
const { left, width } = track.getBoundingClientRect();
|
||||
if (!(width > 0)) return null;
|
||||
let near = null;
|
||||
let nearest = MARK_HIT_PX;
|
||||
for (const tick of ticks.value) {
|
||||
const off = Math.abs(left + tick.share * width - clientX);
|
||||
if (off <= nearest) {
|
||||
near = tick;
|
||||
nearest = off;
|
||||
}
|
||||
}
|
||||
return near;
|
||||
}
|
||||
// The time of the tick the pointer hovers, and whether the handle has focus.
|
||||
const hovered = shallowRef(null);
|
||||
const focused = shallowRef(false);
|
||||
// The labels shown over the track: the hovered tick's, or with the handle
|
||||
// focused and paused on a mark (an arrow key or a tap took it there), that
|
||||
// mark's. Nothing for a mark with no label.
|
||||
const markTip = computed(() => {
|
||||
if (!view.value) return null;
|
||||
const onMark = !time.value.live && focused.value ? time.value.timeMs : null;
|
||||
const over = ticks.value.find((each) => each.time === hovered.value);
|
||||
const tick = over ?? ticks.value.find((each) => each.time === onMark);
|
||||
return tick?.labels.length
|
||||
? { share: tick.share, text: tick.labels.join('\n'), hover: Boolean(over) }
|
||||
: null;
|
||||
});
|
||||
// The time as the handle tells it, with the labels of the mark it is on.
|
||||
const valueText = computed(() => {
|
||||
const labels = time.value.live
|
||||
? null
|
||||
: markLabels.value.get(time.value.timeMs);
|
||||
return labels?.length
|
||||
? `${readout.value} · ${labels.join('; ')}`
|
||||
: readout.value;
|
||||
});
|
||||
const shown = computed(() =>
|
||||
Math.min(view.value.end, Math.max(view.value.start, at.value)),
|
||||
@@ -294,10 +366,11 @@ const scrub = (event) => {
|
||||
}
|
||||
store.scrub(Number(event.target.value), viewLength());
|
||||
};
|
||||
// Arrows go to the previous or next mark (a launch, a frame), or a step along
|
||||
// the track as shown; Page keys take a tenth of it; Home and End go to the
|
||||
// ends of all of it. Plus and minus zoom, and zero shows it all; with a
|
||||
// modifier they are the browser's own zoom.
|
||||
// Arrows go to the previous or next mark (a launch, a strong earthquake),
|
||||
// whose label the handle then tells with the time, or a step along the track
|
||||
// as shown where there is none; Page keys take a tenth
|
||||
// of it; Home and End go to the ends of all of it. Plus and minus zoom, and
|
||||
// zero shows it all; with a modifier they are the browser's own zoom.
|
||||
const ZOOM_KEYS = ['+', '=', '-', '0'];
|
||||
const onKey = (event) => {
|
||||
if (ZOOM_KEYS.includes(event.key)) {
|
||||
@@ -331,17 +404,18 @@ const onKey = (event) => {
|
||||
><UiButton class="world-timeline-play" :label="time.playing ? t('Pause') : t('Play')" @click="store.togglePlay()"
|
||||
><UiIcon :name="time.playing ? 'pause' : 'play_arrow'" :size="20" /></UiButton
|
||||
><UiSelect class="gev-field gev-field--compact world-timeline-speed" :aria-label="t('Play speed')" :title="t('Play speed')" :options="speeds" :model-value="speed" @update:model-value="store.setSpeed($event)"
|
||||
/><div class="world-timeline-track" :class="{ 'is-zoomed': zoomed }" :title="t('Scroll or pinch to zoom, drag to move along · double-click to see it all')" @wheel="onWheel" @dblclick="showAll" @pointerdown="onPointerDown" @pointermove="onPointerMove" @pointerup="onPointerUp" @pointercancel="onPointerUp"
|
||||
/><div class="world-timeline-track" :class="{ 'is-zoomed': zoomed }" :title="markTip?.hover ? undefined : t('Scroll or pinch to zoom, drag to move along · double-click to see it all')" @wheel="onWheel" @dblclick="showAll" @pointerdown="onPointerDown" @pointermove="onPointerMove" @pointerup="onPointerUp" @pointercancel="onPointerUp" @pointerleave="hovered = null"
|
||||
><time class="world-timeline-time" :class="{ 'is-waiting': waiting }" :style="{ '--at': place(shown) / 100 }" :datetime="new Date(time.timeMs).toISOString()" aria-live="off"
|
||||
><span v-if="waiting" class="world-timeline-spinner" aria-hidden="true"></span>{{ bubble }}</time
|
||||
><span v-for="(left, index) in ticks" :key="index" class="world-timeline-tick" :style="{ left }" aria-hidden="true"></span
|
||||
><span v-if="markTip" class="world-timeline-mark-label" :style="{ '--at': markTip.share }" aria-hidden="true">{{ markTip.text }}</span
|
||||
><span v-for="tick in ticks" :key="tick.time" class="world-timeline-tick" :style="{ left: `${tick.share * 100}%` }" aria-hidden="true"></span
|
||||
><span class="world-timeline-fill" :style="{ width: `${place(shown)}%` }" aria-hidden="true"></span
|
||||
><input
|
||||
class="world-timeline-scrub"
|
||||
:class="{ 'is-off-view': handleOff }"
|
||||
type="range"
|
||||
:aria-label="t('World time')"
|
||||
:aria-valuetext="readout"
|
||||
:aria-valuetext="valueText"
|
||||
:min="view.start"
|
||||
:max="view.end"
|
||||
step="any"
|
||||
@@ -349,6 +423,8 @@ const onKey = (event) => {
|
||||
@input="scrub"
|
||||
aria-keyshortcuts="+ - 0"
|
||||
@keydown="onKey"
|
||||
@focus="focused = true"
|
||||
@blur="focused = false"
|
||||
/></div
|
||||
><UiButton class="world-timeline-live" :label="time.live ? t('Live') : t('Back to live')" :pressed="time.live" pressed-class="is-live" :disabled="time.live" @click="store.goLive()">{{ t('Live') }}</UiButton
|
||||
></div>
|
||||
|
||||
@@ -46,6 +46,13 @@ import { cyberVisualDefaultsForHudTransition } from '../hudLayouts.js';
|
||||
const DETECTION_ALLOCATION_STORAGE_KEY = 'gev:detection-allocation:v1';
|
||||
|
||||
/** Own visual preferences, detection overrides and display-control state. */
|
||||
/**
|
||||
* The faintest the Scope mask goes. Below about half, the view reads as if
|
||||
* Scope were off while labels still fade outside the keyhole and the HUD gets
|
||||
* no backplates, so the slider stops here.
|
||||
*/
|
||||
export const SCOPE_OPACITY_MIN_PCT = 50;
|
||||
|
||||
export class VisualSettings {
|
||||
async restoreShareState(state) {
|
||||
const { setScopeTerminusOverride, clampScopeTerminusPct } = this.services;
|
||||
@@ -66,6 +73,7 @@ export class VisualSettings {
|
||||
celestialRing,
|
||||
scopeEnabled,
|
||||
scopeFeatherPct,
|
||||
scopeOpacityPct,
|
||||
scopeTerminusPct,
|
||||
mapStack,
|
||||
panelState,
|
||||
@@ -133,7 +141,12 @@ export class VisualSettings {
|
||||
focus: false,
|
||||
});
|
||||
}
|
||||
this._setScope({ enabled: scopeEnabled, featherPct: scopeFeatherPct });
|
||||
this._setScope({
|
||||
enabled: scopeEnabled,
|
||||
featherPct: scopeFeatherPct,
|
||||
opacityPct:
|
||||
typeof scopeOpacityPct === 'number' ? scopeOpacityPct : undefined,
|
||||
});
|
||||
// null restores the altitude-adaptive ramp; a number pins the terminus
|
||||
// (clamped to the supported 94..100 band, same as the `sce` hash key).
|
||||
if (scopeTerminusPct === null) setScopeTerminusOverride(null);
|
||||
@@ -219,6 +232,7 @@ export class VisualSettings {
|
||||
// What the Scope and Celestial controls show; null until first set.
|
||||
this._scopeEnabledShown = null;
|
||||
this._scopeFeatherShown = null;
|
||||
this._scopeOpacityShown = null;
|
||||
this._celestialShown = null;
|
||||
this.activeStyle = 'normal';
|
||||
this._preCyberStyle = null;
|
||||
@@ -348,6 +362,20 @@ export class VisualSettings {
|
||||
this._syncShareState();
|
||||
}
|
||||
|
||||
/**
|
||||
* While Contacts holds detection, make the detection shown now the state
|
||||
* leaving Contacts puts back (and a share link carries): the user chose it,
|
||||
* as with Reset in Visual. Nothing changes outside Contacts.
|
||||
*/
|
||||
adoptDetectionAsRestore() {
|
||||
if (!this._contactsDetectionRestore) return;
|
||||
const state = this.getDetectionState();
|
||||
this._contactsDetectionRestore = {
|
||||
mode: state.detectionMode,
|
||||
densityPct: state.densityPct,
|
||||
};
|
||||
}
|
||||
|
||||
_setCockpitVision(mode, active, { revealParameters = false } = {}) {
|
||||
const next = active ? normalizeCockpitVisionMode(mode) : 'optical';
|
||||
if (!this.stages) return;
|
||||
@@ -479,6 +507,7 @@ export class VisualSettings {
|
||||
scope: {
|
||||
enabled: this._scopeEnabledShown,
|
||||
featherPct: this._scopeFeatherShown,
|
||||
opacityPct: this._scopeOpacityShown ?? 100,
|
||||
},
|
||||
celestial: this._celestialShown,
|
||||
};
|
||||
@@ -488,7 +517,15 @@ export class VisualSettings {
|
||||
* Apply the Scope mask and show it on its controls; a field that is not
|
||||
* given stays as it is. `apply: false` only shows the mask's state.
|
||||
*/
|
||||
_setScope({ enabled, featherPct } = {}, { apply = true } = {}) {
|
||||
_setScope({ enabled, featherPct, opacityPct } = {}, { apply = true } = {}) {
|
||||
if (Number.isFinite(opacityPct)) {
|
||||
const pct = Math.max(
|
||||
SCOPE_OPACITY_MIN_PCT,
|
||||
Math.min(100, Math.round(opacityPct)),
|
||||
);
|
||||
if (apply) this.services.setScopeMaskOpacity?.(pct / 100);
|
||||
this._scopeOpacityShown = pct;
|
||||
}
|
||||
if (typeof enabled === 'boolean') {
|
||||
if (apply) this.services.setScopeMaskEnabled(enabled);
|
||||
this._scopeEnabledShown = enabled;
|
||||
@@ -819,7 +856,11 @@ export class VisualSettings {
|
||||
if (det.mode) this._setDetectionMode(String(det.mode).toUpperCase());
|
||||
}
|
||||
|
||||
_applyGlobalPostDefaults() {
|
||||
/**
|
||||
* @param {{keepHudVariant?: boolean}} [options] `keepHudVariant` leaves the
|
||||
* HUD layout to the style, as choosing a style does (Visual's reset).
|
||||
*/
|
||||
_applyGlobalPostDefaults({ keepHudVariant = false } = {}) {
|
||||
const defaults = GLOBAL_POST_DEFAULTS;
|
||||
if (typeof defaults.bloom?.intensity === 'number') {
|
||||
this._setBloomIntensity(clampBloomIntensity(defaults.bloom.intensity), {
|
||||
@@ -838,7 +879,7 @@ export class VisualSettings {
|
||||
this._setSharpenEnabled(defaults.sharpen.enabled);
|
||||
}
|
||||
|
||||
if (defaults.hudVariant) {
|
||||
if (defaults.hudVariant && !keepHudVariant) {
|
||||
this._setHudVariant(defaults.hudVariant);
|
||||
}
|
||||
if (typeof defaults.hudVisible === 'boolean') {
|
||||
@@ -883,6 +924,7 @@ export class VisualSettings {
|
||||
getDetectionTuning,
|
||||
isScopeMaskEnabled,
|
||||
getScopeMaskFeather,
|
||||
getScopeMaskOpacity,
|
||||
getScopeTerminusOverride,
|
||||
} = this.services;
|
||||
const detection = this._shareableDetectionState();
|
||||
@@ -903,6 +945,7 @@ export class VisualSettings {
|
||||
celestialRingEnabled: this.celestialRingEnabled,
|
||||
scopeEnabled: isScopeMaskEnabled(),
|
||||
scopeFeatherPct: Math.round(getScopeMaskFeather() * 100),
|
||||
scopeOpacityPct: Math.round((getScopeMaskOpacity?.() ?? 1) * 100),
|
||||
// null when adaptive — the share layer omits `sce` entirely in that case.
|
||||
scopeTerminusPct:
|
||||
getScopeTerminusOverride() == null
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
<script setup>
|
||||
import { t } from '../../i18n/index.js';
|
||||
import RailCards from '../rail/RailCards.vue';
|
||||
import RailTimeline from '../rail/RailTimeline.vue';
|
||||
|
||||
// Active weather: forecast and event cards, then the observed products with
|
||||
// their shared history timeline. The owner computes every value shown.
|
||||
// the time of the frame they show. The world timeline moves time; the owner
|
||||
// computes every value shown.
|
||||
defineProps({
|
||||
view: { type: Object, required: true },
|
||||
onParams: { type: Function, default: () => {} },
|
||||
onOpen: { type: Function, default: () => {} },
|
||||
transport: { type: Object, required: true },
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -31,16 +30,9 @@ defineProps({
|
||||
:aria-label="t('Observed history')"
|
||||
><h3 class="panel-title">{{ t('Observed history') }}</h3
|
||||
><div class="weather-observed-scope">{{ view.scope }}</div
|
||||
><div class="weather-timeline-block" :hidden="!view.observed"
|
||||
><RailTimeline
|
||||
:state="view.timeline"
|
||||
slider-class-name="weather-timeline"
|
||||
:heading="false"
|
||||
:on-commit="transport.onCommit"
|
||||
:on-preview="transport.onPreview"
|
||||
:on-step="transport.onStep"
|
||||
:on-latest="transport.onLatest"
|
||||
:on-play="transport.onPlay" /></div
|
||||
><div class="weather-frame-time" :hidden="!view.frameTime">{{
|
||||
view.frameTime
|
||||
}}</div
|
||||
><div class="weather-cards"
|
||||
><RailCards
|
||||
:cards="view.observedCards"
|
||||
|
||||
+21
-37
@@ -88,13 +88,6 @@ export function createWeatherPanel({
|
||||
openPanels.set(page, id);
|
||||
render();
|
||||
},
|
||||
transport: {
|
||||
onCommit: (tick) => clock?.setTarget(tick),
|
||||
onPreview: historyTime,
|
||||
onStep: (direction) => clock?.step(direction),
|
||||
onLatest: () => clock?.latest(),
|
||||
onPlay: () => clock?.togglePlay(),
|
||||
},
|
||||
};
|
||||
// The readout patches synchronously, so a newly opened card can be measured.
|
||||
const paint = (view) =>
|
||||
@@ -103,14 +96,7 @@ export function createWeatherPanel({
|
||||
hidden: true,
|
||||
observed: false,
|
||||
scope: '',
|
||||
timeline: {
|
||||
ticks: [],
|
||||
index: 0,
|
||||
mode: 'latest',
|
||||
playing: false,
|
||||
readout: '',
|
||||
disabled: true,
|
||||
},
|
||||
frameTime: '',
|
||||
cards: [],
|
||||
observedCards: [],
|
||||
});
|
||||
@@ -125,32 +111,30 @@ export function createWeatherPanel({
|
||||
.filter(({ summary }) => summary)
|
||||
.sort((a, b) => ORDER.indexOf(a.id) - ORDER.indexOf(b.id));
|
||||
const observed = active.filter(({ id }) => OBSERVED.has(id));
|
||||
const showTimeline = observed.length > 0;
|
||||
const showObserved = observed.length > 0;
|
||||
const names = {
|
||||
'weather-radar': t('Rain radar'),
|
||||
'weather-satellite': t('Satellite clouds'),
|
||||
'weather-lightning': t('Lightning density'),
|
||||
};
|
||||
const index =
|
||||
state.mode === 'latest'
|
||||
? state.timeline.length - 1
|
||||
: Math.max(
|
||||
0,
|
||||
state.timeline.findLastIndex(
|
||||
(tick) => Date.parse(tick) <= Date.parse(state.target),
|
||||
),
|
||||
);
|
||||
const timeline = {
|
||||
ticks: state.timeline,
|
||||
index,
|
||||
mode: state.mode,
|
||||
playing: Boolean(state.playing),
|
||||
disabled: !showTimeline || state.timeline.length < 2,
|
||||
readout:
|
||||
state.mode === 'latest'
|
||||
? t('LATEST · newest per product')
|
||||
: historyTime(state.target),
|
||||
// While live, the newest frame and its age; at a past time, the timeline
|
||||
// time alone. The world timeline moves the time. Live, each product's
|
||||
// newest frame counts, suspended or not (reduced motion, a hidden page),
|
||||
// as the timeline leaves those out.
|
||||
const newest = () => {
|
||||
const times = (state.products ?? [])
|
||||
.map(({ selected }) => selected)
|
||||
.filter((time) => Number.isFinite(Date.parse(time)))
|
||||
.sort((a, b) => Date.parse(a) - Date.parse(b));
|
||||
return times.at(-1) ?? state.timeline.at(-1);
|
||||
};
|
||||
const shownTime = state.mode === 'latest' ? newest() : state.target;
|
||||
const frameTime =
|
||||
showObserved && shownTime
|
||||
? state.mode === 'history'
|
||||
? clockTime(shownTime)
|
||||
: historyTime(shownTime)
|
||||
: '';
|
||||
const models = active.map((entry) => {
|
||||
const { id, icon, summary, legend = [], list } = entry;
|
||||
// Discrete classes (storm geometry, AQHI bands) list swatches, not a ramp.
|
||||
@@ -234,9 +218,9 @@ export function createWeatherPanel({
|
||||
const hidden = active.length === 0;
|
||||
paint({
|
||||
hidden,
|
||||
observed: showTimeline,
|
||||
observed: showObserved,
|
||||
scope: observed.map(({ id }) => names[id]).join(' · '),
|
||||
timeline,
|
||||
frameTime,
|
||||
cards: models.filter(({ id }) => !OBSERVED.has(id)),
|
||||
observedCards: models.filter(({ id }) => OBSERVED.has(id)),
|
||||
});
|
||||
|
||||
@@ -54,10 +54,6 @@ function fixture() {
|
||||
listeners.add(fn);
|
||||
return () => listeners.delete(fn);
|
||||
},
|
||||
setTarget: (tick) => calls.push(['target', tick]),
|
||||
latest: () => calls.push(['latest']),
|
||||
togglePlay: () => calls.push(['play']),
|
||||
step: (n) => calls.push(['step', n]),
|
||||
};
|
||||
return {
|
||||
...f,
|
||||
@@ -74,39 +70,55 @@ function fixture() {
|
||||
},
|
||||
};
|
||||
}
|
||||
const timelineHost = (f) =>
|
||||
f.find((n) => n.className === 'weather-timeline-block');
|
||||
const frameTime = (f) => f.find((n) => n.className === 'weather-frame-time');
|
||||
const card = (f, id) => f.find((n) => n.dataset.cardId === id);
|
||||
const line = (f, id, name) =>
|
||||
f.find((n) => n.dataset.lineId === name, card(f, id));
|
||||
test('timeline stays visible with any observed product; native preview and transport use the clock', (t) => {
|
||||
t.mock.timers.enable({ apis: ['setTimeout'] });
|
||||
test('the frame time shows with any observed product; the panel has no time controls of its own', (t) => {
|
||||
t.mock.timers.enable({
|
||||
apis: ['Date'],
|
||||
now: Date.parse('2026-09-22T01:17:00Z'),
|
||||
});
|
||||
const f = fixture();
|
||||
const view = createWeatherPanel(f);
|
||||
view.update([wind]);
|
||||
assert.equal(timelineHost(f).hidden, true);
|
||||
assert.equal(frameTime(f).hidden, true);
|
||||
view.update([wind, radar]);
|
||||
assert.equal(timelineHost(f).hidden, false);
|
||||
f.state({ timeline: [ticks[0]] });
|
||||
assert.equal(timelineHost(f).hidden, false);
|
||||
assert.equal(f.find((n) => n.tagName === 'INPUT').disabled, true);
|
||||
f.state({ timeline: [] });
|
||||
assert.equal(timelineHost(f).hidden, false);
|
||||
f.state({ timeline: ticks });
|
||||
assert.equal(timelineHost(f).hidden, false);
|
||||
const slider = f.find((n) => n.tagName === 'INPUT');
|
||||
slider.value = '0';
|
||||
slider.dispatchEvent(new Event('input'));
|
||||
assert.deepEqual(f.calls, []);
|
||||
slider.dispatchEvent(new Event('change'));
|
||||
assert.deepEqual(f.calls, [['target', ticks[0]]]);
|
||||
f.find((n) => n.textContent === 'Latest' && n.tagName === 'BUTTON').click();
|
||||
f.find((n) => n.textContent === 'Play').click();
|
||||
assert.deepEqual(f.calls.slice(1), [['latest'], ['play']]);
|
||||
slider.dispatchEvent(new Event('input'));
|
||||
view.update([wind]);
|
||||
t.mock.timers.tick(150);
|
||||
assert.equal(f.calls.length, 3, 'hiding cancels pending drag');
|
||||
assert.equal(frameTime(f).hidden, false);
|
||||
assert.equal(frameTime(f).textContent, '01:05 UTC · 12 min ago');
|
||||
f.state({
|
||||
timeline: [ticks[0]],
|
||||
products: [{ id: radar.id, shown: ticks[0], selected: ticks[0] }],
|
||||
});
|
||||
assert.equal(frameTime(f).textContent, '01:00 UTC · 17 min ago');
|
||||
f.state({ timeline: [], products: [] });
|
||||
assert.equal(frameTime(f).hidden, true);
|
||||
// Suspended products (reduced motion, a hidden page) leave the timeline;
|
||||
// live, their newest frame still shows.
|
||||
f.state({
|
||||
timeline: [],
|
||||
products: [
|
||||
{ id: radar.id, shown: ticks[1], selected: ticks[1], suspended: true },
|
||||
{
|
||||
id: 'weather-lightning',
|
||||
shown: null,
|
||||
selected: ticks[0],
|
||||
suspended: true,
|
||||
},
|
||||
],
|
||||
});
|
||||
assert.equal(frameTime(f).hidden, false);
|
||||
assert.equal(frameTime(f).textContent, '01:05 UTC · 12 min ago');
|
||||
f.state({ timeline: ticks, mode: 'history', target: ticks[0] });
|
||||
assert.equal(frameTime(f).textContent, '01:00 UTC');
|
||||
assert.equal(
|
||||
f.find((n) => n.tagName === 'INPUT'),
|
||||
null,
|
||||
);
|
||||
assert.equal(
|
||||
f.find((n) => ['Play', 'Latest'].includes(n.textContent)),
|
||||
null,
|
||||
);
|
||||
view.destroy();
|
||||
assert.equal(f.listeners.size, 0);
|
||||
});
|
||||
@@ -179,7 +191,7 @@ test('cyclone readout retains advisory, position, intensity, geometry, coverage,
|
||||
],
|
||||
};
|
||||
view.update([cyclone]);
|
||||
assert.equal(timelineHost(f).hidden, true);
|
||||
assert.equal(frameTime(f).hidden, true);
|
||||
assert.match(
|
||||
line(f, cyclone.id, 'time').textContent,
|
||||
/JULIO.*Hurricane.*Advisory 10.*UTC/,
|
||||
@@ -410,7 +422,7 @@ test('cyclones lead, and observed history owns one bordered group with only acti
|
||||
group.children[1].textContent,
|
||||
'Rain radar · Satellite clouds · Lightning density',
|
||||
);
|
||||
assertSameNode(group.children[2], timelineHost(f));
|
||||
assertSameNode(group.children[2], frameTime(f));
|
||||
assert.deepEqual(
|
||||
[...group.children[3].children].map((n) => n.dataset.cardId),
|
||||
['weather-radar', 'weather-satellite', 'weather-lightning'],
|
||||
@@ -672,13 +684,8 @@ test('history time keeps the hour whatever the length of the localized date', ()
|
||||
const f = fixture();
|
||||
const view = createWeatherPanel(f);
|
||||
view.update([wind, radar]);
|
||||
const ends = f.find((n) => n.className === 'rail-timeline-endpoints');
|
||||
assert.deepEqual(
|
||||
[...ends.children].map((n) => n.textContent),
|
||||
['01:00 UTC', '01:05 UTC'],
|
||||
locale,
|
||||
);
|
||||
f.state({ mode: 'history', target: ticks[1] });
|
||||
assert.equal(frameTime(f).textContent, '01:05 UTC', locale);
|
||||
assert.match(
|
||||
line(f, radar.id, 'time').textContent,
|
||||
/(^|[^\d:])01:05 UTC/,
|
||||
|
||||
@@ -309,7 +309,7 @@ test('dot, icon and ambient photo clicks open one contained medium-photo card at
|
||||
true,
|
||||
'the loaded medium photo is painted inside the card',
|
||||
);
|
||||
assert.equal(card.querySelector('[role=status]'), null);
|
||||
assert.equal(card.querySelector('[role=status]') === null, true);
|
||||
const style = readFileSync(
|
||||
new URL('./views/panels/WildlifeSightingCard.vue', import.meta.url),
|
||||
'utf8',
|
||||
@@ -343,11 +343,11 @@ test('missing, restricted, obscured and Acartia photos all use the same compact
|
||||
const f = fixture(context, { ...row, ...extra });
|
||||
await f.click();
|
||||
const card = f.cardElement();
|
||||
assert.equal(card.querySelector('img'), null);
|
||||
assert.equal(card.querySelector('[role=status]'), null);
|
||||
assert.equal(card.querySelector('img') === null, true);
|
||||
assert.equal(card.querySelector('[role=status]') === null, true);
|
||||
assert.equal(card.querySelector('h2').textContent, row.commonName);
|
||||
assert.equal(card.querySelector('i').textContent, row.scientificName);
|
||||
assert.equal(document.querySelector('dialog'), null);
|
||||
assert.equal(document.querySelector('dialog') === null, true);
|
||||
if (extra.obscured) {
|
||||
assert.doesNotMatch(card.textContent, /ago|Photographer/);
|
||||
assert.ok(
|
||||
@@ -676,7 +676,7 @@ test('date-only and unsafe-link rows remain readable, and no sighting rail or li
|
||||
link: 'javascript:alert(1)',
|
||||
});
|
||||
await f.click();
|
||||
assert.equal(f.cardElement().querySelector('a'), null);
|
||||
assert.equal(f.cardElement().querySelector('a') === null, true);
|
||||
assert.equal(
|
||||
f.cardElement().querySelector('time').getAttribute('datetime'),
|
||||
row.observedOn,
|
||||
|
||||
Reference in new issue
Block a user