Street Level: polar look-at, a bounded terrain wait, takeovers during the flight

- The look-at longitude wraps fully, so a tilted camera at a pole gives a
  point on the globe. The strict off-globe check on street_level is undone:
  points are clamped again, as before.
- A posted view that fails is answered, and the views behind it still apply.
- A posted view waits at most 2 s for the terrain under its camera, then
  keeps its own estimate.
- A camera taken during that wait stays where it is: the rest of the view
  applies, and only its photos stand down.
- show_street_level keeps a search or a press on the globe made during its
  own flight: it adopts only its own navigation stamps on landing, and a
  gesture is never forgiven.
This commit is contained in:
German Khokhlov committed 2026-11-11 18:02:15 +04:00
1 parent ae66d07575
commit 0ebc09079d
8 files changed
+193 -79

No files matched your search

+2 -7
View File
@@ -119,7 +119,8 @@ export function lookAtPoint(camera) {
const lon = camera.lon + dLon;
return {
lat: clamp(camera.lat + dLat, -90, 90),
lon: lon > 180 ? lon - 360 : lon < -180 ? lon + 360 : lon,
// Near a pole one step ahead can be several turns of the parallel.
lon: ((((lon + 180) % 360) + 360) % 360) - 180,
};
}
@@ -387,12 +388,6 @@ export function createView({
// photos at X, also when the camera sits behind it. It is a pair: half
// of one is not mixed with the camera's other half.
const given = [latitude(streetLevel.lat), longitude(streetLevel.lon)];
// A coordinate given off the globe is an error, not a reason to guess.
for (const [index, key] of ['lat', 'lon'].entries())
if (streetLevel[key] != null && given[index] === undefined)
throw new TypeError(
`Street-level ${key} is not a valid coordinate: ${streetLevel[key]}`,
);
const seen = lookAtPoint(camera);
const [lat, lon] = given.includes(undefined) ? [seen.lat, seen.lon] : given;
street = Object.freeze({
-15
View File
@@ -208,21 +208,6 @@ test('street-level photos travel in the link, light their source and bring their
assert.equal(streetLevelFromParams(new URLSearchParams('sl=bing,1,2')), null);
assert.equal(streetLevelFromParams(new URLSearchParams('lat=1')), null);
assert.equal(createView({ camera: { lat: 1, lon: 2 } }).street_level, null);
// A point off the globe is refused, like an unknown source.
for (const bad of [
{ lat: 95, lon: 2 },
{ lat: 48, lon: 200 },
{ lat: Number.NaN, lon: 2 },
])
assert.throws(
() =>
createView({
camera: { lat: 1, lon: 2 },
street_level: { provider: 'mapillary', ...bad },
}),
TypeError,
JSON.stringify(bad),
);
// Half a point is not mixed with the camera's other half.
const half = createView({
camera: { lat: 1, lon: 2 },