diff --git a/src/layers/launches/failedEntry.test.mjs b/src/layers/launches/failedEntry.test.mjs index b82663597..9284e4fd2 100644 --- a/src/layers/launches/failedEntry.test.mjs +++ b/src/layers/launches/failedEntry.test.mjs @@ -17,6 +17,7 @@ import { createIngestion } from './ingestion.js'; import { createPanel } from './panel.js'; import { createControls } from './controls.js'; import { createLifecycle } from './lifecycle.js'; +import { createReplay } from './replay.js'; const noop = () => {}; @@ -81,6 +82,7 @@ function fakeCamera() { camera.flight = null; flight?.cancel?.(); }, + lookAtTransform: noop, setView({ destination, orientation }) { camera.position = Cesium.Cartesian3.clone(destination); camera.heading = orientation.heading; @@ -144,8 +146,8 @@ async function fixture(t) { clearMissionOverlaySources: noop, hideReplayVehicleOverlay: noop, destroyReplayVehicleOverlay: noop, + syncMissionOverlayEntries: noop, }, - replay: { stopMissionReplay: noop, presentReplay: () => null }, selection: { focusFullGlobe(target, flight) { target.camera.flyTo({ @@ -182,6 +184,7 @@ async function fixture(t) { parts.policyHelpers = createPolicyHelpers(context); parts.model = createModel(context); parts.panel = createPanel(context); + parts.replay = createReplay(context); parts.ingestion = createIngestion(context); parts.controls = createControls(context); parts.lifecycle = createLifecycle(context); @@ -372,13 +375,24 @@ test('a navigation during a failed first load is not cancelled by the rollback', await untilFlown(f); // Search or Home: navigation releases mission camera ownership, then flies. f.missions.releaseCameraOwnership(); - f.camera.flyTo({ destination: new Cesium.Cartesian3(5, 5, 5) }); + let navigationCancelled = false; + f.camera.flyTo({ + destination: new Cesium.Cartesian3(5, 5, 5), + cancel: () => { + navigationCancelled = true; + }, + }); const cancelled = f.camera.cancelled; const navigated = f.view(); release(); assert.equal(await entering, false); await f.settle(); + assert.equal( + navigationCancelled, + false, + 'the rollback does not cancel the Search/Home flight', + ); assert.equal(f.camera.cancelled, cancelled); assert.deepEqual(f.view(), navigated); }); diff --git a/src/layers/launches/replay.js b/src/layers/launches/replay.js index 86b6a08f0..e74c636f9 100644 --- a/src/layers/launches/replay.js +++ b/src/layers/launches/replay.js @@ -314,9 +314,11 @@ export function createReplay({ state: layerState, services, parts, source }) { layerState._replayCameraToken++; if (layerState._replayCameraRemover) layerState._replayCameraRemover(); layerState._replayCameraRemover = null; - layerState._viewer?.camera?.cancelFlight(); - if (layerState._viewer?.camera) + // Without a replay the camera is not ours: leave other flights running. + if (stoppedLaunchId && layerState._viewer?.camera) { + layerState._viewer.camera.cancelFlight(); layerState._viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY); + } layerState._replayCameraLaunchId = null; layerState._replayPaused = false; layerState._replayPausedAtMs = null;