From 59dba15a4ff75ed5fcf7ce1330d30e070285a16c Mon Sep 17 00:00:00 2001 From: Cohee Date: Tue, 27 Jun 2023 00:45:48 +0300 Subject: [PATCH] Unlock scrolling on streaming if scrolled with mouse wheel --- public/script.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/public/script.js b/public/script.js index d682afa8b..88f850eed 100644 --- a/public/script.js +++ b/public/script.js @@ -291,6 +291,7 @@ let streamingProcessor = null; let crop_data = undefined; let is_delete_mode = false; let fav_ch_checked = false; +let scrollLock = false; //initialize global var for future cropped blobs let currentCroppedAvatar = ''; @@ -1745,7 +1746,9 @@ class StreamingProcessor { this.setFirstSwipe(messageId); } - scrollChatToBottom(); + if (!scrollLock) { + scrollChatToBottom(); + } } onFinishStreaming(messageId, text) { @@ -1839,6 +1842,7 @@ class StreamingProcessor { if (this.messageId == -1) { this.messageId = this.onStartStreaming(this.firstMessageText); await delay(1); // delay for message to be rendered + scrollLock = false; } try { @@ -6318,10 +6322,9 @@ $(document).ready(function () { updateVisibleDivs('#rm_print_characters_block', true); }, 5)); - // This does not actually increase performance. - /*$("#chat").on('scroll', debounce(() => { - updateVisibleDivs('#chat', false); - }, 10));*/ + $("#chat").on('mousewheel', () => { + scrollLock = true; + }); let S_TAFocused = false; let S_TAPreviouslyFocused = false;