Animate traffic on the frame port and follow the camera through the camera port

The traffic lifecycle listens on the frame port's preRender and on the
camera port's changed (at its own 5% threshold) and moveEnd, instead of
the scene's preRender, the camera's events and the shared
percentageChanged ledger. It no longer reaches Cesium and leaves the
allow-list; rendering.js, still listed for the surface identity, tile
readiness and draped-line support, now loads the unbound camera and
globe factories for the layer.
This commit is contained in:
Sameh Khamis committed 2026-11-07 23:16:11 -08:00
1 parent 5715bf9df3
commit 38e0750715
11 files changed
+163 -46

No files matched your search

+4 -3
View File
@@ -4,9 +4,10 @@
*
* `camera.changed` fires once the view has moved by this fraction, and it is a
* single number on the camera that every listener in the app shares. Several
* layers want it finer than the default — traffic and transit ask for 0.05 so
* they notice they have entered a coverage area (bikeshare did too, before it
* listened through the renderer's camera port at its own threshold) — and
* layers want it finer than the default — transit asks for 0.05 so it
* notices it has entered a coverage area (bikeshare and traffic did too,
* before they listened through the renderer's camera port at their own
* threshold) — and
* each of them used to write the number directly and hand back whatever it
* remembered.
*
+8
View File
@@ -245,8 +245,16 @@ test('traffic timing pairs real ordering to the scheduling change and guards re-
// The layer reads the camera through the renderer's camera port.
const { bindRenderer } = await server.ssrLoadModule('/src/render/rendererOf.js');
const degrees = (radians) => radians * 180 / Math.PI;
const cameraEvents = { moveEnd, changed };
const frameEvents = { preRender, postRender };
bindRenderer(viewer, {
// The scene's channels, raised by the test as Cesium would.
frame: {
on: (phase, cb) => frameEvents[phase].addEventListener(cb),
requestRender() {},
},
camera: {
on: (event, cb) => cameraEvents[event].addEventListener(cb),
pose: () => ({
lon: degrees(camera.positionCartographic.longitude),
lat: degrees(camera.positionCartographic.latitude),