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

-68
View File
@@ -2,8 +2,6 @@ import test from 'node:test';
import assert from 'node:assert/strict';
import * as Cesium from 'cesium';
import { bindFakeDraw } from '../testSupport/fakeDrawPort.mjs';
import { bindRenderer } from '../render/rendererOf.js';
import { createStubRenderer } from '../render/stub/index.js';
import {
DEFAULT_DIRECTIONS_MODE,
DIRECTIONS_MODES,
@@ -1027,69 +1025,3 @@ test('a placed endpoint draws its letter through the overlay, not as entity text
directionsLayer.destroy(viewer);
assert.ok(cleared.includes(DIRECTIONS_MARKER_OVERLAY_SOURCE_ID));
});
test('a double-click follows an A or B marker and zooms to the route, as their entities did', async (t) => {
directionsLayer = createApplicationDirectionsLayer({
source: {
getRoute: async () => ({
ok: true,
distanceM: route.distanceM,
durationS: route.durationS,
geometry: route.geometry,
steps: route.steps,
}),
},
});
directionsLayer._setOverlayHostForTest({
setEntries() {},
setVisible() {},
clearSource() {},
});
resetPointerOwnership();
const renderer = createStubRenderer();
const viewer = { isDestroyed: () => false };
const unbind = bindRenderer(viewer, renderer);
t.after(() => {
directionsLayer.destroy(viewer);
directionsLayer._setOverlayHostForTest(null);
unbind();
renderer.destroy();
resetPointerOwnership();
});
directionsLayer.init(viewer);
directionsLayer.enable(viewer);
directionsLayer.placeEndpoint('a', A);
directionsLayer.placeEndpoint('b', B);
const started = Date.now();
while (
directionsLayer.getStats().status !== 'ready' &&
Date.now() - started < 5000
)
await new Promise((resolve) => setTimeout(resolve, 5));
const setOf = (suffix) =>
renderer.testing.sets().find((id) => id.endsWith(suffix));
let hit = null;
renderer.testing.scriptPicks(() => (hit ? [hit] : []));
const markersId = setOf(':markers');
const routeId = setOf(':route');
assert.ok(markersId && routeId, 'the sets are drawn');
hit = { set: markersId, id: 'directions:marker:B', surface: false };
renderer.testing.pointer('dblclick', 10, 10);
const followed = renderer.camera.followed;
assert.ok(followed, 'B is followed');
assert.equal(followed.key, 'directions:marker:B');
const p = followed.position(0);
const at = Cesium.Cartographic.fromCartesian(
new Cesium.Cartesian3(p.x, p.y, p.z),
);
assert.ok(Math.abs(Cesium.Math.toDegrees(at.latitude) - B.lat) < 1e-9);
hit = { set: routeId, id: 'directions:route', surface: false };
renderer.testing.pointer('dblclick', 10, 10);
assert.equal(renderer.camera.followed, null, 'the route is zoomed to');
renderer.testing.tick();
const pose = renderer.camera.pose();
assert.ok(Math.abs(pose.lat - (A.lat + B.lat) / 2) < 0.2, String(pose.lat));
assert.ok(Math.abs(pose.lon - (A.lon + B.lon) / 2) < 0.2, String(pose.lon));
});