Don't auto-adjust scroll height if not in viewport

This commit is contained in:
Cohee 2024-06-16 14:56:08 +03:00
parent 5e44403346
commit d75b30d51a
2 changed files with 7 additions and 0 deletions

View File

@ -712,6 +712,10 @@ function onChatChanged() {
} }
function adjustElementScrollHeight(){ function adjustElementScrollHeight(){
if (!$('.sd_settings').is(':visible')) {
return;
}
resetScrollHeight($('#sd_prompt_prefix')); resetScrollHeight($('#sd_prompt_prefix'));
resetScrollHeight($('#sd_negative_prompt')); resetScrollHeight($('#sd_negative_prompt'));
resetScrollHeight($('#sd_character_prompt')); resetScrollHeight($('#sd_character_prompt'));

View File

@ -292,6 +292,9 @@ export function throttle(func, limit = 300) {
* @returns {boolean} True if the element is in the viewport, false otherwise. * @returns {boolean} True if the element is in the viewport, false otherwise.
*/ */
export function isElementInViewport(el) { export function isElementInViewport(el) {
if (!el) {
return false;
}
if (typeof jQuery === 'function' && el instanceof jQuery) { if (typeof jQuery === 'function' && el instanceof jQuery) {
el = el[0]; el = el[0];
} }