diff --git a/changelog.d/1702-cctv-nearest-same-camera.md b/changelog.d/1702-cctv-nearest-same-camera.md index 660f59c589..2ec0298d12 100644 --- a/changelog.d/1702-cctv-nearest-same-camera.md +++ b/changelog.d/1702-cctv-nearest-same-camera.md @@ -1,5 +1,5 @@ -- Keep the CCTV camera picked with NEAREST, from the camera list or by a scene - when it is the camera the view just moved to. The pick did not stick: +- Keep the CCTV camera picked with NEAREST, FOCUS or by a scene when it is + the camera CCTV switched to after the view moved. The pick did not stick: NEAREST's own flight, or the next pan, switched to another camera, so the - panel showed a camera nobody had picked. Choosing the camera the list already - shows now counts as a pick too (gekh, #1702). + panel showed a camera nobody had picked. To keep the camera the list + already shows, press FOCUS (gekh, #1702). diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 96484b78b8..f4ca0ba090 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -2003,14 +2003,15 @@ count of cameras outside the view. Turning CCTV on opens on the camera nearest the view. Until someone picks a camera, each settled move, such as a shared view's flight landing, moves it to the camera then nearest the view. Automatic selection ends at the first pick: -NEAREST, PREV or NEXT, a camera chosen in the picker, a click on a camera, a -click on empty ground that deselects, an auto-hop step, or a call to +NEAREST, PREV or NEXT, FOCUS, a camera chosen in the picker, a click on a +camera, a click on empty ground that deselects, an auto-hop step, or a call to `selectCamera`, `focusNearest`, `focusNearestToPoint` or `setParams({ selectedCameraId })`, which voice and scenes use. Picking the -camera that is already active counts. While the camera is the automatic one, -the picker shows it from a hidden first option, so choosing that camera from -the list is a change and ends automatic selection; closing the list without a -choice keeps it. +camera that is already active counts. The picker shows the automatic camera +as its own option, and a native list sends no change for the option it +already shows, so the list cannot pick that camera: FOCUS does, and so does +NEAREST when that camera is the nearest. Closing the list without a choice +keeps automatic selection. Traffic owns its rendered-surface observer only while enabled, removes it on disable/destroy, and rebuilds no cached heights on frames where the surface identity is unchanged. Its dots and heat-lines are two renderer draw sets, it animates on the frame port's preRender, and it follows the camera through the camera port at its own 5% threshold rather than the shared `percentageChanged` ledger. The surface identity is the globe port's `surfaceVersion()` and tile readiness its `isSettled('surface')`, so the layer no longer reaches Cesium. Heat-lines are always asked for draped: where the Cesium renderer cannot drape (no depth textures) its draw port draws them (and every other draped line) over the surface, in their colour where the surface hides them and hidden past the horizon, recolouring a line in place when only its colour changes, rather than the layer dropping them. diff --git a/src/data/cctvExplicitPickEndsOpening.test.mjs b/src/data/cctvExplicitPickEndsOpening.test.mjs index fdb207e4c9..f429ab87f8 100644 --- a/src/data/cctvExplicitPickEndsOpening.test.mjs +++ b/src/data/cctvExplicitPickEndsOpening.test.mjs @@ -95,7 +95,6 @@ function withReopenedLayer(fn) { moveViewer(viewer, 51.5131, -0.1291); assert.equal(reopenNearestCamera(), true); assert.equal(cctvLayer.getUIState().activeCameraId, 'b-cambridge'); - assert.equal(cctvLayer.getUIState().activeCameraProvisional, true); fn(viewer); } finally { globalThis.document = originalDocument; @@ -121,7 +120,6 @@ for (const [name, pick] of [ withReopenedLayer((viewer) => { pick(); assert.equal(cctvLayer.getUIState().activeCameraId, 'b-cambridge'); - assert.equal(cctvLayer.getUIState().activeCameraProvisional, false); // A later settled move (a pan, or the landing of the pick's own flight) // leaves the explicit choice alone. moveViewer(viewer, 51.5081, -0.1281); @@ -130,3 +128,11 @@ for (const [name, pick] of [ }); }); } + +test('without a pick, the next settled move still follows the view', () => { + withReopenedLayer((viewer) => { + moveViewer(viewer, 51.5081, -0.1281); + assert.equal(reopenNearestCamera(), true); + assert.equal(cctvLayer.getUIState().activeCameraId, 'a-trafalgar'); + }); +}); diff --git a/src/layers/cctv/navigation.js b/src/layers/cctv/navigation.js index 7f99142839..884686128c 100644 --- a/src/layers/cctv/navigation.js +++ b/src/layers/cctv/navigation.js @@ -73,7 +73,7 @@ export function createNavigation({ return false; const nearest = nearestCameraIdToViewer(); if (!nearest || nearest === layerState._activeCameraId) return false; - // Still the opening pick: its notification tells the picker so. + // Still the opening pick: later settled moves may replace it. parts.selection.setActiveCamera(nearest, { opening: true }); return true; } diff --git a/src/layers/cctv/presentation.js b/src/layers/cctv/presentation.js index cc398ea5f1..f23c007334 100644 --- a/src/layers/cctv/presentation.js +++ b/src/layers/cctv/presentation.js @@ -286,10 +286,6 @@ export function createPresentation({ hoverId: layerState._hoverCardId, }, activeCameraId: activeId, - // The camera CCTV opened on, following the view until someone picks one. - activeCameraProvisional: Boolean( - activeId && layerState._openingCameraProvisional, - ), activeCameraReselection: layerState._activeCameraReselection, activeCamera: active ? getPublicCameraState(active, activeId) : null, cameraIndex: cameraIndex(), diff --git a/src/layers/cctv/selection.js b/src/layers/cctv/selection.js index 7e147834a3..708bd3dedd 100644 --- a/src/layers/cctv/selection.js +++ b/src/layers/cctv/selection.js @@ -73,17 +73,14 @@ export function createSelection({ record, ) ) { - // Picking the camera a settled move re-opened is still a choice: later - // settled moves must leave it alone, and the picker learns it. - const endsOpening = layerState._openingCameraProvisional && !opening; - if (endsOpening) layerState._openingCameraProvisional = false; + // Picking the camera a settled move re-opened is still a pick: later + // settled moves must leave it alone. + if (!opening) layerState._openingCameraProvisional = false; // Browser-only feeds have a separate player; a reselect retries it // without re-running activation or touching the projection geometry. if (parts.model.isBrowserOverlayCamera(record.camera)) { layerState._activeCameraReselection += 1; parts.presentation.notifyListeners(); - } else if (endsOpening) { - parts.presentation.notifyListeners(); } return CCTV_ACTIVATION_RESULT.UNCHANGED; } diff --git a/src/layers/cctv/selection.test.mjs b/src/layers/cctv/selection.test.mjs index 96be823b0a..102b02cee0 100644 --- a/src/layers/cctv/selection.test.mjs +++ b/src/layers/cctv/selection.test.mjs @@ -53,7 +53,7 @@ test('same-camera selection notifies browser-overlay feeds so playback can retry assert.equal(fixture.notifications(), 1); }); -test('same-camera selection ends the opening pick and tells the panel once', () => { +test('same-camera selection ends the opening pick without notifying snapshot feeds', () => { const fixture = makeSelection('tripcheck-odot'); fixture.state._openingCameraProvisional = true; @@ -63,5 +63,5 @@ test('same-camera selection ends the opening pick and tells the panel once', () ); assert.equal(fixture.state._openingCameraProvisional, false); assert.equal(fixture.state._activeCameraReselection, 0); - assert.equal(fixture.notifications(), 1); + assert.equal(fixture.notifications(), 0); }); diff --git a/src/layers/cctv/testing.js b/src/layers/cctv/testing.js index 3a024f7767..c3d2f6a9f2 100644 --- a/src/layers/cctv/testing.js +++ b/src/layers/cctv/testing.js @@ -105,6 +105,7 @@ export function createTesting({ state: layerState, services, parts, source }) { } = {}) { layerState._viewer = viewer; layerState._records = Array.isArray(records) ? records : []; + layerState._count = layerState._records.length; layerState._recordById = new Map( layerState._records .filter((record) => record?.camera?.id) diff --git a/src/ui/cctv/CctvPicker.vue b/src/ui/cctv/CctvPicker.vue index efe611e50b..a4b1a077cb 100644 --- a/src/ui/cctv/CctvPicker.vue +++ b/src/ui/cctv/CctvPicker.vue @@ -5,9 +5,7 @@ import { useCctvStore } from '../stores/cctv.js'; // The camera picker: the cameras in view and a closing note for those the // view leaves out. It renders only when CctvControls publishes a picker, -// which re-applies the active camera, as on every layer notification. The -// opening camera, which follows the view until someone picks one, shows in a -// hidden first option: choosing that camera from the list is a change. +// which re-applies the active camera, as on every layer notification. const { picker } = storeToRefs(useCctvStore()); // The selection, applied once the options are in place. @@ -23,13 +21,6 @@ const vPick = { mounted: pick, updated: pick };