Skip to content

Commit

Permalink
Fixes: novuhq#4256
Browse files Browse the repository at this point in the history
  • Loading branch information
el_malignant committed Oct 31, 2023
1 parent 96cc7c8 commit dca7e35
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/web/src/components/workflow/FlowEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down

0 comments on commit dca7e35

Please sign in to comment.