set current entry even when disableScroll is true

This commit is contained in:
siikamiika 2019-11-28 13:22:47 +02:00
parent e37ffb6cf5
commit 4e7d08ff2c

View File

@ -360,6 +360,8 @@ class Display {
const {index, scroll, disableScroll} = context; const {index, scroll, disableScroll} = context;
if (!disableScroll) { if (!disableScroll) {
this.entryScrollIntoView(index || 0, scroll); this.entryScrollIntoView(index || 0, scroll);
} else {
this.entrySetCurrent(index || 0);
} }
if (options.audio.enabled && options.audio.autoPlay) { 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.min(index, this.definitions.length - 1);
index = Math.max(index, 0); index = Math.max(index, 0);
@ -479,9 +481,16 @@ class Display {
entry.classList.add('entry-current'); entry.classList.add('entry-current');
} }
this.windowScroll.stop(); this.index = index;
let target;
return entry;
}
entryScrollIntoView(index, scroll, smooth) {
this.windowScroll.stop();
const entry = this.entrySetCurrent(index);
let target;
if (scroll !== null) { if (scroll !== null) {
target = scroll; target = scroll;
} else { } else {
@ -493,8 +502,6 @@ class Display {
} else { } else {
this.windowScroll.toY(target); this.windowScroll.toY(target);
} }
this.index = index;
} }
sourceTermView() { sourceTermView() {