summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2019-11-28 13:22:47 +0200
committersiikamiika <siikamiika@users.noreply.github.com>2019-11-28 13:22:47 +0200
commit4e7d08ff2c184a361622a6efaf00e21af51428a9 (patch)
treeec9d6ed9e0e0bc12cc09bf815884ceda50465056
parente37ffb6cf5796fc45787046830d84b9d316c0186 (diff)
set current entry even when disableScroll is true
-rw-r--r--ext/mixed/js/display.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index 27100fd2..ed3d9adc 100644
--- a/ext/mixed/js/display.js
+++ b/ext/mixed/js/display.js
@@ -360,6 +360,8 @@ class Display {
const {index, scroll, disableScroll} = context;
if (!disableScroll) {
this.entryScrollIntoView(index || 0, scroll);
+ } else {
+ this.entrySetCurrent(index || 0);
}
if (options.audio.enabled && options.audio.autoPlay) {
@@ -465,7 +467,7 @@ class Display {
}
}
- entryScrollIntoView(index, scroll, smooth) {
+ entrySetCurrent(index) {
index = Math.min(index, this.definitions.length - 1);
index = Math.max(index, 0);
@@ -479,9 +481,16 @@ class Display {
entry.classList.add('entry-current');
}
+ this.index = index;
+
+ return entry;
+ }
+
+ entryScrollIntoView(index, scroll, smooth) {
this.windowScroll.stop();
- let target;
+ const entry = this.entrySetCurrent(index);
+ let target;
if (scroll !== null) {
target = scroll;
} else {
@@ -493,8 +502,6 @@ class Display {
} else {
this.windowScroll.toY(target);
}
-
- this.index = index;
}
sourceTermView() {