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

-12
View File
@@ -1,5 +1,4 @@
import { inputFor } from '../../input/dispatcher.js';
import { followOnDoubleClick } from '../../data/stockFollow.js';
import {
RADIO_PREFIX,
RADIO_PICK_WINDOW_PX,
@@ -99,15 +98,6 @@ export function createInteraction({
);
}
});
// A double-click follows a station, as the default renderer followed
// its entity.
layerState._stockFollow = followOnDoubleClick({
viewer,
inputFor,
name: 'radio',
enabled: () => radioPresentationAllowed(),
targetFor: (hit) => parts.rendering.followTargetFor(hit),
});
// Polling remains bounded during flights, but a stationary camera no longer
// rewrites every station's visibility four times per second while voice and
// audio processing share the main thread.
@@ -121,8 +111,6 @@ export function createInteraction({
unregisterPickOwner('radio');
layerState._clickSubscription?.();
layerState._clickSubscription = null;
layerState._stockFollow?.destroy();
layerState._stockFollow = null;
if (layerState._horizonTimer) clearInterval(layerState._horizonTimer);
layerState._horizonTimer = null;
}
-33
View File
@@ -529,10 +529,6 @@ export function createRendering({
layerState._selectedId = null;
}
// Every station was drawn anew as an entity: that ended a follow of one.
layerState._stockFollow?.retain(
(key) => !key.startsWith(`${sets?.stations.id}:`),
);
layerState._renderById.clear();
drawnShow.clear();
clusteredIds = new Set();
@@ -575,7 +571,6 @@ export function createRendering({
/** Stop clustering and let the stations' draw sets go. */
function removeDataSource() {
layerState._stockFollow?.stop();
offCameraChanged?.();
offCameraChanged = null;
if (sets) for (const set of Object.values(sets)) set.dispose();
@@ -603,10 +598,6 @@ export function createRendering({
/** Take the selected station's dot and bracket down, if it has them. */
function removeSelectionEntity() {
if (!selection) return;
// The selection's dot was an entity: taking it down ended its follow.
layerState._stockFollow?.retain(
(key) => !key.startsWith(`${sets?.selectedDot.id}:`),
);
selection = null;
sets?.selectedDot.clear();
sets?.selectedBracket.clear();
@@ -622,32 +613,8 @@ export function createRendering({
governorRequestRender('radio-recluster');
}
/**
* What a double-click on a hit follows (`followOnDoubleClick`), as the
* default renderer followed a station's entity or the selected one's: a
* cluster, never an entity, is followed by nothing.
*/
function followTargetFor(hit) {
if (!sets || hit.surface) return null;
let at = null;
let set = hit.set;
if (set === sets.stations.id && hit.id.startsWith(RADIO_PREFIX))
at = layerState._renderById.get(
hit.id.slice(RADIO_PREFIX.length),
)?.position;
else if (
(set === sets.selectedDot.id || set === sets.selectedBracket.id) &&
selection?.dot.id === hit.id
) {
at = selection.position;
set = sets.selectedDot.id;
}
return at ? { key: `${set}:${hit.id}`, position: () => ({ ...at }) } : null;
}
return {
radioStationIdFromPick,
followTargetFor,
installDataSource,
removeDataSource,
setStationsShown,
-23
View File
@@ -139,26 +139,3 @@ test('a filter that hides stations clusters them again at once', async () => {
},
);
});
test('a double-click follows a station, as its entity was', async () => {
const { createStubRenderer } = await import('../../render/stub/index.js');
const renderer = createStubRenderer();
const stations = [station(1, -97.0, 30.0), station(2, -90, 35)];
try {
await withRadioLayer({ stations, renderer }, async () => {
const set = renderer.testing
.sets()
.find((id) => id.endsWith(':stations'));
renderer.testing.scriptPicks(() => [
{ set, id: `radio:${stations[1].id}`, surface: false },
]);
renderer.testing.pointer('dblclick', 10, 10);
const followed = renderer.camera.followed;
assert.ok(followed, 'the station is followed');
const { lon, lat } = toLonLatH(followed.position(0), WGS84);
assert.ok(Math.abs(lon + 90) < 1e-6 && Math.abs(lat - 35) < 1e-6);
});
} finally {
renderer.destroy();
}
});
-2
View File
@@ -119,8 +119,6 @@ export function createState({ services }) {
layerState._playFallbackAttemptId = null;
layerState._clickSubscription = null;
/** The follow a double-click on a station started, while installed. */
layerState._stockFollow = null;
layerState._horizonTimer = null;