Commit the shown CCTV camera with FOCUS, not a hidden picker option

The picker no longer keeps a hidden, disabled copy of the opening camera.
That copy could be re-picked with ArrowDown on a closed list, could show
twice in the iOS picker, and left Firefox without an accessible value.
The list now selects the camera's own option, as before. A native list
sends no change for the option it already shows, so FOCUS (or NEAREST,
when that camera is the nearest) keeps the shown camera. Closing the list
without a choice keeps automatic selection.
This commit is contained in:
German Khokhlov committed 2026-11-20 12:55:52 +04:00
1 parent a6eecee157
commit 09588b98bf
13 files changed
+56 -105

No files matched your search

+1 -1
View File
@@ -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;
}
-4
View File
@@ -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(),
+3 -6
View File
@@ -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;
}
+2 -2
View File
@@ -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);
});
+1
View File
@@ -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)