mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +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
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user