mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 09:12:18 +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
@@ -18,8 +18,6 @@
|
||||
|
||||
import { roadLabel } from '../../data/routeSteps.js';
|
||||
import { fromDegrees, toLonLatH } from '../../geo/ellipsoid.js';
|
||||
import { sphereFromPoints } from '../../geo/sphere.js';
|
||||
import { followOnDoubleClick } from '../../data/stockFollow.js';
|
||||
import { hexColor } from '../../render/color.js';
|
||||
import { drawOf } from '../../render/rendererOf.js';
|
||||
import {
|
||||
@@ -1639,31 +1637,6 @@ export function createDirectionsLayer({ services, source }) {
|
||||
}
|
||||
}
|
||||
|
||||
/** What a double-click on a marker or the route follows or zooms to. */
|
||||
function followTargetFor(hit) {
|
||||
if (!_sets) return null;
|
||||
if (hit.set === _sets.markers.id) {
|
||||
const point =
|
||||
hit.id === 'directions:marker:A'
|
||||
? _a
|
||||
: hit.id === 'directions:marker:B'
|
||||
? _b
|
||||
: null;
|
||||
if (!point) return null;
|
||||
return {
|
||||
key: hit.id,
|
||||
position: () => fromDegrees(point.lon, point.lat, 0),
|
||||
};
|
||||
}
|
||||
if (hit.set === _sets.route.id && _route?.geometry?.length)
|
||||
return {
|
||||
zoomTo: sphereFromPoints(
|
||||
_route.geometry.map(([lon, lat]) => fromDegrees(lon, lat, 0)),
|
||||
),
|
||||
};
|
||||
return null;
|
||||
}
|
||||
|
||||
function _installClickHandler(viewer) {
|
||||
if (_clickSubscription) return;
|
||||
const input = inputFor(viewer);
|
||||
@@ -1697,25 +1670,9 @@ export function createDirectionsLayer({ services, source }) {
|
||||
}
|
||||
if (_selectedStep !== null) _clearStepSelection();
|
||||
});
|
||||
// A double-click follows an A or B marker and zooms to the route, as the
|
||||
// default renderer's double-click did with their entities.
|
||||
let follow = null;
|
||||
try {
|
||||
follow = followOnDoubleClick({
|
||||
viewer,
|
||||
inputFor: () => input,
|
||||
name: 'directions',
|
||||
enabled: () => _enabled,
|
||||
targetFor: followTargetFor,
|
||||
});
|
||||
} catch {
|
||||
// A renderer that takes no input has no double-click to follow on.
|
||||
follow = null;
|
||||
}
|
||||
_clickSubscription = () => {
|
||||
offPlace();
|
||||
offSelect();
|
||||
follow?.destroy();
|
||||
};
|
||||
if (typeof document !== 'undefined')
|
||||
document.addEventListener('keydown', _onKeyDown);
|
||||
|
||||
Reference in new issue
Block a user