diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-11-19 09:32:05 +0100 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-11-19 09:32:05 +0100 |
commit | 0ca53189c638f8c451fc1cefb7540fb9a2ae958e (patch) | |
tree | 5207a0d1f1f359f42f4a161065e3a7bf15aeec16 | |
parent | 45b82f27a387364121fb2eec065ec52c272c29c6 (diff) |
Fix restoring again the scroll position of the chat view
Calling "restoreScrollPosition" twice caused the chat view to be
scrolled to the top due to not taking into account the current scroll
position.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
-rw-r--r-- | js/views/chatview.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/js/views/chatview.js b/js/views/chatview.js index 1149525d7..bac06c07c 100644 --- a/js/views/chatview.js +++ b/js/views/chatview.js @@ -335,7 +335,7 @@ return; } - var scrollBottom = 0; + var scrollBottom = this.$container.scrollTop(); // When the last visible comment has a next sibling the scroll // position is based on the top position of that next sibling. @@ -348,9 +348,9 @@ // element (which would cause the next element to be fully shown // if saving and restoring the scroll position again) due to // rounding. - scrollBottom = this._getCommentTopPosition($nextSibling) - 1; + scrollBottom += this._getCommentTopPosition($nextSibling) - 1; } else if (this._$lastVisibleComment.length > 0) { - scrollBottom = this._getCommentTopPosition(this._$lastVisibleComment) + this._getCommentOuterHeight(this._$lastVisibleComment); + scrollBottom += this._getCommentTopPosition(this._$lastVisibleComment) + this._getCommentOuterHeight(this._$lastVisibleComment); } this.$container.scrollTop(scrollBottom - this.$container.outerHeight()); |