Skip to content

Commit

Permalink
Fix scroll to the bottom when sending/receiving a message
Browse files Browse the repository at this point in the history
  • Loading branch information
akazorg committed Oct 15, 2018
1 parent 487cdac commit 0658d84
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## [0.0.6] - 2018-10-15
- Fix scroll to the bottom when sending/receiving a message.


## [0.0.5] - 2018-10-12
- Fix when sending/receiving a message, scroll to the bottom.
- Fix ensure use of boolean types in order to support PostgreSQL.
Expand Down
2 changes: 1 addition & 1 deletion publishable/public/js/mercurius.js

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions resources/js/messages/Messages.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,12 @@ export default {
if (!this._hasMsg(idx+1)) return false;
return (this.messages[idx+1].sender_id === msg.sender_id);
},
_scrollTo(scroll_y) {
setTimeout(() => {
this.$refs.wrap.scrollTo({x: 0, y: scroll_y+'%'}, false)
}, 300);
_scrollTo(y_val) {
this.$refs.wrap.scrollTo({x: 0, y: y_val})
},
_appendMsg(msg) {
this.messages.unshift(msg)
this._scrollTo(100)
this._scrollTo('100%')
},
Expand All @@ -183,13 +181,13 @@ export default {
},
onLoadMessages(usr) {
this.loadMessagesStart(usr.id)
.then(() => this._scrollTo(100));
.then(() => this._scrollTo('100%'));
},
onScroll(barY, barX, e) {
if (barY.scrollTop > 20 || this.offset < 0) return false;
this.loadMessages()
.then(() => this._scrollTo(25));
.then(() => this._scrollTo('25%'));
},
}
}
Expand Down

0 comments on commit 0658d84

Please sign in to comment.