mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Keep Vue layer rows mounted through globe switches and rollback
This commit is contained in:
1 parent
2ee09c5911
commit
d7ab85f5c4
4 files changed
+31
-5
No files matched your search
+7
-3
@@ -34,10 +34,14 @@ export function createApplicationData({
|
||||
`Data layers could not be destroyed: ${[...dataManager.layers.keys()].join(', ')}`,
|
||||
);
|
||||
});
|
||||
const presentation = new LayerPresentation(dataManager, {
|
||||
const presentation = layerSession?.presentation ?? new LayerPresentation(dataManager, {
|
||||
weatherClock: catalog?.weatherClock,
|
||||
});
|
||||
defer(() => presentation.destroy());
|
||||
if (layerSession) layerSession.presentation = presentation;
|
||||
defer(() => {
|
||||
if (layerSession && !layerSession.lifetime.signal.aborted) presentation.suspend();
|
||||
else presentation.destroy();
|
||||
});
|
||||
onData?.(dataManager);
|
||||
if (!catalog?.layers || !catalog?.metadata)
|
||||
throw new TypeError('An application layer catalog is required');
|
||||
@@ -66,7 +70,7 @@ export function createApplicationData({
|
||||
delete window.__gevQaUnregisterLayer;
|
||||
});
|
||||
}
|
||||
presentation.mount(document.getElementById('data-toggles'));
|
||||
presentation.mount(document.getElementById('data-toggles'), catalog.weatherClock);
|
||||
styleManager.attachDataManager(dataManager);
|
||||
// The sonar scene draws on the viewer; the Navara engine has none.
|
||||
if (viewer) defer(createCyberSonarScene(viewer, dataManager));
|
||||
|
||||
@@ -17,6 +17,7 @@ export class LayerPresentation {
|
||||
this._panel = null;
|
||||
this.pendingVisible = false;
|
||||
this._unsubscribe = manager.subscribeActivity((change) => {
|
||||
if (this.suspended && change.type !== 'destroy-all') return;
|
||||
if (change.type === 'status') this.refresh();
|
||||
else if (change.type === 'destroy-all') this.destroy();
|
||||
else {
|
||||
@@ -67,9 +68,16 @@ export class LayerPresentation {
|
||||
});
|
||||
return this._panel;
|
||||
}
|
||||
mount(container) {
|
||||
mount(container, weatherClock = this.weatherClock) {
|
||||
this.weatherClock = weatherClock;
|
||||
this.panel.weatherClock = weatherClock;
|
||||
this.suspended = false;
|
||||
this.panel.mount(container);
|
||||
}
|
||||
suspend() {
|
||||
this.suspended = true;
|
||||
this._panel?.suspend();
|
||||
}
|
||||
/** Hand the Recent Imagery readout factory to the panel (see LayerPanel). */
|
||||
attachRecentImagery(factory) {
|
||||
// Detaching never builds a panel that teardown already released.
|
||||
|
||||
Reference in new issue
Block a user