diff options
| author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-10-02 20:57:48 -0400 | 
|---|---|---|
| committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-10-02 21:12:24 -0400 | 
| commit | 7380ada1f12c382d423133c2e9142f36a6634067 (patch) | |
| tree | c4f29eedf1c30654d7d2e237710b1aab47b22699 | |
| parent | 0d6177398d0a738430a555ce307ba0a61c15bf9a (diff) | |
Simplify onWheel handler
| -rw-r--r-- | ext/mixed/js/display.js | 18 | 
1 files changed, 5 insertions, 13 deletions
| diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index eb40a5df..dc64dbea 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -161,20 +161,12 @@ class Display {      }      onWheel(e) { -        const handler = () => { -            if (e.altKey) { -                if (e.deltaY < 0) { // scroll up -                    this.entryScrollIntoView(this.index - 1, null, true); -                    return true; -                } else if (e.deltaY > 0) { // scroll down -                    this.entryScrollIntoView(this.index + 1, null, true); -                    return true; -                } +        if (e.altKey) { +            const delta = e.deltaY; +            if (delta !== 0) { +                this.entryScrollIntoView(this.index + (delta > 0 ? 1 : -1), null, true); +                e.preventDefault();              } -        }; - -        if (handler()) { -            e.preventDefault();          }      } |