diff --git a/src/components/Chat.vue b/src/components/Chat.vue index f16ee62..009cc3d 100644 --- a/src/components/Chat.vue +++ b/src/components/Chat.vue @@ -83,7 +83,7 @@ v-on:context-menu="showContextMenuForEvent($event)" v-on:own-avatar-clicked="viewProfile" /> - +
arrow_downward @@ -294,8 +294,8 @@ @@ -420,6 +420,7 @@ export default { showContextMenu: false, showContextMenuAnchor: null, initialLoadDone: false, + loading: false, // Set this to true during long operations to show a "spinner" overlay showRecorder: false, showRecorderPTT: false, // True to open the voice recorder in push-to-talk mode. @@ -619,7 +620,7 @@ export default { console.log("Read up to " + initialEventId); - //initialEventId = null; + initialEventId = "$rkyknHVJfTmbICP-lw3MyQ9Kw-cpMOGnh09l_tHg4ss"; this.timelineWindow = new TimelineWindow( this.$matrix.matrixClient, @@ -692,6 +693,27 @@ export default { ); }, + scrollToEndOfTimeline() { + if (this.timelineWindow && this.timelineWindow.canPaginate(EventTimeline.FORWARDS)) { + this.loading = true; + // Instead of paging though ALL history, just reload a timeline at the live marker... + var timelineWindow = new TimelineWindow(this.$matrix.matrixClient, this.room.getUnfilteredTimelineSet(), {}); + const self = this; + timelineWindow + .load(null, 20) + .then(() => { + self.timelineWindow = timelineWindow; + self.events = self.timelineWindow.getEvents(); + }) + .finally(() => { + this.loading = false; + }); + } else { + // Can't paginate, just scroll to bottom of window! + this.smoothScrollToEnd(); + } + }, + touchX(event) { if (event.type.indexOf("mouse") !== -1) { return event.clientX;