Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Do not systematically scroll to the bottom on new events in the room
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel ROHEE committed Sep 5, 2014
1 parent 0d1d9f3 commit 3bfffab
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions webclient/room/room-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,14 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])

$scope.$on(eventHandlerService.MSG_EVENT, function(ngEvent, event, isLive) {
if (isLive && event.room_id === $scope.room_id) {
scrollToBottom();


// Do not autoscroll to the bottom to display this new event if the user is not at the bottom.
// Exception: if the event is from the user, scroll to the bottom
var objDiv = document.getElementById("messageTableWrapper");
if ( (objDiv.offsetHeight + objDiv.scrollTop >= objDiv.scrollHeight) || event.user_id === $scope.state.user_id) {
scrollToBottom();
}

if (window.Notification) {
// Show notification when the user is idle
if (matrixService.presence.offline === mPresence.getState()) {
Expand Down

0 comments on commit 3bfffab

Please sign in to comment.