mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
- No pointer cursor over coverage lines (no other layer has one); a click test replaces the hover tests. - No legend: one source, one colour. - The on-globe credit lives in index.js; credits.js is gone. - Billboard glyphs are SVG data URLs with the same geometry, so tests need no canvas stub. - The tile cache keeps the 120 most recently used tiles, same 24 h TTL, instead of a byte budget; listTileLayers was test-only. - providers/mapillary/ is flattened into the layer and its policy merged into one policy.js; the source's method list is a literal in the catalog. - One fakeCesiumViewer for the layer tests. - The fixture gate keeps the steps the unit tests do not cover: coverage and credit, a rejected key, line -> cone -> photo, close, a keyless page. Co-Authored-By: Claude Fable 5.1 <[email protected]>
39 lines
1005 B
JavaScript
39 lines
1005 B
JavaScript
import * as Cesium from 'cesium';
|
|
|
|
/**
|
|
* One static Cesium credit per active provider: CC BY-SA imagery needs
|
|
* visible attribution that goes away with the imagery.
|
|
*/
|
|
export function createCredits() {
|
|
/** @type {Map<string, object>} provider id → Cesium.Credit */
|
|
const shown = new Map();
|
|
|
|
function show(viewer, def) {
|
|
if (shown.has(def.id) || !viewer?.creditDisplay) return;
|
|
try {
|
|
const credit = new Cesium.Credit(def.credit.html, true);
|
|
viewer.creditDisplay.addStaticCredit(credit);
|
|
shown.set(def.id, credit);
|
|
} catch {
|
|
/* credit display unavailable */
|
|
}
|
|
}
|
|
|
|
function hide(viewer, def) {
|
|
const credit = shown.get(def.id);
|
|
if (!credit) return;
|
|
try {
|
|
viewer?.creditDisplay?.removeStaticCredit?.(credit);
|
|
} catch {
|
|
/* credit display already torn down */
|
|
}
|
|
shown.delete(def.id);
|
|
}
|
|
|
|
function hideAll(viewer) {
|
|
for (const id of [...shown.keys()]) hide(viewer, { id });
|
|
}
|
|
|
|
return { show, hide, hideAll };
|
|
}
|