diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 3fc14cfa37..38d838d0e2 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -5594,7 +5594,9 @@ activeCameraCardEnabled: true })` may publish it through the retained > taken while it ran is kept. Restored parameters never re-show primitives > while the Satellite layer is disabled. When Satellites is still busy after > the 30 s limit, the restore changes nothing and keeps the saved state, so -> switching Space Missions off again finishes it. +> switching Space Missions off again finishes it. While Space Missions goes +> off, its panel's roster and controls select, focus, preview and replay +> nothing, so no camera move starts that nothing would end. > - **Flights 3D/cockpit hardening:** the destination-direction cue is an > inline SVG rather than a remotely loaded Material Icons ligature, so a > blocked or late font can no longer expand the literal word `navigation` diff --git a/src/layers/launches/panel.js b/src/layers/launches/panel.js index 470adc9d9e..9dc827d5ca 100644 --- a/src/layers/launches/panel.js +++ b/src/layers/launches/panel.js @@ -380,14 +380,20 @@ export function createPanel({ state: layerState, services, parts, source }) { function scheduleMissionRosterPreview(index) { const launch = layerState._launches[index]; - if (!launch || layerState._selectedLaunchId) return; + // Once the layer is going off (its Satellites restore may still be + // running) hovering or focusing a roster row moves no camera. + if (!launch || layerState._selectedLaunchId || !layerState._enabled) return; if (layerState._missionRosterHoverTimer) clearTimeout(layerState._missionRosterHoverTimer); layerState._hoveredRosterLaunchId = launch.id; parts.overlays.syncMissionOverlayEntries(); layerState._missionRosterHoverTimer = setTimeout(() => { layerState._missionRosterHoverTimer = null; - if (layerState._hoveredRosterLaunchId !== launch.id) return; + if ( + layerState._hoveredRosterLaunchId !== launch.id || + !layerState._enabled + ) + return; const currentLaunch = resolveMissionRosterPreviewLaunch( layerState._launches, launch.id, diff --git a/src/layers/launches/panel.test.mjs b/src/layers/launches/panel.test.mjs index 9075d5e5cb..4e0a558944 100644 --- a/src/layers/launches/panel.test.mjs +++ b/src/layers/launches/panel.test.mjs @@ -9,6 +9,7 @@ function fixture() { const state = createState({ services: { overlays: {}, render: {} }, }); + state._enabled = true; const calls = []; const parts = { overlays: { @@ -194,3 +195,26 @@ test('the panel commands act on the selected mission', () => { ['select', null, undefined], ]); }); + +test('a roster row hovered or focused while the layer goes off moves no camera', async () => { + const { state, panel, calls } = fixture(); + state._launches = [launch('a'), launch('b')]; + panel.createMissionPanel(); + panel.renderMissionRoster(); + + // Hovered just before the layer goes off: the pending preview is dropped. + panel.commands.rosterPointerEnter(0); + state._enabled = false; + await new Promise((resolve) => setTimeout(resolve, 160)); + + // Hovered or focused after it went off, while the panel still shows. + panel.commands.rosterPointerEnter(1); + panel.commands.rosterFocus(1); + assert.equal(state._missionRosterHoverTimer, null, 'no preview is pending'); + await new Promise((resolve) => setTimeout(resolve, 160)); + assert.deepEqual( + calls.filter(([name]) => name === 'preview'), + [], + ); + panel.clearMissionPanel(); +});