Retain live flights and earthquake observations across globe switches

This commit is contained in:
German Khokhlov committed 2026-11-03 02:14:55 +04:00
1 parent a0e5f04c30
commit c0062c4d3d
17 files changed
+428 -66

No files matched your search

+3 -3
View File
@@ -37,7 +37,7 @@ export class CockpitCoordinator {
operations,
);
this._cockpitDisplayPortal = null;
this.cockpitView = viewer || engine?.kind === 'navara'
this.cockpitView = viewer || (engine?.frames?.preUpdate && engine?.camera?.followChanged)
? this._createCockpitView(viewer, services)
: null;
}
@@ -88,7 +88,7 @@ export class CockpitCoordinator {
this._stampNavigation({ cancelPendingSelection: false }),
isEntryAllowed: () =>
cockpitEntryAllowed({
standaloneAircraft: this.engine?.kind === 'navara',
standaloneAircraft: true,
contextMode: this._contextMode,
contextModeChanging: this._contextModeChanging,
flightsEnabled: !!this._dataManager?.isEnabled('flights'),
@@ -279,7 +279,7 @@ export class CockpitCoordinator {
action: 'control_cockpit',
error: this._contextModeChanging
? 'Contacts is still starting up — try Cockpit again in a moment'
: this.engine?.kind === 'navara'
: !this._contextMode
? 'Enable an aircraft layer and track a flight to enter Cockpit'
: 'Contacts must be active to enter Cockpit — say "open contacts" first',
state: this.getCockpitState(),
+2 -2
View File
@@ -254,7 +254,7 @@ export class NavigationController {
});
}
_reassertNavigationHandoff(generation, { trackingOrigin = 'tool' } = {}) {
_reassertNavigationHandoff(generation, { trackingOrigin = 'tool', keepTracking = false } = {}) {
return reassertNavigationHandoff({
generation,
currentGeneration: this._navigationGeneration,
@@ -266,7 +266,7 @@ export class NavigationController {
// was refused by the cockpit leaves the old readout standing.
release: () => {
this.clearLocation();
return this._releaseFollowCamera({ trackingOrigin });
if (!keepTracking) return this._releaseFollowCamera({ trackingOrigin });
},
});
}
+9 -3
View File
@@ -174,12 +174,17 @@ export class ShareRestoration {
this._initialShareRestoreTimeout = null;
if (this._disposed) return;
const generation = this._initialShareNavigationGeneration;
const retained = engineSwitch && this._layerStateCoordinator?.retainedTrackingTarget();
const applyCamera =
Number.isInteger(generation) &&
this.navigation._reassertNavigationHandoff(generation);
this.navigation._reassertNavigationHandoff(generation, {
trackingOrigin: engineSwitch ? 'share-restore' : 'tool',
keepTracking: Boolean(retained),
});
void this._runShareRestore(savedState, {
applyCamera,
instant: engineSwitch,
retained,
navigationToken: generation,
layersPromise: this._layerStateRestorePromise,
settle: (result) => this._settleInitialShareRestore(result),
@@ -238,7 +243,7 @@ export class ShareRestoration {
*/
async _runShareRestore(
state,
{ applyCamera, instant = false, navigationToken, layersPromise, settle },
{ applyCamera, instant = false, retained, navigationToken, layersPromise, settle },
) {
const generation = this._shareRestoreGeneration;
const current = () =>
@@ -253,7 +258,8 @@ export class ShareRestoration {
if (!current()) return;
const tracking =
share.camera === 'applied'
? await this._layerStateCoordinator?.restoreShareTrackingSelection?.()
? (retained && this._layerStateCoordinator.resumeRetainedTracking(retained)) ||
await this._layerStateCoordinator?.restoreShareTrackingSelection?.()
: {
status: 'superseded',
cleared: