How to make trackball controls pan by default?

I’m wondering if there’s some way to specify the .keys, .mousebuttons, or some other attribute of the trackball controls in three/examples/js/controls/TrackballControls so as to make the trackball controls pan by default instead of rotating by default?

I know I could just swap the callbacks in the TrackballControls source code, but I’d like to just import the module in a webpack setup, and modifying the source of the controls in a postinstall hook or something similar would be super hacky. If there’s a more elegant way to make the trackball controls pan by default, I’d be grateful if anyone could provide a little pointer explaining how it can be done!

Are you looking for this: https://jsfiddle.net/cu5tdLmv/1/

The fiddle configures TrackballControls like so:

controls.mouseButtons.LEFT = THREE.MOUSE.PAN;
controls.mouseButtons.MIDDLE = THREE.MOUSE.ZOOM;
controls.mouseButtons.RIGHT = THREE.MOUSE.ROTATE;
1 Like

Yes sir, that’s the one! Thanks very much @Mungen87!

1 Like