-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
[core] Some degrees issues on swipe gestures for web. #3154
Comments
@ubkp Is the above code from the screenshot example? I think it could be moved to a raylib example to illustrate usage. |
@raysan5 It is, although it's not very interactive (just printed the protractor to have some quick visual reference for the test). But I can make a better one. I'm currently debugging |
@ubkp ok, that would be great! |
@raysan5 Sorry it took long, but I've finished the example. Just sent a PR with it. Follow-up: Almost finishing sorting the |
@ubkp that's great! thank you very much for the improvement! |
Issue description
Upon taking a closer look at the swipe gestures handling, I noticed three issues:
GESTURE_SWIPE_DOWN
at rgestures.h#L317 to complete the 360°;GESTURE_SWIPE_RIGHT
range is 60° (0+30=30, 360-30=330), but theGESTURE_SWIPE_LEFT
range is 90° (180-60=120,180+30=210);30.0f
,120.0f
(that should be150.0f
),210.0f
and330.0f
degrees are not being considered.I believe these were the cause of some unexpected behavior I randomly experienced while testing the swipe gestures.
Proposed solution
The fix appears to be simple enough:
300
to330
at rgestures.h#L317 to complete the 360°;120
to150
at rgestures.h#L315 and rgestures.h#L316 so both sides range is 60°;>
to>=
at rgestures.h#L315 and rgestures.h#L317 so those angles get caught if they happen.Will send a PR with the proposed changes shortly.
Environment
Platform: Linux (x86_64)
Operating System: Linux Mint 21.1
OpenGL version: 3.1 Mesa 22.0.5
GPU: Intel HD Graphics 3000
Platform: Android
Operating System: Android 5.1.1
OpenGL version: OpenGL ES 1.1/2.0
GPU: Mali-400
Issue Screenshot
On Chrome (114.0.5735.106 64-bit) for Linux and on Chrome (95.0.4638.74) for Android:
Code Example
Minimal reproduction code to test the issue:
The text was updated successfully, but these errors were encountered: