Merge branch 'SillyTavern:staging' into staging
This commit is contained in:
commit
5c61c47f31
|
@ -9253,12 +9253,26 @@ jQuery(async function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const chatElementScroll = document.getElementById('chat');
|
const chatElementScroll = document.getElementById('chat');
|
||||||
chatElementScroll.addEventListener('wheel', function () {
|
const chatScrollHandler = function () {
|
||||||
|
if (power_user.waifuMode) {
|
||||||
scrollLock = true;
|
scrollLock = true;
|
||||||
}, { passive: true });
|
return;
|
||||||
chatElementScroll.addEventListener('touchstart', function () {
|
}
|
||||||
|
|
||||||
|
const scrollIsAtBottom = Math.abs(chatElementScroll.scrollHeight - chatElementScroll.clientHeight - chatElementScroll.scrollTop) < 1;
|
||||||
|
|
||||||
|
// Resume autoscroll if the user scrolls to the bottom
|
||||||
|
if (scrollLock && scrollIsAtBottom) {
|
||||||
|
scrollLock = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cancel autoscroll if the user scrolls up
|
||||||
|
if (!scrollLock && !scrollIsAtBottom) {
|
||||||
scrollLock = true;
|
scrollLock = true;
|
||||||
}, { passive: true });
|
}
|
||||||
|
};
|
||||||
|
chatElementScroll.addEventListener('wheel', chatScrollHandler, { passive: true });
|
||||||
|
chatElementScroll.addEventListener('touchmove', chatScrollHandler, { passive: true });
|
||||||
chatElementScroll.addEventListener('scroll', function () {
|
chatElementScroll.addEventListener('scroll', function () {
|
||||||
if (is_use_scroll_holder) {
|
if (is_use_scroll_holder) {
|
||||||
this.scrollTop = scroll_holder;
|
this.scrollTop = scroll_holder;
|
||||||
|
|
Loading…
Reference in New Issue