Browse Source

Fixed append message blink

master
Igor Zhukov 11 years ago
parent
commit
e4d3f7e4ea
  1. 3
      app/css/app.css
  2. 4
      app/js/controllers.js
  3. 18
      app/js/directives.js

3
app/css/app.css

@ -967,6 +967,9 @@ a.im_dialog:hover .im_dialog_date {
.im_message_grouped .im_content_message_select_area { .im_message_grouped .im_content_message_select_area {
height: 34px; height: 34px;
} }
.im_history_appending .im_content_message_select_area {
height: 52px;
}
.im_message_grouped .icon-select-tick { .im_message_grouped .icon-select-tick {
margin-top: 4px; margin-top: 4px;
} }

4
app/js/controllers.js

@ -454,14 +454,14 @@ angular.module('myApp.controllers', [])
for (i = start; i < end; i++) { for (i = start; i < end; i++) {
curMessage = $scope.history[i]; curMessage = $scope.history[i];
// if (prevMessage) console.log(dT(), curMessage.from_id == prevMessage.from_id, curMessage.date - prevMessage.date);
if (prevMessage && if (prevMessage &&
curMessage.from_id == prevMessage.from_id && curMessage.from_id == prevMessage.from_id &&
curMessage.date < prevMessage.date + 30 && curMessage.date < prevMessage.date + 30 &&
!curMessage.fwd_from_id && !curMessage.fwd_from_id &&
curMessage.message && curMessage.message.length < 30) { curMessage.message && curMessage.message.length < 30) {
curMessage.grouped = true; curMessage.grouped = true;
} else if (!start) { } else if (prevMessage || !i) {
delete curMessage.grouped; delete curMessage.grouped;
} }
prevMessage = curMessage; prevMessage = curMessage;

18
app/js/directives.js

@ -149,7 +149,7 @@ angular.module('myApp.directives', ['myApp.filters'])
}) })
.directive('myHistory', function ($window, $timeout) { .directive('myHistory', function ($window, $timeout, $transition) {
return { return {
link: link link: link
@ -199,9 +199,7 @@ angular.module('myApp.directives', ['myApp.filters'])
if (!atBottom && !options.my) { if (!atBottom && !options.my) {
return; return;
} }
if (animated) { if (!animated) {
$(scrollableWrap).stop();
} else {
$(scrollable).css({bottom: 0}); $(scrollable).css({bottom: 0});
$(scrollableWrap).addClass('im_history_to_bottom'); $(scrollableWrap).addClass('im_history_to_bottom');
} }
@ -213,22 +211,22 @@ angular.module('myApp.directives', ['myApp.filters'])
$(historyMessagesEl).removeClass('im_history_appending'); $(historyMessagesEl).removeClass('im_history_appending');
scrollableWrap.scrollTop = scrollableWrap.scrollHeight; scrollableWrap.scrollTop = scrollableWrap.scrollHeight;
$(historyMessagesEl).css(transform, 'translate(0px, ' + (scrollableWrap.scrollHeight - wasH) + 'px)'); $(historyMessagesEl).css(transform, 'translate(0px, ' + (scrollableWrap.scrollHeight - wasH) + 'px)');
setTimeout(function () { $(historyWrap).nanoScroller();
var styles = {};
styles[transform] = 'translate(0px, 0px)';
$(historyMessagesEl).addClass('im_history_appending'); $(historyMessagesEl).addClass('im_history_appending');
$(historyMessagesEl).css(transform, 'translate(0px, 0px)'); $transition($(historyMessagesEl), styles).then(function () {
setTimeout(function () {
curAnimation = false; curAnimation = false;
$(historyMessagesEl).removeClass('im_history_appending'); $(historyMessagesEl).removeClass('im_history_appending');
updateBottomizer(); updateBottomizer();
}, 300); });
}, 0);
} else { } else {
$(scrollableWrap).removeClass('im_history_to_bottom'); $(scrollableWrap).removeClass('im_history_to_bottom');
$(scrollable).css({bottom: ''}); $(scrollable).css({bottom: ''});
scrollableWrap.scrollTop = scrollableWrap.scrollHeight; scrollableWrap.scrollTop = scrollableWrap.scrollHeight;
updateBottomizer(); updateBottomizer();
}
$(historyWrap).nanoScroller(); $(historyWrap).nanoScroller();
}
}); });
}); });

Loading…
Cancel
Save