Move the bikeshare layer onto the renderer's draw and camera ports

Station dots and the selected-station highlight are now two point draw
sets, picked through the draw hit, and the layer follows the camera
through the camera port at its own threshold instead of the shared
percentageChanged ledger. Altitude and view centre come from the camera
pose and view rectangle. All five bikeshare files leave the Cesium
allow-list.

The Cesium draw port now keeps a rebuilt host in its place in the scene
instead of re-adding it on top, tags hosts with their set id so sprite
order can raise a draw set (registerSpriteSet), and restyles unclamped
points in place when they have not moved, so a status poll or selection
no longer rebuilds every station. Other draw-port layers (cyclone
markers, earthquake discs) now also keep their first-build slot rather
than jumping above the sprite layers on each rebuild.
This commit is contained in:
Sameh Khamis committed 2026-11-06 20:26:35 -08:00
1 parent 2b66c46a30
commit 8c6fa6258b
22 files changed
+732 -249

No files matched your search

+27 -5
View File
@@ -43,6 +43,8 @@ import {
uninstallRenderGovernor,
} from '../../renderGovernor.js';
import { fakeInput } from '../../input/testDoubles.mjs';
import { fakeCameraPort } from '../../testSupport/fakeCameraPort.mjs';
import { bindRenderer } from '../../render/rendererOf.js';
import { framePortFor } from '../../testSupport/fakeFramePort.mjs';
import { registerStyleStages } from '../../styles/styleStages.js';
@@ -3561,7 +3563,7 @@ test('reject then selected history backfill cannot resurrect a 111 km displaceme
assert.equal(entry.track.resets, 0);
});
test('actual Traffic, Bikeshare and Transit lifecycles retain sensitivity in every enable/disable order', async (t) => {
test('actual Traffic and Transit lifecycles retain sensitivity in every enable/disable order, Bikeshare among them', async (t) => {
const { createLifecycle: trafficLifecycle } =
await import('../traffic/lifecycle.js');
const { createLifecycle: bikeLifecycle } =
@@ -3583,7 +3585,7 @@ test('actual Traffic, Bikeshare and Transit lifecycles retain sensitivity in eve
}).methods;
const bike = bikeLifecycle({
state: {
_pointCollection: {},
_stationSet: {},
_overlayHost: { setVisible: noop },
_cityRuntime: new Map(),
_failedCityIds: new Set(),
@@ -3608,7 +3610,21 @@ test('actual Traffic, Bikeshare and Transit lifecycles retain sensitivity in eve
},
}).methods;
app.viewer.camera.moveEnd = new Cesium.Event();
const layers = { traffic, bikeshare: bike, transit: app.layer };
// Bikeshare listens through its renderer's camera port, at its own
// threshold: it takes no claim on the shared camera's sensitivity.
const bikeCamera = fakeCameraPort();
const bikeViewer = {};
const unbindBike = bindRenderer(bikeViewer, { camera: bikeCamera.port });
t.after(unbindBike);
const layers = {
traffic,
bikeshare: {
enable: () => bike.enable(bikeViewer),
disable: () => bike.disable(bikeViewer),
},
transit: app.layer,
};
const claimants = new Set(['traffic', 'transit']);
const orders = [
['traffic', 'bikeshare', 'transit'],
['traffic', 'transit', 'bikeshare'],
@@ -3623,8 +3639,13 @@ test('actual Traffic, Bikeshare and Transit lifecycles retain sensitivity in eve
const active = new Set();
for (const id of enable) {
layers[id].enable(app.viewer);
active.add(id);
assert.equal(app.viewer.camera.percentageChanged, 0.05);
if (claimants.has(id)) active.add(id);
if (id === 'bikeshare')
assert.equal(bikeCamera.listenerCount('changed'), 1);
assert.equal(
app.viewer.camera.percentageChanged,
active.size ? 0.05 : 0.5,
);
assert.deepEqual(
new Set(cameraSensitivityClaims(app.viewer.camera)),
active,
@@ -3643,6 +3664,7 @@ test('actual Traffic, Bikeshare and Transit lifecycles retain sensitivity in eve
active,
);
}
assert.equal(bikeCamera.listenerCount('changed'), 0);
}
} finally {
for (const layer of Object.values(layers)) layer.disable(app.viewer);