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

+3 -3
View File
@@ -1,5 +1,5 @@
import { toRadians } from './geo/index.js';
import { cameraOf, findCamera } from './render/rendererOf.js';
import { cameraOf, findCamera, frameOf } from './render/rendererOf.js';
import {
holdContinuousRender,
releaseContinuousRender,
@@ -7,7 +7,7 @@ import {
/**
* OrbitController — smooth orbit around a target point.
* Uses scene.preRender for frame-rate-independent 60fps updates.
* Uses the frame port's preRender for frame-rate-independent 60fps updates.
* Toggle with O key; auto-stops on POI/city change.
*/
export class OrbitController {
@@ -50,7 +50,7 @@ export class OrbitController {
this.angle = pose.heading;
let lastTime = Date.now();
this._removeListener = this.viewer.scene.preRender.addEventListener(() => {
this._removeListener = frameOf(this.viewer).on('preRender', () => {
if (!this.active) return;
const now = Date.now();