fix: mouse wheel responds on the first tick after a direction change - #21807
Open
Arecsu wants to merge 1 commit into
Open
fix: mouse wheel responds on the first tick after a direction change#21807Arecsu wants to merge 1 commit into
Arecsu wants to merge 1 commit into
Conversation
The discrete scroll accumulators (both the event controller proxy used by bauhaus sliders/dropdowns and dt_gui_get_scroll_unit_deltas) kept the signed fractional remainder from the previous scroll direction. After reversing direction, the first tick was silently spent cancelling that stale remainder, so it did nothing and a second tick was needed before the value changed. Drop the accumulated remainder when the incoming scroll delta changes sign, so the new direction takes effect on its very first tick.
1 task
Contributor
Author
|
Need help to test if this solves #21390 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mouse wheel scrolling of bauhaus sliders and dropdowns ignored the first tick after a direction change: scroll down three notches, then one notch up — the up notch does nothing, and only the second one moves the value back. Same in reverse, and it affects dropdown popups and the alt/ctrl/shift zoom-range shortcuts too.
The new discrete scroll proxy accumulates attenuated wheel deltas and only emits a step once the accumulator crosses ±1.0, keeping the fractional remainder from the previous direction. On a direction change that remainder has to be cancelled first, so the first tick of the new direction is spent doing nothing. Released versions handled mouse wheel notches as exact ±1 cardinal events that never went through the accumulator, which is why this never happened before.
The fix drops the accumulated remainder as soon as the incoming delta changes sign:
dt_gui_get_scroll_unit_deltas()(thumbtable, gradientslider, darkroom scroll-zoom, scroll shortcuts) gets the same handling for smooth/touchpad input, which had the identical lag.No behavior changes for scrolling within a single direction.
Could fix #21390