navigate history with wheel only over buttons

This commit is contained in:
siikamiika 2019-12-07 17:41:14 +02:00
parent df06251cb0
commit e99c8c40a1

View File

@ -211,6 +211,11 @@ class Display {
e.preventDefault();
}
} else if (e.shiftKey) {
this.onHistoryWheel(e);
}
}
onHistoryWheel(e) {
const delta = -e.deltaX || e.deltaY;
if (delta > 0) {
this.sourceTermView();
@ -220,7 +225,6 @@ class Display {
e.preventDefault();
}
}
}
onRuntimeMessage({action, params}, sender, callback) {
const handlers = Display.runtimeMessageHandlers;
@ -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));