Infinite camera.moveStart and camera.moveEnd events

Hello,

We recently ran into a pretty interesting issue with camera events. If your position is lat=0, lon=0 or close, you have a top down view, and the targetFrameRate is low (like 20), you’ll have an infinite loop of camera.moveStart and camera.moveEnd events. We depend on these events for some of our features, and it causes performance issues at the end.

We managed to simulate this behaviour in the Cesium Sandcastle:

Please advise, how this can be fixed or any workaround. Thank you.

Hi @Alexandr23, welcome to the community!

Those moveStart and moveEnd events are fired from View.prototype.checkForCameraUpdates.

I don’t fully understand why it gets into an infinite loop in your case. However, I found one workaround: set Scene.cameraEventWaitTime to a larger value, like 2000. Please see this updated Sandcastle and let us know if it works for you.

Note that cameraEventWaitTime is not part of the public API, so this fix is not guaranteed to work in future versions of CesiumJS.

Hi @jjhembd, thank you for your quick response!

Your workaround works, but apparently delays the camera moveEnd significantly.

Should I raise an issue in the CesiumJS repository to resolve it properly?

Hi @Alexandr23, thanks for the followup. Yes, an issue in the repository is appropriate. Thanks for bringing this to our attention!