mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 01:02:23 +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
@@ -63,10 +63,7 @@ export function createCycloneRendering({ viewer, overlayHost }) {
|
||||
let centers = new Map(),
|
||||
forecasts = [],
|
||||
spheres = new Map(),
|
||||
itemStorms = new Map(),
|
||||
// Per drawn item, where a double-click follows it (a point) or what it
|
||||
// zooms to (a track, cone or outline).
|
||||
itemPlaces = new Map();
|
||||
itemStorms = new Map();
|
||||
let counts = { storms: 0, tracks: 0, cones: 0, forecastPoints: 0 };
|
||||
let itemCount = 0;
|
||||
|
||||
@@ -102,8 +99,7 @@ export function createCycloneRendering({ viewer, overlayHost }) {
|
||||
if (destroyed) return false;
|
||||
const nextCenters = new Map(),
|
||||
nextSpheres = new Map(),
|
||||
nextItemStorms = new Map(),
|
||||
nextItemPlaces = new Map();
|
||||
nextItemStorms = new Map();
|
||||
const nextForecasts = [],
|
||||
nextLines = [],
|
||||
nextCones = [],
|
||||
@@ -126,7 +122,6 @@ export function createCycloneRendering({ viewer, overlayHost }) {
|
||||
const center = ecef(at);
|
||||
const extent = [center];
|
||||
own(`cyclone:${storm.id}:center`);
|
||||
nextItemPlaces.set(`cyclone:${storm.id}:center`, { at: center });
|
||||
nextCenters.set(storm.id, { id: storm.id, at });
|
||||
const label = {
|
||||
id: storm.id,
|
||||
@@ -147,9 +142,6 @@ export function createCycloneRendering({ viewer, overlayHost }) {
|
||||
// Lines take ECEF (draw.d.ts `LineItem`).
|
||||
const positions = line.map((c) => ecef(pair(c)));
|
||||
extent.push(...positions);
|
||||
nextItemPlaces.set(`cyclone:${storm.id}:track:${index}`, {
|
||||
extent: positions,
|
||||
});
|
||||
nextLines.push({
|
||||
id: own(`cyclone:${storm.id}:track:${index}`),
|
||||
positions,
|
||||
@@ -169,9 +161,6 @@ export function createCycloneRendering({ viewer, overlayHost }) {
|
||||
const all = rings.map((ring) => ring.map(pair));
|
||||
const ecefRings = all.map((ring) => ring.map(ecef));
|
||||
extent.push(...ecefRings[0]);
|
||||
nextItemPlaces.set(`cyclone:${storm.id}:cone:${index}`, {
|
||||
extent: ecefRings[0],
|
||||
});
|
||||
nextCones.push({
|
||||
id: own(`cyclone:${storm.id}:cone:${index}`),
|
||||
geometry: { kind: 'polygon', rings: all },
|
||||
@@ -179,10 +168,6 @@ export function createCycloneRendering({ viewer, overlayHost }) {
|
||||
height: 'clampGround',
|
||||
});
|
||||
ecefRings.forEach((ring, ringIndex) => {
|
||||
nextItemPlaces.set(
|
||||
`cyclone:${storm.id}:cone:${index}:outline:${ringIndex}`,
|
||||
{ extent: ring },
|
||||
);
|
||||
nextLines.push({
|
||||
id: own(
|
||||
`cyclone:${storm.id}:cone:${index}:outline:${ringIndex}`,
|
||||
@@ -203,9 +188,6 @@ export function createCycloneRendering({ viewer, overlayHost }) {
|
||||
const pos = lonLat(point.position);
|
||||
const p = ecef(pos);
|
||||
extent.push(p);
|
||||
nextItemPlaces.set(`cyclone:${storm.id}:forecast:${index}`, {
|
||||
at: p,
|
||||
});
|
||||
nextForecasts.push({
|
||||
id: own(`cyclone:${storm.id}:forecast:${index}`),
|
||||
pos,
|
||||
@@ -230,7 +212,6 @@ export function createCycloneRendering({ viewer, overlayHost }) {
|
||||
forecasts = nextForecasts;
|
||||
spheres = nextSpheres;
|
||||
itemStorms = nextItemStorms;
|
||||
itemPlaces = nextItemPlaces;
|
||||
counts = nextCounts;
|
||||
itemCount = nextItemStorms.size;
|
||||
committed = true;
|
||||
@@ -254,28 +235,6 @@ export function createCycloneRendering({ viewer, overlayHost }) {
|
||||
if (!setIds.has(hit.set)) return null;
|
||||
return itemStorms.get(hit.id) ?? null;
|
||||
},
|
||||
/**
|
||||
* What a double-click on a hit follows or zooms to (`followOnDoubleClick`
|
||||
* in `data/stockFollow.js`), as the default renderer did for the
|
||||
* advisory's entities: a center or forecast point is followed, a track,
|
||||
* cone or outline zoomed to.
|
||||
*/
|
||||
followTargetFor(hit) {
|
||||
if (!committed || !hit || hit.surface || !setIds.has(hit.set))
|
||||
return null;
|
||||
const place = itemPlaces.get(hit.id);
|
||||
if (!place) return null;
|
||||
if (place.extent) return { zoomTo: sphereFromPoints(place.extent) };
|
||||
const at = place.at;
|
||||
return { key: `${hit.set}:${hit.id}`, position: () => ({ ...at }) };
|
||||
},
|
||||
/** Whether the item a follow's key (`<set>:<item>`) names is drawn now. */
|
||||
drawsFollowKey(key) {
|
||||
for (const set of setIds)
|
||||
if (key.startsWith(`${set}:`))
|
||||
return committed && itemPlaces.has(key.slice(set.length + 1));
|
||||
return false;
|
||||
},
|
||||
getFocusSphere(id) {
|
||||
return spheres.get(id) || null;
|
||||
},
|
||||
@@ -291,7 +250,6 @@ export function createCycloneRendering({ viewer, overlayHost }) {
|
||||
forecasts = [];
|
||||
spheres = new Map();
|
||||
itemStorms = new Map();
|
||||
itemPlaces = new Map();
|
||||
itemCount = 0;
|
||||
selected = null;
|
||||
counts = { storms: 0, tracks: 0, cones: 0, forecastPoints: 0 };
|
||||
|
||||
Reference in new issue
Block a user