mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Merge main and switch Cesium and Navara in place through Vue
Preserve the camera, map source and layer selection across engine sessions. Restore the previous engine if startup fails and retain local history navigation.
This commit is contained in:
commit
b8f4d097c4
1691 files changed
+225876
-41594
No files matched your search
+102
-83
@@ -5,6 +5,7 @@ import {
|
||||
toggleTrackedTr3b,
|
||||
syncTr3bToggle,
|
||||
syncEntry,
|
||||
publishPresenceView,
|
||||
navigateContext,
|
||||
_adoptTrackedEntity,
|
||||
enter,
|
||||
@@ -12,6 +13,8 @@ import {
|
||||
} from './cockpitTrackingController.js';
|
||||
import { update } from './cockpitCamera.js';
|
||||
import {
|
||||
publishInstrumentsView,
|
||||
publishRouteView,
|
||||
updateHud,
|
||||
updateRoute,
|
||||
syncWeatherToggle,
|
||||
@@ -19,8 +22,21 @@ import {
|
||||
cycleVisionMode,
|
||||
clearPredictiveRoute,
|
||||
} from './cockpitInstruments.js';
|
||||
import { updateContext } from './cockpitContext.js';
|
||||
import {
|
||||
publishContextView,
|
||||
showContextCard,
|
||||
updateContext,
|
||||
} from './cockpitContext.js';
|
||||
import { createContextState } from './cockpitContextState.js';
|
||||
import { createBriefState } from './cockpitBriefPages.js';
|
||||
import {
|
||||
createInstrumentState,
|
||||
createRouteState,
|
||||
createVisionState,
|
||||
} from './cockpitInstrumentState.js';
|
||||
import { onLocaleChange } from '../i18n/index.js';
|
||||
import {
|
||||
publishBriefView,
|
||||
showBriefPage,
|
||||
setBriefAutoRotate,
|
||||
startBriefRotation,
|
||||
@@ -29,10 +45,11 @@ import {
|
||||
maybeRefreshRegionalBrief,
|
||||
renderRegionalBriefStatus,
|
||||
renderRegionalBrief,
|
||||
relocalizeBrief,
|
||||
} from './cockpitBriefing.js';
|
||||
import {
|
||||
handleSignalClick,
|
||||
renderCockpitSignals,
|
||||
publishCockpitSignals,
|
||||
pushCockpitSignal,
|
||||
updateCockpitSignals,
|
||||
} from './cockpitSignals.js';
|
||||
@@ -55,9 +72,11 @@ export class CockpitViewController {
|
||||
getInitialVisionMode = null,
|
||||
onCameraTakeover = null,
|
||||
isEntryAllowed = null,
|
||||
isUtilityDisclosureOpen = null,
|
||||
onEntered = null,
|
||||
onExited = null,
|
||||
restoreTrackingFrame = null,
|
||||
publish = {},
|
||||
} = {},
|
||||
) {
|
||||
this.viewer = viewer;
|
||||
@@ -77,47 +96,14 @@ export class CockpitViewController {
|
||||
this.surfaceWaitStartedMs = 0;
|
||||
this.surfaceAcquiring = false;
|
||||
this.surfaceFallback = false;
|
||||
this.lastCompassSignature = '';
|
||||
this.entry = document.getElementById('cockpit-entry');
|
||||
this.tr3bToggle = document.getElementById('tr3b-toggle');
|
||||
this._tr3bSignature = null;
|
||||
this.mapViewButton = document.getElementById('map-view-switch');
|
||||
this.resetGlobeButton = document.getElementById('cockpit-reset-globe');
|
||||
this.hud = document.getElementById('cockpit-hud');
|
||||
this.entryFocusOrigin = null;
|
||||
this.callsign = document.getElementById('cockpit-callsign');
|
||||
this.speed = document.getElementById('cockpit-speed-value');
|
||||
this.speedRim = document.getElementById('cockpit-speed-rim');
|
||||
this.speedRimValue = document.getElementById('cockpit-speed-rim-value');
|
||||
this.speedRimTicks = Array.from(
|
||||
document.querySelectorAll('[data-speed-rim-tick]'),
|
||||
);
|
||||
this.altitude = document.getElementById('cockpit-altitude-value');
|
||||
this.altitudeRim = document.getElementById('cockpit-altitude-rim');
|
||||
this.altitudeRimValue = document.getElementById(
|
||||
'cockpit-altitude-rim-value',
|
||||
);
|
||||
this.altitudeRimTicks = Array.from(
|
||||
document.querySelectorAll('[data-altitude-rim-tick]'),
|
||||
);
|
||||
this.headingValue = document.getElementById('cockpit-heading-value');
|
||||
this.compassTape = document.getElementById('cockpit-compass-tape');
|
||||
this.clock = document.getElementById('cockpit-clock');
|
||||
this.position = document.getElementById('cockpit-position');
|
||||
this.aircraftMeta = document.getElementById('cockpit-aircraft-meta');
|
||||
this.route = document.getElementById('cockpit-route');
|
||||
this.routeFrom = document.getElementById('cockpit-route-from');
|
||||
this.routeTo = document.getElementById('cockpit-route-to');
|
||||
this.routeStatus = document.getElementById('cockpit-route-status');
|
||||
this.routeDirection = document.getElementById('cockpit-route-direction');
|
||||
this.routeDirectionLabel = document.getElementById(
|
||||
'cockpit-route-direction-label',
|
||||
);
|
||||
this.visionPrevious = document.getElementById('cockpit-vision-previous');
|
||||
this.visionCurrent = document.getElementById('cockpit-vision-current');
|
||||
this.visionCurrentLabel = document.getElementById(
|
||||
'cockpit-vision-current-label',
|
||||
);
|
||||
this.visionNext = document.getElementById('cockpit-vision-next');
|
||||
this.visionMode = 'optical';
|
||||
this.onVisionChange = onVisionChange;
|
||||
@@ -134,71 +120,54 @@ export class CockpitViewController {
|
||||
: () => false;
|
||||
this.isEntryAllowed =
|
||||
typeof isEntryAllowed === 'function' ? isEntryAllowed : () => true;
|
||||
this.isUtilityDisclosureOpen =
|
||||
typeof isUtilityDisclosureOpen === 'function'
|
||||
? isUtilityDisclosureOpen
|
||||
: () => false;
|
||||
this.context = document.getElementById('cockpit-context');
|
||||
this.contextSubject = document.getElementById('cockpit-context-subject');
|
||||
this.contextNearestLabel = document.getElementById(
|
||||
'cockpit-context-nearest-label',
|
||||
);
|
||||
this.contextBearing = document.getElementById('cockpit-context-bearing');
|
||||
this.contextDistance = document.getElementById('cockpit-context-distance');
|
||||
this.contextDirection = document.getElementById(
|
||||
'cockpit-context-direction',
|
||||
);
|
||||
this.contextUncertainty = document.getElementById(
|
||||
'cockpit-context-uncertainty',
|
||||
);
|
||||
this.contextUpdated = document.getElementById('cockpit-context-updated');
|
||||
this.contextCohorts = new Map(
|
||||
Array.from(document.querySelectorAll('[data-context-cohort]')).map(
|
||||
(element) => [element.dataset.contextCohort, element],
|
||||
),
|
||||
);
|
||||
this.contextPrevious = document.getElementById('cockpit-context-previous');
|
||||
this.contextNext = document.getElementById('cockpit-context-next');
|
||||
this.contextToggle = document.getElementById('cockpit-context-toggle');
|
||||
this.weatherToggle = document.getElementById('cockpit-weather-toggle');
|
||||
this.weatherState = document.getElementById('cockpit-weather-state');
|
||||
this.contextCollapsed = false;
|
||||
this.signalStream = document.getElementById('cockpit-signal-stream');
|
||||
this.signalList = document.getElementById('cockpit-signal-list');
|
||||
this.signalToggle = document.getElementById('cockpit-signal-toggle');
|
||||
this.briefKicker = document.getElementById('cockpit-brief-kicker');
|
||||
this.briefSubtitle = document.getElementById('cockpit-brief-subtitle');
|
||||
this.briefPrevious = document.getElementById('cockpit-brief-previous');
|
||||
this.briefNext = document.getElementById('cockpit-brief-next');
|
||||
this.briefAutoToggle = document.getElementById('cockpit-brief-auto');
|
||||
this.briefPosition = document.getElementById('cockpit-brief-position');
|
||||
this.briefSource = document.getElementById('cockpit-brief-source');
|
||||
this.briefPages = Array.from(
|
||||
document.querySelectorAll('[data-cockpit-brief-page]'),
|
||||
);
|
||||
this.briefTabs = Array.from(
|
||||
document.querySelectorAll('[data-cockpit-brief-index]'),
|
||||
);
|
||||
this.newsStatus = document.getElementById('cockpit-news-status');
|
||||
this.newsList = document.getElementById('cockpit-news-list');
|
||||
this.localPlace = document.getElementById('cockpit-local-place');
|
||||
this.localCoordinates = document.getElementById(
|
||||
'cockpit-local-coordinates',
|
||||
);
|
||||
this.localTemperature = document.getElementById(
|
||||
'cockpit-local-temperature',
|
||||
);
|
||||
this.localWind = document.getElementById('cockpit-local-wind');
|
||||
this.localWindDirection = document.getElementById(
|
||||
'cockpit-local-wind-direction',
|
||||
);
|
||||
this.localCondition = document.getElementById('cockpit-local-condition');
|
||||
this.localCloud = document.getElementById('cockpit-local-cloud');
|
||||
this.localPrecipitation = document.getElementById(
|
||||
'cockpit-local-precipitation',
|
||||
);
|
||||
this.signalCollapsed = false;
|
||||
this.signalUserCollapsed = false;
|
||||
this.signalItems = [];
|
||||
this.signalSignatures = new Map();
|
||||
this.briefPageIndex = 0;
|
||||
this.briefAutoRotateEnabled = false;
|
||||
// Cockpit's views render what these receive.
|
||||
this.publishPresence = publish.presence ?? (() => {});
|
||||
this.publishBrief = publish.brief ?? (() => {});
|
||||
this.publishContext = publish.context ?? (() => {});
|
||||
this.publishInstruments = publish.instruments ?? (() => {});
|
||||
this.publishRoute = publish.route ?? (() => {});
|
||||
this.publishVision = publish.vision ?? (() => {});
|
||||
this.publishSignals = publish.signals ?? (() => {});
|
||||
this.publishUtilityLayout = publish.utilityLayout ?? (() => {});
|
||||
this.presence = {
|
||||
active: false,
|
||||
entryAvailable: false,
|
||||
tr3b: null,
|
||||
context: false,
|
||||
// The Contact and briefing cards' collapse, which their toggles show.
|
||||
contextCollapsed: false,
|
||||
signalCollapsed: false,
|
||||
};
|
||||
this.instruments = createInstrumentState();
|
||||
this.routeView = createRouteState();
|
||||
this.routeSignature = null;
|
||||
this.contextView = createContextState();
|
||||
this.brief = createBriefState();
|
||||
this.briefTimer = null;
|
||||
this.lastAircraftInfo = null;
|
||||
this.regionalBrief = null;
|
||||
@@ -251,8 +220,7 @@ export class CockpitViewController {
|
||||
this.setContextCollapsed(!this.contextCollapsed),
|
||||
);
|
||||
this._listen(this.weatherToggle, 'click', () => {
|
||||
const enabled =
|
||||
this.weatherToggle.getAttribute('aria-pressed') !== 'true';
|
||||
const enabled = !this.contextView.weather;
|
||||
this.syncWeatherToggle(enabled);
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('gev:cockpit-weather-toggle', {
|
||||
@@ -310,6 +278,9 @@ export class CockpitViewController {
|
||||
toggleTrackedTr3b() {
|
||||
return toggleTrackedTr3b.call(this);
|
||||
}
|
||||
publishPresenceView() {
|
||||
return publishPresenceView.call(this);
|
||||
}
|
||||
syncTr3bToggle(info) {
|
||||
return syncTr3bToggle.call(this, info);
|
||||
}
|
||||
@@ -331,6 +302,12 @@ export class CockpitViewController {
|
||||
update() {
|
||||
return update.call(this);
|
||||
}
|
||||
publishInstrumentsView() {
|
||||
return publishInstrumentsView.call(this);
|
||||
}
|
||||
publishRouteView() {
|
||||
return publishRouteView.call(this);
|
||||
}
|
||||
updateHud(info, nowMs, forceContext) {
|
||||
return updateHud.call(this, info, nowMs, forceContext);
|
||||
}
|
||||
@@ -349,9 +326,18 @@ export class CockpitViewController {
|
||||
clearPredictiveRoute() {
|
||||
return clearPredictiveRoute.call(this);
|
||||
}
|
||||
publishContextView() {
|
||||
return publishContextView.call(this);
|
||||
}
|
||||
showContextCard(visible) {
|
||||
return showContextCard.call(this, visible);
|
||||
}
|
||||
updateContext(info, heading) {
|
||||
return updateContext.call(this, info, heading);
|
||||
}
|
||||
publishBriefView() {
|
||||
return publishBriefView.call(this);
|
||||
}
|
||||
showBriefPage(index, options) {
|
||||
return showBriefPage.call(this, index, options);
|
||||
}
|
||||
@@ -373,11 +359,14 @@ export class CockpitViewController {
|
||||
renderRegionalBriefStatus(status, info) {
|
||||
return renderRegionalBriefStatus.call(this, status, info);
|
||||
}
|
||||
relocalizeBrief() {
|
||||
return relocalizeBrief.call(this);
|
||||
}
|
||||
renderRegionalBrief(payload, info) {
|
||||
return renderRegionalBrief.call(this, payload, info);
|
||||
}
|
||||
renderCockpitSignals() {
|
||||
return renderCockpitSignals.call(this);
|
||||
publishCockpitSignals() {
|
||||
return publishCockpitSignals.call(this);
|
||||
}
|
||||
pushCockpitSignal(key, tone, title, detail, target) {
|
||||
return pushCockpitSignal.call(this, key, tone, title, detail, target);
|
||||
@@ -408,6 +397,36 @@ export class CockpitViewController {
|
||||
return handleSignalClick.call(this, event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Word every Cockpit surface again in the current locale. In flight the
|
||||
* last reading is shown again; otherwise the surfaces go back to their
|
||||
* placeholders, which the next entry replaces.
|
||||
*/
|
||||
relocalize() {
|
||||
if (this.destroyed) return;
|
||||
this.relocalizeBrief();
|
||||
this.publishVision(createVisionState(this.visionMode));
|
||||
this.routeSignature = null;
|
||||
if (this.active && this.lastAircraftInfo) {
|
||||
this.rewordingSignals = true;
|
||||
try {
|
||||
this.updateHud(this.lastAircraftInfo, performance.now(), true);
|
||||
} finally {
|
||||
this.rewordingSignals = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.instruments = createInstrumentState();
|
||||
this.publishInstrumentsView();
|
||||
this.routeView = createRouteState();
|
||||
this.publishRouteView();
|
||||
this.contextView = {
|
||||
...createContextState(),
|
||||
weather: this.contextView.weather,
|
||||
};
|
||||
this.publishContextView();
|
||||
}
|
||||
|
||||
/** Revoke new work before the shell awaits layer restoration. */
|
||||
stop() {
|
||||
if (this.destroyed) return;
|
||||
|
||||
Reference in new issue
Block a user