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

@@ -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');
});
});