mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Keep Contacts, active layer intents and mapped sites across globe switches
This commit is contained in:
1 parent
81bcae907f
commit
87bbe14748
35 files changed
+465
-118
No files matched your search
@@ -105,11 +105,13 @@ export class StyleManager extends ShellFacade {
|
||||
requestServices,
|
||||
initialShareCode = null,
|
||||
engineSwitch = false,
|
||||
layerSession = null,
|
||||
localePicker = true,
|
||||
} = {},
|
||||
) {
|
||||
super();
|
||||
this._localePickerEnabled = localePicker;
|
||||
this._layerSession = layerSession;
|
||||
const {
|
||||
IntelHUD,
|
||||
ShareLinkManager,
|
||||
@@ -197,6 +199,7 @@ export class StyleManager extends ShellFacade {
|
||||
this._shareRestoration = new ShareRestoration({
|
||||
viewer,
|
||||
canvas: engine?.host.canvas ?? viewer?.canvas,
|
||||
handoffLayers: layerSession?.handoffLayers,
|
||||
navigation: this._navigation,
|
||||
syncShareState: () => this._syncShareState(),
|
||||
syncModels3d: (state) => this._syncModels3dFromLayerState(state),
|
||||
@@ -972,6 +975,8 @@ export class StyleManager extends ShellFacade {
|
||||
setClearBusy: (busy) => this._publishClearBusy(busy),
|
||||
},
|
||||
});
|
||||
if (this._layerSession?.handoffLayers)
|
||||
this._contextControls.resumeScene(this._layerSession.contacts);
|
||||
// The Contacts layer publishes its panel; the view calls its navigation.
|
||||
contextStore.connectAwareness(militaryAwarenessLayer);
|
||||
// A panel left by an earlier shell must not outlive its layer.
|
||||
@@ -1855,7 +1860,13 @@ export class StyleManager extends ShellFacade {
|
||||
// Close camera-entry seams synchronously. Context restoration may await
|
||||
// layer work, so leaving these listeners attached until afterward lets a
|
||||
// focus event release tracking or start a flight during teardown.
|
||||
await this._contextControls.restoreForDisposal();
|
||||
if (this._layerSession && !this._layerSession.lifetime.signal.aborted &&
|
||||
this._contextControls.canRetainContacts()) {
|
||||
this._layerSession.contacts = this._contextControls.captureScene();
|
||||
} else {
|
||||
if (this._layerSession) this._layerSession.contacts = null;
|
||||
await this._contextControls.restoreForDisposal();
|
||||
}
|
||||
// IR boost teardown BEFORE detaching the data manager: restore fog and
|
||||
// un-boost both aircraft layers so a surviving viewer or replacement
|
||||
// manager doesn't inherit sensor state (review P2, 2026-08-16).
|
||||
|
||||
@@ -85,6 +85,19 @@ export class ContextControls {
|
||||
this[field] = null;
|
||||
}
|
||||
}
|
||||
canRetainContacts() {
|
||||
return this._contextMode === 'flights' && !this._contextModeChanging &&
|
||||
!this._contextRestoreState && !this._clearSelectedLayersPromise &&
|
||||
!this._contextLayerReactionPromises.size;
|
||||
}
|
||||
captureScene() {
|
||||
return { mode: this._contextMode, snapshot: this._contextSessionSnapshot };
|
||||
}
|
||||
resumeScene(saved) {
|
||||
if (!saved) return;
|
||||
this._contextMode = saved.mode;
|
||||
this._contextSessionSnapshot = saved.snapshot;
|
||||
}
|
||||
stop() {
|
||||
if (this.destroyed) return;
|
||||
this.destroyed = true;
|
||||
|
||||
@@ -110,6 +110,7 @@ export class ShareRestoration {
|
||||
constructor({
|
||||
viewer,
|
||||
canvas = viewer?.canvas,
|
||||
handoffLayers = null,
|
||||
navigation,
|
||||
syncShareState,
|
||||
syncModels3d,
|
||||
@@ -121,6 +122,7 @@ export class ShareRestoration {
|
||||
Object.assign(this, {
|
||||
viewer,
|
||||
canvas,
|
||||
handoffLayers,
|
||||
navigation,
|
||||
syncShareState,
|
||||
syncModels3d,
|
||||
@@ -368,11 +370,13 @@ export class ShareRestoration {
|
||||
);
|
||||
this._layerStateRestorePromise = this._layerStateCoordinator.start({
|
||||
shareLayerState: this._initialShareState?.layerState || null,
|
||||
handoffLayers: this.handoffLayers,
|
||||
shareCreatedAtMs: this._initialShareState?.sharedAtMs ?? null,
|
||||
// Any valid camera/style share isolates recipient-local preferences,
|
||||
// including legacy and malformed-v2 layer payloads.
|
||||
allowLocalState: !this._initialShareState,
|
||||
});
|
||||
this.handoffLayers = null;
|
||||
if (this._initialShareSelectionSuperseded) {
|
||||
this._layerStateCoordinator.cancelPendingShareTracking(
|
||||
'superseded-before-layer-coordinator-start',
|
||||
@@ -425,6 +429,7 @@ export class ShareRestoration {
|
||||
try {
|
||||
while (live()) {
|
||||
const vessels = this._dataManager?.layers?.get?.(layerId)?.module;
|
||||
if (vessels?.getSelectedInfo?.()?.mmsi === id) return true;
|
||||
if (vessels?.hasContact?.(id) && vessels.selectById(id)) return true;
|
||||
if (Date.now() >= deadline) break;
|
||||
await new Promise((resolve) =>
|
||||
|
||||
Reference in new issue
Block a user