-
Notifications
You must be signed in to change notification settings - Fork 494
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
sokol_app.h: Scroll event amounts are inconsistent between browsers #339
Comments
Yeah I noticed this too, but haven't investigated, so many thanks for doing that :) It seems like mouse movement and resolution is generally quite a mess to get consistent across platforms (also when using the native APIs), but if there are hints like this (e.g. the deltaMode), then we should make use of it. I'm currently working on a pointer-lock feature (in the branch pointer-lock-2), and since I'm dealing with mouse stuff there anyway I'll integrate your fix there (I'll also need to read up on this deltaMode thing first). |
Ok, I've added your fix to sokol_app.h, it's currently in the branch |
You can test the fix here: https://floooh.github.io/sokol-html5/cgltf-sapp.html (I should add some smoothing to the camera zoom though). I guess this feature will close automatically when the pointer-lock-2 branch is merged (should happen in the next few days). |
Cool thanks! Seems consistent to me now! |
...and this has just been merged. |
The scroll event doesn't take the wheel event units into account resulting in Firefox scrolling a lot slower than Chrome (on Windows).
I have fudged the values to be consistent with what the Win32 backend returns on Windows, I didn't test
DOM_DELTA_PAGE
as I didn't happen to have a browser that emits it handy:https://github.com/bqqbarbhg/spear/blob/ab4b57edd4cc622bd9b933cb17bb89e188fe9e43/src/ext/sokol/sokol_app_impl.h#L2110-L2124
This might break existing user code depending on the scroll unit behavior (especially if changing the Chrome's
DOM_DELTA_PIXEL
unit from-0.1f
). Feel free to swipe the snippet and/or tweak the values to your liking if you're interested :D I can also do a PR for this if it's easier.The text was updated successfully, but these errors were encountered: