mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 09:12:18 +00:00
Launches and satellites leave the world clock when destroyed
Both layers registered their time coverage with the page's world clock when created and never unregistered it, so an application destroyed and started again kept each old layer, and its scene and tiles, reachable through the clock. They now unregister on destroy and register again on init, as earthquakes do.
This commit is contained in:
1 parent
9239d3efff
commit
ee306a46fc
3 files changed
+42
-4
No files matched your search
@@ -163,7 +163,7 @@ export function createLifecycle({
|
||||
// has none), cut short and in capitals as the mission index shows names.
|
||||
// Registered once; off, the layer has no time to show, and each step tells
|
||||
// the clock once it has settled.
|
||||
worldClock.register({
|
||||
const clockSource = {
|
||||
id: 'rocket-launches',
|
||||
coverage: () => {
|
||||
if (!layerState._enabled) return null;
|
||||
@@ -184,11 +184,15 @@ export function createLifecycle({
|
||||
if (!marks.length) return null;
|
||||
return { start: marks[0].time, end: marks.at(-1).time, marks };
|
||||
},
|
||||
});
|
||||
};
|
||||
// Unregistered on destroy, so a page that builds the app again holds no old layer; init
|
||||
// registers it again.
|
||||
let uncover = worldClock.register(clockSource);
|
||||
|
||||
const methods = {
|
||||
init(viewer) {
|
||||
layerState._viewer = viewer;
|
||||
uncover ??= worldClock.register(clockSource);
|
||||
layerState._enabled = false;
|
||||
parts.panel.createMissionPanel();
|
||||
parts.overlays.createReplayVehicleOverlay();
|
||||
@@ -324,6 +328,8 @@ export function createLifecycle({
|
||||
|
||||
async destroy(viewer) {
|
||||
hover?.destroy();
|
||||
uncover?.();
|
||||
uncover = null;
|
||||
hover = null;
|
||||
layerState._sourceController.abort();
|
||||
releaseContinuousRender('rocket-launches'); // direct-destroy path (perf wave 2 fix)
|
||||
|
||||
Reference in new issue
Block a user