-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Remove mousemove event onPointerMove function in TransformControls #16482
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
Conversation
|
Can you explain the bug you're running in to? It's not immediately clear looking at your other issue. |
|
hopefully this isn't more confusing: the problem:
the breakdown of solution was:
so simply adding to the dispose in TransformControls.js: fixes it |
|
Okay it sounds like the fundamental issue is that in certain conditions the TransformControls leaves a lingering event on You can reproduce the sticky behavior in Chrome here:
Interestingly I can't reproduce this when the example is not embedded in an iframe in chrome -- it must have to do with how events are delegated. In Firefox it works as expected in both cases. I think one solution is to add a "mouseenter" callback to the document that checks if the mouse button is pressed and if it's not then remove the "mousemove" event. That way if the user does click drag out of the window and release the event will get removed when hovering over the window again. I'm not sure how tightly we want to consider these two issues but that solution may help with your issue, as well. |
|
This behaves differently again in Edge - when moving the mouse over the menu while dragging the position of the cube "jumps". So we have different behaviour in Chrome, Firefox and Edge, only Firefox is correct. |
|
I think this PR should be merged regardless of the sticky behavior which I can fix in a separate PR. I think it is a good practice to dispose all event listeners just in case |
|
Interesting... the sticky behavior happens only if Edit: it appears to be this preventDefault() shomehow blocks the correct behavior. I'm not sure why. |
|
Thanks! |
|
Hey @WestLangley, I noticed you added this line. Would it be possible to remove it since it causes sticky behavior when releasing drag outside an iframe? The comment says "Prevent the browser from scrolling." Is that intended for touch scroll? |
|
It seems like it should be possible to achieve both use cases. I wonder why that line would be causing sticky behavior. |
|
@gkjohnson I'm not sure why it is but you can clearly see in this fiddle. With |
|
My theory is that mousedown event "captures" the pointer so that while you are dragging, mouse events keeps getting dispatched to the original iframe as you drag outside. I you |
|
The comment in the OrbitControls is wrong. My bad. The line itself is old If you remove the line you can probably remove the line after as well. I did a quick test with it removed and I didn't notice anything but I might have missed what it's for. Things it might have been for? It might have been for stopping selection a long time ago before |
This PR remove mousemove event onPointerMove function in TransformControls. A bug we ran into at exokitxr/exokit#1065 while using TransformControls.