Unlock scrolling on streaming if scrolled with mouse wheel

This commit is contained in:
Cohee
2023-06-27 00:45:48 +03:00
parent 976a8fd65c
commit 59dba15a4f

View File

@ -291,6 +291,7 @@ let streamingProcessor = null;
let crop_data = undefined; let crop_data = undefined;
let is_delete_mode = false; let is_delete_mode = false;
let fav_ch_checked = false; let fav_ch_checked = false;
let scrollLock = false;
//initialize global var for future cropped blobs //initialize global var for future cropped blobs
let currentCroppedAvatar = ''; let currentCroppedAvatar = '';
@ -1745,7 +1746,9 @@ class StreamingProcessor {
this.setFirstSwipe(messageId); this.setFirstSwipe(messageId);
} }
scrollChatToBottom(); if (!scrollLock) {
scrollChatToBottom();
}
} }
onFinishStreaming(messageId, text) { onFinishStreaming(messageId, text) {
@ -1839,6 +1842,7 @@ class StreamingProcessor {
if (this.messageId == -1) { if (this.messageId == -1) {
this.messageId = this.onStartStreaming(this.firstMessageText); this.messageId = this.onStartStreaming(this.firstMessageText);
await delay(1); // delay for message to be rendered await delay(1); // delay for message to be rendered
scrollLock = false;
} }
try { try {
@ -6318,10 +6322,9 @@ $(document).ready(function () {
updateVisibleDivs('#rm_print_characters_block', true); updateVisibleDivs('#rm_print_characters_block', true);
}, 5)); }, 5));
// This does not actually increase performance. $("#chat").on('mousewheel', () => {
/*$("#chat").on('scroll', debounce(() => { scrollLock = true;
updateVisibleDivs('#chat', false); });
}, 10));*/
let S_TAFocused = false; let S_TAFocused = false;
let S_TAPreviouslyFocused = false; let S_TAPreviouslyFocused = false;