Give the Cesium renderer the contract's credits port

The shared Cesium ports gain credits, on both the conformance renderer and
the application's. list() reports what Cesium owes as plain data: its logo,
its static credits and the last drawn frame's imagery, terrain and tile
credits, read from the credit display through internals.js, with the
credits the app adds listed as given where the display shows them. addStatic
shows a credit through Cesium's display, as markup built from the plain
data with every value escaped and only web links kept, so attribution stays
on screen. change fires when the app adds or removes a credit, and after a
drawn frame whose Cesium credits differ from the last one's.

src/render/creditMarkup.js reads markup credits as plain data. The credits
listener check moves out of renderer.listenerRules into its own check, so a
renderer without every port can run it; it and the credits check now run on
Cesium.
This commit is contained in:
Sameh Khamis committed 2026-11-06 16:32:17 -08:00
1 parent 28b5de7196
commit 979e2213b9
13 files changed
+803 -15

No files matched your search

+12 -1
View File
@@ -2,7 +2,8 @@
* @module render/cesium/ports
* @description The Cesium renderer's contract ports, built over a Cesium
* widget or viewer someone else made and configured: frame phases, the
* draw sets, `setView` and the pose, picks and projection, and capture.
* draw sets, `setView` and the pose, picks and projection, credits and
* capture.
* Building them puts the loop on demand (no holds yet, and no redraws for
* scene time alone); nothing else in the scene changes until a call.
*
@@ -15,6 +16,7 @@ import * as Cesium from 'cesium';
import { heightsFor } from '../../queries/heights.js';
import { createCesiumCamera } from './camera.js';
import { listenerList, toCartesian, uncaught } from './common.js';
import { createCesiumCredits } from './credits.js';
import {
atEndOfTick,
billboardLoadError,
@@ -734,6 +736,13 @@ export function createCesiumPorts(widget, { capabilities }) {
const cameraPart = createCesiumCamera({ scene, camera, report, widget });
const cameraPort = cameraPart.port;
const creditsPart = createCesiumCredits({
display: widget.creditDisplay,
scene,
report,
requestRender: () => frame.requestRender('credits'),
});
// --- Query -----------------------------------------------------------------
const screen = (x, y) => new Cesium.Cartesian2(x, y);
@@ -1075,6 +1084,7 @@ export function createCesiumPorts(widget, { capabilities }) {
frame,
draw,
camera: cameraPort,
credits: creditsPart.port,
query,
capture,
modelSets,
@@ -1091,6 +1101,7 @@ export function createCesiumPorts(widget, { capabilities }) {
for (const list of Object.values(rendererListeners)) list.clear();
for (const list of Object.values(frameListeners)) list.clear();
cameraPart.dispose();
creditsPart.dispose();
for (const done of [...pendingRenders]) done();
// Late model loads find no host and destroy themselves.
for (const record of sets.values()) record.host = null;