Skip to content

A spy satellite simulator in your browser, except the data is real. Live open source spatial intelligence on a photorealistic 3D globe.

710 B
Raw Blame
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);
    },
  };
}