fix(street-level): camera height over Google 3D, cast only when it helps, gate token

From the code review of #768:

- view.js measured the camera's height above ground with globe.getHeight,
  but Google 3D hides the globe, so coverage picked its zoom from the
  ellipsoidal height. Over a high city (Denver, ~1,600 m) a camera 500 m up
  read 2,100 m: coverage stayed at z12/z13, whose tiles are too big to cast,
  and lines stayed draped on the roofs. With the globe hidden, the bare-earth
  height from the ground caster now answers; coverage re-picks its zoom when
  the surface mode changes. Verified in Denver: terrain mode, z14, cast lines.
  The core's surface check uses the same helper (and no longer subtracts the
  2 m lift from the camera height).
- castTile rebuilt a tile even when no line could be cast (terrain proxy
  down, tile too big); it now leaves such tiles as they are.
- The feature gate read Street Level's share token as a literal `0`; it now
  takes it from LAYER_STATE_REGISTRY, since a rebase can reassign it.

New view.test.mjs covers the shown-globe, hidden-globe and no-sample cases.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Said TurkseverandClaude Opus 5.5 committed 2026-10-02 01:01:40 +01:00
1 parent e01ffb3cad
commit abbf69a512
6 files changed
+96 -22

No files matched your search

+12 -5
View File
@@ -9,6 +9,7 @@
*/
import assert from 'node:assert/strict';
import { pathToFileURL } from 'node:url';
import { LAYER_STATE_REGISTRY } from '../src/data/layerState.js';
/** Viewports every layout assertion runs at. */
export const VIEWPORTS = Object.freeze([
@@ -19,6 +20,11 @@ export const VIEWPORTS = Object.freeze([
/** Provider chips the panel must show, in order (one per registered provider). */
export const EXPECTED_PROVIDERS = Object.freeze(['mapillary']);
/** Street Level's share-link token, as the ledger assigned it. */
const STREET_LEVEL_TOKEN = LAYER_STATE_REGISTRY.find(
(entry) => entry.id === 'street-level',
).token;
/** Expected right-rail order once the layout controller has run. */
export const RAIL_ORDER = Object.freeze([
'pp-toggles',
@@ -338,13 +344,14 @@ async function main() {
assert.ok(after <= before, `${after} ≤ ${before}`);
assert.equal((await ui()).filter.pano, 'pano');
// The click is a user params request, so the share link records it
// (Street Level's share token is `0`).
// under Street Level's share token, whatever the ledger assigned.
await page.waitForFunction(
() =>
/(^|_)0\.p\.p(_|$)/.test(
new URLSearchParams(location.hash.slice(1)).get('lo') || '',
),
(option) =>
(new URLSearchParams(location.hash.slice(1)).get('lo') || '')
.split('_')
.includes(option),
{ timeout: 10_000 },
`${STREET_LEVEL_TOKEN}.p.p`,
);
await page.click('[data-sl-pano="all"]');
await sleep(600);