mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-20 00:18:45 +01:00
Fix list view scrolling
Resize handlers are ugly. But not as ugly as scroll handlers. :p Normalized some whitespace along the way.
This commit is contained in:
@@ -16,23 +16,23 @@
|
||||
var Whisper = Whisper || {};
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
Whisper.MessageListView = Whisper.ListView.extend({
|
||||
tagName: 'ul',
|
||||
className: 'message-list',
|
||||
itemView: Whisper.MessageView,
|
||||
events: {
|
||||
'add': 'scrollToBottom',
|
||||
'update *': 'scrollToBottom'
|
||||
},
|
||||
scrollToBottom: function() {
|
||||
// TODO: Avoid scrolling if user has manually scrolled up?
|
||||
this.$el.scrollTop(this.el.scrollHeight);
|
||||
},
|
||||
addAll: function() {
|
||||
Whisper.ListView.prototype.addAll.apply(this, arguments); // super()
|
||||
this.scrollToBottom();
|
||||
},
|
||||
});
|
||||
Whisper.MessageListView = Whisper.ListView.extend({
|
||||
tagName: 'ul',
|
||||
className: 'message-list',
|
||||
itemView: Whisper.MessageView,
|
||||
events: {
|
||||
'add': 'scrollToBottom',
|
||||
'update *': 'scrollToBottom'
|
||||
},
|
||||
scrollToBottom: function() {
|
||||
// TODO: Avoid scrolling if user has manually scrolled up?
|
||||
this.$el.scrollTop(this.el.scrollHeight);
|
||||
},
|
||||
addAll: function() {
|
||||
Whisper.ListView.prototype.addAll.apply(this, arguments); // super()
|
||||
this.scrollToBottom();
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user