mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 01:32:19 +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
@@ -1,6 +1,5 @@
|
||||
import { t } from '../../i18n/index.js';
|
||||
import { inputFor } from '../../input/dispatcher.js';
|
||||
import { followOnDoubleClick } from '../../data/stockFollow.js';
|
||||
import {
|
||||
BIKESHARE_SELECTED_OVERLAY_SOURCE_ID,
|
||||
BIKESHARE_SELECTED_OVERLAY_SOURCE_OPTIONS,
|
||||
@@ -102,8 +101,6 @@ export function createSelection({
|
||||
if (record?.position)
|
||||
layerState._stationSet?.upsert([parts.rendering.stationItem(record)]);
|
||||
if (layerState._selectedSet?.size()) layerState._selectedSet.clear();
|
||||
// Removing the highlight entity ended the default renderer's follow of it.
|
||||
layerState._stockFollow?.stop();
|
||||
layerState._overlayHost.clearSource(BIKESHARE_SELECTED_OVERLAY_SOURCE_ID);
|
||||
}
|
||||
|
||||
@@ -145,7 +142,7 @@ export function createSelection({
|
||||
function _installClickHandler(viewer) {
|
||||
if (layerState._clickSubscription) return;
|
||||
|
||||
const clickOff = inputFor(viewer).onClick((event) => {
|
||||
layerState._clickSubscription = inputFor(viewer).onClick((event) => {
|
||||
const hit = event.drawHit;
|
||||
|
||||
if (hit) {
|
||||
@@ -165,26 +162,6 @@ export function createSelection({
|
||||
// Clicked anything else — deselect.
|
||||
if (layerState._selectedKey) _clearSelection();
|
||||
});
|
||||
// A double-click follows the selected station's highlight, as the
|
||||
// default renderer followed the point entity it was (the station dots
|
||||
// were point primitives, which it never followed).
|
||||
layerState._stockFollow = followOnDoubleClick({
|
||||
viewer,
|
||||
inputFor,
|
||||
name: 'bikeshare',
|
||||
enabled: () => layerState._enabled,
|
||||
targetFor: (hit) => {
|
||||
const key = layerState._selectedKey;
|
||||
const position = layerState._stationRenderMap.get(key)?.position;
|
||||
if (hit.set !== layerState._selectedSet?.id || !position) return null;
|
||||
return { key, position: () => ({ ...position }) };
|
||||
},
|
||||
});
|
||||
layerState._clickSubscription = () => {
|
||||
clickOff?.();
|
||||
layerState._stockFollow?.destroy();
|
||||
layerState._stockFollow = null;
|
||||
};
|
||||
|
||||
document.addEventListener('keydown', _onKeyDown);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user