From: Ian Jackson Date: Wed, 14 Oct 2020 00:38:12 +0000 (+0100) Subject: log scroll to bottom, try to defend against rounding error X-Git-Tag: otter-0.2.0~653 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=01d593323ec755c2f62bbaa33e6b73fd1d4883e0;p=otter.git log scroll to bottom, try to defend against rounding error Signed-off-by: Ian Jackson --- 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);