@@ -616,7 +616,7 @@ export const FlowBuilderComponent: React.FC<FlowBuilderProps> = (props) => {
616616const InternalFlowBuilder : React . FC < FlowBuilderProps > = ( props ) => {
617617 const { flowId, namespaceId, projectId, ...rest } = props
618618
619- const { setCenter, getInternalNode } = useReactFlow ( ) ;
619+ const { setCenter, getInternalNode, getZoom } = useReactFlow ( ) ;
620620 const fileTabsService = useService ( FileTabsService )
621621
622622 const nodeTypes = React . useMemo ( ( ) => ( {
@@ -635,10 +635,6 @@ const InternalFlowBuilder: React.FC<FlowBuilderProps> = (props) => {
635635 const [ edges , setEdges , edgeChangeEvent ] = useEdgesState < Edge > ( [ ] )
636636 const [ showTree , setShowTree ] = React . useState < boolean > ( false )
637637
638- const viewportWidth = useStore ( s => s . width ) ;
639- const viewportHeight = useStore ( s => s . height ) ;
640- const flowInstance = useReactFlow ( )
641-
642638 const updateNodeInternals = useUpdateNodeInternals ( )
643639
644640 const { fitView} = useReactFlow ( )
@@ -740,8 +736,10 @@ const InternalFlowBuilder: React.FC<FlowBuilderProps> = (props) => {
740736 const centerX = node . internals . positionAbsolute . x + node . measured . width / 2 ;
741737 const centerY = node . internals . positionAbsolute . y + node . measured . height / 2 ;
742738
739+ const currentZoom = getZoom ( ) ;
740+
743741 setCenter ( centerX , centerY , {
744- zoom : 1 ,
742+ zoom : Math . max ( currentZoom , 1 ) ,
745743 duration : 250 ,
746744 } ) . then ( ) ;
747745 }
0 commit comments