From 01d593323ec755c2f62bbaa33e6b73fd1d4883e0 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 14 Oct 2020 01:38:12 +0100 Subject: [PATCH] log scroll to bottom, try to defend against rounding error Signed-off-by: Ian Jackson --- templates/script.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/templates/script.ts b/templates/script.ts index 5b83cb8d..64207a86 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -790,10 +790,12 @@ function add_log_message(msg_html: string) { // rejected // https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API (() => { + let le_top = lastent.getBoundingClientRect()!.top; let le_bot = lastent.getBoundingClientRect()!.bottom; let ld_bot = logdiv.getBoundingClientRect()!.bottom; - console.log("ADD_LOG_MESSAGE bboxes: le, bb", le_bot, ld_bot); - return le_bot > ld_bot; + console.log("ADD_LOG_MESSAGE bboxes: le t b, bb", + le_top, le_bot, ld_bot); + return 0.5 * (le_bot + le_top) > ld_bot; })(); console.log('ADD LOG MESSAGE ',in_scrollback, msg_html); -- 2.30.2