mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 17:52:21 +00:00
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:
1 parent
bb2d22dbce
commit
b86014244d
69 files changed
+94
-2797
No files matched your search
@@ -133,57 +133,3 @@ test('a renderer without meshes or quads still draws the lines', () => {
|
||||
unbind();
|
||||
}
|
||||
});
|
||||
|
||||
test('a double-click zooms to a coverage line and follows the plane, as their entities were', () => {
|
||||
const viewer = {};
|
||||
const { unbind } = bindFakeDraw(viewer);
|
||||
const retained = [];
|
||||
const state = {
|
||||
_viewer: viewer,
|
||||
_stockFollow: { retain: (drawn) => retained.push(drawn), stop() {} },
|
||||
};
|
||||
const drawSets = createDrawSets({ state });
|
||||
try {
|
||||
const a = line('cctv-cam-ray-tl');
|
||||
drawSets.writeLines([a]);
|
||||
const plane = {
|
||||
id: 'cctv-cam-plane',
|
||||
cameraId: 'cam',
|
||||
center: { x: 10, y: 0, z: 0 },
|
||||
orientation: { x: 0, y: 0, z: 0, w: 1 },
|
||||
size: [6, 8],
|
||||
show: true,
|
||||
};
|
||||
drawSets.writePlane(plane);
|
||||
const [coverage, planes] = drawSets.pickableSetIds();
|
||||
|
||||
const zoom = drawSets.followTargetFor({ set: coverage, id: a.id });
|
||||
assert.deepEqual(zoom.zoomTo.center, { x: 2.5, y: 3.5, z: 4.5 });
|
||||
|
||||
const follow = drawSets.followTargetFor({ set: planes, id: plane.id });
|
||||
assert.equal(follow.key, `${planes}:${plane.id}`);
|
||||
assert.deepEqual(follow.position(), { x: 10, y: 0, z: 0 });
|
||||
assert.equal(follow.sphere.radius, 5, 'framed to fit the plane');
|
||||
plane.center = { x: 20, y: 0, z: 0 };
|
||||
drawSets.writePlane(plane);
|
||||
assert.deepEqual(follow.position(), { x: 20, y: 0, z: 0 }, 'as drawn now');
|
||||
|
||||
assert.equal(drawSets.followTargetFor({ set: 'other', id: a.id }), null);
|
||||
a.show = false;
|
||||
drawSets.writeLines([a]);
|
||||
assert.equal(
|
||||
drawSets.followTargetFor({ set: coverage, id: a.id }),
|
||||
null,
|
||||
'a hidden line takes no part',
|
||||
);
|
||||
|
||||
// Taking the plane out ends a follow of it, and only of it.
|
||||
drawSets.removePlane(plane);
|
||||
assert.equal(retained.length, 1);
|
||||
assert.equal(retained[0](follow.key), false);
|
||||
assert.equal(retained[0]('other:key'), true);
|
||||
} finally {
|
||||
drawSets.dispose();
|
||||
unbind();
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user