Disable Pan Zoom Rotate
In a ThreeJs scene you might want to lock down certain camera motions.
Using the standard
OrbitControls controls system, you’d have something like this setup for your controls in the scene:
controls = new OrbitControls(camera, container)
Controls have 3 basic movements available - zoom, pan, and rotate.
It’s easy to disable each of these directly like so:
controls.enableZoom = false controls.enablePan = false controls.enableRotate = false
Disabling all three of the movement types effectively locks the camera in place, which is great if you want to take control of the view for something specific.
The most notable benefit of this - normally with Zoom enabled, the canvas will capture any scroll events and interpret them as zoom in/out motion. For users on a page with a viewer in the content area, this can easily disrupt the scrolling down.
controls.enableZoom = false unbinds the scroll input listeners, so scrolling down a page behaves unaffected by the viewer. Super!