mirror of https://github.com/zulip/zulip.git
message_viewport: Rename at_bottom for clarity.
This commit is contained in:
parent
45f9bd21e5
commit
42956e0305
|
@ -88,7 +88,7 @@ export function scroll_finished() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message_viewport.at_bottom()) {
|
if (message_viewport.at_rendered_bottom()) {
|
||||||
message_fetch.maybe_load_newer_messages({
|
message_fetch.maybe_load_newer_messages({
|
||||||
msg_list: message_lists.current,
|
msg_list: message_lists.current,
|
||||||
});
|
});
|
||||||
|
|
|
@ -75,7 +75,7 @@ export function message_viewport_info(): MessageViewportInfo {
|
||||||
// rendered message feed; messages that are not displayed due to a
|
// rendered message feed; messages that are not displayed due to a
|
||||||
// limited render window or because they have not been fetched from
|
// limited render window or because they have not been fetched from
|
||||||
// the server are not considered.
|
// the server are not considered.
|
||||||
export function at_bottom(): boolean {
|
export function at_rendered_bottom(): boolean {
|
||||||
const bottom = scrollTop() + height();
|
const bottom = scrollTop() + height();
|
||||||
const full_height = $scroll_container.prop("scrollHeight");
|
const full_height = $scroll_container.prop("scrollHeight");
|
||||||
|
|
||||||
|
@ -86,8 +86,9 @@ export function at_bottom(): boolean {
|
||||||
return bottom + 2 >= full_height;
|
return bottom + 2 >= full_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This differs from at_bottom in that it only requires the bottom message to
|
// This differs from at_rendered_bottom in that it only requires the
|
||||||
// be visible, but you may be able to scroll down further.
|
// bottom message to be visible, but you may be able to scroll down
|
||||||
|
// further to see the rest of that message.
|
||||||
export function bottom_rendered_message_visible(): boolean {
|
export function bottom_rendered_message_visible(): boolean {
|
||||||
const $last_row = rows.last_visible();
|
const $last_row = rows.last_visible();
|
||||||
if ($last_row.length) {
|
if ($last_row.length) {
|
||||||
|
@ -485,7 +486,7 @@ export function keep_pointer_in_view(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
function message_is_far_enough_up(): boolean {
|
function message_is_far_enough_up(): boolean {
|
||||||
return at_bottom() || $next_row.get_offset_to_window().top <= bottom_threshold;
|
return at_rendered_bottom() || $next_row.get_offset_to_window().top <= bottom_threshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
function adjust(
|
function adjust(
|
||||||
|
|
|
@ -108,7 +108,7 @@ export function page_up() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function page_down() {
|
export function page_down() {
|
||||||
if (message_viewport.at_bottom() && !message_lists.current.visibly_empty()) {
|
if (message_viewport.at_rendered_bottom() && !message_lists.current.visibly_empty()) {
|
||||||
message_lists.current.select_id(message_lists.current.last().id, {then_scroll: false});
|
message_lists.current.select_id(message_lists.current.last().id, {then_scroll: false});
|
||||||
unread_ops.process_visible();
|
unread_ops.process_visible();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -199,7 +199,7 @@ export function initialize_kitchen_sink_stuff() {
|
||||||
|
|
||||||
if (delta < 0 && message_viewport.at_top()) {
|
if (delta < 0 && message_viewport.at_top()) {
|
||||||
navigate.up();
|
navigate.up();
|
||||||
} else if (delta > 0 && message_viewport.at_bottom()) {
|
} else if (delta > 0 && message_viewport.at_rendered_bottom()) {
|
||||||
navigate.down();
|
navigate.down();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue