mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 19:04:02 +00:00
refactor(maps): separate source factories and scene coordination
This commit is contained in:
1 parent
561a781099
commit
e59282dc9c
22 files changed
+1807
-798
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import * as Cesium from 'cesium';
|
||||
|
||||
/** Static credits follow the source actually on screen, including fallback. */
|
||||
export function createMapCredits(viewer) {
|
||||
let active = null;
|
||||
let markup = null;
|
||||
return {
|
||||
show(html) {
|
||||
if (html === markup) return;
|
||||
const display = viewer?.scene?.frameState?.creditDisplay;
|
||||
if (!display) return;
|
||||
try {
|
||||
if (active) display.removeStaticCredit(active);
|
||||
active = html ? new Cesium.Credit(html, true) : null;
|
||||
markup = html;
|
||||
if (active) display.addStaticCredit(active);
|
||||
} catch {
|
||||
/* Switching remains usable on older credit displays. */
|
||||
}
|
||||
},
|
||||
destroy() {
|
||||
this.show(null);
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user