How can I prevent zooming in/out using an interactor style?

I need to set min and max zoom levels for the application that I work on. It uses the InteractorStyleTrackballCamera and I’d like to be able to stop the zooming in and out once a certain min/max zoom level is reached.

Is there a way to do that?

I realize that the interactor has some events* that I subscribe to, but it doesn’t seem that there is an option to stop the zooming (dolly?).

* I am aware of these events triggering on user navigation:
interactor.onStartMouseWheel(mapChange),
interactor.onEndMouseWheel(mapChange),
interactor.onMouseWheel(mapChange),
interactor.onPinch(mapChange),
interactor.onPan(mapChange),
interactor.onMouseMove(mapChange),

I figure that there is no such thing as “zoom level” in 3D. The solution I am looking for above is for our app’s 2D mode, where the VTK.js viewer is locked to only move along a vertical axis towards a 2D projected map (kept in sync with OpenLayers 2D map view) thus simulating a 2D viewer. OpenLayers is kept in sync with the event subscriptions mentioned above by a previous developer who left the team and I struggle to wrap my head around VTK.js.

I want to stop VTK.js from moving the camera any closer to the 2D map than a certain limit. IE the distance from the camera to the 2D plane will determine that.

You will likely have to modify/extend the InteractorStyleTrackballCamera to include a property for maximum zoom, where 2D zoom (using orthographic projection) should depend on the value of the camera’s parallel scale (camera.getParallelScale()).

Thanks. I was hoping not to “copy and modify” existing modules in VTK.js. We already have a few of those and they are harder to maintain and could break with future updates of VTK.js. When I read through such copied & modified modules by our previous team member, I struggle to wrap my head around it.