Keep mouse-wheel scroll position when clicking a tree node#1159
Open
bowenr-deshaw wants to merge 1 commit into
Open
Keep mouse-wheel scroll position when clicking a tree node#1159bowenr-deshaw wants to merge 1 commit into
bowenr-deshaw wants to merge 1 commit into
Conversation
Scrolling the TreeView with the mouse wheel and then clicking a node caused the view to snap the selection back into view on the redraw triggered by the button-press, so the following click selected the wrong node. Track user scrolls and skip the scroll-into-view step until the selection actually changes (resizes and tree changes still scroll into view, as they do not set userScrolled). Fixes rivo#1044
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.
Fixes #1044
After scrolling a TreeView with the mouse wheel and then clicking a
visible node, the wrong node ends up selected. The mouse button-press
triggers a redraw, and
process()scrolls the selected node back intoview before the click is resolved, which shifts the rows out from under
the cursor so the following click lands on a different node.
This tracks when the user has scrolled with the mouse wheel and skips the
scroll-into-view step in
process()while that is the case. The flag isreset as soon as the selection actually changes, so keyboard navigation,
resizes, and changes to the tree still move the selection into view as
before.
To reproduce, build a tree taller than its viewport, scroll with the
mouse wheel until the selected node is off-screen, and click a visible
node. Before this change a different node is selected.
Listbox doesn't have this issue anymore so no changes are needed there.