-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update OrbitControls.js to be in compliance with default browser behavior #18612
Conversation
removed event.preventDefault() from onTouchStart(event) to contain default behavior of "https://developer.mozilla.org/en-US/docs/Web/API/Touch_events/Supporting_both_TouchEvent_and_MouseEvent" changed document.add/removeEventListener to scope.domElement for consistency in code changed == to === for js conditions
Can you please explain in more detail what you mean by that? |
I meant to remove the preventDefault() because the eventorder (see the link) would not call the mouse/click events. |
Okay, thanks for this bit. So when removing In the past we have encountered some back and forth in context of However, if @mrdoob and @WestLangley think the change is appropriate, I won't block it. |
Yeah i thought this could be useful because then ThreeJS would have the same (default) behavior as every browser on touch-devices. |
You can see where preventDefault is important for touchstart/touchmove in https://threejs.org/examples/webgl_multiple_elements.html Without preventDefault when you try to touch an object to orient it the page will scroll under your finger making it difficult to orient the objects. With preventDefault just the objects move, the page does not. Maybe add a comment what the point is? Or maybe make that sample add it's own event handlers? Seems to me if you're usng the OrbitControls that's the behavior you'd want. |
That sounds like a good idea. |
removed event.preventDefault() from onTouchStart(event) to be in compliance with the behavior of "https://developer.mozilla.org/en-US/docs/Web/API/Touch_events/Supporting_both_TouchEvent_and_MouseEvent"
changed document.add/removeEventListener to scope.domElement for consistency in code
changed == to === for js conditions