From be44af4680ea0a4bda50c3d9ea67929ba2a57da6 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Thu, 19 Sep 2024 01:25:46 +0200 Subject: [PATCH] enh: focus on current message --- src/lib/components/chat/Overview.svelte | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lib/components/chat/Overview.svelte b/src/lib/components/chat/Overview.svelte index a252b7959..5d571fcca 100644 --- a/src/lib/components/chat/Overview.svelte +++ b/src/lib/components/chat/Overview.svelte @@ -34,6 +34,10 @@ drawFlow(); } + $: if (history?.currentId) { + fitView({ nodes: [{ id: history.currentId }] }); + } + const drawFlow = async () => { const nodeList = []; const edgeList = []; @@ -116,19 +120,21 @@ nodesInitialized.subscribe(async (initialized) => { if (initialized) { await tick(); - const res = await fitView(); + const res = await fitView({ nodes: [{ id: history.currentId }] }); } }); width.subscribe((value) => { if (value) { - fitView(); + // fitView(); + fitView({ nodes: [{ id: history.currentId }] }); } }); height.subscribe((value) => { if (value) { - fitView(); + // fitView(); + fitView({ nodes: [{ id: history.currentId }] }); } }); });