Merge branch 'release/0.9.11-4'

This commit is contained in:
Book Pauk
2020-12-16 21:16:58 +07:00
2 changed files with 14 additions and 7 deletions

View File

@@ -103,7 +103,8 @@ import * as utils from '../../../share/utils';
const ContentsPageProps = Vue.extend({
props: {
bookPos: Number
bookPos: Number,
isVisible: Boolean,
}
});
@@ -112,8 +113,8 @@ export default @Component({
Window,
},
watch: {
bookPos: function(newValue) {
this.updateBookPosSelection(newValue);
bookPos: function() {
this.updateBookPosSelection();
}
},
})
@@ -134,6 +135,7 @@ class ContentsPage extends ContentsPageProps {
//проверим, надо ли обновлять списки
if (this.parsed == parsed) {
this.updateBookPosSelection();
return;
}
@@ -231,7 +233,7 @@ class ContentsPage extends ContentsPageProps {
this.selectedTab = 'images';
//выделим на bookPos
this.updateBookPosSelection(currentBook.bookPos);
this.updateBookPosSelection();
//асинхронная загрузка изображений
this.imageSrc = [];
@@ -251,8 +253,13 @@ class ContentsPage extends ContentsPageProps {
})();
}
async updateBookPosSelection(bp) {
await utils.sleep(100);
async updateBookPosSelection() {
if (!this.isVisible)
return;
await utils.sleep(50);
const bp = this.bookPos;
for (let i = 0; i < this.contents.length; i++) {
const item = this.contents[i];
const nextOffset = (i < this.contents.length - 1 ? this.contents[i + 1].offset : this.parsed.textLength);

View File

@@ -99,7 +99,7 @@
<HelpPage v-if="helpActive" ref="helpPage" @do-action="doAction"></HelpPage>
<ClickMapPage v-show="clickMapActive" ref="clickMapPage"></ClickMapPage>
<ServerStorage v-show="hidden" ref="serverStorage"></ServerStorage>
<ContentsPage v-show="contentsActive" ref="contentsPage" :book-pos="bookPos" @do-action="doAction" @book-pos-changed="bookPosChanged"></ContentsPage>
<ContentsPage v-show="contentsActive" ref="contentsPage" :book-pos="bookPos" :is-visible="contentsActive" @do-action="doAction" @book-pos-changed="bookPosChanged"></ContentsPage>
<ReaderDialogs ref="dialogs" @donate-toggle="donateToggle" @version-history-toggle="versionHistoryToggle"></ReaderDialogs>
</div>