mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 02:44:02 +00:00
26 lines
710 B
JavaScript
26 lines
710 B
JavaScript
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);
|
|
},
|
|
};
|
|
}
|