OrbitControls - Can I enable / disable scaling dynamically?

I am running Three.js r69 with OrbitControls.js enabled. I have a simple scene with several objects that can be selected. I would like to turn off scaling while the object is selected and turn it back on as soon as I clear the selection.

I am working on a workaround, but it includes editing the OrbitControls.js code. This can be annoying when upgrading to the new version of Three.js, especially if OrbitControls is ever changed.

Is there a way to enable / disable some functions (e.g. zooming, panning, or cycling) on ​​the fly independently of each other?

+6
source share
2 answers

Simple:

controls = new THREE.OrbitControls( camera ); // to disable zoom controls.enableZoom = false; // to disable rotation controls.enableRotate = false; // to disable pan controls.enablePan = false; 
+9
source

If you are editing the source , you should see noZoom and noPan.

And this post shows how to limit rotation.

Do they fit your needs?

+1
source

Source: https://habr.com/ru/post/979418/


All Articles