Street Level: leave an interrupted link and an overtaken view alone (gekh review)

- A pasted or start-up link opens its photos only when its restore's camera
  landed: a drag or search during the restore flight keeps the camera.
- A posted view whose photo step was cancelled or superseded no longer closes
  the viewer or flies; one that found a photo it could not load keeps the error.
- openNearest gains `replace` (keep the open photo while it looks, close it
  only when nothing opens, so EXPAND stays) and `proceed()` (asked before a
  found photo loads); the action uses both, so a navigation, a gesture or a
  hiding mode during the lookup loads no billed panorama.
- Mapillary's timeout message is a msg() string with all eleven translations.
This commit is contained in:
Said Turksever committed 2026-11-10 15:12:50 +00:00
1 parent 5370b8a268
commit 9c73939425
22 files changed
+329 -17

No files matched your search

+10 -6
View File
@@ -4084,14 +4084,12 @@ async function requestStreetLevel(
location,
});
// A photo of another place must not stay up beside this request's answer,
// armed or opened, found or not: the panel shows this request's outcome.
if (layerModule.getUIState?.()?.street?.open === true)
layerModule.closeViewer?.();
// A billed source never loads from a link without a click: everything is
// ready and OPEN is one press away at the view centre.
if (args.autoOpen === false && status?.billed === true) {
// A photo of another place must not stay up beside the armed request.
if (layerModule.getUIState?.()?.street?.open === true)
layerModule.closeViewer?.();
// The next OPEN press loads exactly what the link asked for.
layerModule.armNearest?.(point, {
providerIds: [provider],
@@ -4113,11 +4111,17 @@ async function requestStreetLevel(
// A source with no coverage to click (Street View) is searched wider: a
// geocoded landmark is rarely within 50 m of a street. A newer turn
// retires the lookup: nothing opens after the user moved on.
// retires the lookup: nothing opens after the user moved on. A photo of
// another place stays up while it looks (the viewer, EXPAND included, is
// replaced, not closed) and closes if this request opens nothing: the
// panel shows this request's outcome. Once an image is found it loads
// only if the camera and the panel are still the request's.
reportProgress('imagery', label);
const opened = await layerModule.openNearest(point, {
providerIds: [provider],
frame: false,
replace: true,
proceed: () => current() && !owner.taken() && !streetLevelPanelHidden(),
// Under the screen centre, not the middle of a tilted view's footprint;
// this request is the user's own, not a link's armed one.
...(point ? {} : { aim: 'screen-centre', armed: false }),
+44
View File
@@ -6660,16 +6660,26 @@ function createStreetLevelHarness({
return false;
}
}
// Like the layer: a replacing lookup that opens nothing closes the photo.
const closeReplaced = () => {
if (!options.replace || !street.open) return;
order.push('close');
Object.assign(street, { open: false, imageId: null, error: null, nearestOutcome: null });
};
if (imageryError) {
closeReplaced();
street.error = imageryError;
street.nearestOutcome = null;
return false;
}
if (!nearest) {
closeReplaced();
street.nearestOutcome = options.aim === 'screen-centre' && sky ? 'sky' : 'empty';
street.error = `No street-level imagery within ${options.radiusM ?? 50} m of ${point ? 'that point' : 'the view centre'}`;
return false;
}
// Found: it loads only if the request still wants it.
if (options.proceed && options.proceed() !== true) return false;
street.open = true;
street.imageId = nearest;
street.title = '10th St, Sacramento';
@@ -7426,6 +7436,40 @@ test('show_street_level stops once the camera is someone else’s: a navigation
assert.ok(!h.order.some((step) => step.startsWith('open:')));
});
test('show_street_level loads no photo it found once the camera or the panel moved on during the lookup', async () => {
globalThis.window = globalThis.window || { clearTimeout, setTimeout, requestIdleCallback: null };
for (const take of ['navigate', 'gesture']) {
let h;
h = createStreetLevelHarness({ enabled: true, activeStack: 'photoreal', duringLookup: () => h[take]() });
const result = await h.runner('show_street_level', { latitude: 38.58, longitude: -121.49, provider: 'google', fly: false });
assert.deepEqual([result.ok, result.stage, result.superseded], [false, 'imagery', true], take);
assert.equal(h.lookups.length, 1);
assert.equal(h.street.open, false, `${take}: the billed panorama never loads`);
assert.ok(!h.order.includes('close'), `${take}: nothing opened, nothing to close`);
}
const saved = globalThis.document;
const classes = new Set();
globalThis.document = { body: { classList: { contains: (name) => classes.has(name) } } };
try {
const h = createStreetLevelHarness({ enabled: true, activeStack: 'photoreal', duringLookup: () => classes.add('ui-clean-view') });
const result = await h.runner('show_street_level', { latitude: 38.58, longitude: -121.49, provider: 'google', fly: false });
assert.deepEqual([result.ok, result.stage], [false, 'view']);
assert.equal(h.street.open, false, 'nothing loads into the hidden panel');
} finally {
globalThis.document = saved;
}
});
test('show_street_level replaces an open photo in place: the viewer (and EXPAND) stays up while it looks', async () => {
globalThis.window = globalThis.window || { clearTimeout, setTimeout, requestIdleCallback: null };
const h = createStreetLevelHarness({ enabled: true, photoOpen: true, nearest: 'pano-b' });
const result = await h.runner('show_street_level', { latitude: 38.58, longitude: -121.49, provider: 'mapillary', fly: false });
assert.equal(result.ok, true);
assert.equal(h.lookups[0].replace, true, 'the lookup takes over the open photo');
assert.ok(!h.order.includes('close'), 'never closed on the way');
assert.deepEqual([h.street.open, h.street.imageId], [true, 'pano-b']);
});
test('show_street_level owns the camera from where its own flight lands', async () => {
globalThis.window = globalThis.window || { clearTimeout, setTimeout, requestIdleCallback: null };
const h = createStreetLevelHarness();