From dca7e35cf7ddc56d46c2e85c37d9d5688cfee3e1 Mon Sep 17 00:00:00 2001 From: el_malignant Date: Tue, 31 Oct 2023 20:19:05 +0530 Subject: [PATCH] Fixes: #4256 --- apps/web/src/components/workflow/FlowEditor.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/workflow/FlowEditor.tsx b/apps/web/src/components/workflow/FlowEditor.tsx index 7509ece23d2..456554f6f2f 100644 --- a/apps/web/src/components/workflow/FlowEditor.tsx +++ b/apps/web/src/components/workflow/FlowEditor.tsx @@ -91,10 +91,12 @@ export function FlowEditor({ useEffect(() => { const clientWidth = reactFlowWrapper.current?.clientWidth; - const middle = clientWidth ? clientWidth / 2 - 100 : 0; + const clientHeight = reactFlowWrapper.current?.clientHeight; + const middleX = clientWidth ? clientWidth / 2 - 100 : 0; + const middleY = clientHeight ? clientHeight / 2 : 0; const zoomView = 1; - reactFlowInstance.setViewport({ x: middle, y: 10, zoom: zoomView }); + reactFlowInstance.setViewport({ x: middleX, y: middleY, zoom: zoomView }); }, [reactFlowInstance]); useEffect(() => {