-
Notifications
You must be signed in to change notification settings - Fork 560
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 click drag on touch + WebBrowsers #563
Fix click drag on touch + WebBrowsers #563
Conversation
Just a clarification - the video recording of your setup is before or after applying this patch? It looks horrendously jumpy - "touch and drag" makes the window resize seemingly in the next frame and first then starts the actuall "resize" operation from there on. |
Ohh, should have led with that^^ |
I have to admit I do not have any quick way to test this now. Would you mind if I left this PR opened until someone picks it up and tests it? It sounds too important to make a mistake - so I would rather want others to test it with several backends on mobile as well as non-mobile devices. |
Sure 👍 Since the Nuklear WebApp is autocompiled via GitHub actions and auto-published via GitHub pages, you can just make changes to compare right in GitHub and watch it being deployed 5 mins later automatically. https://github.com/FrostKiwi/frostorama/actions/runs/5377023469/jobs/9754955853 The SDL2 demo within this repo should show the same behavior: https://github.com/Immediate-Mode-UI/Nuklear/tree/master/demo/sdl_opengles2 You can test via a mobile, touch enabled device or by going into chrome and turning on mobile device emulation in the dev panel. The crux of the bug stems from the way input is not being updated, even though the event and rendering loop are, which is an optimization that browsers perform, leading to big deltas being computed in this line Line 53 in ca2a260
|
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 think this makes sense. The issue could happen if you're moving the mouse and then initiate the drag at the same time? Tested locally, and while I wasn't quite able to reproduce the issue, I was able to confirm things are still working.
After a bit more testing, I think this is good to go. Let's merge this, and then revert if there are reports of mouse movement being borked. |
Thanks @RobLoach for spending some time with & merging this (also all the other PRs recently). Really appreciated! |
This one has been driving me insane. Each time I tested my WebApp on a touch device, like a Smartphone, tablet, iPad, what have you, Window resizing and the property click-drag behavior was busted. Touch works a bit differently on Webbrosers and doesn't update the mouse position regularly, which leads to huge deltas, as Nuklear just saves the previous frame's mouse position.
This PR fixes this by setting the drag during the click part of the click-drag to zero. This fixes the breaking behaviour in the video below. Thanks to Chrome's mobile device emulation, I tracked it down. Why this doesn't occur on Scrollbars and Window dragging, I'm not sure, but this seems to be a fix without having a negative effect on other things.
2023-06-26.19-46-09.1.mp4