mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 10:24:02 +00:00
Google Street View registers beside Mapillary as provider `google`. It runs on the Maps JavaScript API with the browser GOOGLE_MAPS_API_KEY, loaded on first use (mapsLoader.js), and uses Google's own StreetViewPanorama as its viewer adapter, emitting provider-neutral poses (address and month in the caption, a link to Google Maps, steps along Google's arrows, FOLLOW on Google 3D). Its chip starts off because every panorama is billed to the key; the share option is `g`. Google offers no coverage layer for other maps, so the provider draws none: with it on, a click on bare ground at street zoom opens its nearest Google-collected outdoor panorama (groundClick.js). A key Google refuses reads KEY REJECTED and fails a pending open at once; a lookup Google never answers fails after 10 s. Core: providers may declare `groundClick` and `defaultOn`; poses may carry `capturedAtPrecision` and `title`; the coverage line keeps every provider's hint; opening one provider's image releases another's prewarmed viewer; FIT/FILL hides for viewers without render modes. CSP script-src admits https://maps.googleapis.com. The browser gate gains two Street View steps (the keyed one skips as 'no Google key' in CI). Co-Authored-By: Claude Opus 5.5 <[email protected]>
66 lines
1.8 KiB
JavaScript
66 lines
1.8 KiB
JavaScript
import { FILTER_DEFAULT } from './policy.js';
|
|
|
|
/**
|
|
* The per-image fields of `state.street` with no image open; closing resets
|
|
* exactly these (host, render mode and follow availability outlive an image).
|
|
*/
|
|
export function freshStreet() {
|
|
return {
|
|
open: false,
|
|
follow: false,
|
|
providerId: null,
|
|
providerName: null,
|
|
providerLabel: null,
|
|
imageId: null,
|
|
position: null,
|
|
bearing: null,
|
|
tilt: null,
|
|
altitude: null,
|
|
isPano: false,
|
|
capturedAt: null,
|
|
/** 'day', or 'month' for providers that date images by month (Google). */
|
|
capturedAtPrecision: 'day',
|
|
/** A place name for the caption (Google's address), or null. */
|
|
title: null,
|
|
/** Whether the open viewer has FIT/FILL render modes. */
|
|
renderModes: true,
|
|
sequenceId: null,
|
|
creator: null,
|
|
externalUrl: null,
|
|
loading: false,
|
|
error: null,
|
|
};
|
|
}
|
|
|
|
/** Mutable core state, created once per layer instance. */
|
|
export function createState({ services }) {
|
|
return {
|
|
services,
|
|
viewer: null,
|
|
enabled: false,
|
|
initialized: false,
|
|
destroyed: false,
|
|
listeners: new Set(),
|
|
notify: null,
|
|
/** Shared imagery filter, in the stored (relative-days) form. */
|
|
filter: { ...FILTER_DEFAULT },
|
|
/** @type {Map<string, {def: object, instance: object, on: boolean}>} */
|
|
providers: new Map(),
|
|
|
|
street: {
|
|
host: null,
|
|
/** Whether the active map stack allows following (Google 3D only). */
|
|
followAvailable: false,
|
|
/** 'letterbox' shows the whole image; 'fill' crops it to the frame. */
|
|
renderMode: 'letterbox',
|
|
...freshStreet(),
|
|
},
|
|
|
|
/** 'terrain' on Google 3D at street zoom (overlays on the bare earth), else 'draped'. */
|
|
surface: 'draped',
|
|
|
|
marker: { collection: null, billboard: null },
|
|
clickHandler: null,
|
|
};
|
|
}
|