Commit 0bc0072f authored by JC Brand's avatar JC Brand

chatview: Mark whether scrolling was automatic

so that we don't confuse it with the case where it was manual.
parent 246dec37
...@@ -784,6 +784,13 @@ ...@@ -784,6 +784,13 @@
* received. * received.
*/ */
if (ev && ev.preventDefault) { ev.preventDefault(); } 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 = var is_at_bottom =
(this.$content.scrollTop() + this.$content.innerHeight()) >= (this.$content.scrollTop() + this.$content.innerHeight()) >=
this.$content[0].scrollHeight-10; this.$content[0].scrollHeight-10;
...@@ -806,6 +813,7 @@ ...@@ -806,6 +813,7 @@
if (this.$content.is(':visible') && !this.model.get('scrolled')) { if (this.$content.is(':visible') && !this.model.get('scrolled')) {
this.$content.scrollTop( this.$content.scrollTop(
this.$content.scrollTop() + $message[0].scrollHeight); this.$content.scrollTop() + $message[0].scrollHeight);
this.model.save({'auto_scrolled': true});
} }
return this; return this;
}, },
...@@ -815,6 +823,7 @@ ...@@ -815,6 +823,7 @@
if (this.$content.is(':visible') && !this.model.get('scrolled')) { if (this.$content.is(':visible') && !this.model.get('scrolled')) {
this.$content.scrollTop(this.$content[0].scrollHeight); this.$content.scrollTop(this.$content[0].scrollHeight);
this.$el.find('.new-msgs-indicator').addClass('hidden'); this.$el.find('.new-msgs-indicator').addClass('hidden');
this.model.save({'auto_scrolled': true});
} }
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment