mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
feat(cockpit): ride a tracked satellite in an orbital view
With a satellite tracked and no aircraft tracked, Cockpit can ride the satellite. Entry needs only the Satellites layer; debris can be tracked but not entered, and voice stays aircraft-only. Double-clicking the tracked satellite or the entry buttons (reading ORBIT) enter it. The camera sits on the satellite's per-frame SGP4 position and looks straight down, turned to the ground track (north-up for a satellite with none). The optical zoom steps 1x to 8x with a focus pull, the arrows tilt the view up to 45 degrees off nadir, and Home or 0 returns to nadir. Off nadir the tilt reads its total angle first and the swath readout becomes an approximation marked with ≈. While in orbit the map leases flat Esri imagery, the cloud pass stays off and the view opens in the optical style. The orbital HUD names the satellite with its owner's flag (from the flag-icons package, loaded per country) or an organisation badge, its operator, class, NORAD and COSPAR ids and TLE epoch with the element lines on request, altitude, orbital speed and the sub-satellite point. CURRENTLY OVER names the country and its first-level division, or the sea, and from 8x the most prominent populated place nearby, looked up offline from the bundled Natural Earth packs (populated places are a new pack). The satellites layer hides the ridden satellite's own marks, dims the other orbit rings and ignores scene clicks and Escape while held. Exit restores the camera's field of view and the satellite's follow camera. C no longer enters or leaves Cockpit, bridge or orbit: it is left to the app-wide CCTV shortcut, and Escape or the exit button leave first person.
This commit is contained in:
1 parent
a648c9b665
commit
048293fc2a
67 files changed
+6642
-172
No files matched your search
@@ -362,6 +362,7 @@ export class StyleManager extends ShellFacade {
|
||||
flightsLayer: services.flightsLayer,
|
||||
militaryFlightsLayer: services.militaryFlightsLayer,
|
||||
aisLiveVesselsLayer: services.aisLiveVesselsLayer,
|
||||
satellitesLayer: services.satellitesLayer,
|
||||
isTr3b: services.isTr3b,
|
||||
toggleTr3b: services.toggleTr3b,
|
||||
militaryAwarenessLayer: services.militaryAwarenessLayer,
|
||||
@@ -376,6 +377,13 @@ export class StyleManager extends ShellFacade {
|
||||
fetchRegionalBrief: services.fetchRegionalBrief,
|
||||
regionalDistanceM: services.regionalDistanceM,
|
||||
weatherCodeLabel: services.weatherCodeLabel,
|
||||
// Orbit reads flat Esri imagery: Google 3D tiles stay coarse from
|
||||
// hundreds of kilometres up. The lease puts the map back on exit.
|
||||
acquireOrbitImagery: () =>
|
||||
this.mapStackController?.acquireImageryComparison?.({
|
||||
owner: 'cockpit-orbit',
|
||||
switchPolicy: 'esri-if-photoreal',
|
||||
}) ?? null,
|
||||
},
|
||||
elements: {
|
||||
_ppToggles: this._ppToggles,
|
||||
@@ -403,6 +411,8 @@ export class StyleManager extends ShellFacade {
|
||||
useCockpitStore(applicationPinia()).publishSignals(rows),
|
||||
radar: (view) =>
|
||||
useCockpitStore(applicationPinia()).publishRadar(view),
|
||||
orbital: (view) =>
|
||||
useCockpitStore(applicationPinia()).publishOrbital(view),
|
||||
utilityLayout: (layout) =>
|
||||
useCockpitStore(applicationPinia()).publishUtilityLayout(layout),
|
||||
},
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// src/ui/cockpitBodyClasses.test.mjs — the classes the Cockpit puts on
|
||||
// <body> must not also name an element's rule. A bare `.name { … }` written
|
||||
// for a panel matches <body> the moment <body> carries `name`, and its
|
||||
// pointer-events, position and overflow then apply to the whole page.
|
||||
// pointer-events, position and overflow then apply to the whole page (a
|
||||
// shared `cockpit-orbital` once made every click in orbit fall through).
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync, readdirSync } from 'node:fs';
|
||||
@@ -52,7 +53,7 @@ function cockpitBodyClasses() {
|
||||
|
||||
test('the Cockpit adds its subject classes to <body>', () => {
|
||||
const classes = cockpitBodyClasses();
|
||||
for (const name of ['cockpit-mode', 'cockpit-bridge']) {
|
||||
for (const name of ['cockpit-mode', 'cockpit-bridge', 'cockpit-orbit']) {
|
||||
assert.ok(classes.includes(name), `${name} is not added to <body>`);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -424,23 +424,33 @@ test("turning off the ridden aircraft's layer ends the cockpit", async (t) => {
|
||||
assert.equal(cockpit.active, false);
|
||||
});
|
||||
|
||||
test('C enters the selected vessel bridge and aircraft-only entry refuses it', async (t) => {
|
||||
const { cockpit } = fixture(t);
|
||||
test('BRIDGE enters the selected vessel bridge and aircraft-only entry refuses it', async (t) => {
|
||||
const { $, cockpit } = fixture(t);
|
||||
assert.equal(cockpit.enter({ kind: 'aircraft' }), false);
|
||||
const event = {
|
||||
key: 'c',
|
||||
target: document.body,
|
||||
defaultPrevented: false,
|
||||
preventDefault() {
|
||||
this.defaultPrevented = true;
|
||||
},
|
||||
stopImmediatePropagation() {},
|
||||
};
|
||||
cockpit.onKeyDown(event);
|
||||
cockpit.syncEntry();
|
||||
await settle();
|
||||
$('#cockpit-entry').click();
|
||||
await settle();
|
||||
assert.equal(cockpit.active, true);
|
||||
assert.equal(cockpit.subjectKind, 'vessel');
|
||||
assert.equal(event.defaultPrevented, true);
|
||||
});
|
||||
|
||||
test('C neither enters nor leaves the bridge; it stays the CCTV shortcut', async (t) => {
|
||||
const { cockpit } = fixture(t);
|
||||
const outside = press(cockpit, 'c');
|
||||
await settle();
|
||||
assert.equal(cockpit.active, false, 'C does not enter');
|
||||
assert.equal(outside.defaultPrevented, false);
|
||||
assert.equal(outside.propagationStopped, false);
|
||||
cockpit.enter();
|
||||
await settle();
|
||||
assert.equal(cockpit.subjectKind, 'vessel');
|
||||
for (const key of ['c', 'C']) {
|
||||
const inside = press(cockpit, key);
|
||||
assert.equal(cockpit.active, true, `${key} does not exit`);
|
||||
assert.equal(inside.defaultPrevented, false);
|
||||
assert.equal(inside.propagationStopped, false);
|
||||
}
|
||||
});
|
||||
|
||||
test('C stays the CCTV shortcut when the bridge gate is shut', async (t) => {
|
||||
@@ -501,10 +511,13 @@ function press(
|
||||
repeat,
|
||||
target,
|
||||
defaultPrevented: false,
|
||||
propagationStopped: false,
|
||||
preventDefault() {
|
||||
this.defaultPrevented = true;
|
||||
},
|
||||
stopImmediatePropagation() {},
|
||||
stopImmediatePropagation() {
|
||||
this.propagationStopped = true;
|
||||
},
|
||||
};
|
||||
cockpit.onKeyDown(event);
|
||||
return event;
|
||||
@@ -696,11 +709,9 @@ test('a held arrow keeps turning the bridge view', async (t) => {
|
||||
assert.equal(event.defaultPrevented, true);
|
||||
}
|
||||
assert.equal(cockpit.lookTarget.yawDeg, -30);
|
||||
// A held Home or C still acts only once.
|
||||
// A held Home still acts only once.
|
||||
press(cockpit, 'Home', { repeat: true });
|
||||
assert.equal(cockpit.lookTarget.yawDeg, -30);
|
||||
press(cockpit, 'c', { repeat: true });
|
||||
assert.equal(cockpit.active, true);
|
||||
});
|
||||
|
||||
test('Home, 0 and LOOK AHEAD bring the bridge view back over the bow', async (t) => {
|
||||
@@ -844,6 +855,41 @@ test('arrows do nothing new in an aircraft cockpit', async (t) => {
|
||||
);
|
||||
});
|
||||
|
||||
test('C neither enters nor leaves an aircraft cockpit', async (t) => {
|
||||
const aircraftInfo = {
|
||||
icao24: 'abc123',
|
||||
callsign: 'TEST1',
|
||||
latitude: 54.5,
|
||||
longitude: 10.2,
|
||||
altitudeM: 3000,
|
||||
velocityMps: 200,
|
||||
track: 45,
|
||||
onGround: false,
|
||||
};
|
||||
const { cockpit, viewer, aircraft } = fixture(t, { aircraftInfo });
|
||||
viewer.trackedEntity = aircraft;
|
||||
const outside = press(cockpit, 'c');
|
||||
await settle();
|
||||
assert.equal(cockpit.active, false, 'C does not enter');
|
||||
assert.equal(outside.defaultPrevented, false);
|
||||
assert.equal(outside.propagationStopped, false);
|
||||
assert.equal(cockpit.enter({ kind: 'aircraft' }), true);
|
||||
await settle();
|
||||
const inside = press(cockpit, 'c');
|
||||
assert.equal(cockpit.active, true, 'C does not exit');
|
||||
assert.equal(inside.propagationStopped, false);
|
||||
assert.doesNotMatch(
|
||||
document.querySelector('.cockpit-help').textContent,
|
||||
/C TOGGLE/,
|
||||
);
|
||||
assert.doesNotMatch(
|
||||
document
|
||||
.querySelector('#map-view-switch')
|
||||
.getAttribute('aria-keyshortcuts'),
|
||||
/C/,
|
||||
);
|
||||
});
|
||||
|
||||
/** The eye's ellipsoidal height in a placed camera, metres. */
|
||||
const eyeHeightM = (shot) =>
|
||||
Cesium.Cartographic.fromCartesian(shot.destination).height;
|
||||
@@ -1162,6 +1208,10 @@ test('both entries name the subject the same way', async () => {
|
||||
icon: 'directions_boat',
|
||||
label: 'BRIDGE',
|
||||
});
|
||||
assert.deepEqual(cockpitEntryFace('satellite'), {
|
||||
icon: 'satellite_alt',
|
||||
label: 'ORBIT',
|
||||
});
|
||||
assert.deepEqual(cockpitEntryFace('aircraft'), {
|
||||
icon: 'flight',
|
||||
label: 'COCKPIT',
|
||||
|
||||
@@ -153,7 +153,7 @@ export function maybeRefreshRegionalBrief(info) {
|
||||
!Number.isFinite(info.longitude)
|
||||
)
|
||||
return;
|
||||
const subjectId = `${info.layerId || 'aircraft'}:${info.icao24 || info.mmsi || info.registration || info.callsign || 'unknown'}`;
|
||||
const subjectId = `${info.layerId || 'aircraft'}:${info.icao24 || info.mmsi || info.noradId || info.registration || info.callsign || 'unknown'}`;
|
||||
if (subjectId !== this.regionalBriefSubjectId) {
|
||||
this.regionalBriefAbort?.abort();
|
||||
this.regionalBriefAbort = null;
|
||||
|
||||
@@ -57,6 +57,10 @@ export function update() {
|
||||
updateVessel.call(this, nowMs);
|
||||
return;
|
||||
}
|
||||
if (this.subjectKind === 'satellite') {
|
||||
this.updateOrbital(nowMs);
|
||||
return;
|
||||
}
|
||||
const info = this.readAircraftInfo();
|
||||
|
||||
// Adopt a newly selected track before the camera cadence gate. A context
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/** Coordinate Cockpit lifecycle through supplied aircraft, terrain, rendering and briefing operations. */
|
||||
import {
|
||||
readAircraftInfo,
|
||||
readSatelliteInfo,
|
||||
readVesselInfo,
|
||||
readSubjectLayerId,
|
||||
resolveEntryKind,
|
||||
@@ -15,6 +16,15 @@ import {
|
||||
exit,
|
||||
} from './cockpitTrackingController.js';
|
||||
import { update } from './cockpitCamera.js';
|
||||
import {
|
||||
beginOrbital,
|
||||
endOrbital,
|
||||
resetOrbitalLook,
|
||||
stepOrbitalZoom,
|
||||
turnOrbitalLook,
|
||||
updateOrbital,
|
||||
updateOrbitalHud,
|
||||
} from './cockpitOrbitalView.js';
|
||||
import {
|
||||
publishInstrumentsView,
|
||||
publishRouteView,
|
||||
@@ -95,6 +105,7 @@ export class CockpitViewController {
|
||||
onCameraTakeover = null,
|
||||
isEntryAllowed = null,
|
||||
isBridgeEntryAllowed = null,
|
||||
isOrbitEntryAllowed = null,
|
||||
isUtilityDisclosureOpen = null,
|
||||
onEntered = null,
|
||||
onExited = null,
|
||||
@@ -108,10 +119,21 @@ export class CockpitViewController {
|
||||
this.destroyed = false;
|
||||
this.disposed = false;
|
||||
this.active = false;
|
||||
/** 'aircraft' or 'vessel' while active; which subject the camera rides. */
|
||||
/**
|
||||
* 'aircraft', 'vessel' or 'satellite' while active; which subject the
|
||||
* camera rides.
|
||||
*/
|
||||
this.subjectKind = null;
|
||||
/** The vessel subject's MMSI; aircraft are identified by trackedEntity. */
|
||||
/**
|
||||
* The vessel subject's MMSI or the satellite's NORAD id; aircraft are
|
||||
* identified by trackedEntity.
|
||||
*/
|
||||
this.subjectId = null;
|
||||
/**
|
||||
* The orbital view's zoom, look and saved field of view while a
|
||||
* satellite is ridden (src/ui/cockpitOrbitalView.js); null otherwise.
|
||||
*/
|
||||
this.orbital = null;
|
||||
this.trackedEntity = null;
|
||||
this.trackedEntityWasShown = true;
|
||||
this.heading = null;
|
||||
@@ -162,6 +184,11 @@ export class CockpitViewController {
|
||||
typeof isBridgeEntryAllowed === 'function'
|
||||
? isBridgeEntryAllowed
|
||||
: () => false;
|
||||
// Nor a satellite layer to ride without one.
|
||||
this.isOrbitEntryAllowed =
|
||||
typeof isOrbitEntryAllowed === 'function'
|
||||
? isOrbitEntryAllowed
|
||||
: () => false;
|
||||
this.isUtilityDisclosureOpen =
|
||||
typeof isUtilityDisclosureOpen === 'function'
|
||||
? isUtilityDisclosureOpen
|
||||
@@ -197,6 +224,7 @@ export class CockpitViewController {
|
||||
this.publishSignals = publish.signals ?? (() => {});
|
||||
this.publishUtilityLayout = publish.utilityLayout ?? (() => {});
|
||||
this.publishRadar = publish.radar ?? (() => {});
|
||||
this.publishOrbital = publish.orbital ?? (() => {});
|
||||
/** The bridge radar's range in nautical miles; kept across bridges. */
|
||||
this.radarRangeNm = DEFAULT_RADAR_RANGE_NM;
|
||||
this.presence = {
|
||||
@@ -302,6 +330,15 @@ export class CockpitViewController {
|
||||
this._listen(document, 'click', (event) => {
|
||||
if (event.target?.closest?.('#cockpit-look-ahead')) this.lookAhead();
|
||||
});
|
||||
// The orbital HUD mounts only in orbit, so its controls are delegated.
|
||||
this._listen(document, 'click', (event) => {
|
||||
const target = event.target;
|
||||
if (target?.closest?.('#cockpit-orbital-zoom-in'))
|
||||
this.stepOrbitalZoom(1);
|
||||
else if (target?.closest?.('#cockpit-orbital-zoom-out'))
|
||||
this.stepOrbitalZoom(-1);
|
||||
else if (target?.closest?.('#cockpit-orbital-nadir')) this.orbitalNadir();
|
||||
});
|
||||
this._listen(this.signalToggle, 'click', () =>
|
||||
this.setSignalCollapsed(!this.signalCollapsed, { user: true }),
|
||||
);
|
||||
@@ -346,6 +383,49 @@ export class CockpitViewController {
|
||||
readVesselInfo() {
|
||||
return readVesselInfo.call(this);
|
||||
}
|
||||
readSatelliteInfo() {
|
||||
return readSatelliteInfo.call(this);
|
||||
}
|
||||
beginOrbital() {
|
||||
return beginOrbital.call(this);
|
||||
}
|
||||
endOrbital() {
|
||||
return endOrbital.call(this);
|
||||
}
|
||||
updateOrbital(nowMs) {
|
||||
return updateOrbital.call(this, nowMs);
|
||||
}
|
||||
updateOrbitalHud(info, nowMs) {
|
||||
return updateOrbitalHud.call(this, info, nowMs);
|
||||
}
|
||||
/**
|
||||
* Step the orbital view's optical zoom (the + and − keys and buttons).
|
||||
* @param {number} direction Positive zooms in, negative out.
|
||||
* @returns {boolean} True when the zoom changed.
|
||||
*/
|
||||
stepOrbitalZoom(direction) {
|
||||
return stepOrbitalZoom.call(this, direction);
|
||||
}
|
||||
/**
|
||||
* Tilt the orbital view one arrow step off nadir.
|
||||
* @param {{axis: 'yaw'|'pitch', sign: number, stepDeg: number}} step
|
||||
* @returns {boolean} True in an orbital view.
|
||||
*/
|
||||
turnOrbitalLook(step) {
|
||||
return turnOrbitalLook.call(this, step);
|
||||
}
|
||||
/**
|
||||
* The NADIR control and the Home and 0 keys in orbit: back to pure nadir.
|
||||
* Focus leaves the button before it hides.
|
||||
* @returns {boolean} True in an orbital view.
|
||||
*/
|
||||
orbitalNadir() {
|
||||
const button = document.getElementById('cockpit-orbital-nadir');
|
||||
const hadFocus = !!button && button.contains(document.activeElement);
|
||||
const reset = resetOrbitalLook.call(this);
|
||||
if (reset && hadFocus) this.mapViewButton?.focus({ preventScroll: true });
|
||||
return reset;
|
||||
}
|
||||
readSubjectLayerId() {
|
||||
return readSubjectLayerId.call(this);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
COCKPIT_AIRCRAFT_LAYER_IDS,
|
||||
bridgeEntryAllowed,
|
||||
cockpitEntryAllowed,
|
||||
orbitEntryAllowed,
|
||||
} from '../contextModePolicy.js';
|
||||
import { formatAwarenessLabel } from '../data/militaryAwarenessEngine.js';
|
||||
import { enterCockpitWithTracking } from '../cockpitTracking.js';
|
||||
@@ -42,6 +43,7 @@ export class CockpitCoordinator {
|
||||
flightsLayer,
|
||||
militaryFlightsLayer,
|
||||
aisLiveVesselsLayer,
|
||||
satellitesLayer,
|
||||
isTr3b,
|
||||
toggleTr3b,
|
||||
militaryAwarenessLayer,
|
||||
@@ -56,6 +58,7 @@ export class CockpitCoordinator {
|
||||
fetchRegionalBrief,
|
||||
regionalDistanceM,
|
||||
weatherCodeLabel,
|
||||
acquireOrbitImagery,
|
||||
} = services;
|
||||
this._cockpitDisplayPortal = null;
|
||||
this.cockpitView = new CockpitViewController(viewer, {
|
||||
@@ -63,6 +66,7 @@ export class CockpitCoordinator {
|
||||
flightsLayer,
|
||||
militaryFlightsLayer,
|
||||
aisLiveVesselsLayer,
|
||||
satellitesLayer,
|
||||
isTr3b,
|
||||
toggleTr3b,
|
||||
militaryAwarenessLayer,
|
||||
@@ -78,6 +82,7 @@ export class CockpitCoordinator {
|
||||
fetchRegionalBrief,
|
||||
regionalDistanceM,
|
||||
weatherCodeLabel,
|
||||
acquireOrbitImagery,
|
||||
// The Contact card and Live Signals say which feeds are off.
|
||||
isLayerEnabled: (layerId) => this._isLayerEnabled(layerId),
|
||||
},
|
||||
@@ -101,6 +106,14 @@ export class CockpitCoordinator {
|
||||
vesselsEnabled: !!this._dataManager?.isEnabled('ais-live-vessels'),
|
||||
contextModeChanging: this._contextModeChanging,
|
||||
}),
|
||||
isOrbitEntryAllowed: () =>
|
||||
orbitEntryAllowed({
|
||||
satellitesEnabled: !!this._dataManager?.isEnabled('satellites'),
|
||||
contextModeChanging: this._contextModeChanging,
|
||||
// The layer says whether its class may be ridden.
|
||||
subjectEnterable:
|
||||
satellitesLayer?.getCockpitSubject?.()?.enterable !== false,
|
||||
}),
|
||||
publish: this.publishCockpit,
|
||||
isUtilityDisclosureOpen: () => !!this.readUtilityDisclosureOpen?.(),
|
||||
onEntered: () => this.enterPanels(),
|
||||
@@ -190,6 +203,11 @@ export class CockpitCoordinator {
|
||||
active && this.cockpitView?.subjectKind === 'vessel'
|
||||
? this.cockpitView.readVesselInfo?.()
|
||||
: null;
|
||||
// Likewise an orbital view in use: its satellite, never an aircraft.
|
||||
const satellite =
|
||||
active && this.cockpitView?.subjectKind === 'satellite'
|
||||
? this.cockpitView.readSatelliteInfo?.()
|
||||
: 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
|
||||
@@ -218,22 +236,30 @@ export class CockpitCoordinator {
|
||||
? 'subject-layer-off'
|
||||
: 'no-tracked-aircraft',
|
||||
visionMode: this.cockpitView?.visionMode || null,
|
||||
subject: vessel
|
||||
subject: satellite
|
||||
? {
|
||||
kind: 'vessel',
|
||||
id: vessel.mmsi,
|
||||
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.mmsi,
|
||||
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),
|
||||
|
||||
@@ -25,6 +25,20 @@ const CIVIL = Object.freeze({
|
||||
latitude: 30,
|
||||
longitude: -97,
|
||||
});
|
||||
/** A tracked satellite, as the Satellites layer reports it. */
|
||||
const SATELLITE = Object.freeze({
|
||||
kind: 'satellite',
|
||||
layerId: 'satellites',
|
||||
id: '25544',
|
||||
noradId: 25544,
|
||||
name: 'ISS (ZARYA)',
|
||||
classLabel: 'STATION · ISS',
|
||||
latitude: 30,
|
||||
longitude: -97,
|
||||
altitudeM: 420_000,
|
||||
velocityMps: 7_660,
|
||||
stale: false,
|
||||
});
|
||||
const MILITARY = Object.freeze({
|
||||
...CIVIL,
|
||||
icao24: 'ae0001',
|
||||
@@ -36,6 +50,7 @@ function fixture(
|
||||
{
|
||||
enabled = [],
|
||||
tracked = null,
|
||||
satellite = null,
|
||||
contextMode = null,
|
||||
changing = false,
|
||||
dataManager: suppliedManager = null,
|
||||
@@ -87,6 +102,13 @@ function fixture(
|
||||
flightsLayer: { getTrackedInfo: trackedFrom('flights') },
|
||||
militaryFlightsLayer: { getTrackedInfo: trackedFrom('military') },
|
||||
aisLiveVesselsLayer: { getCockpitSubject: () => null },
|
||||
// Like the layer, no subject while Satellites is off.
|
||||
satellitesLayer: {
|
||||
getCockpitSubject: () =>
|
||||
satellite && layers.has('satellites') ? { ...satellite } : null,
|
||||
getCockpitPosition: () => null,
|
||||
setCockpitSubject: () => true,
|
||||
},
|
||||
militaryAwarenessLayer: { getContextSnapshot: () => null },
|
||||
isTr3b: () => false,
|
||||
holdContinuousRender() {},
|
||||
@@ -121,7 +143,11 @@ function fixture(
|
||||
t.after(() => {
|
||||
coordinator.stop();
|
||||
app.unmount();
|
||||
document.body.classList.remove('cockpit-mode', 'cockpit-bridge');
|
||||
document.body.classList.remove(
|
||||
'cockpit-mode',
|
||||
'cockpit-bridge',
|
||||
'cockpit-orbit',
|
||||
);
|
||||
});
|
||||
/** Turn a layer off and tell the Context owner, as the data manager does. */
|
||||
const disable = (layerId) => {
|
||||
@@ -520,3 +546,85 @@ test('the readout entry reads BRIDGE for a selected vessel', async (t) => {
|
||||
assert.match(readoutEntry.textContent, /directions_boat/);
|
||||
assert.match(readoutEntry.textContent, /BRIDGE/);
|
||||
});
|
||||
|
||||
test('a tracked satellite needs Satellites on for the ORBIT entry', async (t) => {
|
||||
const { $, cockpit } = fixture(t, { satellite: SATELLITE });
|
||||
cockpit.syncEntry();
|
||||
await nextTick();
|
||||
assert.equal($('#cockpit-entry').hidden, true, 'Satellites off: no entry');
|
||||
assert.equal(cockpit.enter(), false);
|
||||
});
|
||||
|
||||
test('with Satellites on, the tracked satellite offers ORBIT and reports itself', async (t) => {
|
||||
const { $, cockpit, coordinator, pinia } = fixture(t, {
|
||||
enabled: ['satellites'],
|
||||
satellite: SATELLITE,
|
||||
});
|
||||
useHudStore(pinia);
|
||||
cockpit.syncEntry();
|
||||
await nextTick();
|
||||
for (const selector of ['#cockpit-entry', '#cockpit-entry-readout']) {
|
||||
assert.equal($(selector).hidden, false, selector);
|
||||
assert.match($(selector).textContent, /satellite_alt/);
|
||||
assert.match($(selector).textContent, /ORBIT/);
|
||||
}
|
||||
// Voice stays aircraft-only: it neither offers nor takes the satellite.
|
||||
assert.equal(coordinator.getCockpitState().entryAllowed, false);
|
||||
assert.equal(coordinator.controlCockpit('enter').ok, false);
|
||||
assert.equal(cockpit.active, false);
|
||||
$('#cockpit-entry-readout').click();
|
||||
await nextTick();
|
||||
assert.equal(cockpit.active, true);
|
||||
assert.equal(cockpit.subjectKind, 'satellite');
|
||||
const state = coordinator.getCockpitState();
|
||||
assert.equal(state.active, true);
|
||||
assert.deepEqual(state.subject, {
|
||||
kind: 'satellite',
|
||||
id: '25544',
|
||||
layerId: 'satellites',
|
||||
callsign: null,
|
||||
name: 'ISS (ZARYA)',
|
||||
});
|
||||
});
|
||||
|
||||
test('tracked debris offers no ORBIT entry and refuses to be entered', async (t) => {
|
||||
const { $, cockpit } = fixture(t, {
|
||||
enabled: ['satellites'],
|
||||
satellite: {
|
||||
...SATELLITE,
|
||||
id: '27386',
|
||||
noradId: 27386,
|
||||
name: 'SL-16 R/B',
|
||||
satelliteClass: 'debris',
|
||||
enterable: false,
|
||||
},
|
||||
});
|
||||
cockpit.syncEntry();
|
||||
await nextTick();
|
||||
for (const selector of ['#cockpit-entry', '#cockpit-entry-readout'])
|
||||
assert.equal($(selector).hidden, true, selector);
|
||||
assert.equal(cockpit.enter(), false);
|
||||
assert.equal(cockpit.enter({ kind: 'satellite' }), false);
|
||||
assert.equal(cockpit.active, false);
|
||||
});
|
||||
|
||||
test('a Context change in flight blocks the orbital view too', (t) => {
|
||||
const { cockpit } = fixture(t, {
|
||||
enabled: ['satellites'],
|
||||
satellite: SATELLITE,
|
||||
changing: true,
|
||||
});
|
||||
assert.equal(cockpit.enter(), false);
|
||||
});
|
||||
|
||||
test('turning Satellites off ends the orbital view', (t) => {
|
||||
const { cockpit, disable } = fixture(t, {
|
||||
enabled: ['satellites', 'flights'],
|
||||
satellite: SATELLITE,
|
||||
});
|
||||
assert.equal(cockpit.enter(), true);
|
||||
disable('flights');
|
||||
assert.equal(cockpit.active, true, 'other feeds are free to go off');
|
||||
disable('satellites');
|
||||
assert.equal(cockpit.active, false);
|
||||
});
|
||||
+31
-30
@@ -39,6 +39,8 @@ function subjectWorldPosition(kind) {
|
||||
) ?? null
|
||||
);
|
||||
}
|
||||
if (kind === 'satellite')
|
||||
return this.services.satellitesLayer?.getCockpitPosition?.() ?? null;
|
||||
const info = this.readVesselInfo();
|
||||
if (!Number.isFinite(info?.latitude) || !Number.isFinite(info?.longitude))
|
||||
return null;
|
||||
@@ -194,9 +196,35 @@ function handleLookKey(event) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Zoom keys in orbit: `+` (or `=`, unshifted) in and `-` (or `_`) out. */
|
||||
const ORBITAL_ZOOM_KEYS = Object.freeze({ '+': 1, '=': 1, '-': -1, _: -1 });
|
||||
|
||||
/**
|
||||
* The Cockpit's capture-phase keydown: Escape and C, and on a bridge the
|
||||
* look-around keys.
|
||||
* In an orbital view: tilt off nadir with the arrows (single 5° steps; Shift
|
||||
* does not take the bridge's 45° step), return to nadir with Home or 0, and
|
||||
* step the zoom with + and −. The bridge's focus guards apply.
|
||||
* @returns {boolean} True when the key was taken.
|
||||
*/
|
||||
function handleOrbitalKey(event) {
|
||||
if (!this.active || this.subjectKind !== 'satellite') return false;
|
||||
if (event.metaKey || event.ctrlKey || event.altKey) return false;
|
||||
const step = lookKeyStep(event.key);
|
||||
const reset = !event.repeat && (event.key === 'Home' || event.key === '0');
|
||||
const zoom = event.repeat ? 0 : ORBITAL_ZOOM_KEYS[event.key] || 0;
|
||||
if (!step && !reset && !zoom) return false;
|
||||
if (event.target?.closest?.(LOOK_KEY_OWNERS)) return false;
|
||||
if (this.isUtilityDisclosureOpen?.()) return false;
|
||||
event.preventDefault();
|
||||
if (step) this.turnOrbitalLook(step);
|
||||
else if (reset) this.orbitalNadir();
|
||||
else this.stepOrbitalZoom(zoom);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Cockpit's capture-phase keydown: Escape, on a bridge the look-around
|
||||
* keys and in orbit the tilt and zoom keys. C is left to the app-wide CCTV
|
||||
* shortcut; entry is by double-click or the entry buttons.
|
||||
* @param {KeyboardEvent} event
|
||||
*/
|
||||
export function onKeyDown(event) {
|
||||
@@ -247,32 +275,5 @@ export function onKeyDown(event) {
|
||||
if (event.target?.closest?.('input, textarea, select, [contenteditable]'))
|
||||
return;
|
||||
if (handleLookKey.call(this, event)) return;
|
||||
const key = event.key?.toLowerCase();
|
||||
if (key === 'c' && !event.metaKey && !event.ctrlKey && !event.altKey) {
|
||||
if (!this.active) {
|
||||
const cockpitAttempt = !!(
|
||||
this.readAircraftInfo() && this.viewer.trackedEntity?.position
|
||||
);
|
||||
// With no tracked aircraft, C takes the selected vessel's bridge, but
|
||||
// only when the bridge can be entered: otherwise C stays the CCTV
|
||||
// shortcut, as it is with nothing selected.
|
||||
const bridgeAttempt =
|
||||
!cockpitAttempt &&
|
||||
!!this.readVesselInfo() &&
|
||||
this.isBridgeEntryAllowed();
|
||||
if (!cockpitAttempt && !bridgeAttempt) return;
|
||||
if (bridgeAttempt) {
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
this.enter({ kind: 'vessel' });
|
||||
return;
|
||||
}
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
if (!this.active && !this.isEntryAllowed()) return;
|
||||
if (this.active) this.exit();
|
||||
else this.enter({ kind: 'aircraft' });
|
||||
return;
|
||||
}
|
||||
handleOrbitalKey.call(this, event);
|
||||
}
|
||||
@@ -140,6 +140,11 @@ export function updateHud(
|
||||
updateVesselHud.call(this, info, nowMs, forceContext);
|
||||
return;
|
||||
}
|
||||
// The orbital view keeps its own HUD (CockpitOrbital).
|
||||
if (info?.kind === 'satellite') {
|
||||
this.updateOrbitalHud(info, nowMs);
|
||||
return;
|
||||
}
|
||||
this.lastSubjectInfo = info;
|
||||
const view = this.instruments;
|
||||
view.kind = 'aircraft';
|
||||
|
||||
@@ -0,0 +1,263 @@
|
||||
// src/ui/cockpitOrbital.test.mjs — the orbital view HUD shows what the
|
||||
// Cockpit controller publishes to the store, over happy-dom.
|
||||
import '../testSupport/registerDom.mjs';
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { createPinia } from 'pinia';
|
||||
import { createApp, nextTick } from 'vue';
|
||||
import { useCockpitStore } from './stores/cockpit.js';
|
||||
import CockpitOrbital from './views/panels/CockpitOrbital.vue';
|
||||
|
||||
const VIEW = Object.freeze({
|
||||
name: 'ISS (ZARYA)',
|
||||
classLabel: 'STATION · ISS',
|
||||
altitudeM: 418_400,
|
||||
velocityMps: 7_662,
|
||||
latitude: 12.3456,
|
||||
longitude: -45.6789,
|
||||
zoom: 4,
|
||||
zoomSteps: [1, 2, 4, 8],
|
||||
footprintKm: 61.4,
|
||||
transition: { active: false, blurPx: 0, lockTick: false },
|
||||
});
|
||||
|
||||
function fixture(t) {
|
||||
document.body.replaceChildren();
|
||||
const host = document.body.appendChild(document.createElement('div'));
|
||||
const pinia = createPinia();
|
||||
const app = createApp(CockpitOrbital).use(pinia);
|
||||
app.mount(host);
|
||||
t.after(() => app.unmount());
|
||||
const store = useCockpitStore(pinia);
|
||||
const section = () => document.getElementById('cockpit-orbital');
|
||||
const text = (selector) =>
|
||||
section().querySelector(selector)?.textContent.trim() ?? null;
|
||||
return { store, section, text };
|
||||
}
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
test('a published orbital view renders its readouts and zoom controls', async (t) => {
|
||||
const f = fixture(t);
|
||||
f.store.publishOrbital({ ...VIEW });
|
||||
await nextTick();
|
||||
assert.equal(f.section().hidden, false);
|
||||
assert.equal(f.text('.cockpit-orbital-kicker'), 'ORBITAL VIEW · NADIR');
|
||||
assert.equal(f.text('.cockpit-orbital-name'), 'ISS (ZARYA)');
|
||||
assert.equal(f.text('.cockpit-orbital-class'), 'STATION · ISS');
|
||||
assert.equal(f.text('.cockpit-orbital-altitude'), '418 KM');
|
||||
assert.equal(f.text('.cockpit-orbital-velocity'), '7.66 KM/S');
|
||||
assert.match(f.text('.cockpit-orbital-subpoint'), /12\.346°N.*45\.679°W/);
|
||||
assert.equal(f.text('.cockpit-orbital-north'), 'NORTH UP');
|
||||
assert.equal(f.text('.cockpit-orbital-zoom'), 'ZOOM 4×');
|
||||
assert.equal(f.text('.cockpit-orbital-swath'), 'SWATH 61 KM');
|
||||
|
||||
const zoomIn = document.getElementById('cockpit-orbital-zoom-in');
|
||||
const zoomOut = document.getElementById('cockpit-orbital-zoom-out');
|
||||
assert.equal(zoomIn.getAttribute('aria-label'), 'Zoom in');
|
||||
assert.equal(zoomOut.getAttribute('aria-label'), 'Zoom out');
|
||||
assert.equal(zoomIn.disabled, false);
|
||||
assert.equal(zoomOut.disabled, false);
|
||||
assert.ok(f.section().querySelector('.cockpit-orbital-reticle'));
|
||||
});
|
||||
|
||||
test('zoom buttons stop at the ends of the zoom steps', async (t) => {
|
||||
const f = fixture(t);
|
||||
f.store.publishOrbital({ ...VIEW, zoom: 8, footprintKm: 7.25 });
|
||||
await nextTick();
|
||||
assert.equal(
|
||||
document.getElementById('cockpit-orbital-zoom-in').disabled,
|
||||
true,
|
||||
);
|
||||
assert.equal(f.text('.cockpit-orbital-swath'), 'SWATH 7.3 KM');
|
||||
f.store.publishOrbital({ ...VIEW, zoom: 1 });
|
||||
await nextTick();
|
||||
assert.equal(
|
||||
document.getElementById('cockpit-orbital-zoom-out').disabled,
|
||||
true,
|
||||
);
|
||||
assert.equal(
|
||||
document.getElementById('cockpit-orbital-zoom-in').disabled,
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
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.text('.cockpit-orbital-altitude'), '418 KM');
|
||||
});
|
||||
|
||||
test('a zoom step reflects its blur and lock tick', async (t) => {
|
||||
const f = fixture(t);
|
||||
f.store.publishOrbital({
|
||||
...VIEW,
|
||||
transition: { active: true, blurPx: 4.5, lockTick: false },
|
||||
});
|
||||
await nextTick();
|
||||
assert.ok(f.section().classList.contains('cockpit-orbital-focusing'));
|
||||
assert.equal(
|
||||
f.section().style.getPropertyValue('--cockpit-orbital-blur'),
|
||||
'4.50px',
|
||||
);
|
||||
const reticle = f.section().querySelector('.cockpit-orbital-reticle');
|
||||
assert.equal(
|
||||
reticle.classList.contains('cockpit-orbital-reticle-lock'),
|
||||
false,
|
||||
);
|
||||
|
||||
f.store.publishOrbital({
|
||||
...VIEW,
|
||||
transition: { active: false, blurPx: 0, lockTick: true },
|
||||
});
|
||||
await nextTick();
|
||||
assert.ok(!f.section().classList.contains('cockpit-orbital-focusing'));
|
||||
assert.equal(
|
||||
f.section().style.getPropertyValue('--cockpit-orbital-blur'),
|
||||
'0px',
|
||||
);
|
||||
assert.ok(
|
||||
f
|
||||
.section()
|
||||
.querySelector('.cockpit-orbital-reticle')
|
||||
.classList.contains('cockpit-orbital-reticle-lock'),
|
||||
);
|
||||
});
|
||||
|
||||
test('publishing null hides the orbital HUD again', async (t) => {
|
||||
const f = fixture(t);
|
||||
f.store.publishOrbital({ ...VIEW });
|
||||
await nextTick();
|
||||
assert.equal(f.section().hidden, false);
|
||||
f.store.publishOrbital(null);
|
||||
await nextTick();
|
||||
assert.equal(f.section().hidden, true);
|
||||
assert.equal(f.section().querySelector('.cockpit-orbital-name'), null);
|
||||
});
|
||||
|
||||
const ISS_TLE = Object.freeze({
|
||||
line1:
|
||||
'1 25544U 98067A 26308.34166667 .00016717 00000-0 30306-3 0 9993',
|
||||
line2:
|
||||
'2 25544 51.6416 247.4627 0006703 130.5360 325.0288 15.50377579477310',
|
||||
epochMs: Date.UTC(2026, 10, 4, 8, 12, 0),
|
||||
});
|
||||
|
||||
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);
|
||||
const over = () =>
|
||||
f.section().querySelector('#cockpit-orbital-over strong')?.textContent;
|
||||
f.store.publishOrbital({
|
||||
...VIEW,
|
||||
place: { kind: 'country', name: 'France', countryCode: 'FR' },
|
||||
});
|
||||
await nextTick();
|
||||
assert.match(f.text('#cockpit-orbital-over'), /^CURRENTLY OVER/);
|
||||
assert.equal(over(), 'France');
|
||||
// The division as Natural Earth names it, the country localized.
|
||||
const sichuan = {
|
||||
kind: 'country',
|
||||
name: 'China',
|
||||
countryCode: 'CN',
|
||||
division: 'Sichuan',
|
||||
near: null,
|
||||
};
|
||||
f.store.publishOrbital({ ...VIEW, place: sichuan });
|
||||
await nextTick();
|
||||
assert.equal(over(), 'Sichuan, China');
|
||||
// From 8x, the populated place in view.
|
||||
f.store.publishOrbital({ ...VIEW, place: { ...sichuan, near: 'Chengdu' } });
|
||||
await nextTick();
|
||||
assert.equal(over(), 'Sichuan, China · near Chengdu');
|
||||
f.store.publishOrbital({
|
||||
...VIEW,
|
||||
place: { kind: 'sea', name: 'Caspian Sea', countryCode: null },
|
||||
});
|
||||
await nextTick();
|
||||
assert.equal(over(), 'Caspian Sea');
|
||||
// No feature holds the point (a gap at a simplified coastline): the band
|
||||
// says nothing rather than call land open ocean.
|
||||
f.store.publishOrbital({ ...VIEW, place: null });
|
||||
await nextTick();
|
||||
assert.equal(document.querySelector('#cockpit-orbital-over'), null);
|
||||
});
|
||||
|
||||
test('the readout names the owner, operator and element set', async (t) => {
|
||||
const f = fixture(t);
|
||||
f.store.publishOrbital({
|
||||
...VIEW,
|
||||
noradId: 25544,
|
||||
cosparId: '1998-067A',
|
||||
tle: ISS_TLE,
|
||||
// Under node there is no flag glob, so a country shows as a badge.
|
||||
owner: { countryCode: 'US', label: 'USA' },
|
||||
operator: 'NASA',
|
||||
});
|
||||
await nextTick();
|
||||
assert.equal(f.text('.cockpit-orbital-name'), 'ISS (ZARYA)');
|
||||
assert.equal(f.text('.cockpit-orbital-owner-badge'), 'USA');
|
||||
assert.equal(
|
||||
f.section().querySelector('.cockpit-orbital-owner-badge').title,
|
||||
'United States',
|
||||
);
|
||||
assert.equal(f.text('.cockpit-orbital-operator'), 'NASA');
|
||||
assert.equal(
|
||||
f.text('.cockpit-orbital-ident-text'),
|
||||
'NORAD 25544 · 1998-067A · EPOCH 2026-11-04 08:12Z',
|
||||
);
|
||||
const toggle = document.getElementById('cockpit-orbital-tle-toggle');
|
||||
const tle = document.getElementById('cockpit-orbital-tle');
|
||||
assert.equal(toggle.getAttribute('aria-expanded'), 'false');
|
||||
assert.equal(tle.style.display, 'none', 'folded');
|
||||
toggle.click();
|
||||
await nextTick();
|
||||
assert.equal(toggle.getAttribute('aria-expanded'), 'true');
|
||||
assert.notEqual(tle.style.display, 'none');
|
||||
assert.equal(tle.textContent, `${ISS_TLE.line1}\n${ISS_TLE.line2}`);
|
||||
// Another satellite starts folded.
|
||||
f.store.publishOrbital({ ...VIEW, noradId: 48274, tle: ISS_TLE });
|
||||
await nextTick();
|
||||
assert.equal(
|
||||
document
|
||||
.getElementById('cockpit-orbital-tle-toggle')
|
||||
.getAttribute('aria-expanded'),
|
||||
'false',
|
||||
);
|
||||
});
|
||||
|
||||
test('unknown identity fields leave their rows out', async (t) => {
|
||||
const f = fixture(t);
|
||||
f.store.publishOrbital({
|
||||
...VIEW,
|
||||
noradId: null,
|
||||
cosparId: null,
|
||||
tle: null,
|
||||
owner: null,
|
||||
operator: null,
|
||||
});
|
||||
await nextTick();
|
||||
for (const selector of [
|
||||
'.cockpit-orbital-flag',
|
||||
'.cockpit-orbital-owner-badge',
|
||||
'.cockpit-orbital-operator',
|
||||
'.cockpit-orbital-ident',
|
||||
'#cockpit-orbital-tle',
|
||||
])
|
||||
assert.equal(f.section().querySelector(selector), null, selector);
|
||||
// An element set with no NORAD id still dates itself.
|
||||
f.store.publishOrbital({ ...VIEW, tle: ISS_TLE });
|
||||
await nextTick();
|
||||
assert.equal(
|
||||
f.text('.cockpit-orbital-ident-text'),
|
||||
'EPOCH 2026-11-04 08:12Z',
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,549 @@
|
||||
/** The orbital (satellite) view of the Cockpit controller: camera, zoom, look and HUD. */
|
||||
import { formatNumber, msg, t } from '../i18n/index.js';
|
||||
import {
|
||||
ORBITAL_BASE_MAX_ZOOM,
|
||||
ORBITAL_DEFAULT_ZOOM,
|
||||
ORBITAL_SETTLE_BLUR_PX,
|
||||
ORBITAL_ZOOM_LADDER,
|
||||
ORBITAL_ZOOM_TRANSITION_MS,
|
||||
cesiumFrustumFovRad,
|
||||
footprintWidthKm,
|
||||
fovForZoom,
|
||||
interpolateZoomFov,
|
||||
nadirOrientation,
|
||||
nextOrbitalZoom,
|
||||
offNadirAngleDeg,
|
||||
offNadirOrientation,
|
||||
offNadirSwathScale,
|
||||
orbitalBaseFovRad,
|
||||
previousOrbitalZoom,
|
||||
zoomSettleHolding,
|
||||
zoomTransitionState,
|
||||
} from '../cockpitOrbital.js';
|
||||
import {
|
||||
easeLook,
|
||||
lookIsOffset,
|
||||
orbitalLookReadoutParts,
|
||||
stepOrbitalLook,
|
||||
} from '../cockpitLook.js';
|
||||
import { cockpitUiUpdateDue } from '../cockpitMath.js';
|
||||
import { createPlaceTracker, nearPlaceRadiusKm } from '../data/placeBelow.js';
|
||||
import {
|
||||
COCKPIT_CONTEXT_UPDATE_MS,
|
||||
COCKPIT_HUD_UPDATE_MS,
|
||||
compassPointLabel,
|
||||
formatCockpitCoordinate,
|
||||
} from './cockpitPresentation.js';
|
||||
|
||||
/**
|
||||
* How often the orbital view asks for a regional brief. A low orbit crosses
|
||||
* the briefing's 25 km refresh distance every few seconds, so the sub-satellite
|
||||
* point is briefed on a clock instead.
|
||||
*/
|
||||
export const ORBITAL_BRIEF_REFRESH_MS = 60_000;
|
||||
|
||||
/** Whether the user asked for reduced motion: zoom steps and tilts cut. */
|
||||
function prefersReducedMotion() {
|
||||
return Boolean(
|
||||
globalThis.matchMedia?.('(prefers-reduced-motion: reduce)')?.matches,
|
||||
);
|
||||
}
|
||||
|
||||
const IDLE_TRANSITION = Object.freeze({
|
||||
active: false,
|
||||
blurPx: 0,
|
||||
lockTick: false,
|
||||
});
|
||||
|
||||
const NADIR_LOOK = Object.freeze({ yawDeg: 0, pitchDeg: 0 });
|
||||
|
||||
/**
|
||||
* Start an orbital session's state. Keeps the camera's own field of view so
|
||||
* the exit can put it back exactly.
|
||||
*/
|
||||
export function beginOrbital() {
|
||||
const frustum = this.viewer.camera?.frustum;
|
||||
const state = {
|
||||
imagery: acquireOrbitImagery(this.services),
|
||||
zoom: ORBITAL_DEFAULT_ZOOM,
|
||||
// A zoom step in flight: the magnification it started from and when.
|
||||
transition: null,
|
||||
previousUp: null,
|
||||
savedFov: Number.isFinite(frustum?.fov) ? frustum.fov : null,
|
||||
altitudeM: null,
|
||||
verticalFov: null,
|
||||
lastBriefMs: 0,
|
||||
lookTarget: { ...NADIR_LOOK },
|
||||
lookView: { ...NADIR_LOOK },
|
||||
lookLastMs: performance.now(),
|
||||
// What the sub-satellite point is over: undefined until the first
|
||||
// lookup lands, then a place or null (nothing named there).
|
||||
place: undefined,
|
||||
placeTracker: null,
|
||||
};
|
||||
state.placeTracker = createPlaceTracker({
|
||||
lookup: this.services.placeBelow,
|
||||
onPlace: (place) => {
|
||||
if (this.orbital !== state) return;
|
||||
state.place = place;
|
||||
if (this.lastSubjectInfo?.kind === 'satellite')
|
||||
publishOrbitalView.call(this, this.lastSubjectInfo);
|
||||
},
|
||||
});
|
||||
this.orbital = state;
|
||||
}
|
||||
|
||||
/** End the orbital session: restore the field of view and clear the HUD. */
|
||||
export function endOrbital() {
|
||||
const state = this.orbital;
|
||||
if (!state) return;
|
||||
this.orbital = null;
|
||||
state.placeTracker?.reset();
|
||||
const frustum = this.viewer.camera?.frustum;
|
||||
if (frustum && state.savedFov !== null) frustum.fov = state.savedFov;
|
||||
// Back to the map the operator had, unless they picked another meanwhile.
|
||||
state.imagery?.release?.()?.catch?.(() => {});
|
||||
this.publishOrbital(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Offer the sub-satellite point to the place tracker, with the radius a
|
||||
* populated place may lie in to be named (half the settled view's smaller
|
||||
* ground dimension, from NEAR_PLACE_MIN_ZOOM on), so a zoom step refreshes
|
||||
* the place at once.
|
||||
*/
|
||||
function trackPlace(info, nowMs) {
|
||||
const state = this.orbital;
|
||||
if (!state?.placeTracker) return;
|
||||
let nearKm = null;
|
||||
if (Number.isFinite(info.altitudeM)) {
|
||||
const frustum = this.viewer.camera?.frustum;
|
||||
const aspect = Number.isFinite(frustum?.aspectRatio)
|
||||
? frustum.aspectRatio
|
||||
: canvasAspect(this.viewer);
|
||||
const fov = fovForZoom(orbitalBaseFovRad(info.altitudeM), state.zoom);
|
||||
// The field of view is vertical: aspect 1 gives the ground height.
|
||||
nearKm = nearPlaceRadiusKm(
|
||||
state.zoom,
|
||||
footprintWidthKm(info.altitudeM, fov, aspect),
|
||||
footprintWidthKm(info.altitudeM, fov, 1),
|
||||
);
|
||||
}
|
||||
state.placeTracker.update(info.latitude, info.longitude, nowMs, nearKm);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lease the map for flat imagery while in orbit. Another owner already
|
||||
* holding it (an imagery comparison) keeps the map as it is.
|
||||
* @returns {{release: () => Promise<void>}|null}
|
||||
*/
|
||||
function acquireOrbitImagery(services) {
|
||||
try {
|
||||
const lease = services?.acquireOrbitImagery?.() ?? null;
|
||||
lease?.ready?.catch?.(() => {});
|
||||
return lease;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** The magnification the view shows at `nowMs`, mid-step included. */
|
||||
function currentMagnification(state, baseFov, nowMs) {
|
||||
const fov = verticalFovAt(state, baseFov, nowMs).fov;
|
||||
return Math.tan(baseFov / 2) / Math.tan(fov / 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* The vertical field of view at `nowMs` and the step's HUD state. Once the
|
||||
* field of view lands, the focus pull holds until the imagery has loaded
|
||||
* (see `zoomSettleHolding`), then the reticle locks. A step that has settled
|
||||
* (lock tick over) is retired.
|
||||
*/
|
||||
function verticalFovAt(state, baseFov, nowMs, tilesLoaded = true) {
|
||||
const target = fovForZoom(baseFov, state.zoom);
|
||||
const step = state.transition;
|
||||
if (!step) return { fov: target, transition: IDLE_TRANSITION, moving: false };
|
||||
const elapsedMs = nowMs - step.startMs;
|
||||
const landedMs = elapsedMs - ORBITAL_ZOOM_TRANSITION_MS;
|
||||
if (landedMs >= 0 && step.heldMs === undefined) {
|
||||
if (zoomSettleHolding(landedMs, tilesLoaded)) {
|
||||
return {
|
||||
fov: target,
|
||||
transition: {
|
||||
active: true,
|
||||
blurPx: ORBITAL_SETTLE_BLUR_PX,
|
||||
lockTick: false,
|
||||
},
|
||||
moving: true,
|
||||
};
|
||||
}
|
||||
step.heldMs = landedMs;
|
||||
}
|
||||
// The lock tick runs from the end of the hold, not the end of the move.
|
||||
const now = zoomTransitionState(elapsedMs - (step.heldMs ?? 0));
|
||||
const fov = interpolateZoomFov(
|
||||
fovForZoom(baseFov, step.fromZoom),
|
||||
target,
|
||||
now.progress,
|
||||
);
|
||||
return {
|
||||
fov,
|
||||
transition: {
|
||||
active: now.active,
|
||||
// Settled steps carry no residue of the blur curve (sin π ≠ 0).
|
||||
blurPx: now.active ? now.blurPx : 0,
|
||||
lockTick: now.lockTick,
|
||||
},
|
||||
moving: now.active || now.lockTick,
|
||||
};
|
||||
}
|
||||
|
||||
/** Apply the field of view for the altitude and time; returns the HUD state. */
|
||||
function applyFov(state, altitudeM, nowMs) {
|
||||
const baseFov = orbitalBaseFovRad(altitudeM);
|
||||
const reading = verticalFovAt(
|
||||
state,
|
||||
baseFov,
|
||||
nowMs,
|
||||
tilesLoaded(this.viewer),
|
||||
);
|
||||
// The step's last frame (its lock tick over) publishes the idle state.
|
||||
if (state.transition && !reading.moving) {
|
||||
state.transition = null;
|
||||
reading.transition = IDLE_TRANSITION;
|
||||
}
|
||||
state.verticalFov = reading.fov;
|
||||
const frustum = this.viewer.camera?.frustum;
|
||||
if (frustum && 'fov' in frustum) {
|
||||
const aspect = Number.isFinite(frustum.aspectRatio)
|
||||
? frustum.aspectRatio
|
||||
: canvasAspect(this.viewer);
|
||||
frustum.fov = cesiumFrustumFovRad(reading.fov, aspect);
|
||||
}
|
||||
return reading;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the imagery under the view has loaded. Flat imagery drapes the
|
||||
* globe; with the globe hidden (Google 3D kept) there is nothing to wait for.
|
||||
*/
|
||||
function tilesLoaded(viewer) {
|
||||
const globe = viewer.scene?.globe;
|
||||
return !globe?.show || globe.tilesLoaded !== false;
|
||||
}
|
||||
|
||||
function canvasAspect(viewer) {
|
||||
const canvas = viewer.scene?.canvas;
|
||||
const width = canvas?.clientWidth;
|
||||
const height = canvas?.clientHeight;
|
||||
return width > 0 && height > 0 ? width / height : 1;
|
||||
}
|
||||
|
||||
/** Copy a plain vector into a Cesium scratch. */
|
||||
function intoCartesian(vector, result) {
|
||||
result.x = vector.x;
|
||||
result.y = vector.y;
|
||||
result.z = vector.z;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Drive the orbital camera for one rendered frame: at the satellite's own
|
||||
* per-frame position, looking at the Earth's centre with the ground track at
|
||||
* the top (north at the top for a satellite with none), tilted by the
|
||||
* off-nadir look. A low orbit moves ~7.6 km/s, so there is no cadence
|
||||
* gate here; only the HUD and briefing keep theirs.
|
||||
* @param {number} nowMs Frame time.
|
||||
*/
|
||||
export function updateOrbital(nowMs) {
|
||||
// Tracking anything from orbit (an aircraft, another satellite) ends the
|
||||
// view and leaves Cesium tracking with that target.
|
||||
if (this.viewer.trackedEntity?.position) {
|
||||
this.exit({ restoreTracking: false });
|
||||
return;
|
||||
}
|
||||
const info = this.readSatelliteInfo();
|
||||
if (!info || info.noradId !== this.subjectId || !this.orbital) {
|
||||
this.exit({ restoreTracking: false });
|
||||
return;
|
||||
}
|
||||
const position = this.services.satellitesLayer?.getCockpitPosition?.(
|
||||
this.scratchTarget,
|
||||
);
|
||||
if (!position) return;
|
||||
const state = this.orbital;
|
||||
// Track-up: the ground track at the top, so the picture scrolls along it.
|
||||
// A geostationary satellite has no track and stays north-up.
|
||||
const nadir = nadirOrientation(position, {
|
||||
previousUp: state.previousUp,
|
||||
headingDeg: Number.isFinite(info.groundTrackDeg)
|
||||
? info.groundTrackDeg
|
||||
: null,
|
||||
});
|
||||
if (!nadir) return;
|
||||
state.previousUp = nadir.north;
|
||||
state.altitudeM = info.altitudeM;
|
||||
state.lookView = easeLook(
|
||||
state.lookView,
|
||||
state.lookTarget,
|
||||
nowMs - (state.lookLastMs || nowMs),
|
||||
{ immediate: prefersReducedMotion() },
|
||||
);
|
||||
state.lookLastMs = nowMs;
|
||||
const view = offNadirOrientation(nadir, {
|
||||
northDeg: state.lookView.pitchDeg,
|
||||
eastDeg: state.lookView.yawDeg,
|
||||
});
|
||||
const zoomStepping = Boolean(state.transition);
|
||||
const reading = applyFov.call(this, state, info.altitudeM, nowMs);
|
||||
this.viewer.camera.setView({
|
||||
destination: position,
|
||||
orientation: {
|
||||
direction: intoCartesian(view.direction, this.scratchForward),
|
||||
up: intoCartesian(view.up, this.scratchUp),
|
||||
},
|
||||
});
|
||||
this.lastSubjectInfo = info;
|
||||
if (
|
||||
zoomStepping ||
|
||||
cockpitUiUpdateDue(nowMs, this.lastHudUpdateMs, COCKPIT_HUD_UPDATE_MS)
|
||||
) {
|
||||
this.lastHudUpdateMs = nowMs;
|
||||
trackPlace.call(this, info, nowMs);
|
||||
publishOrbitalView.call(this, info, reading.transition);
|
||||
}
|
||||
if (
|
||||
cockpitUiUpdateDue(
|
||||
nowMs,
|
||||
this.lastContextUpdateMs,
|
||||
COCKPIT_CONTEXT_UPDATE_MS,
|
||||
)
|
||||
) {
|
||||
this.lastContextUpdateMs = nowMs;
|
||||
updateOrbitalContext.call(this, info, nowMs);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Brief the sub-satellite point: the local page every context beat, the
|
||||
* regional brief on its own slower clock.
|
||||
*/
|
||||
function updateOrbitalContext(info, nowMs, force = false) {
|
||||
this.updateLocalPosition(info);
|
||||
const state = this.orbital;
|
||||
if (
|
||||
state &&
|
||||
(force || nowMs - state.lastBriefMs >= ORBITAL_BRIEF_REFRESH_MS)
|
||||
) {
|
||||
state.lastBriefMs = nowMs;
|
||||
this.maybeRefreshRegionalBrief(info);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A track-up view tilts along and across the ground track, not toward the
|
||||
* compass: the look's north/east axes are the frame's top and right.
|
||||
*/
|
||||
const TRACK_LOOK_LABELS = Object.freeze({
|
||||
N: msg('FWD'),
|
||||
S: msg('AFT'),
|
||||
E: msg('RIGHT'),
|
||||
W: msg('LEFT'),
|
||||
});
|
||||
|
||||
function lookDirectionLabel(code, trackUp) {
|
||||
return trackUp ? t(TRACK_LOOK_LABELS[code]) : compassPointLabel(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Word the off-nadir look with its total angle from nadir first, or '' at
|
||||
* nadir: `OFF-NADIR 18.0° · FWD 15° · RIGHT 10°`.
|
||||
*/
|
||||
function wordOffNadir(look, { trackUp = false } = {}) {
|
||||
const parts = orbitalLookReadoutParts(look);
|
||||
const words = [];
|
||||
if (parts.northSouth)
|
||||
words.push(
|
||||
t('{direction} {angle}°', {
|
||||
direction: lookDirectionLabel(parts.northSouth, trackUp),
|
||||
angle: formatNumber(parts.northSouthDeg),
|
||||
}),
|
||||
);
|
||||
if (parts.eastWest)
|
||||
words.push(
|
||||
t('{direction} {angle}°', {
|
||||
direction: lookDirectionLabel(parts.eastWest, trackUp),
|
||||
angle: formatNumber(parts.eastWestDeg),
|
||||
}),
|
||||
);
|
||||
if (!words.length) return '';
|
||||
return t('OFF-NADIR {angle}° · {offset}', {
|
||||
angle: formatNumber(offNadirAngleDeg(lookTilt(parts)), {
|
||||
minimumFractionDigits: 1,
|
||||
maximumFractionDigits: 1,
|
||||
}),
|
||||
offset: words.join(' · '),
|
||||
});
|
||||
}
|
||||
|
||||
/** The look's tilt as worded: whole degrees, signed north and east. */
|
||||
function lookTilt(parts) {
|
||||
return {
|
||||
northDeg: (parts.northSouth === 'S' ? -1 : 1) * parts.northSouthDeg,
|
||||
eastDeg: (parts.eastWest === 'W' ? -1 : 1) * parts.eastWestDeg,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish the orbital HUD. The swath is the nadir footprint, so it is left
|
||||
* out while the view is tilted off nadir.
|
||||
* @param {object} info Satellite subject (`readSatelliteInfo`).
|
||||
* @param {{active: boolean, blurPx: number, lockTick: boolean}} transition
|
||||
*/
|
||||
export function publishOrbitalView(info, transition = IDLE_TRANSITION) {
|
||||
const state = this.orbital;
|
||||
if (!state || !info) return;
|
||||
const offset = lookIsOffset(state.lookTarget, 0);
|
||||
const aspect = Number.isFinite(this.viewer.camera?.frustum?.aspectRatio)
|
||||
? this.viewer.camera.frustum.aspectRatio
|
||||
: canvasAspect(this.viewer);
|
||||
const settledFov = fovForZoom(orbitalBaseFovRad(info.altitudeM), state.zoom);
|
||||
const footprintKm = footprintWidthKm(info.altitudeM, settledFov, aspect);
|
||||
const trackUp = Number.isFinite(info.groundTrackDeg);
|
||||
const swathScale = offset
|
||||
? offNadirSwathScale(lookTilt(orbitalLookReadoutParts(state.lookTarget)))
|
||||
: 1;
|
||||
this.publishOrbital({
|
||||
name: info.name,
|
||||
classLabel: info.classLabel || '',
|
||||
altitudeM: info.altitudeM,
|
||||
velocityMps: Number.isFinite(info.velocityMps) ? info.velocityMps : null,
|
||||
latitude: info.latitude,
|
||||
longitude: info.longitude,
|
||||
zoom: state.zoom,
|
||||
zoomSteps: [...ORBITAL_ZOOM_LADDER],
|
||||
maxZoom: ORBITAL_BASE_MAX_ZOOM,
|
||||
footprintKm: offset ? null : footprintKm,
|
||||
transition: { ...transition },
|
||||
look: {
|
||||
offset,
|
||||
readout: offset ? wordOffNadir(state.lookTarget, { trackUp }) : '',
|
||||
// Off nadir, the ground width at the view's centre, approximated from
|
||||
// the nadir footprint (`offNadirSwathScale`); 1 and null at nadir.
|
||||
swathScale,
|
||||
swathKm:
|
||||
offset && Number.isFinite(footprintKm)
|
||||
? footprintKm * swathScale
|
||||
: null,
|
||||
},
|
||||
// Track-up turns the frame to the ground track; north then sits at
|
||||
// `northDeg` clockwise from the top. A geostationary view stays north-up.
|
||||
trackUp,
|
||||
northDeg: trackUp ? (360 - info.groundTrackDeg) % 360 : 0,
|
||||
place: state.place,
|
||||
noradId: info.noradId ?? null,
|
||||
cosparId: info.cosparId ?? null,
|
||||
tle: info.tle ?? null,
|
||||
owner: info.owner ?? null,
|
||||
operator: info.operator ?? null,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Present the orbital view on entry and after a language switch: the HUD,
|
||||
* the local page and a regional brief for the sub-satellite point.
|
||||
* @param {object} info Satellite subject.
|
||||
*/
|
||||
export function updateOrbitalHud(info, nowMs = performance.now()) {
|
||||
this.lastSubjectInfo = info;
|
||||
// A satellite has no flight plan and no Contact card.
|
||||
this.routeView.visible = false;
|
||||
this.clearPredictiveRoute();
|
||||
this.showContextCard(false);
|
||||
trackPlace.call(this, info, nowMs);
|
||||
publishOrbitalView.call(this, info);
|
||||
updateOrbitalContext.call(this, info, nowMs, true);
|
||||
}
|
||||
|
||||
/** Re-apply the field of view and publish after a zoom or look change. */
|
||||
function presentNow() {
|
||||
const state = this.orbital;
|
||||
const info = this.lastSubjectInfo;
|
||||
if (!state || info?.kind !== 'satellite') return;
|
||||
const nowMs = performance.now();
|
||||
const reading = Number.isFinite(state.altitudeM ?? info.altitudeM)
|
||||
? applyFov.call(this, state, state.altitudeM ?? info.altitudeM, nowMs)
|
||||
: null;
|
||||
publishOrbitalView.call(this, info, reading?.transition ?? IDLE_TRANSITION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Step the optical zoom one step in (`direction` > 0) or out. The step
|
||||
* animates over ORBITAL_ZOOM_TRANSITION_MS with a focus-pull blur and a
|
||||
* lock tick, or cuts at once under reduced motion. The ends stay put.
|
||||
* @param {number} direction Positive to zoom in, negative to zoom out.
|
||||
* @returns {boolean} True when the zoom changed.
|
||||
*/
|
||||
export function stepOrbitalZoom(direction) {
|
||||
if (!this.active || this.subjectKind !== 'satellite' || !this.orbital)
|
||||
return false;
|
||||
const state = this.orbital;
|
||||
const next =
|
||||
direction > 0
|
||||
? nextOrbitalZoom(state.zoom)
|
||||
: previousOrbitalZoom(state.zoom);
|
||||
return goToZoom.call(this, next);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the zoom to `next`, animated from the magnification shown now unless
|
||||
* reduced motion is on.
|
||||
* @returns {boolean} True when the zoom changed.
|
||||
*/
|
||||
function goToZoom(next) {
|
||||
const state = this.orbital;
|
||||
if (!Number.isFinite(next) || next === state.zoom) return false;
|
||||
const nowMs = performance.now();
|
||||
const altitudeM = state.altitudeM ?? this.lastSubjectInfo?.altitudeM;
|
||||
const fromZoom = Number.isFinite(altitudeM)
|
||||
? currentMagnification(state, orbitalBaseFovRad(altitudeM), nowMs)
|
||||
: state.zoom;
|
||||
state.zoom = next;
|
||||
state.transition = prefersReducedMotion()
|
||||
? null
|
||||
: { fromZoom, startMs: nowMs };
|
||||
presentNow.call(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tilt the orbital view one arrow step off nadir (see `lookKeyStep`); each
|
||||
* axis stops at ±45°. The view eases there unless reduced motion is on.
|
||||
* @param {{axis: 'yaw'|'pitch', sign: number, stepDeg: number}} step
|
||||
* @returns {boolean} True in an orbital view.
|
||||
*/
|
||||
export function turnOrbitalLook(step) {
|
||||
if (!this.active || this.subjectKind !== 'satellite' || !this.orbital)
|
||||
return false;
|
||||
if (!step) return false;
|
||||
const state = this.orbital;
|
||||
state.lookTarget = stepOrbitalLook(state.lookTarget, step);
|
||||
if (prefersReducedMotion()) state.lookView = { ...state.lookTarget };
|
||||
presentNow.call(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bring the orbital view back to pure nadir (Home, 0 or the NADIR button).
|
||||
* @param {{immediate?: boolean}} [options] Jump instead of easing.
|
||||
* @returns {boolean} True in an orbital view.
|
||||
*/
|
||||
export function resetOrbitalLook({ immediate = false } = {}) {
|
||||
if (!this.active || this.subjectKind !== 'satellite' || !this.orbital)
|
||||
return false;
|
||||
const state = this.orbital;
|
||||
state.lookTarget = { ...NADIR_LOOK };
|
||||
if (immediate || prefersReducedMotion()) state.lookView = { ...NADIR_LOOK };
|
||||
presentNow.call(this);
|
||||
return true;
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -146,18 +146,30 @@ export function formatCockpitWindDirection(value) {
|
||||
}
|
||||
|
||||
/**
|
||||
* The Cockpit entry for each subject it can ride: an aircraft's cockpit or a
|
||||
* vessel's bridge. Both entry buttons (Contacts and
|
||||
* A TLE epoch as compact UTC, `2026-11-04 08:12Z`, or '' when unknown.
|
||||
* @param {number|null|undefined} epochMs
|
||||
*/
|
||||
export function formatTleEpochUtc(epochMs) {
|
||||
// Beyond ±8.64e15 ms a Date is invalid and toISOString throws.
|
||||
if (!Number.isFinite(epochMs) || Math.abs(epochMs) > 8.64e15) return '';
|
||||
const iso = new Date(epochMs).toISOString();
|
||||
return `${iso.slice(0, 10)} ${iso.slice(11, 16)}Z`;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Cockpit entry for each subject it can ride: an aircraft's cockpit, a
|
||||
* vessel's bridge or a satellite's orbit. Both entry buttons (Contacts and
|
||||
* the Intel HUD readout) show it.
|
||||
*/
|
||||
const COCKPIT_ENTRY_FACES = Object.freeze({
|
||||
aircraft: Object.freeze({ icon: 'flight', label: msg('COCKPIT') }),
|
||||
vessel: Object.freeze({ icon: 'directions_boat', label: msg('BRIDGE') }),
|
||||
satellite: Object.freeze({ icon: 'satellite_alt', label: msg('ORBIT') }),
|
||||
});
|
||||
|
||||
/**
|
||||
* The entry's glyph and localized label for the subject it would ride.
|
||||
* @param {'aircraft'|'vessel'|null|undefined} kind
|
||||
* @param {'aircraft'|'vessel'|'satellite'|null|undefined} kind
|
||||
* @returns {{icon: string, label: string}}
|
||||
*/
|
||||
export function cockpitEntryFace(kind) {
|
||||
|
||||
@@ -28,15 +28,22 @@ export function readVesselInfo() {
|
||||
return this.services.aisLiveVesselsLayer?.getCockpitSubject?.() || null;
|
||||
}
|
||||
|
||||
/** The tracked satellite the orbital view would ride, or rides; null without one. */
|
||||
export function readSatelliteInfo() {
|
||||
return this.services.satellitesLayer?.getCockpitSubject?.() || null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The layer the active view rides: Live AIS Vessels on a bridge, 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'|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}
|
||||
*/
|
||||
export function readSubjectLayerId() {
|
||||
if (!this.active) return null;
|
||||
if (this.subjectKind === 'vessel') return 'ais-live-vessels';
|
||||
if (this.subjectKind === 'satellite') return 'satellites';
|
||||
const layerId = this.readAircraftInfo()?.layerId;
|
||||
if (layerId) return layerId;
|
||||
const [prefix] = String(this.trackedEntity?.gevTrackedId || '').split(':');
|
||||
@@ -44,26 +51,29 @@ export function readSubjectLayerId() {
|
||||
}
|
||||
|
||||
/**
|
||||
* The subject entry would take: a Cesium-tracked aircraft first, else the
|
||||
* selected vessel. Vessels never take Cesium tracking, so an aircraft and a
|
||||
* vessel cannot be live through the same owner.
|
||||
* @returns {'aircraft'|'vessel'|null}
|
||||
* 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}
|
||||
*/
|
||||
export function resolveEntryKind() {
|
||||
if (this.readAircraftInfo() && this.viewer.trackedEntity?.position)
|
||||
return 'aircraft';
|
||||
if (this.readSatelliteInfo()) return 'satellite';
|
||||
return this.readVesselInfo() ? 'vessel' : null;
|
||||
}
|
||||
|
||||
export function dispatchCockpitModeChanged(active, info = null) {
|
||||
const subjectId = active
|
||||
? String(info?.icao24 || info?.mmsi || '')
|
||||
? String(info?.icao24 || info?.mmsi || info?.noradId || '')
|
||||
.trim()
|
||||
.toLowerCase() || null
|
||||
: null;
|
||||
const layerId =
|
||||
active &&
|
||||
['flights', 'military', 'ais-live-vessels'].includes(info?.layerId)
|
||||
['flights', 'military', 'ais-live-vessels', 'satellites'].includes(
|
||||
info?.layerId,
|
||||
)
|
||||
? info.layerId
|
||||
: null;
|
||||
window.dispatchEvent(
|
||||
@@ -118,9 +128,13 @@ export function syncEntry() {
|
||||
const info = this.readAircraftInfo();
|
||||
const trackedContact = !!(info && this.viewer.trackedEntity?.position);
|
||||
this.syncTr3bToggle(trackedContact ? info : null);
|
||||
const bridgeContact = !trackedContact && !!this.readVesselInfo();
|
||||
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 available = entryKind !== null;
|
||||
@@ -139,8 +153,10 @@ export function syncEntry() {
|
||||
|
||||
export function navigateContext(direction, options = {}) {
|
||||
if (this.destroyed) return false;
|
||||
// Contact navigation moves between aircraft; a bridge does not jump ship.
|
||||
if (this.subjectKind === 'vessel') 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')
|
||||
return false;
|
||||
const method = direction < 0 ? 'navigatePrevious' : 'navigateNext';
|
||||
const wasActive = this.active;
|
||||
if (wasActive) this.contextNavigationDeadlineMs = performance.now() + 1500;
|
||||
@@ -159,9 +175,10 @@ export function navigateContext(direction, options = {}) {
|
||||
}
|
||||
|
||||
export function _adoptTrackedEntity(nowMs, suppliedInfo = null) {
|
||||
// An aircraft tracked from the bridge ends it (see the vessel camera
|
||||
// update); it is never adopted as the bridge's subject.
|
||||
if (this.subjectKind === 'vessel') return false;
|
||||
// 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')
|
||||
return false;
|
||||
const nextEntity = this.viewer.trackedEntity;
|
||||
if (
|
||||
!this.active ||
|
||||
@@ -192,8 +209,8 @@ export function _adoptTrackedEntity(nowMs, suppliedInfo = null) {
|
||||
|
||||
/**
|
||||
* Enter first person on a tracked aircraft or, with none tracked, the
|
||||
* selected vessel's bridge.
|
||||
* @param {{kind?: 'aircraft'|'vessel'|null}} [options] Restrict
|
||||
* 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.
|
||||
* @returns {boolean} True when the view was entered.
|
||||
*/
|
||||
@@ -202,12 +219,21 @@ export function enter({ kind = null } = {}) {
|
||||
if (this.active) return false;
|
||||
const subjectKind = kind ?? this.resolveEntryKind() ?? 'aircraft';
|
||||
const vessel = subjectKind === 'vessel';
|
||||
const allowed = vessel ? this.isBridgeEntryAllowed() : this.isEntryAllowed();
|
||||
const satellite = subjectKind === 'satellite';
|
||||
const allowed = vessel
|
||||
? this.isBridgeEntryAllowed()
|
||||
: satellite
|
||||
? this.isOrbitEntryAllowed()
|
||||
: this.isEntryAllowed();
|
||||
if (!allowed) return false;
|
||||
const info = vessel ? this.readVesselInfo() : this.readAircraftInfo();
|
||||
const info = vessel
|
||||
? this.readVesselInfo()
|
||||
: satellite
|
||||
? this.readSatelliteInfo()
|
||||
: this.readAircraftInfo();
|
||||
// Only an aircraft is ridden through its Cesium entity.
|
||||
const entity = vessel ? null : this.viewer.trackedEntity;
|
||||
if (!info || (!vessel && !entity?.position)) return false;
|
||||
const entity = vessel || satellite ? null : this.viewer.trackedEntity;
|
||||
if (!info || (!vessel && !satellite && !entity?.position)) return false;
|
||||
this.entryFocusOrigin =
|
||||
document.activeElement instanceof HTMLElement
|
||||
? document.activeElement
|
||||
@@ -219,11 +245,15 @@ export function enter({ kind = null } = {}) {
|
||||
// Each session reads its own water: never a height left from the last.
|
||||
this.vesselWaterline = null;
|
||||
this.vesselFix = null;
|
||||
this.subjectId = vessel ? info.mmsi : null;
|
||||
this.subjectId = vessel ? info.mmsi : satellite ? info.noradId : null;
|
||||
this.trackedEntity = entity;
|
||||
if (entity) {
|
||||
this.trackedEntityWasShown = entity.show;
|
||||
entity.show = false;
|
||||
} else if (satellite) {
|
||||
// The layer hides the satellite's own marks and dims the other orbits.
|
||||
this.services.satellitesLayer?.setCockpitSubject?.(info.noradId);
|
||||
this.beginOrbital();
|
||||
} else {
|
||||
this.services.aisLiveVesselsLayer?.setCockpitSubject?.(info.mmsi);
|
||||
}
|
||||
@@ -259,6 +289,7 @@ export function enter({ kind = null } = {}) {
|
||||
document.body.classList.add('cockpit-mode');
|
||||
// Bridge styling reaches surfaces outside the HUD (exit row, side panels).
|
||||
if (vessel) document.body.classList.add('cockpit-bridge');
|
||||
if (satellite) document.body.classList.add('cockpit-orbit');
|
||||
// Activation hides the entry and TR-3B chip; clearing the chip's signature
|
||||
// lets the exit-path syncEntry publish it again.
|
||||
this._tr3bSignature = null;
|
||||
@@ -277,7 +308,14 @@ export function enter({ kind = null } = {}) {
|
||||
this.showBriefPage(0);
|
||||
this.startBriefRotation();
|
||||
const trackHeading = formatHeadingReadout(info.track ?? 0);
|
||||
if (vessel) {
|
||||
if (satellite) {
|
||||
this.pushCockpitSignal(
|
||||
'track',
|
||||
'track',
|
||||
t('TRACK ACQUIRED'),
|
||||
t('{label} · NADIR VIEW', { label: info.name }),
|
||||
);
|
||||
} else if (vessel) {
|
||||
this.pushCockpitSignal(
|
||||
'track',
|
||||
'track',
|
||||
@@ -310,7 +348,9 @@ export function enter({ kind = null } = {}) {
|
||||
);
|
||||
}
|
||||
this.updateHud(info, performance.now(), true);
|
||||
this.setVisionMode(this.getInitialVisionMode());
|
||||
// Orbit always opens in the plain optical picture; the vision styles stay
|
||||
// one click away.
|
||||
this.setVisionMode(satellite ? 'optical' : this.getInitialVisionMode());
|
||||
this.scheduleContextLayout();
|
||||
// The exit button shows when Vue flushes the presence; focus it after.
|
||||
Promise.resolve().then(() => {
|
||||
@@ -327,6 +367,8 @@ export function exit({ restoreTracking = true } = {}) {
|
||||
if (!this.active) return false;
|
||||
const entity = this.trackedEntity;
|
||||
const vesselSubject = this.subjectKind === 'vessel' ? this.subjectId : null;
|
||||
const satelliteSubject =
|
||||
this.subjectKind === 'satellite' ? this.subjectId : null;
|
||||
this.active = false;
|
||||
this.subjectKind = null;
|
||||
this.vesselWaterline = null;
|
||||
@@ -348,7 +390,13 @@ export function exit({ restoreTracking = true } = {}) {
|
||||
this.regionalBriefAbort = null;
|
||||
this.regionalBriefRequestToken += 1;
|
||||
this.regionalBriefSubjectId = null;
|
||||
document.body.classList.remove('cockpit-mode', 'cockpit-bridge');
|
||||
document.body.classList.remove(
|
||||
'cockpit-mode',
|
||||
'cockpit-bridge',
|
||||
'cockpit-orbit',
|
||||
);
|
||||
// The camera's own field of view returns before any follow resumes.
|
||||
this.endOrbital();
|
||||
this.onExited?.();
|
||||
this.publishUtilityLayout(null);
|
||||
this.presence.active = false;
|
||||
@@ -364,6 +412,8 @@ export function exit({ restoreTracking = true } = {}) {
|
||||
this.trackedEntityWasShown = true;
|
||||
if (vesselSubject)
|
||||
this.services.aisLiveVesselsLayer?.setCockpitSubject?.(null);
|
||||
if (satelliteSubject !== null)
|
||||
this.services.satellitesLayer?.setCockpitSubject?.(null);
|
||||
this.dispatchCockpitModeChanged(false);
|
||||
if (restoreTracking && entity && this.viewer.entities.contains(entity)) {
|
||||
this.viewer.trackedEntity = entity;
|
||||
@@ -371,6 +421,9 @@ export function exit({ restoreTracking = true } = {}) {
|
||||
} else if (restoreTracking && vesselSubject) {
|
||||
// Back to the selected vessel's map view, through the layer's own focus.
|
||||
this.services.aisLiveVesselsLayer?.focusSelectedVessel?.();
|
||||
} else if (restoreTracking && satelliteSubject !== null) {
|
||||
// Back to the satellite's follow camera, through the layer's own refocus.
|
||||
this.services.satellitesLayer?.refocusTrackedById?.(satelliteSubject);
|
||||
}
|
||||
this.syncEntry();
|
||||
// Back to whichever entry was used: the Contacts button or the readout's.
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
/**
|
||||
* The owner mark beside a satellite's name: the owner country's flag (an SVG
|
||||
* from flag-icons — Windows draws no flag emoji), or a short text badge for
|
||||
* an organisation without one (ESA, EUMETSAT, "Multinational"). Each flag is
|
||||
* its own lazily fetched asset; only the shown one ever loads.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Flag URL loaders by path; empty under node:test, which has no glob. The
|
||||
* glob is eager so the bundle carries only the URL strings: a lazy glob would
|
||||
* emit a JS stub chunk per flag (~270), two requests for each flag shown.
|
||||
* The SVG itself is still fetched only when an <img> shows it.
|
||||
*/
|
||||
let FLAG_LOADERS = {};
|
||||
try {
|
||||
const urls = import.meta.glob('/node_modules/flag-icons/flags/4x3/*.svg', {
|
||||
query: '?url&no-inline',
|
||||
import: 'default',
|
||||
eager: true,
|
||||
// flag-icons lives in node_modules, which globs skip by default.
|
||||
exhaustive: true,
|
||||
});
|
||||
FLAG_LOADERS = Object.fromEntries(
|
||||
Object.entries(urls).map(([path, url]) => [path, () => url]),
|
||||
);
|
||||
} catch {
|
||||
/* Not under Vite. */
|
||||
}
|
||||
|
||||
const FLAG_PATH = (code) =>
|
||||
`/node_modules/flag-icons/flags/4x3/${code.toLowerCase()}.svg`;
|
||||
|
||||
/** An ISO 3166-1 alpha-2 code, upper case, or null. */
|
||||
function isoCode(value) {
|
||||
const code = String(value ?? '').trim();
|
||||
return /^[A-Za-z]{2}$/.test(code) ? code.toUpperCase() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* A region's name in the locale, from the browser's own table.
|
||||
* @param {string} code ISO 3166-1 alpha-2.
|
||||
* @param {string} locale BCP 47 tag.
|
||||
* @returns {string|null}
|
||||
*/
|
||||
export function regionName(code, locale) {
|
||||
try {
|
||||
const name = new Intl.DisplayNames([locale || 'en'], {
|
||||
type: 'region',
|
||||
}).of(code);
|
||||
return name && name !== code ? name : null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* How to mark a satellite's owner.
|
||||
* @param {{countryCode: string|null, label: string|null}|null|undefined} owner
|
||||
* @param {{locale?: string, loaders?: object}} [options]
|
||||
* @returns {{kind: 'flag', code: string, label: string}
|
||||
* | {kind: 'badge', label: string, title: string}
|
||||
* | null} A flag (with the country's localized name as its label), a text
|
||||
* badge for an owner with no flag to show, or nothing when unknown.
|
||||
*/
|
||||
export function ownerMark(
|
||||
owner,
|
||||
{ locale = 'en', loaders = FLAG_LOADERS } = {},
|
||||
) {
|
||||
const code = isoCode(owner?.countryCode);
|
||||
const label = String(owner?.label ?? '').trim();
|
||||
if (code) {
|
||||
const name = regionName(code, locale) || label || code;
|
||||
if (loaders[FLAG_PATH(code)]) return { kind: 'flag', code, label: name };
|
||||
return { kind: 'badge', label: label || code, title: name };
|
||||
}
|
||||
return label ? { kind: 'badge', label, title: label } : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* What the readout shows for an owner once its flag has loaded or failed: the
|
||||
* flag, or a badge (the country code when the flag would not load, so the
|
||||
* owner never disappears), or nothing for an unknown owner.
|
||||
* @param {ReturnType<typeof ownerMark>} mark
|
||||
* @param {{url?: string|null, failed?: boolean}} [flag] The flag's load state.
|
||||
* @returns {{kind: 'flag', url: string, label: string}
|
||||
* | {kind: 'badge', label: string, title: string} | null}
|
||||
*/
|
||||
export function shownOwnerMark(mark, { url = null, failed = false } = {}) {
|
||||
if (!mark) return null;
|
||||
if (mark.kind === 'badge') return mark;
|
||||
if (failed) {
|
||||
return { kind: 'badge', label: mark.code.toUpperCase(), title: mark.label };
|
||||
}
|
||||
return url ? { kind: 'flag', url, label: mark.label } : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a flag's URL.
|
||||
* @param {string} code ISO 3166-1 alpha-2.
|
||||
* @returns {Promise<string|null>}
|
||||
*/
|
||||
export async function loadFlagUrl(code, loaders = FLAG_LOADERS) {
|
||||
const load = loaders[FLAG_PATH(String(code))];
|
||||
if (!load) return null;
|
||||
try {
|
||||
return (await load()) || null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
// src/ui/ownerFlag.test.mjs — a satellite owner's mark: a country's flag with
|
||||
// its localized name, a text badge for an organisation, nothing when unknown.
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {
|
||||
loadFlagUrl,
|
||||
ownerMark,
|
||||
regionName,
|
||||
shownOwnerMark,
|
||||
} from './ownerFlag.js';
|
||||
|
||||
const FLAG = (code) => `/node_modules/flag-icons/flags/4x3/${code}.svg`;
|
||||
const LOADERS = Object.freeze({
|
||||
[FLAG('us')]: async () => '/assets/us-abc.svg',
|
||||
[FLAG('fr')]: async () => '/assets/fr-def.svg',
|
||||
});
|
||||
|
||||
test('an owner country shows its flag, named in the reader language', () => {
|
||||
assert.deepEqual(
|
||||
ownerMark({ countryCode: 'us', label: 'USA' }, { loaders: LOADERS }),
|
||||
{ kind: 'flag', code: 'US', label: 'United States' },
|
||||
);
|
||||
assert.equal(
|
||||
ownerMark(
|
||||
{ countryCode: 'FR', label: null },
|
||||
{ locale: 'de', loaders: LOADERS },
|
||||
).label,
|
||||
'Frankreich',
|
||||
);
|
||||
});
|
||||
|
||||
test('an organisation without a country shows a text badge', () => {
|
||||
assert.deepEqual(
|
||||
ownerMark({ countryCode: null, label: 'ESA' }, { loaders: LOADERS }),
|
||||
{ kind: 'badge', label: 'ESA', title: 'ESA' },
|
||||
);
|
||||
});
|
||||
|
||||
test('a country with no flag to show falls back to a badge', () => {
|
||||
assert.deepEqual(
|
||||
ownerMark({ countryCode: 'DE', label: 'Germany' }, { loaders: LOADERS }),
|
||||
{ kind: 'badge', label: 'Germany', title: 'Germany' },
|
||||
);
|
||||
// Natural Earth and UCS write -99 or names, never a flag code.
|
||||
assert.deepEqual(
|
||||
ownerMark(
|
||||
{ countryCode: '-99', label: 'Multinational' },
|
||||
{ loaders: LOADERS },
|
||||
),
|
||||
{ kind: 'badge', label: 'Multinational', title: 'Multinational' },
|
||||
);
|
||||
});
|
||||
|
||||
test('an unknown owner shows nothing', () => {
|
||||
assert.equal(ownerMark(null, { loaders: LOADERS }), null);
|
||||
assert.equal(
|
||||
ownerMark({ countryCode: null, label: ' ' }, { loaders: LOADERS }),
|
||||
null,
|
||||
);
|
||||
});
|
||||
|
||||
test('only the flag asked for loads', async () => {
|
||||
assert.equal(await loadFlagUrl('US', LOADERS), '/assets/us-abc.svg');
|
||||
assert.equal(await loadFlagUrl('DE', LOADERS), null);
|
||||
assert.equal(
|
||||
await loadFlagUrl('FR', {
|
||||
[FLAG('fr')]: async () => {
|
||||
throw new Error('offline');
|
||||
},
|
||||
}),
|
||||
null,
|
||||
);
|
||||
});
|
||||
|
||||
test('a region name comes from Intl, never the bare code', () => {
|
||||
assert.equal(regionName('JP', 'en'), 'Japan');
|
||||
assert.equal(regionName('XX', 'en'), null);
|
||||
});
|
||||
|
||||
test('a flag that will not load falls back to its country code, never to nothing', () => {
|
||||
const flag = { kind: 'flag', code: 'us', label: 'United States' };
|
||||
assert.equal(shownOwnerMark(flag), null, 'nothing while it loads');
|
||||
assert.deepEqual(shownOwnerMark(flag, { url: '/flags/us.svg' }), {
|
||||
kind: 'flag',
|
||||
url: '/flags/us.svg',
|
||||
label: 'United States',
|
||||
});
|
||||
assert.deepEqual(shownOwnerMark(flag, { failed: true }), {
|
||||
kind: 'badge',
|
||||
label: 'US',
|
||||
title: 'United States',
|
||||
});
|
||||
const badge = { kind: 'badge', label: 'ESA', title: 'ESA' };
|
||||
assert.equal(shownOwnerMark(badge, { failed: true }), badge);
|
||||
assert.equal(shownOwnerMark(null), null);
|
||||
});
|
||||
|
||||
test('flags ship as a map of URLs, not one JS chunk per flag', async () => {
|
||||
const { readFileSync } = await import('node:fs');
|
||||
const source = readFileSync(
|
||||
new URL('./ownerFlag.js', import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
// A lazy glob emits a stub chunk for each of ~270 flags; eager URLs ship
|
||||
// only strings, and each SVG still loads when an <img> shows it.
|
||||
assert.match(source, /eager:\s*true/);
|
||||
assert.match(source, /query:\s*'\?url&no-inline'/);
|
||||
});
|
||||
@@ -87,6 +87,42 @@ export const useCockpitStore = defineStore('gev-cockpit', () => {
|
||||
radar.value = next && markRaw(next);
|
||||
}
|
||||
|
||||
/**
|
||||
* The orbital view's HUD: null outside a satellite subject. Shape:
|
||||
* `{ name, classLabel, altitudeM, velocityMps|null, latitude, longitude,
|
||||
* zoom, zoomSteps: number[], maxZoom, footprintKm|null,
|
||||
* transition: { active, blurPx, lockTick },
|
||||
* look: { offset, readout, swathScale, swathKm|null }, trackUp, northDeg,
|
||||
* place: { kind: 'country'|'sea'|'ocean', name, countryCode,
|
||||
* division?|null, near?|null }|null|undefined,
|
||||
* noradId|null, cosparId|null, tle: { line1, line2, epochMs }|null,
|
||||
* owner: { countryCode|null, label|null }|null, operator|null }` where
|
||||
* `place` is what the sub-satellite point is over (undefined until the
|
||||
* first offline lookup lands, null when nothing named holds it; see
|
||||
* src/data/placeBelow.js), the identity fields come from the satellites
|
||||
* layer and are null when unknown, `classLabel` is
|
||||
* already localized (the satellite layer's class label, e.g. "NAV · GPS"),
|
||||
* `velocityMps` is the orbital (inertial) speed, latitude/longitude are the
|
||||
* sub-satellite point in degrees, `zoom` is one of `zoomSteps` (1, 2, 4
|
||||
* and 8, the tightest being `maxZoom`), `footprintKm` is the nadir ground width across the frame at that zoom
|
||||
* (null while the view is tilted off nadir), `transition` is a zoom step in
|
||||
* flight: `active` while the field of view moves, `blurPx` the focus-pull
|
||||
* blur for the picture, `lockTick` true briefly once the step settles (see
|
||||
* src/cockpitOrbital.js), `look` says whether the view is tilted off
|
||||
* nadir and words the tilt (`readout`, '' at nadir), with the approximate
|
||||
* ground width at the tilted view's centre (`swathKm`, null at nadir) and
|
||||
* its ratio to the nadir footprint (`swathScale`, 1 at nadir), `trackUp`
|
||||
* whether the view is turned to the ground track (false for a satellite with none,
|
||||
* which stays north-up) and `northDeg` where north sits, in degrees
|
||||
* clockwise from the top (0 when north-up).
|
||||
*/
|
||||
const orbital = shallowRef(null);
|
||||
|
||||
/** @param {?object} next A fresh presentation of the orbital view HUD. */
|
||||
function publishOrbital(next) {
|
||||
orbital.value = next && markRaw(next);
|
||||
}
|
||||
|
||||
/**
|
||||
* The utility strip's measured layout: its top and height limits as CSS
|
||||
* lengths (null leaves the stylesheet's), whether only the expanded control
|
||||
@@ -124,6 +160,8 @@ export const useCockpitStore = defineStore('gev-cockpit', () => {
|
||||
publishSignals,
|
||||
radar,
|
||||
publishRadar,
|
||||
orbital,
|
||||
publishOrbital,
|
||||
utilityLayout,
|
||||
publishUtilityLayout,
|
||||
};
|
||||
|
||||
@@ -0,0 +1,499 @@
|
||||
/* Orbital view HUD (src/ui/views/panels/CockpitOrbital.vue). The section
|
||||
covers the picture it is placed over: the reticle sits on its centre, the
|
||||
readout top-left and the optics bottom-centre. Square-cornered like the
|
||||
bridge view. The Cockpit controller publishes the zoom step's blur as
|
||||
--cockpit-orbital-blur and its lock tick as a reticle class. */
|
||||
.cockpit-orbital {
|
||||
--orbital-line: color-mix(
|
||||
in srgb,
|
||||
var(--cockpit-accent, #00dcff) 42%,
|
||||
transparent
|
||||
);
|
||||
--orbital-faint: color-mix(
|
||||
in srgb,
|
||||
var(--cockpit-accent, #00dcff) 18%,
|
||||
transparent
|
||||
);
|
||||
--orbital-reticle-size: min(38vmin, 320px);
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
color: rgba(244, 251, 255, 0.86);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.08em;
|
||||
pointer-events: none;
|
||||
}
|
||||
.cockpit-orbital[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Focus pull: blurs the picture beneath only while a step is in flight. */
|
||||
.cockpit-orbital-lens {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
}
|
||||
.cockpit-orbital-focusing .cockpit-orbital-lens {
|
||||
backdrop-filter: blur(var(--cockpit-orbital-blur, 0px));
|
||||
-webkit-backdrop-filter: blur(var(--cockpit-orbital-blur, 0px));
|
||||
}
|
||||
|
||||
.cockpit-orbital-reticle {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: var(--orbital-reticle-size);
|
||||
height: var(--orbital-reticle-size);
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
.cockpit-orbital-bracket {
|
||||
position: absolute;
|
||||
width: 18%;
|
||||
height: 18%;
|
||||
border: 0 solid var(--orbital-line);
|
||||
transition:
|
||||
border-color 160ms ease-out,
|
||||
transform 160ms ease-out;
|
||||
}
|
||||
.cockpit-orbital-bracket-tl {
|
||||
top: 0;
|
||||
left: 0;
|
||||
border-top-width: 1px;
|
||||
border-left-width: 1px;
|
||||
}
|
||||
.cockpit-orbital-bracket-tr {
|
||||
top: 0;
|
||||
right: 0;
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
}
|
||||
.cockpit-orbital-bracket-bl {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
}
|
||||
.cockpit-orbital-bracket-br {
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
}
|
||||
/* Nadir cross: a gapped plus, so the sub-satellite point stays visible. */
|
||||
.cockpit-orbital-cross {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
transform: translate(-50%, -50%);
|
||||
background:
|
||||
linear-gradient(var(--orbital-line), var(--orbital-line)) left center / 10px
|
||||
1px no-repeat,
|
||||
linear-gradient(var(--orbital-line), var(--orbital-line)) right center /
|
||||
10px 1px no-repeat,
|
||||
linear-gradient(var(--orbital-line), var(--orbital-line)) center top / 1px
|
||||
10px no-repeat,
|
||||
linear-gradient(var(--orbital-line), var(--orbital-line)) center bottom /
|
||||
1px 10px no-repeat;
|
||||
}
|
||||
/* North on the frame: the pointer spans the reticle and turns about its
|
||||
centre, carrying the tick (and, track-up, an N) round the rim. */
|
||||
.cockpit-orbital-north-pointer {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
}
|
||||
.cockpit-orbital-north-letter {
|
||||
position: absolute;
|
||||
top: -26px;
|
||||
left: 50%;
|
||||
color: var(--cockpit-accent, #00dcff);
|
||||
font-weight: 700;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
/* North sits at the top of a north-up frame. */
|
||||
.cockpit-orbital-north-tick {
|
||||
position: absolute;
|
||||
top: -10px;
|
||||
left: 50%;
|
||||
width: 1px;
|
||||
height: 7px;
|
||||
background: var(--cockpit-accent, #00dcff);
|
||||
}
|
||||
.cockpit-orbital-reticle-lock .cockpit-orbital-bracket {
|
||||
border-color: var(--cockpit-accent, #00dcff);
|
||||
animation: cockpit-orbital-lock 220ms ease-out;
|
||||
}
|
||||
.cockpit-orbital-reticle-lock .cockpit-orbital-cross {
|
||||
--orbital-line: var(--cockpit-accent, #00dcff);
|
||||
}
|
||||
@keyframes cockpit-orbital-lock {
|
||||
0% {
|
||||
transform: scale(1.12);
|
||||
opacity: 0.4;
|
||||
}
|
||||
60% {
|
||||
transform: scale(0.97);
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
transform: scale(1);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Bottom-left, where the aircraft Contact card sits (hidden in orbit): clear
|
||||
of the Intel HUD's top-left classification block and above its MGRS and
|
||||
coordinate lines. */
|
||||
.cockpit-orbital-readout {
|
||||
position: absolute;
|
||||
bottom: clamp(150px, 19vh, 190px);
|
||||
left: clamp(16px, 4vw, 48px);
|
||||
max-width: min(320px, calc(100% - 32px));
|
||||
padding: 8px 10px;
|
||||
border: 1px solid var(--orbital-faint);
|
||||
border-radius: 2px;
|
||||
background: rgba(0, 9, 14, 0.62);
|
||||
}
|
||||
.cockpit-orbital-readout p,
|
||||
.cockpit-orbital-data,
|
||||
.cockpit-orbital-data dd {
|
||||
margin: 0;
|
||||
}
|
||||
.cockpit-orbital-kicker {
|
||||
color: var(--cockpit-accent, #00dcff);
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.14em;
|
||||
}
|
||||
.cockpit-orbital-name {
|
||||
margin-top: 4px;
|
||||
overflow: hidden;
|
||||
color: #f4fbff;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.06em;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.cockpit-orbital-class {
|
||||
margin-top: 2px;
|
||||
color: rgba(244, 251, 255, 0.66);
|
||||
}
|
||||
|
||||
/* The name with its owner's flag (or text badge) in front. */
|
||||
.cockpit-orbital-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
min-width: 0;
|
||||
margin-top: 4px;
|
||||
}
|
||||
.cockpit-orbital-title .cockpit-orbital-name {
|
||||
min-width: 0;
|
||||
margin-top: 0;
|
||||
}
|
||||
.cockpit-orbital-flag {
|
||||
flex: none;
|
||||
width: 20px;
|
||||
height: 15px;
|
||||
border: 1px solid var(--orbital-faint);
|
||||
border-radius: 1px;
|
||||
object-fit: cover;
|
||||
}
|
||||
.cockpit-orbital-owner-badge {
|
||||
flex: none;
|
||||
max-width: 96px;
|
||||
overflow: hidden;
|
||||
padding: 1px 4px;
|
||||
border: 1px solid var(--orbital-line);
|
||||
border-radius: 2px;
|
||||
color: var(--cockpit-accent, #00dcff);
|
||||
font-size: 9px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.1em;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.cockpit-orbital-operator {
|
||||
margin-top: 2px;
|
||||
overflow: hidden;
|
||||
color: #f4fbff;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* NORAD · COSPAR · epoch, and the element set on request. */
|
||||
.cockpit-orbital-ident {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
margin-top: 6px;
|
||||
color: rgba(244, 251, 255, 0.66);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
/* Wraps between its parts rather than truncating, so the epoch and the
|
||||
element set's age always show in full. */
|
||||
.cockpit-orbital-ident-text {
|
||||
min-width: 0;
|
||||
}
|
||||
.cockpit-orbital-ident-part {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.cockpit-orbital-tle-toggle {
|
||||
flex: none;
|
||||
padding: 1px 6px;
|
||||
border: 1px solid var(--orbital-line);
|
||||
border-radius: 2px;
|
||||
background: rgba(0, 7, 12, 0.6);
|
||||
color: #f4fbff;
|
||||
font: inherit;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.12em;
|
||||
cursor: pointer;
|
||||
pointer-events: auto;
|
||||
}
|
||||
.cockpit-orbital-tle-toggle[aria-expanded='true'],
|
||||
.cockpit-orbital-tle-toggle:hover,
|
||||
.cockpit-orbital-tle-toggle:focus-visible {
|
||||
border-color: var(--cockpit-accent, #00dcff);
|
||||
color: #fff;
|
||||
outline: none;
|
||||
}
|
||||
/* 69 characters a line: small enough to fit the card, and selectable. */
|
||||
.cockpit-orbital-tle {
|
||||
margin: 6px 0 0;
|
||||
padding: 5px 6px;
|
||||
overflow-x: auto;
|
||||
border: 1px solid var(--orbital-faint);
|
||||
border-radius: 2px;
|
||||
background: rgba(0, 4, 8, 0.7);
|
||||
color: #f4fbff;
|
||||
font: 8px/1.5 var(--font-mono);
|
||||
letter-spacing: 0;
|
||||
white-space: pre;
|
||||
user-select: text;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
/* Under the vision selector (topline top + its ~38px height + a gap), on
|
||||
the centre line the reticle keeps clear below; the Intel HUD blocks and
|
||||
Display/Radio sit at the sides. */
|
||||
.cockpit-orbital-over {
|
||||
position: absolute;
|
||||
top: calc(clamp(18px, 3vh, 34px) + 50px);
|
||||
left: 50%;
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 8px;
|
||||
max-width: min(560px, calc(100% - 32px));
|
||||
margin: 0;
|
||||
padding: 4px 10px;
|
||||
border: 1px solid var(--orbital-faint);
|
||||
border-radius: 2px;
|
||||
background: rgba(0, 9, 14, 0.62);
|
||||
transform: translateX(-50%);
|
||||
white-space: nowrap;
|
||||
}
|
||||
.cockpit-orbital-over span {
|
||||
flex: none;
|
||||
color: var(--cockpit-accent, #00dcff);
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.14em;
|
||||
}
|
||||
.cockpit-orbital-over strong {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
color: #f4fbff;
|
||||
font-size: 12px;
|
||||
letter-spacing: 0.08em;
|
||||
text-overflow: ellipsis;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.cockpit-orbital-data {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.cockpit-orbital-datum {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
.cockpit-orbital-datum dt {
|
||||
color: rgba(244, 251, 255, 0.56);
|
||||
}
|
||||
.cockpit-orbital-datum dd {
|
||||
color: #f4fbff;
|
||||
font-variant-numeric: tabular-nums;
|
||||
text-align: end;
|
||||
}
|
||||
.cockpit-orbital-north {
|
||||
display: inline-block;
|
||||
margin-top: 8px;
|
||||
padding: 1px 5px;
|
||||
border: 1px solid var(--orbital-line);
|
||||
border-radius: 2px;
|
||||
color: var(--cockpit-accent, #00dcff);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/* Above RESET / EXIT ORBIT: #view-switcher sits at clamp(128px, 15vh, 150px)
|
||||
less its -95px margin, and its buttons are about 30px tall. */
|
||||
.cockpit-orbital-optics {
|
||||
position: absolute;
|
||||
bottom: calc(clamp(128px, 15vh, 150px) - 95px + 44px);
|
||||
left: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 4px;
|
||||
border: 1px solid var(--orbital-faint);
|
||||
border-radius: 2px;
|
||||
background: rgba(0, 9, 14, 0.62);
|
||||
transform: translateX(-50%);
|
||||
white-space: nowrap;
|
||||
}
|
||||
.cockpit-orbital-zoom-button {
|
||||
width: 28px;
|
||||
height: 24px;
|
||||
padding: 0;
|
||||
border: 1px solid var(--orbital-line);
|
||||
border-radius: 2px;
|
||||
background: rgba(0, 7, 12, 0.6);
|
||||
color: #f4fbff;
|
||||
font: inherit;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
pointer-events: auto;
|
||||
}
|
||||
.cockpit-orbital-zoom-button:hover:not(:disabled),
|
||||
.cockpit-orbital-zoom-button:focus-visible {
|
||||
border-color: var(--cockpit-accent, #00dcff);
|
||||
color: #fff;
|
||||
outline: none;
|
||||
}
|
||||
.cockpit-orbital-zoom-button:disabled {
|
||||
opacity: 0.35;
|
||||
cursor: default;
|
||||
}
|
||||
.cockpit-orbital-zoom {
|
||||
min-width: 64px;
|
||||
color: var(--cockpit-accent, #00dcff);
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.12em;
|
||||
text-align: center;
|
||||
}
|
||||
.cockpit-orbital-swath {
|
||||
padding-inline: 4px 2px;
|
||||
border-inline-start: 1px solid var(--orbital-faint);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
@media (max-width: 560px) {
|
||||
.cockpit-orbital-readout {
|
||||
max-width: calc(100% - 32px);
|
||||
}
|
||||
.cockpit-orbital-name {
|
||||
font-size: 13px;
|
||||
}
|
||||
/* The phone shell lifts RESET / EXIT ORBIT (its row ends ~106px up) and
|
||||
sets the DISPLAY / RADIO row above it (to ~194px up). The optics wrap to
|
||||
two rows and sit above that row, where the zoom buttons can be tapped;
|
||||
the card sits above the optics. */
|
||||
.cockpit-orbital-optics {
|
||||
bottom: 200px;
|
||||
}
|
||||
.cockpit-orbital-readout {
|
||||
bottom: 284px;
|
||||
}
|
||||
}
|
||||
|
||||
/* A short window: the card stops below the left rail (DATA LAYERS,
|
||||
UTILITIES, which end ~340px down) and scrolls its own content, the TLE
|
||||
block included, instead of running into the rail. */
|
||||
@media (max-height: 760px) and (min-width: 561px) {
|
||||
.cockpit-orbital-readout {
|
||||
max-height: max(120px, calc(100vh - clamp(150px, 19vh, 190px) - 350px));
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
|
||||
/* An instant cut: no focus pull and no lock motion. */
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.cockpit-orbital-focusing .cockpit-orbital-lens {
|
||||
backdrop-filter: none;
|
||||
-webkit-backdrop-filter: none;
|
||||
}
|
||||
.cockpit-orbital-bracket {
|
||||
transition: none;
|
||||
}
|
||||
.cockpit-orbital-reticle-lock .cockpit-orbital-bracket {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Off-nadir look: the tilt readout and the way back, tucked under the
|
||||
readout card at the side of the picture. Shown only while tilted. */
|
||||
.cockpit-orbital-look {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
padding-top: 8px;
|
||||
border-top: 1px solid var(--orbital-faint);
|
||||
}
|
||||
.cockpit-orbital-look-readout {
|
||||
color: var(--cockpit-accent, #00dcff);
|
||||
font-weight: 700;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.cockpit-orbital-nadir {
|
||||
padding: 3px 8px;
|
||||
border: 1px solid var(--orbital-line);
|
||||
border-radius: 2px;
|
||||
background: rgba(0, 7, 12, 0.6);
|
||||
color: #f4fbff;
|
||||
font: inherit;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.12em;
|
||||
cursor: pointer;
|
||||
pointer-events: auto;
|
||||
}
|
||||
.cockpit-orbital-nadir:hover,
|
||||
.cockpit-orbital-nadir:focus-visible {
|
||||
border-color: var(--cockpit-accent, #00dcff);
|
||||
color: #fff;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* The Cockpit HUD in orbit (#cockpit-hud[data-subject='satellite']): the
|
||||
orbital readout names the satellite, so the topline keeps only the
|
||||
vision selector, and panels and buttons stay square like the bridge. */
|
||||
#cockpit-hud[data-subject='satellite'] .cockpit-topline > div:first-child {
|
||||
visibility: hidden;
|
||||
}
|
||||
:root[data-ui-theme='cyber'] #cockpit-hud[data-subject='satellite']::before {
|
||||
clip-path: none;
|
||||
}
|
||||
:root:not([data-ui-theme='cyber']) body.cockpit-orbit {
|
||||
--panel-radius: 2px;
|
||||
--btn-radius: 2px;
|
||||
}
|
||||
#cockpit-hud[data-subject='satellite']
|
||||
:is(
|
||||
.cockpit-vision-controls,
|
||||
.cockpit-vision-controls button,
|
||||
.cockpit-card-actions button,
|
||||
.cockpit-utility-glyph,
|
||||
.cockpit-radio-transport button,
|
||||
#cockpit-brief-auto
|
||||
) {
|
||||
border-radius: 2px;
|
||||
}
|
||||
body.cockpit-orbit #view-switcher button {
|
||||
border-radius: 2px;
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import { useCockpitStore } from '../stores/cockpit.js';
|
||||
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 CockpitRadar from './panels/CockpitRadar.vue';
|
||||
import CockpitRollingValue from './panels/CockpitRollingValue.vue';
|
||||
import CockpitUtilityControls from './panels/CockpitUtilityControls.vue';
|
||||
@@ -26,15 +27,31 @@ const { presence, instruments, route, vision, utilityLayout } =
|
||||
const active = computed(() => Boolean(presence.value?.active));
|
||||
// A vessel subject swaps the aviation readouts for bridge ones.
|
||||
const bridge = computed(() => presence.value?.subjectKind === 'vessel');
|
||||
const subject = computed(() => (bridge.value ? 'vessel' : 'aircraft'));
|
||||
// A satellite subject keeps only its orbital HUD over the nadir picture.
|
||||
const orbital = computed(() => presence.value?.subjectKind === 'satellite');
|
||||
const subject = computed(() =>
|
||||
bridge.value ? 'vessel' : orbital.value ? 'satellite' : 'aircraft',
|
||||
);
|
||||
const hudLabel = computed(() =>
|
||||
bridge.value ? t('Ship bridge view') : t('Aircraft cockpit 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') : t('Exit cockpit view'),
|
||||
bridge.value
|
||||
? t('Exit bridge view')
|
||||
: orbital.value
|
||||
? t('Exit orbital view')
|
||||
: t('Exit cockpit view'),
|
||||
);
|
||||
const exitText = computed(() =>
|
||||
bridge.value ? t('EXIT BRIDGE') : t('EXIT COCKPIT'),
|
||||
bridge.value
|
||||
? t('EXIT BRIDGE')
|
||||
: orbital.value
|
||||
? t('EXIT ORBIT')
|
||||
: t('EXIT COCKPIT'),
|
||||
);
|
||||
const globe = useGlobeActionsStore();
|
||||
const { resetBusy } = storeToRefs(globe);
|
||||
@@ -74,8 +91,10 @@ const tickStyle = (tick) =>
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- Aircraft first-person view or a vessel's bridge. 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="hud.layer ?? undefined">
|
||||
<!-- 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">
|
||||
<!-- 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.
|
||||
Decorative only; telemetry and interactive panels remain separate.
|
||||
A bridge looks out through straight window mullions instead: a header
|
||||
@@ -87,7 +106,7 @@ const tickStyle = (tick) =>
|
||||
<path d="M0 600H324 M876 600H1200"/>
|
||||
</g>
|
||||
</svg>
|
||||
<svg v-else class="cockpit-frame-lines" viewBox="0 0 1200 720" preserveAspectRatio="none" aria-hidden="true" focusable="false">
|
||||
<svg v-else-if="!orbital" 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"/>
|
||||
@@ -97,7 +116,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" class="cockpit-scan-array" aria-hidden="true">
|
||||
<div v-if="!bridge && !orbital" 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"/>
|
||||
@@ -129,7 +148,7 @@ const tickStyle = (tick) =>
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="cockpit-visor-shell" aria-hidden="true">
|
||||
<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">
|
||||
<span style="--slot:-3;--depth:3">−30</span>
|
||||
@@ -158,7 +177,7 @@ const tickStyle = (tick) =>
|
||||
<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>
|
||||
<div id="cockpit-speed-rim" class="cockpit-altitude-rim cockpit-speed-rim" v-class-toggle="{ unavailable: hud.speedRim.unavailable }">
|
||||
<div v-if="!orbital" 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">
|
||||
@@ -169,7 +188,7 @@ const tickStyle = (tick) =>
|
||||
<strong id="cockpit-speed-rim-value">{{ hud.speedRim.value }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
<div id="cockpit-altitude-rim" class="cockpit-altitude-rim" :hidden="bridge" v-class-toggle="{ unavailable: hud.altitudeRim.unavailable }">
|
||||
<div v-if="!orbital" 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,7 +220,7 @@ const tickStyle = (tick) =>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cockpit-reticle material-symbols-outlined" aria-hidden="true">my_location</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">
|
||||
<span id="cockpit-look-readout" class="cockpit-look-readout" aria-live="polite">{{ look.readout }}</span>
|
||||
@@ -209,7 +228,7 @@ const tickStyle = (tick) =>
|
||||
<span>{{ t('LOOK AHEAD') }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="cockpit-compass" :aria-label="bridge ? t('Current vessel heading') : t('Current aircraft heading')">
|
||||
<div v-if="!orbital" class="cockpit-compass" :aria-label="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>
|
||||
@@ -231,7 +250,7 @@ const tickStyle = (tick) =>
|
||||
<span class="cockpit-heading-caret material-symbols-outlined" aria-hidden="true">arrow_drop_down</span>
|
||||
<div class="cockpit-compass-tape" id="cockpit-compass-tape" aria-hidden="true" :style="bridge ? { '--tape-shift': tapeShift } : undefined"><span v-for="division in hud.compass" :key="division.heading ?? division.slot" :class="(division.active ?? division.slot === 0) ? 'active' : ''" :style="{ '--slot': division.slot, '--depth': Math.abs(division.slot) }">{{ division.label }}</span><template v-if="bridge"><i v-if="hud.compassMarkers?.prograde != null" class="cockpit-compass-marker cockpit-compass-prograde" aria-hidden="true" :style="{ '--slot': hud.compassMarkers.prograde }"></i><i v-if="hud.compassMarkers?.retrograde != null" class="cockpit-compass-marker cockpit-compass-retrograde" aria-hidden="true" :style="{ '--slot': hud.compassMarkers.retrograde }"></i></template></div>
|
||||
</div>
|
||||
<div class="cockpit-position-readout">
|
||||
<div v-if="!orbital" class="cockpit-position-readout">
|
||||
<span id="cockpit-clock">{{ hud.clock }}</span>
|
||||
<span id="cockpit-position">{{ hud.position }}</span>
|
||||
</div>
|
||||
@@ -242,7 +261,7 @@ const tickStyle = (tick) =>
|
||||
<CockpitRadar />
|
||||
</div>
|
||||
<CockpitUtilityControls />
|
||||
<div class="cockpit-help"><bdi>{{ t('ESC EXIT') }}</bdi> <span>·</span> <bdi>{{ t('C TOGGLE') }}</bdi><template v-if="bridge"> <span>·</span> <bdi>{{ t('ARROWS LOOK') }}</bdi> <span>·</span> <bdi>{{ t('HOME RESET') }}</bdi></template></div>
|
||||
<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>
|
||||
</section>
|
||||
|
||||
<nav id="view-switcher" :aria-label="t('View switcher')">
|
||||
@@ -250,7 +269,7 @@ const tickStyle = (tick) =>
|
||||
<span class="material-symbols-outlined" aria-hidden="true">public</span>
|
||||
<span>{{ t('RESET') }}</span>
|
||||
</button>
|
||||
<button id="map-view-switch" type="button" :aria-label="exitLabel" aria-keyshortcuts="Escape C" :title="exitLabel" :hidden="!active">
|
||||
<button id="map-view-switch" type="button" :aria-label="exitLabel" aria-keyshortcuts="Escape" :title="exitLabel" :hidden="!active">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">close_fullscreen</span>
|
||||
<span>{{ exitText }}</span>
|
||||
</button>
|
||||
|
||||
@@ -0,0 +1,279 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed, nextTick, ref, watch } from 'vue';
|
||||
import { formatNumber, getLocale, t } from '../../../i18n/index.js';
|
||||
import {
|
||||
formatCockpitCoordinate,
|
||||
formatTleEpochUtc,
|
||||
} from '../../cockpitPresentation.js';
|
||||
import {
|
||||
loadFlagUrl,
|
||||
ownerMark,
|
||||
regionName,
|
||||
shownOwnerMark,
|
||||
} from '../../ownerFlag.js';
|
||||
import { useCockpitStore } from '../../stores/cockpit.js';
|
||||
|
||||
// The orbital view's HUD: a nadir reticle over the picture, the satellite's
|
||||
// identity and orbit, and the optical zoom. The Cockpit controller presents
|
||||
// it, drives the zoom step's blur and lock tick, and keeps the zoom buttons'
|
||||
// listeners; this view only reflects the store.
|
||||
|
||||
const { orbital } = storeToRefs(useCockpitStore());
|
||||
|
||||
const finite = (value) => typeof value === 'number' && Number.isFinite(value);
|
||||
|
||||
const altitudeText = computed(() => {
|
||||
const altitudeM = orbital.value?.altitudeM;
|
||||
return finite(altitudeM)
|
||||
? t('{value} KM', {
|
||||
value: formatNumber(Math.round(altitudeM / 1000)),
|
||||
})
|
||||
: '—';
|
||||
});
|
||||
|
||||
const velocityText = computed(() => {
|
||||
const velocityMps = orbital.value?.velocityMps;
|
||||
return finite(velocityMps)
|
||||
? t('{value} KM/S', {
|
||||
value: formatNumber(velocityMps / 1000, {
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2,
|
||||
}),
|
||||
})
|
||||
: null;
|
||||
});
|
||||
|
||||
const subPointText = computed(() => {
|
||||
const { latitude, longitude } = orbital.value || {};
|
||||
if (!finite(latitude) || !finite(longitude)) return '—';
|
||||
return `${formatCockpitCoordinate(latitude, 'N', 'S')} ${formatCockpitCoordinate(longitude, 'E', 'W')}`;
|
||||
});
|
||||
|
||||
const zoomSteps = computed(() => orbital.value?.zoomSteps || [1]);
|
||||
const zoom = computed(() => orbital.value?.zoom ?? zoomSteps.value[0]);
|
||||
const zoomText = computed(() =>
|
||||
t('ZOOM {zoom}×', { zoom: formatNumber(zoom.value) }),
|
||||
);
|
||||
const maxZoom = computed(
|
||||
() => orbital.value?.maxZoom ?? Math.max(...zoomSteps.value),
|
||||
);
|
||||
const atWidest = computed(() => zoom.value <= Math.min(...zoomSteps.value));
|
||||
const atTightest = computed(() => zoom.value >= maxZoom.value);
|
||||
|
||||
// Track-up turns the frame to the ground track; north's pointer turns back.
|
||||
const trackUp = computed(() => orbital.value?.trackUp === true);
|
||||
const northPointerStyle = computed(() => {
|
||||
const northDeg = orbital.value?.northDeg;
|
||||
return finite(northDeg) && northDeg !== 0
|
||||
? { transform: `rotate(${northDeg.toFixed(1)}deg)` }
|
||||
: null;
|
||||
});
|
||||
// The N itself stays upright as its pointer turns.
|
||||
const northLetterStyle = computed(() => {
|
||||
const northDeg = orbital.value?.northDeg;
|
||||
return finite(northDeg) && northDeg !== 0
|
||||
? { transform: `translateX(-50%) rotate(${(-northDeg).toFixed(1)}deg)` }
|
||||
: null;
|
||||
});
|
||||
|
||||
// A focused zoom button that turns off at the end of its range hands focus
|
||||
// on instead of dropping it to the page. The watchers run before the
|
||||
// re-render, while it still has focus.
|
||||
const zoomInButton = ref(null);
|
||||
const zoomOutButton = ref(null);
|
||||
const handFocus = (from, to) => {
|
||||
if (!from || document.activeElement !== from) return;
|
||||
nextTick(() =>
|
||||
(to() ?? document.getElementById('map-view-switch'))?.focus({
|
||||
preventScroll: true,
|
||||
}),
|
||||
);
|
||||
};
|
||||
watch(
|
||||
atTightest,
|
||||
(now) => now && handFocus(zoomInButton.value, () => zoomOutButton.value),
|
||||
{ flush: 'pre' },
|
||||
);
|
||||
watch(
|
||||
atWidest,
|
||||
(now) => now && handFocus(zoomOutButton.value, () => zoomInButton.value),
|
||||
{ flush: 'pre' },
|
||||
);
|
||||
|
||||
// At nadir the footprint; tilted, the approximate width at the view's
|
||||
// centre, marked ≈.
|
||||
const swathText = computed(() => {
|
||||
const tilted = orbital.value?.look?.offset === true;
|
||||
const km = tilted ? orbital.value?.look?.swathKm : orbital.value?.footprintKm;
|
||||
if (!finite(km)) return '';
|
||||
const digits = km < 10 ? 1 : 0;
|
||||
const value = formatNumber(km, {
|
||||
minimumFractionDigits: digits,
|
||||
maximumFractionDigits: digits,
|
||||
});
|
||||
return tilted
|
||||
? t('SWATH ≈ {value} KM', { value })
|
||||
: t('SWATH {value} KM', { value });
|
||||
});
|
||||
|
||||
// What the sub-satellite point is over: nothing until the first lookup
|
||||
// lands; on land the division as Natural Earth names it and the country in
|
||||
// the reader's language, with the populated place in view from 8x; at sea
|
||||
// the Natural Earth name.
|
||||
const placeText = computed(() => {
|
||||
const place = orbital.value?.place;
|
||||
if (place === undefined) return '';
|
||||
// No feature holds the point (a gap at a simplified coastline): say
|
||||
// nothing rather than call land open ocean.
|
||||
if (!place) return '';
|
||||
if (place.kind !== 'country') return place.name || '';
|
||||
const country =
|
||||
(place.countryCode && regionName(place.countryCode, getLocale())) ||
|
||||
place.name ||
|
||||
'';
|
||||
const region = place.division
|
||||
? t('{division}, {country}', { division: place.division, country })
|
||||
: country;
|
||||
return place.near
|
||||
? t('{region} · near {place}', { region, place: place.near })
|
||||
: region;
|
||||
});
|
||||
|
||||
// The owner's flag, or a text badge for an owner without one.
|
||||
const mark = computed(() =>
|
||||
ownerMark(orbital.value?.owner, { locale: getLocale() }),
|
||||
);
|
||||
const flagUrl = ref(null);
|
||||
// A flag that would not load (offline, a stale chunk after a deploy, a
|
||||
// missing file) falls back to the code as a badge, never to no owner at all.
|
||||
const flagFailed = ref(false);
|
||||
let flagRequest = 0;
|
||||
watch(
|
||||
() => (mark.value?.kind === 'flag' ? mark.value.code : null),
|
||||
async (code) => {
|
||||
const request = ++flagRequest;
|
||||
flagUrl.value = null;
|
||||
flagFailed.value = false;
|
||||
if (!code) return;
|
||||
let url = null;
|
||||
try {
|
||||
url = await loadFlagUrl(code);
|
||||
} catch {
|
||||
url = null;
|
||||
}
|
||||
if (request !== flagRequest) return;
|
||||
flagUrl.value = url;
|
||||
flagFailed.value = !url;
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
const shownMark = computed(() =>
|
||||
shownOwnerMark(mark.value, {
|
||||
url: flagUrl.value,
|
||||
failed: flagFailed.value,
|
||||
}),
|
||||
);
|
||||
|
||||
// NORAD · COSPAR · TLE epoch, and the two element lines on request.
|
||||
const identParts = computed(() => {
|
||||
const o = orbital.value;
|
||||
if (!o) return [];
|
||||
const parts = [];
|
||||
if (o.noradId !== null && o.noradId !== undefined && o.noradId !== '')
|
||||
parts.push(t('NORAD {id}', { id: String(o.noradId) }));
|
||||
if (o.cosparId) parts.push(o.cosparId);
|
||||
const epoch = formatTleEpochUtc(o.tle?.epochMs);
|
||||
if (epoch) parts.push(t('EPOCH {time}', { time: epoch }));
|
||||
return parts;
|
||||
});
|
||||
const identText = computed(() => identParts.value.join(' · '));
|
||||
const tleText = computed(() => {
|
||||
const tle = orbital.value?.tle;
|
||||
return tle?.line1 && tle?.line2 ? `${tle.line1}\n${tle.line2}` : '';
|
||||
});
|
||||
const tleOpen = ref(false);
|
||||
// Another satellite starts with its element set folded.
|
||||
watch(
|
||||
() => orbital.value?.noradId ?? null,
|
||||
() => {
|
||||
tleOpen.value = false;
|
||||
},
|
||||
);
|
||||
|
||||
// The off-nadir tilt; an untilted view shows no readout or reset.
|
||||
const look = computed(() => orbital.value?.look || { offset: false });
|
||||
|
||||
const transition = computed(() => orbital.value?.transition || {});
|
||||
const lensStyle = computed(() => {
|
||||
const blurPx = transition.value.blurPx;
|
||||
return {
|
||||
'--cockpit-orbital-blur': `${finite(blurPx) && blurPx > 0 ? blurPx.toFixed(2) : 0}px`,
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section id="cockpit-orbital" class="cockpit-orbital" :class="{ 'cockpit-orbital-focusing': transition.active }" :style="lensStyle" :aria-label="t('Orbital view')" :hidden="!orbital">
|
||||
<template v-if="orbital">
|
||||
<div class="cockpit-orbital-lens" aria-hidden="true"></div>
|
||||
<div class="cockpit-orbital-reticle" :class="{ 'cockpit-orbital-reticle-lock': transition.lockTick }" aria-hidden="true">
|
||||
<span class="cockpit-orbital-bracket cockpit-orbital-bracket-tl"></span>
|
||||
<span class="cockpit-orbital-bracket cockpit-orbital-bracket-tr"></span>
|
||||
<span class="cockpit-orbital-bracket cockpit-orbital-bracket-bl"></span>
|
||||
<span class="cockpit-orbital-bracket cockpit-orbital-bracket-br"></span>
|
||||
<span class="cockpit-orbital-cross"></span>
|
||||
<!-- North on the frame: at the top while north-up, turned with the ground track while track-up. -->
|
||||
<span class="cockpit-orbital-north-pointer" :style="northPointerStyle">
|
||||
<span class="cockpit-orbital-north-tick"></span>
|
||||
<span v-if="trackUp" class="cockpit-orbital-north-letter" :style="northLetterStyle">{{ t('N') }}</span>
|
||||
</span>
|
||||
</div>
|
||||
<!-- Under the vision selector: where the ground track is. -->
|
||||
<p v-if="placeText" id="cockpit-orbital-over" class="cockpit-orbital-over"><span>{{ t('CURRENTLY OVER') }}</span> <strong>{{ placeText }}</strong></p>
|
||||
<div class="cockpit-orbital-readout">
|
||||
<p class="cockpit-orbital-kicker">{{ look.offset ? t('ORBITAL VIEW · OFF-NADIR') : t('ORBITAL VIEW · NADIR') }}</p>
|
||||
<div class="cockpit-orbital-title">
|
||||
<!-- i18n-ignore: @error is the image's load-failure event, not a status message. -->
|
||||
<img v-if="shownMark?.kind === 'flag'" class="cockpit-orbital-flag" :src="shownMark.url" :alt="shownMark.label" :title="shownMark.label" width="20" height="15" @error="flagFailed = true" />
|
||||
<span v-else-if="shownMark?.kind === 'badge'" class="cockpit-orbital-owner-badge" :title="shownMark.title">{{ shownMark.label }}</span>
|
||||
<p class="cockpit-orbital-name">{{ orbital.name }}</p>
|
||||
</div>
|
||||
<p v-if="orbital.operator" class="cockpit-orbital-operator">{{ orbital.operator }}</p>
|
||||
<p v-if="orbital.classLabel" class="cockpit-orbital-class">{{ orbital.classLabel }}</p>
|
||||
<div v-if="identText" class="cockpit-orbital-ident">
|
||||
<!-- Wraps between parts, never inside a date. -->
|
||||
<span class="cockpit-orbital-ident-text"><template v-for="(part, index) in identParts" :key="index"><template v-if="index"> · </template><span class="cockpit-orbital-ident-part">{{ part }}</span></template></span>
|
||||
<button v-if="tleText" id="cockpit-orbital-tle-toggle" type="button" class="cockpit-orbital-tle-toggle" :aria-expanded="String(tleOpen)" aria-controls="cockpit-orbital-tle" :aria-label="tleOpen ? t('Hide the two-line element set') : t('Show the two-line element set')" :title="tleOpen ? t('Hide the two-line element set') : t('Show the two-line element set')" @click="tleOpen = !tleOpen">{{ t('TLE') }}</button>
|
||||
</div>
|
||||
<pre v-if="tleText" v-show="tleOpen" id="cockpit-orbital-tle" class="cockpit-orbital-tle" :aria-label="t('Two-line element set')">{{ tleText }}</pre>
|
||||
<dl class="cockpit-orbital-data">
|
||||
<div class="cockpit-orbital-datum">
|
||||
<dt>{{ t('ALTITUDE') }}</dt>
|
||||
<dd class="cockpit-orbital-altitude">{{ altitudeText }}</dd>
|
||||
</div>
|
||||
<div v-if="velocityText" class="cockpit-orbital-datum">
|
||||
<dt>{{ t('ORBITAL VELOCITY') }}</dt>
|
||||
<dd class="cockpit-orbital-velocity">{{ velocityText }}</dd>
|
||||
</div>
|
||||
<div class="cockpit-orbital-datum">
|
||||
<dt>{{ t('SUB-SATELLITE POINT') }}</dt>
|
||||
<dd class="cockpit-orbital-subpoint">{{ subPointText }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<p class="cockpit-orbital-north">{{ trackUp ? t('TRACK UP') : t('NORTH UP') }}</p>
|
||||
<!-- Shown only while the view is tilted off nadir: where it looks and the way back. -->
|
||||
<div v-if="look.offset" class="cockpit-orbital-look">
|
||||
<span id="cockpit-orbital-look-readout" class="cockpit-orbital-look-readout" aria-live="polite">{{ look.readout }}</span>
|
||||
<button id="cockpit-orbital-nadir" type="button" class="cockpit-orbital-nadir" :aria-label="t('Return the view to nadir')" :title="t('Return to nadir (Home or 0)')" aria-keyshortcuts="Home 0">{{ t('NADIR') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cockpit-orbital-optics">
|
||||
<button id="cockpit-orbital-zoom-out" ref="zoomOutButton" type="button" class="cockpit-orbital-zoom-button" :disabled="atWidest" :aria-label="t('Zoom out')" :title="t('Zoom out (−)')" aria-keyshortcuts="- _">−</button>
|
||||
<span class="cockpit-orbital-zoom" aria-live="polite">{{ zoomText }}</span>
|
||||
<button id="cockpit-orbital-zoom-in" ref="zoomInButton" type="button" class="cockpit-orbital-zoom-button" :disabled="atTightest" :aria-label="t('Zoom in')" :title="t('Zoom in (+)')" aria-keyshortcuts="+ =">+</button>
|
||||
<span v-if="swathText" class="cockpit-orbital-swath">{{ swathText }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</section>
|
||||
</template>
|
||||
Reference in new issue
Block a user