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

-51
View File
@@ -1,9 +1,5 @@
import { isPointerFree } from '../../data/inputOwnership.js';
import { inputFor as defaultInputFor } from '../../input/dispatcher.js';
import {
drawnItemTarget,
followOnDoubleClick,
} from '../../data/stockFollow.js';
import { fromDegrees } from '../../geo/ellipsoid.js';
import { cssColor } from '../../render/color.js';
import {
@@ -222,15 +218,10 @@ export function createNewsLayer({
if (drawPictureCards !== null && typeof drawPictureCards !== 'function')
throw new TypeError('News picture cards must be a function');
const outlineItems = new Map();
let viewer = null,
// The layer's draw sets (`sets.icons` and the rest), made on init.
sets = null,
clickOff = null,
// The follow a double-click started, and what each set draws now (the
// markers by set, the outlines by id), for it to follow or zoom to.
stockFollow = null,
drawnMarkers = new Map(),
listener = null,
runNavigation = null,
request = null,
@@ -890,19 +881,6 @@ export function createNewsLayer({
horizon.update(cullTargets, { quiet: true });
for (const kind of ['halos', 'points', 'icons', 'boxes'])
sets[kind].set(list[kind]);
// Every marker was drawn anew as an entity: that ended a follow of one.
stockFollow?.retain(
(key) =>
!['halos', 'points', 'icons', 'boxes'].some((kind) =>
key.startsWith(`${sets[kind].id}:`),
),
);
drawnMarkers = new Map(
['halos', 'points', 'icons', 'boxes'].map((kind) => [
sets[kind].id,
new Map(list[kind].map((item) => [item.id, item])),
]),
);
updatePulse();
if (drawPictureCards)
// At every height: zoomed out, a hotspot's reports give way to its
@@ -1048,8 +1026,6 @@ export function createNewsLayer({
for (const [index, area] of disputed.entries())
for (const [k, points] of area.rings.entries())
line(`${pickId}~disputed${index}.${k}`, closed(points), 2, dotted);
for (const item of [...parts.fills, ...parts.borders])
outlineItems.set(item.id, item);
if (parts.fills.length) sets.outlineFills.upsert(parts.fills);
if (parts.borders.length) sets.outlineLines.upsert(parts.borders);
outlineDisputed.set(key, disputed);
@@ -1434,37 +1410,11 @@ export function createNewsLayer({
if (id && isOwnedByOtherLayer(NEWS_LAYER_ID, id)) return;
if (selectedId && !picked?.id) layer.setParams({ clear: true });
});
// A double-click follows a marker and zooms to an outline, as the
// default renderer did for their entities.
stockFollow = followOnDoubleClick({
viewer,
inputFor,
name: NEWS_LAYER_ID,
enabled: () => enabled && !destroyed,
targetFor: followTargetFor,
});
}
function removeSelection() {
clickOff?.();
clickOff = null;
stockFollow?.destroy();
stockFollow = null;
}
/**
* What a double-click on a hit follows or zooms to, as the default
* renderer did for the entity it was: a marker is followed, an outline or
* hotspot box zoomed to; an item not shown takes no part.
*/
function followTargetFor(hit) {
if (!sets || hit.surface) return null;
const item =
drawnMarkers.get(hit.set)?.get(hit.id) ??
(hit.set === sets.outlineFills.id || hit.set === sets.outlineLines.id
? outlineItems.get(hit.id)
: null);
return item && item.show !== false ? drawnItemTarget(hit.set, item) : null;
}
function feedView() {
@@ -1810,7 +1760,6 @@ export function createNewsLayer({
if (sets) for (const set of Object.values(sets)) set.dispose();
sets = null;
outlineParts.clear();
outlineItems.clear();
outlineDisputed.clear();
viewer = null;
listener = null;