mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 08:42:21 +00:00
feat(globe): implement the engine on Cesium
createCesiumEngine wraps an existing viewer without changing it: camera, picker, projector, frames, render (through the render governor), surface, input, credits and maps, with geo values out and Cesium values in at the boundary. Map and surface code is shared with src/maps and services/groundSnap instead of copied. scripts/qa-globe-contract.mjs runs the contract suite against the engine in headless Chrome; the camera-events check now waits for the previous move to end, as Cesium's moveStart marks a move from rest.
This commit is contained in:
1 parent
cd94a26b9f
commit
d831cbd23a
33 files changed
+2374
-32
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import * as Cesium from 'cesium';
|
||||
import { createCesiumCredits } from './credits.js';
|
||||
import { createFakeViewer } from './testing/fakeViewer.mjs';
|
||||
|
||||
test('addStatic adds a Cesium credit and returns an idempotent remover', () => {
|
||||
const viewer = createFakeViewer();
|
||||
const { credits } = createCesiumCredits(viewer);
|
||||
const remove = credits.addStatic('<b>Source</b>', { onScreen: true });
|
||||
assert.equal(viewer.staticCredits.length, 1);
|
||||
const [credit] = viewer.staticCredits;
|
||||
assert.ok(credit instanceof Cesium.Credit);
|
||||
assert.equal(credit.html, '<b>Source</b>');
|
||||
assert.equal(credit.showOnScreen, true);
|
||||
remove();
|
||||
remove();
|
||||
assert.equal(viewer.staticCredits.length, 0);
|
||||
assert.equal(viewer.callsOf('creditDisplay.removeStaticCredit').length, 1);
|
||||
credits.addStatic('Off screen');
|
||||
assert.equal(viewer.staticCredits[0].showOnScreen, false);
|
||||
});
|
||||
|
||||
test('destroy removes the credits the engine added', () => {
|
||||
const viewer = createFakeViewer();
|
||||
const { credits, destroy } = createCesiumCredits(viewer);
|
||||
credits.addStatic('a');
|
||||
const removeB = credits.addStatic('b');
|
||||
removeB();
|
||||
destroy();
|
||||
assert.equal(viewer.staticCredits.length, 0);
|
||||
assert.equal(viewer.callsOf('creditDisplay.removeStaticCredit').length, 2);
|
||||
});
|
||||
Reference in new issue
Block a user