15

I'm running Three.js r69 with the bundled OrbitControls.js. I have a simple scene with a couple of objects that are selectable. I'd like to be able to disable zooming while an object is selected and re-enable it once I've cleared the selection.

I'm working on a temporary solution, but it involves editing the OrbitControls.js code. This could make it really annoying to upgrade to a new version of Three.js, especially if OrbitControls is ever changed.

Is there currently a way to enable/disable certain features (like zooming, panning, or orbiting) on the fly, independently of each other?

Justin
  • 1,881
  • 4
  • 20
  • 40

2 Answers2

39

Is simple:

controls = new THREE.OrbitControls( camera );

// to disable zoom
controls.enableZoom = false;

// to disable rotation
controls.enableRotate = false;

// to disable pan
controls.enablePan = false;
meirm
  • 1,241
  • 14
  • 21
1

If you're editing the source you must have seen noZoom and noPan.

And this post shows how to constrain rotation.

Do these not meet your need?

Community
  • 1
  • 1
Bob Woodley
  • 1,246
  • 15
  • 30