Sfoglia il codice sorgente

Поправки багов

Book Pauk 5 anni fa
parent
commit
9ac3be455c
1 ha cambiato i file con 24 aggiunte e 11 eliminazioni
  1. 24 11
      client/components/Reader/Reader.vue

+ 24 - 11
client/components/Reader/Reader.vue

@@ -220,14 +220,19 @@ export default @Component({
         bookPos: function(newValue) {
         bookPos: function(newValue) {
             if (newValue !== undefined && this.activePage == 'TextPage') {
             if (newValue !== undefined && this.activePage == 'TextPage') {
                 const textPage = this.$refs.page;
                 const textPage = this.$refs.page;
+
                 if (textPage.bookPos != newValue) {
                 if (textPage.bookPos != newValue) {
                     textPage.bookPos = newValue;
                     textPage.bookPos = newValue;
                 }
                 }
-                this.debouncedSetRecentBook(newValue);
+
+                if (!this.scrollingActive)
+                    this.debouncedSetRecentBook(newValue);
+                else
+                    this.scrollingSetRecentBook(newValue);
             }
             }
         },
         },
         routeParamPos: function(newValue) {
         routeParamPos: function(newValue) {
-            if (newValue !== undefined && newValue != this.bookPos) {
+            if (!this.paramPosIgnore && newValue !== undefined && newValue != this.bookPos) {
                 this.bookPos = newValue;
                 this.bookPos = newValue;
             }
             }
         },
         },
@@ -291,21 +296,24 @@ class Reader extends Vue {
 
 
         this.lastActivePage = false;
         this.lastActivePage = false;
 
 
-        this.debouncedUpdateRoute = _.debounce(() => {
-            this.updateRoute();
-        }, 1000);
-
-        this.debouncedSetRecentBook = _.throttle(async(newValue) => {
-            await utils.sleep(300);
-            
+        this.debouncedSetRecentBook = _.debounce(async(newValue) => {
             const recent = this.mostRecentBook();
             const recent = this.mostRecentBook();
             if (recent && (recent.bookPos != newValue || recent.bookPosSeen !== this.bookPosSeen)) {
             if (recent && (recent.bookPos != newValue || recent.bookPosSeen !== this.bookPosSeen)) {
                 await bookManager.setRecentBook(Object.assign({}, recent, {bookPos: newValue, bookPosSeen: this.bookPosSeen}));
                 await bookManager.setRecentBook(Object.assign({}, recent, {bookPos: newValue, bookPosSeen: this.bookPosSeen}));
 
 
                 if (this.actionCur < 0 || (this.actionCur >= 0 && this.actionList[this.actionCur] != newValue))
                 if (this.actionCur < 0 || (this.actionCur >= 0 && this.actionList[this.actionCur] != newValue))
                     this.addAction(newValue);
                     this.addAction(newValue);
+
+                this.paramPosIgnore = true;
+                this.updateRoute();
+                await this.$nextTick();
+                this.paramPosIgnore = false;
             }
             }
-        }, 500);
+        }, 500, {'maxWait':5000});
+
+        this.scrollingSetRecentBook = _.debounce((newValue) => {
+            this.debouncedSetRecentBook(newValue);
+        }, 15000, {'maxWait':20000});
 
 
         document.addEventListener('fullscreenchange', () => {
         document.addEventListener('fullscreenchange', () => {
             this.fullScreenActive = (document.fullscreenElement !== null);
             this.fullScreenActive = (document.fullscreenElement !== null);
@@ -345,6 +353,8 @@ class Reader extends Vue {
 
 
             await this.showWhatsNew();
             await this.showWhatsNew();
             await this.showMigration();
             await this.showMigration();
+
+            this.updateRoute();
         })();
         })();
     }
     }
 
 
@@ -509,7 +519,6 @@ class Reader extends Vue {
         if (event.bookPosSeen !== undefined)
         if (event.bookPosSeen !== undefined)
             this.bookPosSeen = event.bookPosSeen;
             this.bookPosSeen = event.bookPosSeen;
         this.bookPos = event.bookPos;
         this.bookPos = event.bookPos;
-        this.debouncedUpdateRoute();
     }
     }
 
 
     async bookManagerEvent(eventName, value) {
     async bookManagerEvent(eventName, value) {
@@ -656,6 +665,10 @@ class Reader extends Vue {
                 page.stopTextScrolling();
                 page.stopTextScrolling();
             }
             }
         }
         }
+
+        if (!this.scrollingActive) {
+            this.scrollingSetRecentBook.flush();
+        }
     }
     }
 
 
     stopSearch() {
     stopSearch() {