mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 01:32:19 +00:00
Application extras come from the renderer plugin; framing, occlusion and panel drawing are contract ports
A renderer plugin may supply applicationHooks(renderer) for what only its renderer has (map engine, own credits, stale commands, QA handles). What every renderer should do moves onto the contract: controls.keepEarthFramed (behind the keepEarthFramed capability), query.occlusionTest (behind occlusionTest), and panel drawing, which keepPanelRendering now does through resize and frame.renderNow through the contract. renderNow throws when the frame fails to draw. The Cesium port installs its zoom-out guard through keepEarthFramed (a setView no longer cancels its turn) and answers occlusionTest with the scene's probe; the stub answers it with a horizon test.
This commit is contained in:
1 parent
a755f63638
commit
619c19ea67
40 files changed
+737
-323
No files matched your search
@@ -11,55 +11,7 @@ before(() => {
|
||||
});
|
||||
after(() => uninstallDom());
|
||||
|
||||
test("application controls install the scene's zoom-out guard and remove it on teardown", () => {
|
||||
const handoffs = new Set();
|
||||
class Controls {
|
||||
hasShareState = true;
|
||||
orbitController = { stop() {} };
|
||||
hud = { destroy() {} };
|
||||
dispose() {}
|
||||
subscribeCameraHandoff(listener) {
|
||||
handoffs.add(listener);
|
||||
return () => handoffs.delete(listener);
|
||||
}
|
||||
}
|
||||
const cleanups = [];
|
||||
// The guard the scene's renderer gives: installed once, with the controls'
|
||||
// camera handoff, and disposed with the application.
|
||||
const guard = { installs: 0, disposals: 0 };
|
||||
createApplicationControls({
|
||||
scene: {
|
||||
viewer: {},
|
||||
mapStackController: {},
|
||||
operations: {
|
||||
surface: { controlServices: {} },
|
||||
searchAndFlyTo() {},
|
||||
requests: { regional: {}, weather: {} },
|
||||
},
|
||||
installZoomOutGuard({ subscribeCameraHandoff }) {
|
||||
guard.installs += 1;
|
||||
const unsubscribe = subscribeCameraHandoff(() => {});
|
||||
return () => {
|
||||
guard.disposals += 1;
|
||||
unsubscribe();
|
||||
};
|
||||
},
|
||||
},
|
||||
loaderStatus: {},
|
||||
Controls,
|
||||
catalog: { get: (id) => ({ id }) },
|
||||
defer: (cleanup) => cleanups.push(cleanup),
|
||||
});
|
||||
|
||||
assert.equal(guard.installs, 1);
|
||||
assert.equal(handoffs.size, 1);
|
||||
|
||||
for (const cleanup of cleanups.reverse()) cleanup();
|
||||
assert.equal(guard.disposals, 1);
|
||||
assert.equal(handoffs.size, 0);
|
||||
});
|
||||
|
||||
test('a scene without a zoom-out guard starts its controls without one', () => {
|
||||
test('the application controls start and stop', () => {
|
||||
class Controls {
|
||||
hasShareState = true;
|
||||
orbitController = { stop() {} };
|
||||
|
||||
Reference in new issue
Block a user