mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 19:04:02 +00:00
feat(street-level): camera follow only on the Google 3D map
FOLLOW puts the globe camera at eye height inside the street-level view; on flat imagery or terrain there is nothing to stand among. The layer now takes the application map stack controller (attachMapStackController), subscribes to stack switches, offers FOLLOW only while the stack is 'photoreal', disables the button with a MAP SOURCE hint elsewhere, and stops following when the stack leaves Google 3D. Selection uninstall is a no-op when never installed. The QA gate checks the disabled path and, when Google 3D is available, that leaving it stops following; its caption-timeout dump now forces one render to tell a missed update from a render fault. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
f7456f2436
commit
c7dc3146f2
14 files changed
+246
-12
No files matched your search
@@ -11,6 +11,7 @@ import { decodeParams, encodeParams } from './params.js';
|
||||
import { composeUIState, summarizeCoverage } from './uiState.js';
|
||||
import { viewCentre } from './view.js';
|
||||
import {
|
||||
FOLLOW_MAP_STACK_ID,
|
||||
NEAREST_RADIUS_M,
|
||||
POSITION_PICK_ID,
|
||||
STREET_LEVEL_LAYER_ID,
|
||||
@@ -99,6 +100,18 @@ export function createStreetLevelLayer({
|
||||
state.providers.set(def.id, entry);
|
||||
}
|
||||
|
||||
let mapStack = null;
|
||||
let unsubscribeMapStack = null;
|
||||
|
||||
/** Follow is offered only on the Google 3D stack; leaving it stops following. */
|
||||
function syncFollowAvailability() {
|
||||
const available = mapStack?.getActiveId?.() === FOLLOW_MAP_STACK_ID;
|
||||
if (available === state.street.followAvailable) return;
|
||||
state.street.followAvailable = available;
|
||||
if (!available && state.street.follow) parts.follow.setFollow(false);
|
||||
notify();
|
||||
}
|
||||
|
||||
const activeEntries = () =>
|
||||
[...state.providers.values()].filter((entry) => entry.on);
|
||||
|
||||
@@ -256,6 +269,9 @@ export function createStreetLevelLayer({
|
||||
for (const entry of state.providers.values())
|
||||
entry.instance.destroy(viewer);
|
||||
parts.marker.destroy(viewer);
|
||||
unsubscribeMapStack?.();
|
||||
unsubscribeMapStack = null;
|
||||
mapStack = null;
|
||||
state.listeners.clear();
|
||||
state.viewer = null;
|
||||
state.initialized = false;
|
||||
@@ -279,6 +295,15 @@ export function createStreetLevelLayer({
|
||||
};
|
||||
},
|
||||
|
||||
/** The application map stack; FOLLOW is available only on Google 3D. */
|
||||
attachMapStackController(controller) {
|
||||
unsubscribeMapStack?.();
|
||||
mapStack = controller || null;
|
||||
unsubscribeMapStack =
|
||||
mapStack?.subscribe?.(() => syncFollowAvailability()) || null;
|
||||
syncFollowAvailability();
|
||||
},
|
||||
|
||||
/** Share-link and stored state: provider switches plus the filter. */
|
||||
getParams() {
|
||||
return encodeParams({
|
||||
|
||||
Reference in new issue
Block a user