From 1c8850fc952431cd6fd6c663601b15b6e859f993 Mon Sep 17 00:00:00 2001 From: lyzno1 <92089059+lyzno1@users.noreply.github.com> Date: Tue, 9 Sep 2025 14:58:42 +0800 Subject: [PATCH] feat: adjust scroll to selected node position to top-left area (#25403) --- .../components/workflow/utils/node-navigation.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/web/app/components/workflow/utils/node-navigation.ts b/web/app/components/workflow/utils/node-navigation.ts index 5522764949..57106ae6ee 100644 --- a/web/app/components/workflow/utils/node-navigation.ts +++ b/web/app/components/workflow/utils/node-navigation.ts @@ -97,13 +97,14 @@ export function setupScrollToNodeListener( const node = nodes.find(n => n.id === nodeId) if (node) { // Use ReactFlow's fitView API to scroll to the node - reactflow.fitView({ - nodes: [node], - padding: 0.2, - duration: 800, - minZoom: 0.5, - maxZoom: 1, - }) + const nodePosition = { x: node.position.x, y: node.position.y } + + // Calculate position to place node in top-left area + // Move the center point right and down to show node in top-left + const targetX = nodePosition.x + window.innerWidth * 0.25 + const targetY = nodePosition.y + window.innerHeight * 0.25 + + reactflow.setCenter(targetX, targetY, { zoom: 1, duration: 800 }) } } }