Skip to content

Conversation

@emilk
Copy link
Owner

@emilk emilk commented Oct 31, 2025

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

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

@emilk emilk added the egui label Oct 31, 2025
@github-actions
Copy link

github-actions bot commented Oct 31, 2025

Preview available at https://egui-pr-preview.github.io/pr/7678-emilkscroll-refactor
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

View snapshot changes at kitdiff

@emilk emilk changed the title Make InputState::smooth_scroll_delta into a function Improve modifier handling when scrolling Oct 31, 2025
@emilk emilk marked this pull request as ready for review October 31, 2025 13:51
@emilk emilk requested a review from IsseW October 31, 2025 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants