diff --git a/packages/web/src/App.svelte b/packages/web/src/App.svelte index 7d055f3..81b79a7 100644 --- a/packages/web/src/App.svelte +++ b/packages/web/src/App.svelte @@ -1192,10 +1192,18 @@ ); let chronicleEl = $state(null); + /** The chronicle follows the newest line only while the reader is at + * the bottom; scrolled back into history, it holds still. */ + let chronicleStick = true; + function onChronicleScroll() { + if (!chronicleEl) return; + chronicleStick = + chronicleEl.scrollHeight - chronicleEl.scrollTop - chronicleEl.clientHeight < 60; + } $effect(() => { void net.log.length; void local.log.length; - if (chronicleEl) chronicleEl.scrollTop = chronicleEl.scrollHeight; + if (chronicleEl && chronicleStick) chronicleEl.scrollTop = chronicleEl.scrollHeight; }); // Tab title + favicon carry the turn signal even from another tab. @@ -2044,13 +2052,14 @@ -
+
{#if local.active} - {#each local.log.slice(-60) as line, i (i)} + {#each local.log as line, i (i)}
{line}
{/each} {:else} - {#each net.log.slice(-60) as line, i (i)} + {#each net.log as line, i (i)}
{line.text} {#if line.notable && line.turn !== null && prefs.instantReplay && !net.spectating}