mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 09:42:21 +00:00
Merge main into fix/earthquake-click-details
Resolves conflicts with main: a world focus target's own range past its framed radius replaces the kind's range (#1832), so a quake asks for its own range only past M6 and the earthquake framing stays its floor; FIRMS keeps main's marker stand-in under the card-on-top rule; launches keep main's label click and also read the card on top through the pick registry.
This commit is contained in:
commit
e87aa5190d
1337 files changed
+38638
-9950
No files matched your search
@@ -5,7 +5,11 @@ import {
|
||||
BIKESHARE_SELECTED_OVERLAY_SOURCE_ID,
|
||||
BIKESHARE_SELECTED_OVERLAY_SOURCE_OPTIONS,
|
||||
SELECTED_POINT_STYLE,
|
||||
COVERAGE_FLY_HEIGHT_M,
|
||||
} from './policy.js';
|
||||
import { GBFS_CITY_REGISTRY } from './registry.js';
|
||||
import { COVERAGE_ID_PREFIX } from './rendering.js';
|
||||
import { cameraOf } from '../../render/rendererOf.js';
|
||||
|
||||
export function createSelection({
|
||||
state: layerState,
|
||||
@@ -140,6 +144,38 @@ export function createSelection({
|
||||
* @param {object} viewer - The viewer the layer draws on.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The covered city a marker id names, or null.
|
||||
* @param {unknown} id
|
||||
*/
|
||||
function coverageCityOf(id) {
|
||||
if (typeof id !== 'string' || !id.startsWith(COVERAGE_ID_PREFIX))
|
||||
return null;
|
||||
const cityId = id.slice(COVERAGE_ID_PREFIX.length);
|
||||
return GBFS_CITY_REGISTRY.find((city) => city.id === cityId) ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Straight down over a covered city, low enough for its stations, as the
|
||||
* shell's camera action when it gave one.
|
||||
* @param {{ centerLat: number, centerLon: number }} city
|
||||
*/
|
||||
function flyIntoCity(city) {
|
||||
const viewer = layerState._viewer;
|
||||
if (!viewer) return;
|
||||
const fly = () =>
|
||||
cameraOf(viewer).flyTo(
|
||||
{
|
||||
lon: city.centerLon,
|
||||
lat: city.centerLat,
|
||||
height: COVERAGE_FLY_HEIGHT_M,
|
||||
},
|
||||
{ orientation: { heading: 0, pitch: -Math.PI / 2, roll: 0 } },
|
||||
);
|
||||
if (layerState._runNavigation) layerState._runNavigation(fly);
|
||||
else fly();
|
||||
}
|
||||
|
||||
function _installClickHandler(viewer) {
|
||||
if (layerState._clickSubscription) return;
|
||||
|
||||
@@ -153,6 +189,15 @@ export function createSelection({
|
||||
// Clicking the selected highlight itself — ignore (don't deselect).
|
||||
if (hit.set === layerState._selectedSet?.id) return;
|
||||
|
||||
// A covered city's marker: fly down into it.
|
||||
if (hit.set === layerState._coverageSet?.id) {
|
||||
const city = coverageCityOf(hit.id);
|
||||
if (city) {
|
||||
flyIntoCity(city);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// A station dot of this layer's own set
|
||||
if (
|
||||
hit.set === layerState._stationSet?.id &&
|
||||
@@ -187,5 +232,6 @@ export function createSelection({
|
||||
_selectStation,
|
||||
_installClickHandler,
|
||||
_onKeyDown,
|
||||
coverageCityOf,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user