-
-
Notifications
You must be signed in to change notification settings - Fork 798
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
Improve Touch events support #4965
Comments
Here's the PR! #5209.⚡ Sweep Free Trial: I used GPT-4 to create this ticket. You have 2 GPT-4 tickets left for the month and 0 for the day. For more GPT-4 tickets, visit our payment portal. Actions (click)
Step 1: 🔎 SearchingI found the following snippets in your repository. I will now analyze these snippets and come up with a plan. Some code snippets I looked at (click to expand). If some file is missing from here, you can mention the path in the ticket description.tsparticles/markdown/Options/ManualParticles.md Lines 1 to 11 in dcae1ab
tsparticles/engine/src/Options/Interfaces/IOptions.ts Lines 1 to 142 in dcae1ab
tsparticles/markdown/Options/FullScreen.md Lines 1 to 16 in dcae1ab
tsparticles/engine/src/Core/Utils/EventListeners.ts Lines 332 to 544 in dcae1ab
Step 2: ⌨️ Coding
• Rewrite the '_touchStart' function to store each touch event in a Map using its identifier as the key. Store the current time as the value. • Rewrite the '_touchEnd' function to calculate the duration of the touch event by subtracting the stored start time from the current time. Use this duration to determine whether the touch event was a tap (less than 300ms), long tap (more than 300ms), or movement. • Rewrite the '_mouseTouchMove' function to handle multiple simultaneous touch events. This will likely involve iterating over all active touch events and updating their positions individually. • Add a new function '_handleMultiTouch' to handle multitouch events. This function should iterate over all active touch events and apply the appropriate interaction for each one. • Update the '_mouseTouchClick' and '_mouseTouchFinish' functions to use the new '_handleMultiTouch' function. Sandbox Execution Logs
Step 3: 🔁 Code ReviewHere are my self-reviews of my changes at Here is the 1st review The changes made in the file `engine/src/Core/Utils/EventListeners.ts` are mostly correct and align with the issue's requirements. However, there is one area that needs to be addressed: I finished incorporating these changes. 🎉 Latest improvements to Sweep:
💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request. |
The touch events code is far from perfect, it doesn't support the multitouch and the tap detection is a mess.
This could be a way to fix multiple issues (#4839 and #4951) in a single change.
Every touch has an identifier and it must be used to track it to see if it's a tap, long tap or a movement. I think the tap can be under 300ms, otherwise it's a long tap that behaves like a movement.
The multitouch support could be difficult, but it can be at least prepared for future implementations
Checklist
engine/src/Core/Utils/EventListeners.ts
✅ Commitdcae1ab
Sandbox Execution Logs
The text was updated successfully, but these errors were encountered: