mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
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:
1 parent
ae66d07575
commit
0ebc09079d
8 files changed
+193
-79
No files matched your search
@@ -812,6 +812,7 @@ export function createGevActionRunner({
|
||||
runOptions,
|
||||
current,
|
||||
reportProgress,
|
||||
otherHandoffs,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3813,9 +3814,12 @@ async function requestStreetLevel(
|
||||
runOptions = {},
|
||||
current = () => true,
|
||||
reportProgress = () => {},
|
||||
otherHandoffs = () => 0,
|
||||
},
|
||||
) {
|
||||
const action = 'show_street_level';
|
||||
// Navigations other than voice fly-tos (this request's own flight) so far.
|
||||
const handoffs = otherHandoffs();
|
||||
let provider = null;
|
||||
let providerName = null;
|
||||
let label = null;
|
||||
@@ -3972,8 +3976,9 @@ async function requestStreetLevel(
|
||||
}
|
||||
|
||||
// A mode that hides the panel may have started during the flight. The
|
||||
// camera is the request's from where its flight landed.
|
||||
if (location) owner.claim();
|
||||
// camera is the request's from where its flight landed, unless another
|
||||
// navigation took it during the flight.
|
||||
if (location && otherHandoffs() === handoffs) owner.claim();
|
||||
const arrived = interrupted('view');
|
||||
if (arrived) return arrived;
|
||||
|
||||
|
||||
@@ -6573,11 +6573,10 @@ function createStreetLevelHarness({
|
||||
const lookups = [];
|
||||
const origins = [];
|
||||
const revealed = [];
|
||||
const { viewer, styleManager, currentGeneration } = createVoiceNavigationHarness();
|
||||
const { viewer, styleManager, currentGeneration, panelSearch } = createVoiceNavigationHarness();
|
||||
// Who owns the camera: the shell's navigation stamps and globe gestures.
|
||||
let userNavigations = 0;
|
||||
Object.defineProperty(styleManager, '_navigationGeneration', {
|
||||
get: () => currentGeneration() + userNavigations,
|
||||
get: () => currentGeneration(),
|
||||
});
|
||||
viewer.scene.canvas = Object.assign(new EventTarget(), { clientWidth: 1200, clientHeight: 800 });
|
||||
let completeFlight = null;
|
||||
@@ -6719,10 +6718,9 @@ function createStreetLevelHarness({
|
||||
origins,
|
||||
revealed,
|
||||
street,
|
||||
// The user searches or flies elsewhere, or drags the globe.
|
||||
navigate: () => {
|
||||
userNavigations += 1;
|
||||
},
|
||||
// The user searches or flies elsewhere (a stamp, as the shell's), or
|
||||
// drags the globe.
|
||||
navigate: panelSearch,
|
||||
gesture: () => viewer.scene.canvas.dispatchEvent(new Event('pointerdown')),
|
||||
};
|
||||
}
|
||||
@@ -7428,6 +7426,28 @@ test('show_street_level owns the camera from where its own flight lands', async
|
||||
assert.ok(h.order.some((step) => step.startsWith('open:mapillary')));
|
||||
});
|
||||
|
||||
// A camera taken during the action's own flight. 'navigate' is a
|
||||
// location-panel search: a stamp that leaves the flight flying. 'gesture' is a
|
||||
// press on the globe, which does not cancel a Cesium flight either.
|
||||
for (const take of ['navigate', 'gesture']) {
|
||||
test(`show_street_level stands down when the camera is taken during its own flight (${take})`, async () => {
|
||||
globalThis.window = globalThis.window || { clearTimeout, setTimeout, requestIdleCallback: null };
|
||||
const h = createStreetLevelHarness();
|
||||
const pending = h.runner('show_street_level', { latitude: 38.58, longitude: -121.49, provider: 'google' });
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
assert.deepEqual(h.order, ['fly'], 'the flight is under way');
|
||||
h[take]();
|
||||
h.finishFlight();
|
||||
const result = await pending;
|
||||
assert.deepEqual([result.ok, result.superseded], [false, true], result.error);
|
||||
assert.deepEqual(
|
||||
h.order.filter((step) => /^(map|params|open|arm|enable)/.test(step)),
|
||||
[],
|
||||
'no map switch, no source, no billed photo for the place the user left',
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
test('show_street_level closes the previous photo, so one that finds nothing leaves no other place on screen', async () => {
|
||||
globalThis.window = globalThis.window || { clearTimeout, setTimeout, requestIdleCallback: null };
|
||||
const empty = createStreetLevelHarness({ enabled: true, photoOpen: true, nearest: null });
|
||||
|
||||
Reference in new issue
Block a user