Auto Scroll Update

This commit is contained in:
2025-11-28 03:14:06 +00:00
parent 9bda252271
commit c61cb39475
9 changed files with 56 additions and 26 deletions
+9 -8
View File
@@ -18,6 +18,7 @@
onComplete?: () => void;
interactive?: boolean;
speed?: SpeedPreset | number;
autoscroll?: boolean;
}
let {
@@ -26,7 +27,8 @@
class: className = '',
onComplete,
interactive = true,
speed = 'normal'
speed = 'normal',
autoscroll = true
}: Props = $props();
// Calculate speed multiplier from preset or number
@@ -54,14 +56,13 @@
let terminalElement: HTMLDivElement;
let bodyElement = $state<HTMLDivElement>();
// Autoscroll to bottom
// Autoscroll to bottom (respects autoscroll prop)
function scrollToBottom() {
if (bodyElement) {
bodyElement.scrollTo({
top: bodyElement.scrollHeight,
behavior: 'smooth'
});
}
if (!autoscroll || !bodyElement) return;
bodyElement.scrollTo({
top: bodyElement.scrollHeight,
behavior: 'smooth'
});
}
// Get all interactive button indices