Sfoglia il codice sorgente

Поправки багов скроллинга

Book Pauk 2 anni fa
parent
commit
820769071d

+ 2 - 1
client/components/Search/AuthorList/AuthorList.vue

@@ -185,6 +185,8 @@ class AuthorList extends BaseList {
     }
 
     async expandAuthor(item) {
+        this.$emit('listEvent', {action: 'ignoreScroll'});
+
         const expanded = _.cloneDeep(this.expandedAuthor);
         const key = item.author;
 
@@ -197,7 +199,6 @@ class AuthorList extends BaseList {
                 expanded.shift();
             }
 
-            //this.$emit('listEvent', {action: 'ignoreScroll'});
             this.setSetting('expandedAuthor', expanded);
         } else {
             const i = expanded.indexOf(key);

+ 2 - 1
client/components/Search/BaseList.js

@@ -229,6 +229,8 @@ export default class BaseList {
     }
 
     async expandSeries(seriesItem) {
+        this.$emit('listEvent', {action: 'ignoreScroll'});
+        
         const expandedSeries = _.cloneDeep(this.expandedSeries);
         const key = seriesItem.key;
 
@@ -241,7 +243,6 @@ export default class BaseList {
 
             this.getSeriesBooks(seriesItem); //no await
 
-            //this.$emit('listEvent', {action: 'ignoreScroll'});
             this.setSetting('expandedSeries', expandedSeries);
         } else {
             const i = expandedSeries.indexOf(key);

+ 8 - 3
client/components/Search/Search.vue

@@ -744,11 +744,13 @@ class Search {
     }
     
     onScroll() {
-        if (this.ignoreScrolling)
-            return;
-
         const curScrollTop = this.$refs.scroller.scrollTop;
 
+        if (this.ignoreScrolling) {
+            this.lastScrollTop = curScrollTop;
+            return;
+        }
+
         if (!this.lastScrollTop)
             this.lastScrollTop = 0;
         if (!this.lastScrollTop2)
@@ -756,6 +758,9 @@ class Search {
 
         if (curScrollTop - this.lastScrollTop > 0) {
             this.$refs.toolPanel.style.position = 'relative';
+            if (this.lastScrollTop2 <= curScrollTop - this.$refs.toolPanel.clientHeight)
+                this.lastScrollTop2 = 0;
+
             this.$refs.toolPanel.style.top = `${this.lastScrollTop2}px`;
         } else {
             this.$refs.toolPanel.style.position = 'sticky';