Migration of viewer.cameraHandler to Viewer API 2.0

Hey All,

I’ve been in the process of migrating my old codebase across to viewer API 2.0.
I noticed that several functions such as the ability to zoom into objects via the objectIDs is now a protected method. And I couldn’t quite find whereabouts to interact with the cameraHandler in the new API.

I’m hoping to programmatically interact with the camera handler.

Hi @shuzmm

We’ve updated the migration guide for anybody who wants to update existing apps to API 2.0. It specifically doesn’t go into details, just advises about what changed and how. It might have missed some things, and if that’s the case, do let us know!

As always, your feedback is valuable and we’re here if you have other questions



Hey @alex, I noticed the is orbiting implementation which was an event listener on the constructed camerahandler had been removed.

Would the implmenetation below replicate that??


Hi @shuzmm

I believe that would replicate the original implementation using the controls library events. However there is another built in way of getting this sort of information from the camera controller by using CameraControllerEvents emitted by the CameraController extension directly. So you would have something like this

let isOrbiting = false
cameraController.on(CameraControllerEvent.Dynamic, () => {
  isOrbiting  = true
cameraController.on(CameraControllerEvent.Stationary, () => {
  isOrbiting  = false

Ultimately, both approaches do the same thing, the difference being that CameraControllerEvents are emitted by listening on multiple internal controller events (like ‘transitionStart’) so in theory they should be more reliable when in come to camera motion singnaling.

Generally speaking, using the controls from the camera controller extension directly would be discouraged if you ask me, since it’s a specific implementation that will be replaced in the future with possibly no backwards compatibility