mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 00:02:25 +00:00
Street Level: shorter comments and docs
- Comments in the action, the layer, embed, the Mapillary policy and the controls say why in fewer words; restatements of the code are gone. - CURRENT-STATE's "Show me X on Street View" section is a list by topic and no longer says the browser gate aims at coverageLines. - TOOLS.md's street-level view paragraph is shorter.
This commit is contained in:
1 parent
f3996da0af
commit
e34b5103c6
7 files changed
+167
-215
No files matched your search
+97
-105
@@ -5073,111 +5073,103 @@ core's lookups alone. The MCP globe panel allows the meta-catalogue and the
|
|||||||
three biggest instances; a picture on another instance shows only in the
|
three biggest instances; a picture on another instance shows only in the
|
||||||
app.
|
app.
|
||||||
|
|
||||||
**"Show me X on Street View."** The `show_street_level` assistant action
|
**"Show me X on Street View."** `show_street_level` (voice and typed;
|
||||||
(voice and typed; `src/voice/gevActions.js`) is one call: it checks the
|
`src/voice/gevActions.js`) is one call whose stages fail separately
|
||||||
source has its key (a keyless source explains itself and changes nothing, as
|
(`location`, `view`, `map`, `provider`, `layer`, `key`, `imagery`):
|
||||||
a chip does), flies to the place at street framing and waits for arrival (a
|
|
||||||
name, coordinates, a pointed spot, a numbered item, or nothing for the
|
- **Key first.** A keyless source explains itself and changes nothing, as a
|
||||||
ground under the screen centre, as OPEN uses: `aim: 'screen-centre'` with
|
chip does.
|
||||||
`armed: false`, so sky refuses and a link's armed point is not used and is
|
- **Place.** A name, coordinates, a pointed spot or a numbered item: it flies
|
||||||
kept until a photo opens), switches to the map the source needs (Google Street View: Google 3D),
|
there at street framing and waits for arrival. With no place it looks at the
|
||||||
lights that source through `setLayerParams` with origin `voice` (one source at
|
ground under the screen centre, as OPEN does (`aim: 'screen-centre'`,
|
||||||
a time, kept in the share link like a chip click; a link runs the action with
|
`armed: false`: sky refuses, and a link's armed point is not used and is kept
|
||||||
origin `programmatic`, for the source switch and the layer, so it never writes
|
until a photo opens). Coordinates off the globe are refused.
|
||||||
the recipient's saved layer state), turns the layer on and
|
- **Map and source.** It switches to the map the source needs (Google Street
|
||||||
calls `openNearest`. `provider` is `google` for "Street View", `mapillary`,
|
View: Google 3D), lights the source through `setLayerParams`, one at a time
|
||||||
`kartaview` or `panoramax` by name, else the lit source. Stages fail separately (`location`, `view`, `map`,
|
and kept like a chip click (origin `voice`; a link runs the action with
|
||||||
`provider`, `layer`, `key`, `imagery`; `view` when cockpit, clean view,
|
origin `programmatic`, so it never writes the recipient's saved layer state),
|
||||||
recording or scene playback hides the panel, checked after the flight and
|
turns the layer on and calls `openNearest`. `provider` is `google` for
|
||||||
before anything switches or loads; embed mode exempts its own clean-view
|
"Street View", `mapillary`, `kartaview` or `panoramax` by name, else the lit
|
||||||
class because the photo is lifted above the globe; an empty `imagery` result names a
|
source.
|
||||||
narrowing 360°/flat or SINCE filter the source honours, as `filter`;
|
- **Hidden panel.** Cockpit, clean view, recording or scene playback end it at
|
||||||
`noImagery` marks an empty result, `imageryError` a source or viewer failure
|
`view`, before the flight and after every await; embed mode's own clean view
|
||||||
and `aim: 'sky'` a sky centre, from the layer's `street.nearestOutcome`) and a
|
is exempt, since the photo is lifted over the globe.
|
||||||
newer turn retires the lookup
|
- **Superseded.** After every await (flight, map switch, layer on, lookup) a
|
||||||
(`openNearest`'s `signal` option), so nothing opens after the user moved on.
|
newer turn, a shell navigation stamp (`_navigationGeneration`, re-taken where
|
||||||
For a source without a coverage layer the lookup widens to 250 m
|
its own flight lands) or a press or wheel on the globe stops it
|
||||||
(`NEAREST_RADIUS_MAX_M`; Google honours it, Mapillary's API caps at 50 m);
|
(`superseded: true`). The same checks run before a found photo loads
|
||||||
clicks keep 50 m. Mapillary's search gives up after 12 s, body included
|
(`proceed`), so nothing billed loads for a request that was given up, and a
|
||||||
(`NEAREST_TIMEOUT_MS`), and asks for 100 photos, the API's most: it
|
lookup given up leaves the panel as it was; a photo that opened after either
|
||||||
returns the radius's photos in no particular order and cuts them at the limit
|
is closed again.
|
||||||
first, so the distance sort and the imagery filter run over the spot's photos.
|
- **Replacing a photo.** An open photo stays up while the new request looks
|
||||||
On a phone the panel sits in the Cameras tab sheet: a photo that opens, and a
|
(`openNearest` `replace: true`; the viewer is replaced, not closed, so EXPAND
|
||||||
link that arms, open that sheet and scroll the panel into view
|
stays, also across sources through `holdViewer`) and closes if nothing
|
||||||
(`revealPanel`, which does nothing above 720px, scrolling included); every
|
opens, so a place with no imagery shows its own error; a link that only arms
|
||||||
photo the action opens reveals the panel again, also one the user had
|
closes it at once. A replacement stops a playing Mapillary sequence.
|
||||||
collapsed. The layer exposes `requiredMapStack(id)` and
|
- **Outcome.** `noImagery` marks an empty result, `imageryError` a source or
|
||||||
`providerStatus(id)` for callers that must decide before the panel lists a
|
viewer failure and `aim: 'sky'` a sky centre (from `street.nearestOutcome`);
|
||||||
source, and `coverageLines(id)` (the lines a provider draws now, current and
|
an empty result names a narrowing 360°/flat or SINCE filter the source
|
||||||
stale tiles, as `[lon, lat]` parts) for diagnostics and the browser gate,
|
honours, as `filter`. Every photo the action opens reveals the panel, also
|
||||||
which aims its line clicks at that geometry, waits for the asynchronous
|
one the user had collapsed.
|
||||||
ground primitives to be ready, and clicks in the same JavaScript turn as the
|
- **Search.** A source without a coverage layer searches up to 250 m
|
||||||
pick so a rebuilt frame cannot come between them. Views carry the same request as `street_level` (`src/view/index.js`:
|
(`NEAREST_RADIUS_MAX_M`; Google honours it); clicks keep 50 m. Mapillary
|
||||||
source and point, defaulting to where the camera looks; a `google` source
|
asks for 100 photos within 50 m, its API's most (the API returns them
|
||||||
brings `map: photoreal` and refuses another map; not with `follow`), links as
|
unordered and cuts at the limit), and gives up after 12 s, body included
|
||||||
`sl=<source>,<lat>,<lon>`; `show_in_gods_eye_view` accepts it, the globe panel
|
(`NEAREST_TIMEOUT_MS`).
|
||||||
applies it through the action, and a plain link runs the action once restored
|
- **Phone.** The panel sits in the Cameras tab sheet: a photo that opens, or a
|
||||||
(one shot: the rewritten hash drops `sl`). A link pasted into the open tab
|
link that arms, opens the sheet and scrolls the panel into view
|
||||||
runs it after its restore settles (`gev:share-navigation-restore-settled`),
|
(`revealPanel`, which does nothing above 720px).
|
||||||
and only when the restore's camera landed (`share.camera === 'applied'`): a
|
|
||||||
link whose restore flight the visitor stopped with a drag or a search, or
|
The layer also exposes `requiredMapStack(id)` and `providerStatus(id)` for
|
||||||
whose restore a newer link superseded, never runs and never pulls the camera
|
callers that decide before the panel lists a source, `holdViewer()`, and
|
||||||
back. In embed mode the rail holding the
|
`coverageLines(id)` (the lines a provider draws now, as `[lon, lat]` parts)
|
||||||
panel is hidden, so an open photo moves to an overlay on the globe
|
for diagnostics. A caller's abort is honoured through the viewer's mount and
|
||||||
(`sl-viewer-wrap-embed`) and back when it closes; Esc closes it (in full
|
load, and only the lookup that still owns the panel changes its spinner or
|
||||||
screen, Esc leaves full screen first). EXPAND stays open under embed mode's
|
error.
|
||||||
own clean view; cockpit, recording and scene playback hide the overlay. A
|
|
||||||
posted view whose photo step fails before the imagery stage closes the
|
Views carry the request as `street_level` (`src/view/index.js`): a source and
|
||||||
earlier photo before its camera flies; one the user overtook (a click on the
|
a point, which defaults to where the camera looks (below 20 km, at a pitch
|
||||||
map, a newer request) leaves their photo and camera alone, and one that
|
steeper than -5° and within 10 km ahead; else the camera's own point, also
|
||||||
found a photo it could not load keeps that error in view. The action's
|
for half a point). A `google` source brings `map: photoreal` and refuses
|
||||||
lookup replaces an open photo in place (`openNearest` `replace: true`), so
|
another map; `street_level` does not combine with `follow`.
|
||||||
the viewer and EXPAND stay up, and closes it only when it opens nothing; once
|
`show_in_gods_eye_view` measures a view's altitude from the terrain under the
|
||||||
an image is found, `proceed()` asks whether the camera and the panel are
|
camera (`services.terrain`) before taking the look-at point, and keeps the
|
||||||
still the request's before a billed photo loads. Image-loading failures render inside
|
view's own estimate without a terrain answer. Links carry
|
||||||
the embedded overlay, since the panel's error region is hidden with the rail.
|
`sl=<source>,<lat>,<lon>`; the globe panel applies views through the action,
|
||||||
A caller's abort is
|
and a plain link runs it once restored (one shot: the rewritten hash drops
|
||||||
honoured through the viewer's mount and load, not just the lookup, and only
|
`sl`). A link that follows an entity ignores `sl`.
|
||||||
the lookup that still owns the panel may change its spinner or error. Cancelling
|
|
||||||
a lookup clears its loading state even when an existing photo stays open;
|
- **Billing gate.** A plain link never loads a photo from a source that bills
|
||||||
internally retired lookups also release the caller's abort listener. A
|
every load (`billedPerImage`; Google): the action runs with
|
||||||
passive link's photos stand down if anyone navigated (a gesture, a search,
|
`autoOpen: false` and arms the layer (`armNearest`: the link's point and
|
||||||
the assistant) while the link waited behind its own marks. The action itself
|
radius, for the next OPEN press only, and only while the ground under the
|
||||||
checks again after every await (flight, map switch, layer on, lookup): a
|
screen centre is within 1 km of it (`ARMED_REACH_M`) or cannot be picked; a
|
||||||
newer turn, a shell navigation stamp (`_navigationGeneration`, re-taken where
|
sky centre refuses; any other lookup, open, close, disable, the source
|
||||||
its own flight lands) or a press or wheel on the globe stops the remaining
|
switched off or its map leaving drops it), opens the panel and shows a toast
|
||||||
stages (`superseded: true`), and cockpit, clean view, recording or scene
|
pointing at OPEN GOOGLE STREET VIEW.
|
||||||
playback entered meanwhile ends it at the `view` stage. During the lookup the
|
- **Who may open.** Posted views, and the panel page's own link (inline embed)
|
||||||
same checks run before a found photo loads (`proceed`), so nothing billed
|
for a tool result issued in the last 5 minutes, open the photo:
|
||||||
loads for a request that was given up, and a lookup given up leaves the
|
`show_in_gods_eye_view` stamps a street-level result `issued_at`, every
|
||||||
panel as it was; a photo that opened after either is closed again. The
|
`gev:view` the panel posts carries `fresh`, and the inline app applies a
|
||||||
hidden-panel check also runs before the flight, so a recording's camera never
|
view without it with `autoOpen: false` (a framing page's posted views still
|
||||||
moves for it. A photo already open stays up while the new request looks (the
|
open). `?embed=1` on a published link only arms, without the panel nudge or
|
||||||
viewer is replaced, not closed, so EXPAND stays, also when the request
|
toast.
|
||||||
switches the source) and closes if the request opens nothing, so a place with
|
- **Who owns the camera.** A link's photo step is skipped when a newer link
|
||||||
no imagery shows its own error, not the previous place's photo; a link that
|
superseded its restore, when its restore flight never landed
|
||||||
only arms closes it at once. A plain
|
(`share.camera !== 'applied'`: the visitor dragged or searched), or after
|
||||||
link never loads a photo from a source that bills every load
|
any navigation since the generation that flight owned (`navigationToken` on
|
||||||
(`billedPerImage` on the provider; Google): the action runs with
|
the settled result), also while its layers still load. A link pasted into
|
||||||
`autoOpen: false`, arms the lookup on the layer (`armNearest`: the link's
|
the open tab runs its step after its restore settles
|
||||||
point and radius, consumed only by the next OPEN press (`aim:
|
(`gev:share-navigation-restore-settled`).
|
||||||
'screen-centre'`), and only while the ground under the screen centre is within
|
- **Embed.** The rail is hidden, so an open photo moves to an overlay on the
|
||||||
1 km of the point (`ARMED_REACH_M`; a user who moved on opens what the view
|
globe (`sl-viewer-wrap-embed`) and back when it closes; Esc closes it (in
|
||||||
shows) or cannot be picked; a sky centre refuses; any other lookup, open, close, disable, its source
|
full screen, Esc leaves full screen first). EXPAND stays under embed mode's
|
||||||
switched off or its map leaving drops it), opens the panel and a toast
|
clean view; cockpit, recording and scene playback hide the overlay. Loading
|
||||||
points at OPEN GOOGLE STREET VIEW. Only the panel page's own link (inline
|
errors render inside the overlay, and inside the viewer while EXPAND is on.
|
||||||
embed) for a tool result issued in the last 5 minutes, and posted views, open
|
A posted view whose photo step fails before the imagery stage closes the
|
||||||
the photo: `show_in_gods_eye_view` stamps a street-level result `issued_at`,
|
earlier photo before its camera flies; one the user overtook (a click on the
|
||||||
and a host that mounts the panel again later hands back the old result, which
|
map, a newer request) leaves their photo and camera alone; one that found a
|
||||||
only arms. The panel checks every result, not just the first: each `gev:view`
|
photo it could not load keeps that error.
|
||||||
it posts carries `fresh`, and the inline app applies a view without it with
|
|
||||||
`autoOpen: false` (a framing page's posted views still open); `?embed=1` on a published link only
|
|
||||||
arms, without the panel nudge or toast (the rail is hidden in a frame). A link that follows an entity ignores `sl`.
|
|
||||||
The look-at default applies below 20 km, at a pitch steeper than -5° and
|
|
||||||
within 10 km ahead; otherwise the camera's own point is used. A view's
|
|
||||||
altitude is above the ellipsoid, so `show_in_gods_eye_view` measures it from
|
|
||||||
the terrain under the camera (`services.terrain`) before taking the look-at
|
|
||||||
point; without a terrain answer it keeps the view's own estimate.
|
|
||||||
|
|
||||||
Street Level has two browser gates. `npm run qa:street-level -- --url <server>`
|
Street Level has two browser gates. `npm run qa:street-level -- --url <server>`
|
||||||
runs against real Mapillary and needs `MAPILLARY_CLIENT_TOKEN`. `npm run
|
runs against real Mapillary and needs `MAPILLARY_CLIENT_TOKEN`. `npm run
|
||||||
|
|||||||
+9
-11
@@ -104,18 +104,16 @@ draws them once the link has been restored.
|
|||||||
|
|
||||||
A view can open street-level photos too: `street_level` names a source
|
A view can open street-level photos too: `street_level` names a source
|
||||||
(`google` for Street View, `mapillary`, `kartaview`, `panoramax`, or none for
|
(`google` for Street View, `mapillary`, `kartaview`, `panoramax`, or none for
|
||||||
whichever the panel has lit) and a point, which defaults to the spot the camera looks at. Street View
|
the lit one) and a point, by default the spot the camera looks at. Street View
|
||||||
shows only on the Google 3D map, so a `google` source sets `map` to
|
shows only on the Google 3D map, so a `google` source sets `map` to
|
||||||
`photoreal` and any other map is refused; a view cannot both follow an entity
|
`photoreal` and refuses another; a view cannot both follow an entity and open
|
||||||
and open photos. The `street-level` layer is turned on. Links carry it as
|
photos. Links carry it as `sl=<source>,<lat>,<lon>`: once restored, the app
|
||||||
`sl=<source>,<lat>,<lon>`; once the link has restored, the app runs its
|
runs `show_street_level`, which flies there and opens the nearest photo. A
|
||||||
`show_street_level` action, which flies to the point at street framing and
|
plain link with a `google` source only arms the panel for OPEN GOOGLE STREET
|
||||||
opens the nearest photo. A plain link with a `google` source stops before the
|
VIEW; a view posted into the embedded app, or the panel page's own opening
|
||||||
billed load: the panel is armed and OPEN GOOGLE STREET VIEW is one click away.
|
link, opens it, and `?embed=1` on a published link does not. Mapillary,
|
||||||
A view posted into the embedded app, or the panel page's own opening link,
|
KartaView and Panoramax, which do not bill per image, open at once. A link
|
||||||
opens the photo, since it is the client's own request; `?embed=1` on a
|
that follows an entity ignores `sl`.
|
||||||
published link does not. Mapillary, KartaView and Panoramax links open the
|
|
||||||
photo at once; none of them bills per image. A link that follows an entity ignores `sl`.
|
|
||||||
|
|
||||||
Tools take a view as `VIEW_ARGUMENTS`: an `area` to frame from above, or a
|
Tools take a view as `VIEW_ARGUMENTS`: an `area` to frame from above, or a
|
||||||
`camera`, plus `layers`, `style`, `map`, `follow`, `annotations` and
|
`camera`, plus `layers`, `style`, `map`, `follow`, `annotations` and
|
||||||
|
|||||||
+19
-31
@@ -183,8 +183,7 @@ function flyTo(viewer, camera) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The `show_street_level` arguments for a view's street-level photos. A plain
|
* The `show_street_level` arguments for a view's street-level photos. A plain
|
||||||
* link (`autoOpen: false`) never loads a photo from a source that bills every
|
* link (`autoOpen: false`) only arms a source that bills every load; a view
|
||||||
* load: the app arms the panel and the OPEN button is one click away. A view
|
|
||||||
* posted into the embedded app is the client's own request and opens.
|
* posted into the embedded app is the client's own request and opens.
|
||||||
*/
|
*/
|
||||||
function streetLevelArgs(streetLevel, { autoOpen = true } = {}) {
|
function streetLevelArgs(streetLevel, { autoOpen = true } = {}) {
|
||||||
@@ -260,20 +259,18 @@ export async function applyView(
|
|||||||
if (view.annotations.length)
|
if (view.annotations.length)
|
||||||
await act('annotate_map', { annotations: [...view.annotations] });
|
await act('annotate_map', { annotations: [...view.annotations] });
|
||||||
if (view.street_level) {
|
if (view.street_level) {
|
||||||
// The photos frame the camera: the action flies to the point at street
|
// The photos frame the camera; when the action fails before flying, the
|
||||||
// level, lights the source and opens the nearest photo. When it fails
|
// view's own camera still applies.
|
||||||
// before flying, the view's own camera still applies.
|
|
||||||
const result = await act(
|
const result = await act(
|
||||||
'show_street_level',
|
'show_street_level',
|
||||||
streetLevelArgs(view.street_level, { autoOpen }),
|
streetLevelArgs(view.street_level, { autoOpen }),
|
||||||
);
|
);
|
||||||
if (result?.ok !== true) {
|
if (result?.ok !== true) {
|
||||||
// Overtaken (a click on the map, a newer request): the panel and the
|
// Overtaken (a click on the map, a newer request): hands off.
|
||||||
// camera are someone else's now.
|
|
||||||
if (result?.cancelled || result?.superseded) return steps;
|
if (result?.cancelled || result?.superseded) return steps;
|
||||||
// An earlier view's photo must not stay over a place this view left.
|
// An earlier view's photo must not stay over a place this view left.
|
||||||
// From the imagery stage on the action has settled the panel itself:
|
// From the imagery stage on the action has settled the panel itself
|
||||||
// a photo it found but could not load keeps its error in view.
|
// (a photo it could not load keeps its error).
|
||||||
if (result?.stage !== 'imagery')
|
if (result?.stage !== 'imagery')
|
||||||
dataManager.layers?.get?.(STREET_LEVEL_LAYER)?.module?.closeViewer?.();
|
dataManager.layers?.get?.(STREET_LEVEL_LAYER)?.module?.closeViewer?.();
|
||||||
if (!result?.location)
|
if (!result?.location)
|
||||||
@@ -331,18 +328,13 @@ export function installViews({
|
|||||||
const hashParams = new URLSearchParams(
|
const hashParams = new URLSearchParams(
|
||||||
String(location?.hash || '').replace(/^#/, ''),
|
String(location?.hash || '').replace(/^#/, ''),
|
||||||
);
|
);
|
||||||
// What the link itself asks for runs first, one thing at a time; posted
|
// The link's own steps run first, one at a time, and posted views queue
|
||||||
// views queue behind it. One failing step does not take the next with it.
|
// behind them; one failing step does not take the next with it. A passive
|
||||||
// The camera's owner at restore: anyone who navigates while the link's
|
// link never flies over someone who took the camera: its steps are skipped
|
||||||
// steps wait (a gesture, a search, the assistant) takes it, and a passive
|
// when a newer link superseded it, when its flight never landed (the
|
||||||
// link must not fly over them.
|
// recipient dragged or searched), or after any navigation since the
|
||||||
// A start-up restore that a newer link superseded hands the camera to that
|
// generation its restore flight owned.
|
||||||
// link: its own steps never run.
|
|
||||||
// A restore whose camera never landed (the recipient dragged, searched or
|
|
||||||
// opened another place during its flight) leaves the camera with them.
|
|
||||||
const cameraLanded = (outcome) => outcome?.share?.camera === 'applied';
|
const cameraLanded = (outcome) => outcome?.share?.camera === 'applied';
|
||||||
// The generation the restore's own flight owned: a navigation after it
|
|
||||||
// landed, while the layers still loaded, has moved on from it.
|
|
||||||
const restoreGeneration = (outcome) =>
|
const restoreGeneration = (outcome) =>
|
||||||
Number.isInteger(outcome?.navigationToken)
|
Number.isInteger(outcome?.navigationToken)
|
||||||
? outcome.navigationToken
|
? outcome.navigationToken
|
||||||
@@ -369,11 +361,9 @@ export function installViews({
|
|||||||
const linked = annotationsFromParams(hashParams);
|
const linked = annotationsFromParams(hashParams);
|
||||||
if (linked.length)
|
if (linked.length)
|
||||||
queue = linkStep(() => run('annotate_map', { annotations: linked }));
|
queue = linkStep(() => run('annotate_map', { annotations: linked }));
|
||||||
// A link to street-level photos opens them once the link has restored. A
|
// A link's street-level photos open once it has restored. A billed source
|
||||||
// link anyone can publish stops short of a billed load and leaves it to a
|
// only arms, except for the panel page's own link to a result issued just
|
||||||
// click; only the panel page's own link for a result issued just now is
|
// now. A link that follows an entity keeps the camera on it.
|
||||||
// the client's request (a host remounting the panel hands back old ones).
|
|
||||||
// A link that follows an entity keeps the camera on it.
|
|
||||||
const linkedStreetLevel = (params) =>
|
const linkedStreetLevel = (params) =>
|
||||||
followFromParams(params) ? null : streetLevelFromParams(params);
|
followFromParams(params) ? null : streetLevelFromParams(params);
|
||||||
const openLinkedStreetLevel = async (
|
const openLinkedStreetLevel = async (
|
||||||
@@ -388,9 +378,8 @@ export function installViews({
|
|||||||
streetLevelArgs(streetLevel, { autoOpen }),
|
streetLevelArgs(streetLevel, { autoOpen }),
|
||||||
{ origin: 'programmatic' },
|
{ origin: 'programmatic' },
|
||||||
);
|
);
|
||||||
// The restore window keeps the panel collapsed; OPEN must be in view.
|
// OPEN must be in view, but embed mode hides the rail that holds it: in
|
||||||
// Embed mode hides the rail that holds it, so there the link only arms
|
// a frame a posted view is the way to open a photo.
|
||||||
// (a posted view is the way to open a photo in a frame).
|
|
||||||
if (result?.armed === true && !isEmbedded(location)) {
|
if (result?.armed === true && !isEmbedded(location)) {
|
||||||
shell.setPanelCollapsed?.(STREET_LEVEL_PANEL_ID, false, {
|
shell.setPanelCollapsed?.(STREET_LEVEL_PANEL_ID, false, {
|
||||||
explicit: true,
|
explicit: true,
|
||||||
@@ -410,9 +399,8 @@ export function installViews({
|
|||||||
autoOpen: isFreshPanelResult(),
|
autoOpen: isFreshPanelResult(),
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
// A link pasted into the open tab restores camera and layers on its own;
|
// A link pasted into the open tab: its photos follow once its restore
|
||||||
// its photos follow once that restore settles, under the same rule: a plain
|
// settles, under the same rules.
|
||||||
// link never loads a billed photo by itself.
|
|
||||||
const onNavigatedRestore = (event) => {
|
const onNavigatedRestore = (event) => {
|
||||||
if (event?.detail?.status !== 'settled' || !cameraLanded(event.detail))
|
if (event?.detail?.status !== 'settled' || !cameraLanded(event.detail))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -697,22 +697,19 @@ export function createStreetLevelLayer({
|
|||||||
/**
|
/**
|
||||||
* Open the nearest image of the active providers (or `providerIds`) near
|
* Open the nearest image of the active providers (or `providerIds`) near
|
||||||
* a point, else the view centre, or with `aim: 'screen-centre'` the ground
|
* a point, else the view centre, or with `aim: 'screen-centre'` the ground
|
||||||
* under the screen centre (sky: nothing). `radiusM` widens the search for
|
* under the screen centre (sky: nothing). Providers without
|
||||||
* providers that can (a geocoded landmark is rarely within 50 m of a
|
* `nearestImage` are skipped. Options:
|
||||||
* street); clicks keep the default. A caller's `signal` retires the
|
* - `radiusM` widens the search where a provider can (a geocoded landmark
|
||||||
* lookup: nothing opens after it fires. Providers without
|
* is rarely within 50 m of a street);
|
||||||
* `nearestImage` are skipped. `armed: false` (a request of its own, such
|
* - `signal` retires the lookup: nothing opens after it fires;
|
||||||
* as the assistant's) does not use a link's armed point, and keeps it
|
* - `armed: false` (the assistant's own request) ignores a link's armed
|
||||||
* while it looks; a photo it opens ends it, as any opened photo does. Why
|
* point and keeps it until a photo opens;
|
||||||
* nothing opened is left in `street.nearestOutcome`: 'empty' (no imagery
|
* - `replace: true` keeps an open photo (and EXPAND) up while it looks and
|
||||||
* in reach), 'sky' (the screen centre is not ground), or null (an error).
|
* closes it if nothing opens;
|
||||||
* `replace: true` (a request that takes over the panel) keeps an open
|
* - `proceed()` is asked before a found photo loads or an empty lookup
|
||||||
* photo up while it looks, so the viewer and EXPAND stay, and closes it
|
* reports; false retires the request and leaves the panel as it was.
|
||||||
* when the lookup opens nothing: the panel shows this request's outcome.
|
* Why nothing opened is in `street.nearestOutcome`: 'empty', 'sky' or
|
||||||
* `proceed()` is asked before a found image loads and before an empty
|
* null (an error).
|
||||||
* or failed lookup reports; false retires the request and leaves the
|
|
||||||
* panel as it was (a photo that bills every load must not load for a
|
|
||||||
* request its caller has given up).
|
|
||||||
*/
|
*/
|
||||||
async openNearest(
|
async openNearest(
|
||||||
point,
|
point,
|
||||||
@@ -737,9 +734,8 @@ export function createStreetLevelLayer({
|
|||||||
if (replace && state.street.open) closeViewer();
|
if (replace && state.street.open) closeViewer();
|
||||||
};
|
};
|
||||||
if (!point && aim === 'screen-centre' && armed) {
|
if (!point && aim === 'screen-centre' && armed) {
|
||||||
// The button promises the centre of the view: the link's spot only
|
// OPEN promises the view centre: the link's spot only while the view
|
||||||
// while the view still shows it, or when the view cannot be picked.
|
// still shows it, or when the view cannot be picked.
|
||||||
// Sky refuses below, as any OPEN press does.
|
|
||||||
const centre = armed.point ? screenCentreGround() : null;
|
const centre = armed.point ? screenCentreGround() : null;
|
||||||
if (!armed.point) radiusM ??= armed.radiusM;
|
if (!armed.point) radiusM ??= armed.radiusM;
|
||||||
else if (
|
else if (
|
||||||
@@ -777,11 +773,9 @@ export function createStreetLevelLayer({
|
|||||||
callerSignal?.addEventListener('abort', onCallerAbort, { once: true });
|
callerSignal?.addEventListener('abort', onCallerAbort, { once: true });
|
||||||
const retired = () => {
|
const retired = () => {
|
||||||
callerSignal?.removeEventListener('abort', onCallerAbort);
|
callerSignal?.removeEventListener('abort', onCallerAbort);
|
||||||
// Only the lookup that still owns the panel may touch it: a newer one
|
// A newer lookup owns the panel, its spinner and its error.
|
||||||
// has its own spinner and error.
|
|
||||||
if (nearestLookup !== lookup) return false;
|
if (nearestLookup !== lookup) return false;
|
||||||
nearestLookup = null;
|
nearestLookup = null;
|
||||||
// The caller moved on: the panel shows nothing of this lookup.
|
|
||||||
if (state.street.loading) {
|
if (state.street.loading) {
|
||||||
state.street.loading = false;
|
state.street.loading = false;
|
||||||
notify();
|
notify();
|
||||||
@@ -822,8 +816,7 @@ export function createStreetLevelLayer({
|
|||||||
if (proceed && proceed() !== true) return retired();
|
if (proceed && proceed() !== true) return retired();
|
||||||
nearestLookup = null;
|
nearestLookup = null;
|
||||||
callerSignal?.removeEventListener('abort', onCallerAbort);
|
callerSignal?.removeEventListener('abort', onCallerAbort);
|
||||||
// The photo asked for stays on screen: a sequence playing in the
|
// A sequence playing in the replaced photo would step past this one.
|
||||||
// photo it replaces stops.
|
|
||||||
if (replace && state.street.open) parts.viewerHost.stopPlayback();
|
if (replace && state.street.open) parts.viewerHost.stopPlayback();
|
||||||
// The caller's signal still counts while the viewer mounts and loads.
|
// The caller's signal still counts while the viewer mounts and loads.
|
||||||
return openImage(entry.def.id, imageId, {
|
return openImage(entry.def.id, imageId, {
|
||||||
@@ -834,8 +827,7 @@ export function createStreetLevelLayer({
|
|||||||
callerSignal?.removeEventListener('abort', onCallerAbort);
|
callerSignal?.removeEventListener('abort', onCallerAbort);
|
||||||
// Replaced while it looked: the panel is the newer lookup's.
|
// Replaced while it looked: the panel is the newer lookup's.
|
||||||
if (nearestLookup !== lookup) return false;
|
if (nearestLookup !== lookup) return false;
|
||||||
// Given up by its caller while it looked: the open photo stays, and
|
// Given up by its caller: the panel stays as it was.
|
||||||
// the panel reports nothing of this lookup.
|
|
||||||
if (proceed && proceed() !== true) return retired();
|
if (proceed && proceed() !== true) return retired();
|
||||||
nearestLookup = null;
|
nearestLookup = null;
|
||||||
closeReplaced();
|
closeReplaced();
|
||||||
@@ -867,8 +859,7 @@ export function createStreetLevelLayer({
|
|||||||
closeViewer,
|
closeViewer,
|
||||||
/**
|
/**
|
||||||
* Keep the open photo up while a request that replaces it switches the
|
* Keep the open photo up while a request that replaces it switches the
|
||||||
* source (the viewer and EXPAND are replaced, not closed). The returned
|
* source, so EXPAND stays. Release closes it if its source is still off.
|
||||||
* release closes it if its source is still off by then.
|
|
||||||
*/
|
*/
|
||||||
holdViewer() {
|
holdViewer() {
|
||||||
viewerHolds += 1;
|
viewerHolds += 1;
|
||||||
@@ -883,10 +874,9 @@ export function createStreetLevelLayer({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Prepare a nearest lookup for the next OPEN press without running it: a
|
* Arm a nearest lookup for the next OPEN press without running it (a link
|
||||||
* link to a source that bills every load stops here. The press opens at
|
* to a source that bills every load). Any other lookup, open or close, the
|
||||||
* this point with this radius; any other lookup, open or close, the
|
* source switched off or its map leaving clears it.
|
||||||
* source switched off, or its map leaving clears it.
|
|
||||||
*/
|
*/
|
||||||
armNearest(point, { providerIds = null, radiusM = null } = {}) {
|
armNearest(point, { providerIds = null, radiusM = null } = {}) {
|
||||||
state.street.armed = {
|
state.street.armed = {
|
||||||
|
|||||||
@@ -75,17 +75,14 @@ export const SEQUENCE_IMAGE_FIELDS =
|
|||||||
'id,captured_at,compass_angle,geometry,is_pano';
|
'id,captured_at,compass_angle,geometry,is_pano';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Images asked for in a nearest-image search (show_street_level and links
|
* Images asked for in a nearest-image search: the API cuts at the limit
|
||||||
* open the photo nearest a point; the graph API caps the radius at 50 m).
|
* before any order, so this is its most, and the distance sort and the
|
||||||
* The API returns the radius's images in no particular order and cuts them
|
* imagery filter choose among all of the spot's photos.
|
||||||
* at the limit first, so this asks for its most (100): the distance sort and
|
|
||||||
* the imagery filter then choose among the spot's photos, not a few of them.
|
|
||||||
*/
|
*/
|
||||||
export const NEAREST_LIMIT = 100;
|
export const NEAREST_LIMIT = 100;
|
||||||
/**
|
/**
|
||||||
* A nearest-image search that has not answered (headers and body) in this
|
* A nearest-image search not answered in full (body included) by then is
|
||||||
* long is given up: a link or a posted view waits on it, and so does every
|
* given up: a link or posted view, and every view queued behind it, waits.
|
||||||
* view queued behind that one.
|
|
||||||
*/
|
*/
|
||||||
export const NEAREST_TIMEOUT_MS = 12_000;
|
export const NEAREST_TIMEOUT_MS = 12_000;
|
||||||
/** Fields a nearest-image search needs: where each is, and the filter's. */
|
/** Fields a nearest-image search needs: where each is, and the filter's. */
|
||||||
|
|||||||
@@ -316,11 +316,9 @@ export class StreetLevelControls {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Embed mode hides the right rail, panel and viewer with it: an open photo
|
* Embed mode hides the right rail: an open photo moves to <body> as an
|
||||||
* moves to <body> as an overlay on the globe (`sl-viewer-wrap-embed`, see
|
* overlay on the globe (`sl-viewer-wrap-embed`, embed.css) and goes back
|
||||||
* embed.css) and returns to its place in the panel when it closes. The
|
* when it closes. Vue keeps patching the wrap there: its siblings are static.
|
||||||
* panel view keeps patching the wrap where it is: its siblings are static,
|
|
||||||
* so Vue never inserts next to it.
|
|
||||||
*/
|
*/
|
||||||
_syncEmbedOverlay(open) {
|
_syncEmbedOverlay(open) {
|
||||||
const wrap = this._elements.viewerWrap;
|
const wrap = this._elements.viewerWrap;
|
||||||
@@ -404,8 +402,6 @@ export class StreetLevelControls {
|
|||||||
if (!isEmbedPage()) this.actions.revealPanel?.();
|
if (!isEmbedPage()) this.actions.revealPanel?.();
|
||||||
}
|
}
|
||||||
this._wasOpen = open;
|
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.
|
|
||||||
this._syncEmbedOverlay(open);
|
this._syncEmbedOverlay(open);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-21
@@ -3819,9 +3819,8 @@ function streetLevelPanelHidden() {
|
|||||||
* (links) stops short of a billed load: the panel is armed for OPEN.
|
* (links) stops short of a billed load: the panel is armed for OPEN.
|
||||||
*/
|
*/
|
||||||
export async function showStreetLevel(args, context) {
|
export async function showStreetLevel(args, context) {
|
||||||
// Every await can hand the request's moment to someone else: a newer turn,
|
// After any await a newer turn, a navigation, a globe gesture or a mode
|
||||||
// a navigation or gesture that takes the camera, or a mode that hides the
|
// that hides the panel may have taken over: each later stage checks again.
|
||||||
// panel. Each stage after the place is settled checks again.
|
|
||||||
const owner = watchCameraOwner(context.viewer, context.styleManager);
|
const owner = watchCameraOwner(context.viewer, context.styleManager);
|
||||||
// A photo held up while the request switches its source is let go however
|
// A photo held up while the request switches its source is let go however
|
||||||
// the request ends: replaced by then, or closed if its source stayed off.
|
// the request ends: replaced by then, or closed if its source stayed off.
|
||||||
@@ -3912,8 +3911,7 @@ async function requestStreetLevel(
|
|||||||
const status = layerModule.providerStatus?.(provider) || null;
|
const status = layerModule.providerStatus?.(provider) || null;
|
||||||
providerName = status?.name || provider;
|
providerName = status?.name || provider;
|
||||||
|
|
||||||
// The key first, on any map: a chip without a key explains it and switches
|
// The key first: without one nothing changes, as with a chip.
|
||||||
// nothing, and so does this.
|
|
||||||
if (status && (status.keyRequired === true || status.configured === false))
|
if (status && (status.keyRequired === true || status.configured === false))
|
||||||
return fail('key', status.error || `${providerName} needs its key`, {
|
return fail('key', status.error || `${providerName} needs its key`, {
|
||||||
keyRejected: status.keyRejected === true,
|
keyRejected: status.keyRejected === true,
|
||||||
@@ -3998,9 +3996,8 @@ async function requestStreetLevel(
|
|||||||
point = { lat: location.latitude, lon: location.longitude };
|
point = { lat: location.latitude, lon: location.longitude };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cockpit, clean view, recording and scene playback hide the panel the
|
// A mode that hides the panel may have started during the flight. The
|
||||||
// photo opens in, and may have started during the flight.
|
// camera is the request's from where its flight landed.
|
||||||
// The camera is the request's from where its own flight landed.
|
|
||||||
if (location) owner.claim();
|
if (location) owner.claim();
|
||||||
const arrived = interrupted('view');
|
const arrived = interrupted('view');
|
||||||
if (arrived) return arrived;
|
if (arrived) return arrived;
|
||||||
@@ -4076,13 +4073,11 @@ async function requestStreetLevel(
|
|||||||
location,
|
location,
|
||||||
});
|
});
|
||||||
|
|
||||||
// A billed source never loads from a link without a click: everything is
|
// A link never loads a billed photo by itself: it arms OPEN instead.
|
||||||
// ready and OPEN is one press away at the view centre.
|
|
||||||
if (args.autoOpen === false && status?.billed === true) {
|
if (args.autoOpen === false && status?.billed === true) {
|
||||||
// A photo of another place must not stay up beside the armed request.
|
// A photo of another place must not stay up beside the armed request.
|
||||||
if (layerModule.getUIState?.()?.street?.open === true)
|
if (layerModule.getUIState?.()?.street?.open === true)
|
||||||
layerModule.closeViewer?.();
|
layerModule.closeViewer?.();
|
||||||
// The next OPEN press loads exactly what the link asked for.
|
|
||||||
layerModule.armNearest?.(point, {
|
layerModule.armNearest?.(point, {
|
||||||
providerIds: [provider],
|
providerIds: [provider],
|
||||||
...(snapshot.groundClick === true
|
...(snapshot.groundClick === true
|
||||||
@@ -4101,13 +4096,10 @@ async function requestStreetLevel(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// A source with no coverage to click (Street View) is searched wider: a
|
// Street View has no coverage to click, so it searches wider: a geocoded
|
||||||
// geocoded landmark is rarely within 50 m of a street. A newer turn
|
// landmark is rarely within 50 m of a street. An open photo stays up while
|
||||||
// retires the lookup: nothing opens after the user moved on. A photo of
|
// this looks and closes if nothing opens; a found photo loads only while
|
||||||
// another place stays up while it looks (the viewer, EXPAND included, is
|
// the camera and the panel are still the request's.
|
||||||
// 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);
|
reportProgress('imagery', label);
|
||||||
const opened = await layerModule.openNearest(point, {
|
const opened = await layerModule.openNearest(point, {
|
||||||
providerIds: [provider],
|
providerIds: [provider],
|
||||||
@@ -4123,9 +4115,8 @@ async function requestStreetLevel(
|
|||||||
: {}),
|
: {}),
|
||||||
});
|
});
|
||||||
const street = layerModule.getUIState?.()?.street || {};
|
const street = layerModule.getUIState?.()?.street || {};
|
||||||
// A cancelled request opens nothing (the lookup and the viewer both honour
|
// A photo that opened after the camera moved on, or into a panel hidden
|
||||||
// the turn's signal). A photo that opened after the camera moved on, or
|
// meanwhile, is closed again.
|
||||||
// into a panel hidden meanwhile, is closed again: nobody asked to see it.
|
|
||||||
const late = interrupted('imagery');
|
const late = interrupted('imagery');
|
||||||
if (late) {
|
if (late) {
|
||||||
if (opened === true) layerModule.closeViewer?.();
|
if (opened === true) layerModule.closeViewer?.();
|
||||||
|
|||||||
Reference in new issue
Block a user