mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 01:02:23 +00:00
The layer now owns its Mapillary parts directly: the provider registry,
pick router, multi-provider UI summary, params codec helper and provider
context are gone. createStreetLevelLayer({ source }) builds coverage,
sequences, the nearest-image lookup and the MapillaryJS viewer itself; a
single providerOn switch keeps the share link's `mapillary` option (off
draws nothing), and getParams/setParams keep { mapillary, pano, sinceDays }.
No z0-5 overview points: above 60 km nothing is drawn and the panel says to
zoom in; the proxy now serves only coverage z11-14. Tiles come from the
visible ground within range of the camera, ranked from the ground under it
(no line-of-sight ranking or near-range padding). MapillaryJS loads on the
first photo; viewer prewarm is removed. Key status, a rejected key and a
rate limit share one `blocked` state on coverage.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
22 lines
810 B
JavaScript
22 lines
810 B
JavaScript
/**
|
|
* Route picked ids to the provider whose prefix they carry; the registry
|
|
* guarantees prefixes never overlap.
|
|
* @param {() => Iterable<{def: {id: string, pickPrefix: string}, instance: object}>} getProviders
|
|
* @param {{positionId?: string}} [options] Id of the core-owned position marker.
|
|
*/
|
|
export function createPickRouter(getProviders, { positionId = null } = {}) {
|
|
function resolve(id) {
|
|
if (typeof id !== 'string' || !id) return null;
|
|
if (positionId && id === positionId)
|
|
return { providerId: null, instance: null, id };
|
|
for (const entry of getProviders())
|
|
if (id.startsWith(entry.def.pickPrefix))
|
|
return { providerId: entry.def.id, instance: entry.instance, id };
|
|
return null;
|
|
}
|
|
return {
|
|
ownsPick: (id) => resolve(id) !== null,
|
|
resolve,
|
|
};
|
|
}
|