summaryrefslogtreecommitdiff
path: root/ext/mixed/js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2019-12-07 17:41:14 +0200
committersiikamiika <siikamiika@users.noreply.github.com>2019-12-07 17:41:14 +0200
commite99c8c40a1b87e307d5365fe619fa1a71996b500 (patch)
tree927e35d938bcddac561a04dbc153bef00e84ae9c /ext/mixed/js
parentdf06251cb024a285c6ef27bf6b5dfc907afaef84 (diff)
navigate history with wheel only over buttons
Diffstat (limited to 'ext/mixed/js')
-rw-r--r--ext/mixed/js/display.js21
1 files changed, 13 insertions, 8 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index 7d5e4e7d..6e2c8e6a 100644
--- a/ext/mixed/js/display.js
+++ b/ext/mixed/js/display.js
@@ -211,14 +211,18 @@ class Display {
e.preventDefault();
}
} else if (e.shiftKey) {
- const delta = -e.deltaX || e.deltaY;
- if (delta > 0) {
- this.sourceTermView();
- e.preventDefault();
- } else if (delta < 0) {
- this.nextTermView();
- e.preventDefault();
- }
+ this.onHistoryWheel(e);
+ }
+ }
+
+ onHistoryWheel(e) {
+ const delta = -e.deltaX || e.deltaY;
+ if (delta > 0) {
+ this.sourceTermView();
+ e.preventDefault();
+ } else if (delta < 0) {
+ this.nextTermView();
+ e.preventDefault();
}
}
@@ -301,6 +305,7 @@ class Display {
this.addEventListeners('.kanji-link', 'click', this.onKanjiLookup.bind(this));
this.addEventListeners('.source-term', 'click', this.onSourceTermView.bind(this));
this.addEventListeners('.next-term', 'click', this.onNextTermView.bind(this));
+ this.addEventListeners('.term-navigation', 'wheel', this.onHistoryWheel.bind(this), {passive: false});
if (this.options.scanning.enablePopupSearch) {
this.addEventListeners('.glossary-item', 'mouseup', this.onGlossaryMouseUp.bind(this));
this.addEventListeners('.glossary-item', 'mousedown', this.onGlossaryMouseDown.bind(this));