Ver Fonte

chatview: Mark whether scrolling was automatic

so that we don't confuse it with the case where it was manual.
JC Brand há 8 anos atrás
pai
commit
0bc0072fea
1 ficheiros alterados com 9 adições e 0 exclusões
  1. 9 0
      src/converse-chatview.js

+ 9 - 0
src/converse-chatview.js

@@ -784,6 +784,13 @@
                      * received.
                      */
                     if (ev && ev.preventDefault) { ev.preventDefault(); }
+                    if (this.model.get('auto_scrolled')) {
+                        this.model.set({
+                            'scrolled': false,
+                            'auto_scrolled': false
+                        });
+                        return;
+                    }
                     var is_at_bottom =
                         (this.$content.scrollTop() + this.$content.innerHeight()) >=
                             this.$content[0].scrollHeight-10;
@@ -806,6 +813,7 @@
                     if (this.$content.is(':visible') && !this.model.get('scrolled')) {
                         this.$content.scrollTop(
                             this.$content.scrollTop() + $message[0].scrollHeight);
+                        this.model.save({'auto_scrolled': true});
                     }
                     return this;
                 },
@@ -815,6 +823,7 @@
                     if (this.$content.is(':visible') && !this.model.get('scrolled')) {
                         this.$content.scrollTop(this.$content[0].scrollHeight);
                         this.$el.find('.new-msgs-indicator').addClass('hidden');
+                        this.model.save({'auto_scrolled': true});
                     }
                 },