Drive the camera orbit and the FPS readout through the frame port

The orbit controller and the frame-rate monitor had left the Cesium
allow-list but still hooked the scene's preRender and postRender events.
They now listen through the frame port; the monitor looks the port up
each time it is shown, so a renderer bound after it was created is the
one it counts.
This commit is contained in:
Sameh Khamis committed 2026-11-07 01:04:47 -08:00
1 parent d0aa8d8f7d
commit 30b6be1da0
4 files changed
+20 -7

No files matched your search

+7 -1
View File
@@ -8,6 +8,8 @@ import { createPinia } from 'pinia';
import { useStatusStore } from './stores/status.js';
import { createFrameRateMonitor } from './frameRateMonitor.js';
import SceneChromeView from './views/SceneChromeView.vue';
import { bindRenderer } from '../render/rendererOf.js';
import { fakeSceneFrame } from '../testSupport/fakeCesiumScene.mjs';
test('the FPS readout sits in the title bar, hidden until the backquote key', async (t) => {
document.body.replaceChildren();
@@ -18,8 +20,12 @@ test('the FPS readout sits in the title bar, hidden until the backquote key', as
const readout = () =>
document.querySelector('#title-bar .frame-rate-readout');
assert.equal(readout(), null, 'no readout without a monitor');
const viewer = {
scene: { postRender: { addEventListener: () => () => {} } },
};
bindRenderer(viewer, { frame: fakeSceneFrame(viewer) });
const monitor = createFrameRateMonitor({
viewer: { scene: { postRender: { addEventListener: () => () => {} } } },
viewer,
store: useStatusStore(pinia),
});
t.after(() => monitor.destroy());