drei icon indicating copy to clipboard operation
drei copied to clipboard

ScrollControls doesn't work on mobile if you activate OrbitControls at some point

Open dswhy opened this issue 1 year ago • 1 comments

Hello everyone,

Context

My app has two modes:

  • In mode A it uses ScrollControls to move around a model, it is the default mode
  • In mode B it uses OrbitControls to give the user control over it

Expected behavior

I am able to switch back and forth, enabling OrbitControls when going into mode B and disabling it when going back into mode A by setting the prop enabled to true or false. It works in both Desktop and Mobile.

Actual behavior

I am able to switch back and forth in Desktop with no problems. In Mobile, whenever OrbitControls is present - even if disabled -, it seems to take over all touch events, preventing scrolling. Conditionally rendering OrbitControls doesn't help, since the event listener seem to linger even if it's gone or disabled. Using the method dispose when disabling OrbitControls breaks it forever (is there a method to re-connect it to events?), and it also seems to disconnect the events for ScrollControls.

Is this a bug or is there a workaround?

Cheers and thank you in advance

dswhy avatar Mar 21 '23 10:03 dswhy

Experiencing it as well. im using react-three-drei 9.1

briosoemilio avatar Apr 14 '24 04:04 briosoemilio