-
-
Notifications
You must be signed in to change notification settings - Fork 3.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
Event Ordering for touch and mouse events #7378
base: dev-2.0
Are you sure you want to change the base?
Conversation
@davepagurek @limzykenneth I've tried to maintain the original behavior that these issues aim to address. We also discussed the deprecation of |
If there are no special differences between |
I've removed them from |
02ebb48
to
0b078e9
Compare
It probably can mention supporting touch as well although there may not be practical differences. |
0b078e9
to
3d833d1
Compare
3d833d1
to
b6c0967
Compare
src/core/main.js
Outdated
mousemove: null, | ||
mousedown: null, | ||
mouseup: null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these and the touch ones below still need to be here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes! I missed these during the cleanup. But I think we need the touch ones for the touches[]
array since we're handling multiple touches with touch events. I've removed the mouse events.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it would be possible to implement touches[]
with pointer events as well, essentially caching the events as they come in, perhaps something like described here: https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events/Multi-touch_interaction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the local test sketches you tried are working as intended then it should be fine for now, you can try to fix the tests if it is easy to do but that's not a priority as I may need to rewrite them later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized later that if I implement touches with pointer-events then onpointerup()/down()/move()
exists in both mouse.js and touch.js and mousePressed()/Released()
stops working. I think this is because, for sketches, these events fire from both touch.js
and mouse.js
in parallel. So, maybe the choice lies between having one file pointer.js
/ one file which would have pointer events for touches and mouse or letting the touches be decoupled by using touch events.
I did try a pointer.js
handling touches and mouse on the basis of event.pointerType
and everything seems to work. Let me know if I should go with this approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, let's go with just one file pointer.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested the examples and they seem to work fine.
For the test we'll probably transition to use Vitest Browser Mode Interaction API but I can handle that after this is completed. |
2f18a47
to
6f36037
Compare
Resolves #7260 and #7195
Changes:
Description:
I have tested all the examples given for both the issues above on an Android device, and Windows. The outputs are same for both the touch device, and mouse.
Screenshots of the change:
PR Checklist
npm run lint
passes