fix(input): no double-click follow or zoom on the map

The globe viewer's own double-click tracked a picked entity with a
position or zoomed to one without. Layers moving onto the draw port had it
re-created one by one (data/stockFollow.js); following is a click in GEV,
so the viewer's handler is removed where the viewer is made and every
re-creation goes: earthquakes, cyclones, air quality, news, perimeters,
drone airspace, ghost maps, places, radio, cables, CCTV, ALPR, launches,
bikeshare, Local ADS-B, installations, directions, trails, data packs,
annotations, the library's view and local GeoJSON. The Cockpit's own
double-click and the draw tool's finishing double-click stay.
This commit is contained in:
Sameh Khamis committed 2026-11-14 09:10:14 -08:00
1 parent bb2d22dbce
commit b86014244d
69 files changed
+94 -2797

No files matched your search

-52
View File
@@ -168,55 +168,3 @@ test('a viewer with nothing to draw with is refused at init, and init can be ret
layer.destroy();
unbind();
});
test('a double-click follows a disc, framed to fit it, as its entity was', async (t) => {
const { bindRenderer } = await import('../../render/rendererOf.js');
const { createStubRenderer } = await import('../../render/stub/index.js');
const { resetPointerOwnership } = await import('../../input/dispatcher.js');
resetPointerOwnership?.();
const renderer = createStubRenderer();
const viewer = { isDestroyed: () => false };
const unbind = bindRenderer(viewer, renderer);
const layer = createEarthquakesLayer({
source: { getSnapshot: async () => rows },
overlayHost: { setEntries() {}, setVisible() {}, clearSource() {} },
});
let rows = [row];
t.after(() => {
layer.destroy(viewer);
unbind();
renderer.destroy();
resetPointerOwnership?.();
});
layer.init(viewer);
layer.enable(viewer);
await layer.update(viewer);
const set = renderer.testing
.sets()
.find((id) => id.startsWith('earthquakes:'));
renderer.testing.scriptPicks(() => [
{ set, id: 'earthquake:event-a', surface: false },
]);
renderer.testing.pointer('dblclick', 10, 10);
const followed = renderer.camera.followed;
assert.ok(followed, 'the disc is followed');
assert.equal(followed.key, `${set}:earthquake:event-a`);
const p = followed.position(0);
const lon = (Math.atan2(p.y, p.x) * 180) / Math.PI;
assert.ok(Math.abs(lon - row.lon) < 1e-9, String(lon));
await layer.update(viewer);
assert.ok(renderer.camera.followed, 'still reported: still followed');
rows = [{ ...row, stableId: 'event-b', usgsId: 'event-b' }];
await layer.update(viewer);
assert.equal(
renderer.camera.followed,
null,
'gone from the feed: not followed',
);
rows = [row];
await layer.update(viewer);
renderer.testing.pointer('dblclick', 10, 10);
assert.ok(renderer.camera.followed);
layer.disable(viewer);
assert.equal(renderer.camera.followed, null, 'hiding the layer stops it');
});