Always honor scroll intent on mousewheel

This commit introduces a change in the way we respond to mousewheel
events. In particular, if `delta * scrollSensitivity` is less than 1 or
greater than -1, we will round it up or down in an attempt to honor the
user's scroll intent.
This commit is contained in:
Antonio Scandurra
2017-08-29 13:39:11 +02:00
parent 90f872ae1c
commit 76e2e03139
2 changed files with 40 additions and 3 deletions

View File

@@ -1511,11 +1511,15 @@ class TextEditorComponent {
let {deltaX, deltaY} = event
if (Math.abs(deltaX) > Math.abs(deltaY)) {
deltaX = deltaX * scrollSensitivity
deltaX = (Math.sign(deltaX) === 1)
? Math.max(1, deltaX * scrollSensitivity)
: Math.min(-1, deltaX * scrollSensitivity)
deltaY = 0
} else {
deltaX = 0
deltaY = deltaY * scrollSensitivity
deltaY = (Math.sign(deltaY) === 1)
? Math.max(1, deltaY * scrollSensitivity)
: Math.min(-1, deltaY * scrollSensitivity)
}
if (this.getPlatform() !== 'darwin' && event.shiftKey) {