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

-10
View File
@@ -1,6 +1,5 @@
import { toRadians } from '../../geo/vector.js';
import { cameraOf } from '../../render/rendererOf.js';
import { followOnDoubleClick } from '../../data/stockFollow.js';
export function createInteraction({ state, parts, inputFor }) {
function beginInteraction(viewer) {
@@ -11,15 +10,6 @@ export function createInteraction({ state, parts, inputFor }) {
if (!record?.reference) return;
flyToReference(viewer, record.reference);
});
// A double-click follows a landing point or reference and zooms to a
// cable, as the default renderer did for their entities.
state._stockFollow = followOnDoubleClick({
viewer,
inputFor,
name: 'submarine-cables',
enabled: () => state._enabled,
targetFor: (hit) => parts.rendering.followTargetFor(hit),
});
}
/**
-2
View File
@@ -109,8 +109,6 @@ export function createLifecycle({ state, parts, source, mapStackEventTarget }) {
state._overlayPublisher.hide();
state._clickSubscription?.();
state._clickSubscription = null;
state._stockFollow?.destroy();
state._stockFollow = null;
if (state._preRenderRemover) {
state._preRenderRemover();
state._preRenderRemover = null;
-32
View File
@@ -4,7 +4,6 @@ import { densifyRhumb } from '../../geo/rhumb.js';
import { distance, toRadians } from '../../geo/vector.js';
import { cssColor } from '../../render/color.js';
import { cameraOf, canvasOf, drawOf } from '../../render/rendererOf.js';
import { drawnItemTarget } from '../../data/stockFollow.js';
import {
clampLabel,
createCableOverlayEntry,
@@ -181,9 +180,6 @@ export function createRendering({ state }) {
state._publishScratch.length = 0;
state._loaded = false;
state._referenceSweepGate.reset();
// The sources' entities went with them, and so did a follow of one.
state._stockFollow?.stop();
state._drawnItems = new Map();
if (!state._sets) return;
if (clearSets) for (const set of Object.values(state._sets)) set.clear();
for (const picks of state._picks.values()) picks.clear();
@@ -399,18 +395,6 @@ export function createRendering({ state }) {
map.clear();
for (const [id, info] of picks) map.set(id, info);
}
// Drawn anew, as new sources' entities were: a follow of one ends.
state._stockFollow?.stop();
state._drawnItems = new Map([
[sets.lines.id, new Map(out.lines.map((item) => [item.id, item]))],
[sets.fills.id, new Map(out.fills.map((item) => [item.id, item]))],
[sets.pins.id, new Map(out.pins.map((item) => [item.id, item]))],
// A reference's stem and point were one entity, placed at the tip.
...[sets.stems.id, sets.references.id].map((id) => [
id,
new Map(out.references.map((record) => [record.id, record.point])),
]),
]);
sets.lines.set(out.lines);
sets.fills.set(out.fills);
sets.pins.set(out.pins);
@@ -418,21 +402,6 @@ export function createRendering({ state }) {
sets.references.set(out.references.map((record) => record.point));
}
/**
* What a double-click on a hit follows or zooms to, as the default
* renderer did for the entity it was: a landing point or a reference is
* followed, a cable or area zoomed to.
*/
function followTargetFor(hit) {
if (!hit || hit.surface || !state._setIds.has(hit.set)) return null;
const item = state._drawnItems?.get(hit.set)?.get(hit.id);
if (!item) return null;
// A reference's stem and point follow as one.
const set =
hit.set === state._sets?.stems.id ? state._sets.references.id : hit.set;
return drawnItemTarget(set, item);
}
/** What a pick on one of the layer's sets names, or null. */
function pickInfo(hit) {
if (!hit || !state._setIds.has(hit.set)) return null;
@@ -533,7 +502,6 @@ export function createRendering({ state }) {
applyCableClassification,
drawFeatures,
pickInfo,
followTargetFor,
updateReferenceVisibility,
};
}
-3
View File
@@ -62,9 +62,6 @@ export function createState({ sweepClock, overlayHost }) {
state._referenceRecords = [];
state._clickSubscription = null;
/** The follow a double-click started, and each set's drawn items by id. */
state._stockFollow = null;
state._drawnItems = new Map();
state._preRenderRemover = null;