diff --git a/client/components/Reader/Reader.vue b/client/components/Reader/Reader.vue index e1a786df..749c757d 100644 --- a/client/components/Reader/Reader.vue +++ b/client/components/Reader/Reader.vue @@ -141,6 +141,7 @@ @load-file="loadFile" @book-pos-changed="bookPosChanged" @do-action="doAction" + @hide-tool-bar="hideToolBar" > @@ -348,6 +349,13 @@ class Reader { this.debouncedSetRecentBook(newValue); }, 15000, {maxWait: 20000}); + this.debouncedHideToolBar = _.debounce((event) => { + if (this.toolBarHideOnScroll && this.toolBarActive !== !!event.show) { + this.commit('reader/setToolBarActive', !!event.show); + this.$root.eventHook('resize'); + } + }, 200); + document.addEventListener('fullscreenchange', () => { this.fullScreenActive = (document.fullscreenElement !== null); }); @@ -405,6 +413,7 @@ class Reader { this.clickControlActive = this.clickControl; this.blinkCachedLoad = settings.blinkCachedLoad; this.showToolButton = settings.showToolButton; + this.toolBarHideOnScroll = settings.toolBarHideOnScroll; this.enableSitesFilter = settings.enableSitesFilter; this.showNeedUpdateNotify = settings.showNeedUpdateNotify; this.splitToPara = settings.splitToPara; @@ -665,6 +674,10 @@ class Reader { this.$root.eventHook('resize'); } + hideToolBar(event) { + this.debouncedHideToolBar(event); + } + fullScreenToggle() { this.fullScreenActive = !this.fullScreenActive; if (this.fullScreenActive) { diff --git a/client/components/Reader/SettingsPage/ButtonsTab.inc b/client/components/Reader/SettingsPage/ButtonsTab.inc deleted file mode 100644 index 27a6e818..00000000 --- a/client/components/Reader/SettingsPage/ButtonsTab.inc +++ /dev/null @@ -1,9 +0,0 @@ -
Показывать кнопки панели
- -
-
-
- -
-
diff --git a/client/components/Reader/SettingsPage/SettingsPage.vue b/client/components/Reader/SettingsPage/SettingsPage.vue index 38b0f33c..4982df37 100644 --- a/client/components/Reader/SettingsPage/SettingsPage.vue +++ b/client/components/Reader/SettingsPage/SettingsPage.vue @@ -24,7 +24,7 @@
- + @@ -82,8 +82,8 @@
-
- @@include('./ButtonsTab.inc'); +
+ @@include('./ToolBarTab.inc');
@@ -702,11 +702,11 @@ export default vueComponent(SettingsPage); margin-bottom: 5px; } -.label-1, .label-7 { +.label-1, .label-3, .label-7 { width: 75px; } -.label-2, .label-3, .label-4, .label-5 { +.label-2, .label-4, .label-5 { width: 110px; } diff --git a/client/components/Reader/SettingsPage/ToolBarTab.inc b/client/components/Reader/SettingsPage/ToolBarTab.inc new file mode 100644 index 00000000..a55db41b --- /dev/null +++ b/client/components/Reader/SettingsPage/ToolBarTab.inc @@ -0,0 +1,18 @@ +
Отображение
+ +
+
+ + + Скрывать/показывть панель при прокрутке текста вперед/назад + + +
+ +
Показывать кнопки
+ +
+
+ +
diff --git a/client/components/Reader/TextPage/TextPage.vue b/client/components/Reader/TextPage/TextPage.vue index 58377b54..7a1cc4f0 100644 --- a/client/components/Reader/TextPage/TextPage.vue +++ b/client/components/Reader/TextPage/TextPage.vue @@ -66,7 +66,14 @@ const componentOptions = { watch: { bookPos: function() { this.$emit('book-pos-changed', {bookPos: this.bookPos, bookPosSeen: this.bookPosSeen}); + this.draw(); + + if (this.userBookPosChange) { + this.$emit('hide-tool-bar', {show: (this.bookPos == 0 || this.bookPos < this.prevBookPos)}); + this.prevBookPos = this.bookPos; + this.userBookPosChange = false; + } }, bookPosSeen: function() { this.$emit('book-pos-changed', {bookPos: this.bookPos, bookPosSeen: this.bookPosSeen}); @@ -99,6 +106,8 @@ class TextPage { lastBook = null; bookPos = 0; bookPosSeen = null; + prevBookPos = 0; + userBookPosChange = false; fontStyle = null; fontSize = null; @@ -652,7 +661,7 @@ class TextPage { } if (this.book && this.bookPos > 0 && this.bookPos >= this.parsed.textLength) { - this.doEnd(true); + this.doEnd(true, false); return; } @@ -675,7 +684,7 @@ class TextPage { this.debouncedDrawPageDividerAndOrnament(); if (this.book && this.linesDown && this.linesDown.length < this.pageLineCount) { - this.doEnd(true); + this.doEnd(true, false); return; } } @@ -911,12 +920,14 @@ class TextPage { doDown() { if (this.linesDown && this.linesDown.length > this.pageLineCount && this.pageLineCount > 0) { + this.userBookPosChange = true; this.bookPos = this.linesDown[1].begin; } } doUp() { if (this.linesUp && this.linesUp.length > 1 && this.pageLineCount > 0) { + this.userBookPosChange = true; this.bookPos = this.linesUp[1].begin; } } @@ -929,6 +940,7 @@ class TextPage { if (i >= 0 && this.linesDown.length >= 2*i + (this.keepLastToFirst ? 1 : 0)) { this.currentAnimation = this.pageChangeAnimation; this.pageChangeDirectionDown = true; + this.userBookPosChange = true; this.bookPos = this.linesDown[i].begin; } else this.doEnd(); @@ -944,6 +956,7 @@ class TextPage { if (i >= 0 && this.linesUp.length > i) { this.currentAnimation = this.pageChangeAnimation; this.pageChangeDirectionDown = false; + this.userBookPosChange = true; this.bookPos = this.linesUp[i].begin; } } @@ -952,10 +965,11 @@ class TextPage { doHome() { this.currentAnimation = this.pageChangeAnimation; this.pageChangeDirectionDown = false; + this.userBookPosChange = true; this.bookPos = 0; } - doEnd(noAni) { + doEnd(noAni, isUser = true) { if (this.parsed.para.length && this.pageLineCount > 0) { let i = this.parsed.para.length - 1; let lastPos = this.parsed.para[i].offset + this.parsed.para[i].length - 1; @@ -966,6 +980,7 @@ class TextPage { if (!noAni) this.currentAnimation = this.pageChangeAnimation; this.pageChangeDirectionDown = true; + this.userBookPosChange = isUser; this.bookPos = lines[i].begin; } } diff --git a/client/store/modules/reader.js b/client/store/modules/reader.js index 53f34918..d4bb9b87 100644 --- a/client/store/modules/reader.js +++ b/client/store/modules/reader.js @@ -185,6 +185,7 @@ const settingDefaults = { fontShifts: {}, showToolButton: {}, + toolBarHideOnScroll: true, userHotKeys: {}, userWallpapers: [], };