Extract viewport.is_below_visible_bottom().

This encapsulates logic about things covering the viewport
inside of viewport.js.

(imported from commit 429e979fb0ab288d94064b75280a8b053f9a2aa4)
This commit is contained in:
Steve Howell 2013-06-06 17:52:02 -04:00
parent 3cb34cf246
commit 224fcebfc9
2 changed files with 8 additions and 2 deletions

View File

@ -29,8 +29,10 @@ function hide() {
// If there's a custom message, or if the last message is off the bottom of the
// screen, then show the notifications bar.
exports.update = function (num_unread) {
if (rows.last_visible().offset() !== null // otherwise the next line will error
&& rows.last_visible().offset().top + rows.last_visible().height() > viewport.scrollTop() + viewport.height() - $("#compose").height()
var last_row = rows.last_visible();
if (last_row
&& last_row.offset() !== null // otherwise the next line will error
&& viewport.is_below_visible_bottom(last_row.offset().top + last_row.height())
&& num_unread > 0)
show();
else

View File

@ -49,6 +49,10 @@ exports.at_bottom = function () {
return bottom + 2 >= window_size;
};
exports.is_below_visible_bottom = function (offset) {
return offset > viewport.scrollTop() + viewport.height() - $("#compose").height();
};
exports.set_message_position = function (message_top, message_height, viewport_info, ratio) {
// message_top = offset of the top of a message that you are positioning
// message_height = height of the message that you are positioning