mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-16 06:51:46 +01:00
Do not systematically scroll to the bottom on new events in the room
This commit is contained in:
parent
0d1d9f3e9c
commit
3bfffab201
1 changed files with 8 additions and 2 deletions
|
@ -54,7 +54,13 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
|
||||||
|
|
||||||
$scope.$on(eventHandlerService.MSG_EVENT, function(ngEvent, event, isLive) {
|
$scope.$on(eventHandlerService.MSG_EVENT, function(ngEvent, event, isLive) {
|
||||||
if (isLive && event.room_id === $scope.room_id) {
|
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) {
|
if (window.Notification) {
|
||||||
// Show notification when the user is idle
|
// Show notification when the user is idle
|
||||||
|
|
Loading…
Reference in a new issue