How to limit the orbcontrols' scope to specific area in three.js

Hello, everybody.
I tried house visualizer as I mentioned in previous topic.
So my problem is how can I limit the orbitcontrols’ working area to local area.
To be honest, orbitcontrols’ drag(mousemove) event is efficient in whole window.


But I want to limit this scope to only canvas.
Is there any solution for this?

Can you please show how you create the instance of OrbitControls in your app?

1 Like

Pass your canvas element in the second parameter of the constructor like

new THREE.OrbitControls( camera, canvas );

2 Likes

Yeah, great. Perfect.
It works well.
thanks for your help, Mr. Fyrestar.