refactor(credits): use the globe engine

Map credits (maps/credits.js) are shown through a credits capability
(engine.credits.addStatic) instead of the scene's credit display; the
shared map scene takes the engine's credits, so the Cesium engine's maps
and its credits part share one owner. Data credits (registerDataCredits,
registerDynamicCredit, show/hideOsmCredit) take the globe engine and keep
accepting a viewer from layers that still hold one; the scene registers
the data credits on its engine. The Cesium credits part reads
Viewer.creditDisplay, else the scene frame state display it aliases.
This commit is contained in:
German Khokhlov committed 2026-10-15 18:37:02 +04:00
1 parent be56144d75
commit 83c13f330d
11 files changed
+169 -59

No files matched your search

+15
View File
@@ -31,3 +31,18 @@ test('destroy removes the credits the engine added', () => {
assert.equal(viewer.staticCredits.length, 0);
assert.equal(viewer.callsOf('creditDisplay.removeStaticCredit').length, 2);
});
test('the display is Viewer.creditDisplay, else the scene frame state one it aliases', () => {
const added = [];
const display = {
addStaticCredit: (credit) => added.push(credit),
removeStaticCredit: (credit) => added.splice(added.indexOf(credit), 1),
};
const { credits } = createCesiumCredits({
scene: { frameState: { creditDisplay: display } },
});
const remove = credits.addStatic('frame state');
assert.equal(added[0].html, 'frame state');
remove();
assert.deepEqual(added, []);
});