mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
The street-level provider credits, the map source credit, the shared inline OpenStreetMap and OpenMapTiles credits and the ALPR provider credit go through the renderer's credits port instead of Cesium's credit display. Their markup has one link each and is read as the port's plain data; the ALPR credit is built as plain data, which the port escapes. src/maps/credits.js and src/layers/streetLevel/credits.js no longer reach Cesium and leave the allow-list. findCredits finds the port as findCamera finds the camera: a Cesium viewer of a caller's own, with no renderer bound, gets a credits port over its own credit display, so the public entries keep their attribution. A port built that way is released, not disposed, when a renderer binds later, and a credit let go after its viewer is destroyed leaves the display alone. The per-layer data credits and the transit and event credits stay on Cesium's display: their markup carries several links each, which the contract's credit cannot hold.
28 lines
736 B
JavaScript
28 lines
736 B
JavaScript
import { creditFromMarkup } from '../render/creditMarkup.js';
|
|
import { findCredits } from '../render/rendererOf.js';
|
|
|
|
/**
|
|
* The on-map credit of the source actually on screen, including fallback,
|
|
* through the renderer's credits port. A source's credit is markup with one
|
|
* link, read as the port's plain data.
|
|
*/
|
|
export function createMapCredits(viewer) {
|
|
let off = null;
|
|
let markup = null;
|
|
return {
|
|
show(html) {
|
|
if (html === markup) return;
|
|
const credits = findCredits(viewer);
|
|
if (!credits) return;
|
|
off?.();
|
|
off = html
|
|
? credits.addStatic({ ...creditFromMarkup(html), inline: true })
|
|
: null;
|
|
markup = html;
|
|
},
|
|
destroy() {
|
|
this.show(null);
|
|
},
|
|
};
|
|
}
|