Fix strange behavior when scrolling downward at low-speed with trackpad#131231
Merged
alexdima merged 1 commit intomicrosoft:mainfrom Aug 23, 2021
Merged
Fix strange behavior when scrolling downward at low-speed with trackpad#131231alexdima merged 1 commit intomicrosoft:mainfrom
alexdima merged 1 commit intomicrosoft:mainfrom
Conversation
Member
|
Thank you! |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This PR fixes microsoft/monaco-editor#2623 and similar misbehavior in VSCode up to 1.60.0-insider (i.e., editor will not respond to low-speed two-finger scrolling).
When scrolling with trackpad two-figure scrolling, or in the ending phase of an inertial scrolling, small floating pointing numbers of
deltaX/deltaYwill be fed to the handler. When the number is small enough, thescrollTop/scrollLeftwill change by a value less than 1.vscode/src/vs/base/browser/ui/scrollbar/scrollableElement.ts
Lines 411 to 421 in 44129da
Unfortunately, the
validateScrollPositionmethod, which internally callsnew ScrollState(), will simply round-down the input value.vscode/src/vs/base/common/scrollable.ts
Lines 64 to 69 in 8be960c
Therefore, for upward scrolling, users can get a smooth scrolling experience. However, for downward scrolling, VSCode/Monaco will not respond to such scrolling requests when its speed is below a certain level. With the default settings, the speed threshold is relatively high. In some cases, the difficulty of scrolling down in VSCode/Monaco is quite noticeable. For Monaco, this also means that under certain configurations such low-speed scroll events are passed to other HTML elements, causing unexpected scrolling of other elements.
This PR ensures that low-speed scrolling events from user/inertial scrolling are correctly responded to by introducing active symmetric rounding (round away from zero). The behavior is consistent with the original VSCode/Monaco upward scrolling behavior. No disruptive changes to the user experience are expected.