Add is_scrolling/is_smooth_scrolling util, checking for active scroll action.#7669
Add is_scrolling/is_smooth_scrolling util, checking for active scroll action.#7669
is_scrolling/is_smooth_scrolling util, checking for active scroll action.#7669Conversation
|
Preview available at https://egui-pr-preview.github.io/pr/7669-isseis-scrolling-util View snapshot changes at kitdiff |
emilk
left a comment
There was a problem hiding this comment.
Nice - thank you!
A future improvement here would be to store the modifiers at TouchPhase::Start and use that when interpreting scroll events (categorizing them as zoom, or horizontal scrolling, etc). That would solve a problem we currently have where letting go of the modifier key before the last momentum-scroll events arrive will cause the scroll direction to change. This problem can be seen by going to egui.rs and opening the "Scene" example. Hold down shift, start a momentum-scroll (on a Mac trackpad), then quickly let go of shift: you'll see the scroll direction change, which feels wrong.
Co-authored-by: Emil Ernerfeldt <[email protected]>
- is_scrolling -> is_raw_scrolling and moved functions around. - put is_in_scroll_action in an option, which is only some if we have recieved touch phase start. - Document what to set mouse wheel touch action to on unsupported platforms
Oh yeah 100% |
|
Doing some follow-ups in #7678 |
### Problem Letting go of the modifier key before the last momentum-scroll events arrive will cause the scroll direction to change. This problem can be seen by going to egui.rs and opening the "Scene" example. Hold down shift, start a momentum-scroll (on a Mac trackpad), then quickly let go of shift: you'll see the scroll direction change, which feels wrong. ### Solution Store the modifiers at the start of the event, thanks to the new `phase` info added in * #7669 Note that this solution only works on native; not on web. ### Other * Break out wheel/scroll handling into own file * Simplify it a lot by deciding late on wether an input is a scroll or a zoom * Assume input is already smooth if there are `phase` events
…roll action. (emilk#7669) * Closes emilk#7657 * [x] I have followed the instructions in the PR template On native this uses a new "touch phase" parameter of the mouse wheel event to know if a scroll action is done. --------- Co-authored-by: Emil Ernerfeldt <[email protected]>
Letting go of the modifier key before the last momentum-scroll events arrive will cause the scroll direction to change. This problem can be seen by going to egui.rs and opening the "Scene" example. Hold down shift, start a momentum-scroll (on a Mac trackpad), then quickly let go of shift: you'll see the scroll direction change, which feels wrong. Store the modifiers at the start of the event, thanks to the new `phase` info added in * emilk#7669 Note that this solution only works on native; not on web. * Break out wheel/scroll handling into own file * Simplify it a lot by deciding late on wether an input is a scroll or a zoom * Assume input is already smooth if there are `phase` events
On native this uses a new "touch phase" parameter of the mouse wheel event to know if a scroll action is done.