Skip to content
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

Fix pinch gestures for web #3153

Merged
merged 1 commit into from Jul 4, 2023
Merged

Fix pinch gestures for web #3153

merged 1 commit into from Jul 4, 2023

Conversation

ghost
Copy link

@ghost ghost commented Jul 4, 2023

Adds previousPositionA and previousPositionB to the rgestures.h's Touch struct to keep track of the previous Pinch positions. Didn't want to try to reuse downPositionA and downPositionB for this case to not break the other gestures that use them and are working properly.

Assign the values of previousPositionA and previousPositionB during the event.touchAction == TOUCH_ACTION_DOWN instead, so they can exist before the event.touchAction == TOUCH_ACTION_MOVE.

Removes the now no longer used GESTURES.Touch.downPositionA and GESTURES.Touch.downPositionB assigns inside the event.touchAction == TOUCH_ACTION_MOVE.

Changes the MINIMUM_PINCH check to now use the previousPositionA and previousPositionB.

Changes the criteria to define if it's GESTURE_PINCH_IN or GESTURE_PINCH_OUT by checking the distance between previousPosition and moveDownPosition. If previousPosition distance is larger than moveDownPosition distance, then it's a GESTURE_PINCH_IN, else it's a GESTURE_PINCH_OUT.

Fixes #1963.

@SAOMDVN
Copy link
Contributor

SAOMDVN commented Jul 4, 2023

Worked on Safari on iOS 16!

@raysan5 raysan5 merged commit dd2d64e into raysan5:master Jul 4, 2023
12 checks passed
@raysan5
Copy link
Owner

raysan5 commented Jul 4, 2023

@ubkp thanks for the review! great improvement! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[gestures] Pinch In and Pinch Out are messy
2 participants