fix(globe): harden the Navara engine after review

- maps: photoreal hides the base imagery layer instead of deleting it,
  and a new base layer goes in before the old one goes: deleting the
  last raster layer stops Navara 0.2.1 loading terrain at the current
  view, which left terrainHeight undefined under the tiles
- Google 3D tiles open Navara's attribution card so the tiles'
  copyright lines are on screen, as Cesium shows them; onScreen
  credits do the same
- setCameraInputs merges into the camera options set through the
  engine (new setCameraOptions extension) instead of resetting them
- createNavaraGlobe disposes the view and canvas if the engine throws
- the pin test checks the installed Navara version and catches
  bracketed private access
- QA: draw-match checks at the nadir clamp, after a Navara flight and
  after a mouse drag; terrain under photoreal set right away; the
  copyright lines on screen; create/destroy/create leaves no canvas,
  frames, animation frames, workers or console errors (54/54)
This commit is contained in:
German Khokhlov committed 2026-10-15 19:04:07 +04:00
1 parent 90c8e7763a
commit a4ac0b9b0d
8 files changed
+148 -25

No files matched your search

+17 -2
View File
@@ -11,8 +11,23 @@ test('Navara internals are pinned: package.json and internals.js name the same e
/NAVARA_INTERNALS_VERSION = '([^']+)'/,
)?.[1];
assert.equal(declared, '0.2.1');
for (const name of ['@navaramap/three', '@navaramap/three-default-plugin'])
for (const name of ['@navaramap/three', '@navaramap/three-default-plugin']) {
assert.equal(pkg.dependencies[name], declared, name);
const installed = JSON.parse(
read(`../../../node_modules/${name}/package.json`),
);
assert.equal(installed.version, declared, `installed ${name}`);
}
});
// `x._member`, `x?._member` and `x['_member']`.
const PRIVATE_ACCESS = /\.\s*_[A-Za-z]|\[\s*['"`]_[A-Za-z]/;
test('the private-member pattern catches dotted and bracketed access', () => {
for (const code of ['view._isIdle', 'view?._scenes', "view['_isIdle']", 'v[ "_x" ]'])
assert.ok(PRIVATE_ACCESS.test(code), code);
for (const code of ['view.isIdle', 'a_b.c', "map['key']"])
assert.ok(!PRIVATE_ACCESS.test(code), code);
});
test('only internals.js reaches private Navara members', () => {
@@ -20,7 +35,7 @@ test('only internals.js reaches private Navara members', () => {
(name) =>
name.endsWith('.js') &&
name !== 'internals.js' &&
/\.\s*_[A-Za-z]/.test(read(name).replace(/\/\/.*$/gm, '')),
PRIVATE_ACCESS.test(read(name).replace(/\/\/.*$/gm, '')),
);
assert.deepEqual(offenders, []);
});