Fixed scroll to unread when idle

This commit is contained in:
Igor Zhukov 2015-03-17 22:07:28 +03:00
parent 5e1560ba37
commit a72400d3b3
2 changed files with 10 additions and 3 deletions

View File

@ -1413,7 +1413,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$scope.historyState.typing.splice(0, $scope.historyState.typing.length); $scope.historyState.typing.splice(0, $scope.historyState.typing.length);
$scope.$broadcast('ui_history_append_new', { $scope.$broadcast('ui_history_append_new', {
my: addedMessage.my, my: addedMessage.my,
noScroll: unreadAfterIdle && !historyMessage.out && $rootScope.idle.isIDLE idleScroll: unreadAfterIdle && !historyMessage.out && $rootScope.idle.isIDLE
}); });
if (addedMessage.my && $scope.historyUnreadAfter) { if (addedMessage.my && $scope.historyUnreadAfter) {
delete $scope.historyUnreadAfter; delete $scope.historyUnreadAfter;

View File

@ -872,10 +872,17 @@ angular.module('myApp.directives', ['myApp.filters'])
curAnimation = false; curAnimation = false;
$scope.$on('ui_history_append_new', function (e, options) { $scope.$on('ui_history_append_new', function (e, options) {
if (!atBottom && !options.my || options.noScroll) { if (!atBottom && !options.my) {
onContentLoaded(function () { onContentLoaded(function () {
$(historyWrap).nanoScroller(); $(historyWrap).nanoScroller();
}) });
return;
}
if (options.idleScroll) {
onContentLoaded(function () {
$(historyWrap).nanoScroller();
changeScroll();
});
return; return;
} }
var curAnimated = animated && var curAnimated = animated &&