fix(street-level): review fixes for show_street_level and sl= links

P1: on a phone the Street Level panel sits in the Cameras tab sheet, so the
action and sl= links opened photos nobody could see and still reported
success. A photo that opens, and a link that arms, now open that sheet
(revealPanel). In cockpit, clean view, recording or scene playback the action
stops at a new `view` stage before anything switches or loads.

P2s:
- Mapillary's nearest search asks for 100 photos, the API's most. It cuts
  the radius's photos at the limit in no particular order, so 8 left the
  distance sort and the imagery filter a few arbitrary photos.
- The MCP globe panel opens a billed photo only for a result issued in the
  last five minutes (show_in_gods_eye_view stamps issued_at); a host that
  mounts the panel again hands back the old result, which only arms.
- OPEN uses an armed link's point only while the view centre is within 1 km
  of it; a user who moved on opens what the view shows.
- show_in_gods_eye_view measures a camera's altitude from the terrain under
  it before taking its look-at point, so high cities no longer put the
  photos kilometres too far ahead.
- The armed-link toast is translated, and the new view-stage message too,
  in all 11 catalogs.
- Tests: a turn superseded during the geocode, flight or map switch changes
  nothing; an unknown key state lets a cold sl= link through; a wide tilted
  area still opens photos at its centre.
This commit is contained in:
Said Turksever committed 2026-11-03 15:30:48 +00:00
1 parent 8ce01cf48e
commit 0ec57057fa
30 files changed
+473 -65

No files matched your search

+13 -1
View File
@@ -4,7 +4,7 @@ import { ShellFacade } from './shellFacade.js';
import { AircraftDisplay } from './aircraftDisplay.js';
import { LayerBindings } from './layerBindings.js';
import { PanelChrome } from './panelChrome.js';
import { initMobileShell } from './mobileShell.js';
import { initMobileShell, sheetForPanelId } from './mobileShell.js';
import { VisualSettings } from './visualSettings.js';
import { NavigationController } from './navigationController.js';
import { ShareRestoration } from './shareRestoration.js';
@@ -1098,6 +1098,7 @@ export class StyleManager extends ShellFacade {
this._dataManager?.setLayerParams('street-level', params, options),
setPanelCollapsed: (collapsed, options) =>
this.setPanelCollapsed('street-level-panel', collapsed, options),
revealPanel: () => this.revealPanel('street-level-panel'),
showToast: (message) => this._showToast(message),
// Lets the panel open for a user, voice or tool switch-on, not a restore.
subscribeEnableRequests: (listener) =>
@@ -1212,6 +1213,17 @@ export class StyleManager extends ShellFacade {
return this._panelChrome.setPanelCollapsed(...arguments);
}
/**
* Bring a panel into view on a phone, where the rails show only as tab
* sheets: opens the sheet that holds it. Does nothing above 720px.
* @param {string} panelId - DOM id of the panel.
* @returns {void}
*/
revealPanel(panelId) {
const sheet = sheetForPanelId(panelId);
if (sheet) this._mobileShell?.setSheet(sheet);
}
/**
* Toggles "clean view" mode which hides all UI panels via a CSS body class.
* @param {boolean} [forceEnabled] - Explicit on/off. Omit to toggle.
+6 -1
View File
@@ -388,7 +388,12 @@ export class StreetLevelControls {
// Other size changes reach the viewer through the ResizeObserver; opening
// asks for one resize because the element may not have a size yet.
const open = view.viewer.open;
if (open && !this._wasOpen) this.setCollapsed(false, { persist: false });
if (open && !this._wasOpen) {
this.setCollapsed(false, { persist: false });
// A phone shows the rail only as a tab sheet: open it, or the photo
// loads where nobody sees it. Embed mode lifts the photo instead.
if (!isEmbedPage()) this.actions.revealPanel?.();
}
this._wasOpen = open;
// Embed mode hides the rail the panel sits in: an open photo is shown over
// the globe instead, and goes back into the panel when it closes.
+17
View File
@@ -967,6 +967,23 @@ test('outside embed mode a photo stays in the panel', () =>
controls.destroy();
}));
test('an opening photo brings its panel into view (a phone’s tab sheet); embed mode lifts it instead', () =>
withDom(async (dom) => {
const revealed = [];
const { layer, controls } = await stubPanel(dom, uiState({ open: false }), {
revealPanel: () => revealed.push('street-level'),
});
await layer.publish(uiState({ open: true }));
assert.deepEqual(revealed, ['street-level'], 'once, as it opens');
await layer.publish(uiState({ open: true, renderMode: 'fill' }));
assert.equal(revealed.length, 1, 'not on every update');
await layer.publish(uiState({ open: false }));
dom.document.body.classList.add('ui-embed');
await layer.publish(uiState({ open: true }));
assert.equal(revealed.length, 1, 'embed mode shows it over the globe');
controls.destroy();
}));
test('in embed mode Esc closes the photo, and the next photo is shown over the globe again', () =>
withDom(async (dom) => {
dom.document.body.classList.add('ui-embed');