message_viewport: Rename at_bottom for clarity.

This commit is contained in:
Tim Abbott 2024-01-31 13:44:33 -08:00
parent 45f9bd21e5
commit 42956e0305
4 changed files with 8 additions and 7 deletions

View File

@ -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,
}); });

View File

@ -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(

View File

@ -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 {

View File

@ -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();
} }