fix(street-level): re-check after every await; close the old photo; fresh panel views

Address samehkhamis's review on #1113:

- show_street_level checks the turn, the camera's owner (navigation stamp,
  re-taken where its own flight lands, or a press/wheel on the globe) and
  the hiding modes after the flight, the map switch, the layer switch-on and
  the lookup; a photo that opened after either is closed again. The hidden
  panel is also refused before the flight.
- An open photo closes before a new request arms or looks up, so a place
  with no imagery shows its own error.
- The panel posts every view with `fresh`; the inline app opens a billed
  photo only for a fresh one.
- A passed-through view's street_level point moves with a new camera
  position; revealPanel does nothing above 720px, scrolling included.
- Document that the app's own links do not carry `sl`.
This commit is contained in:
Said Turksever committed 2026-11-06 00:40:20 +00:00
1 parent 14f7326dbf
commit 30e6cd39c7
15 files changed
+486 -57

No files matched your search

+7 -2
View File
@@ -77,12 +77,17 @@ export async function resolveViewArguments(args, { services, signal, tools }) {
: { ...base.camera, ...args.camera };
let label = null;
// Street-level photos open at the area's centre unless a point is given;
// a new area moves a passed-through view's photos with it.
// a new area or camera position moves a passed-through view's photos with
// it.
const moved =
Boolean(args.area) ||
args.camera?.lat !== undefined ||
args.camera?.lon !== undefined;
let streetLevel =
args.street_level && typeof args.street_level === 'object'
? { ...args.street_level }
: base.street_level && typeof base.street_level === 'object'
? args.area
? moved
? { provider: base.street_level.provider }
: { ...base.street_level }
: null;
+16 -1
View File
@@ -158,7 +158,7 @@ test('links can open street-level photos at the area, on the map the source need
);
});
test('a new area moves a passed-through view’s photos, and a tilted area still opens them at its centre', async () => {
test('a new area or camera position moves a passed-through view’s photos, and a tilted area still opens them at its centre', async () => {
const catalog = composeCatalog({
tools: coreTools,
services: { app: { baseUrl: 'http://localhost:4173/' } },
@@ -176,6 +176,21 @@ test('a new area moves a passed-through view’s photos, and a tilted area still
lat: 42.3314,
lon: -83.0458,
});
// A new camera position moves them too; turning the camera keeps them.
const moved = await catalog.call('show_in_gods_eye_view', {
view: first.data.view,
camera: { lat: 40.758, lon: -73.9855, altitude_m: 800, pitch_deg: -90 },
});
assert.deepEqual(moved.data.view.street_level, {
provider: 'google',
lat: 40.758,
lon: -73.9855,
});
const turned = await catalog.call('show_in_gods_eye_view', {
view: first.data.view,
camera: { heading_deg: 90 },
});
assert.deepEqual(turned.data.view.street_level, first.data.view.street_level);
const tilted = await catalog.call('show_in_gods_eye_view', {
area: { lat: 48.8584, lon: 2.2945, radius_km: 1 },
camera: { pitch_deg: -30 },