Fix geometry calculation for visible unread messages.

(imported from commit 91e5a6b83919c4cd935ea5e7586d84cc7a559cf6)
This commit is contained in:
Steve Howell 2013-05-20 13:01:35 -04:00 committed by Leo Franchi
parent cf3f62185c
commit c2104e36c9
1 changed files with 5 additions and 3 deletions

View File

@ -66,11 +66,13 @@ $(function () {
});
function within_viewport(row_offset, row_height) {
// Returns true if a message is fully within the viewport.
// Returns true if a message is fully within the effectively visible
// part of the viewport.
var message_top = row_offset.top;
var message_bottom = message_top + row_height;
var viewport_top = viewport.scrollTop();
var viewport_bottom = viewport_top + viewport.height();
var info = ui.message_viewport_info();
var viewport_top = info.visible_top;
var viewport_bottom = viewport_top + info.visible_height;
return (message_top > viewport_top) && (message_bottom < viewport_bottom);
}