Skip to content

Commit

Permalink
fix: architecture refreshes with correct positioning
Browse files Browse the repository at this point in the history
  • Loading branch information
davemooreuws committed Mar 8, 2024
1 parent f9f0b13 commit d29d0ff
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,15 @@ function ReactFlowLayout() {
setEdges([...layouted.edges])

window.requestAnimationFrame(() => {
fitView()
setTimeout(
() =>
fitView({
minZoom: 1,
maxZoom: 1.5,
duration: 500, // animation duration of repositioning the arch diagram
}),
100, // ensure the diagram is 100% ready before re-fitting
)
})
}, [data])

Expand All @@ -142,6 +150,10 @@ function ReactFlowLayout() {
}}
onConnect={onConnect}
fitView
fitViewOptions={{
maxZoom: 1.5,
minZoom: 1,
}}
>
<MiniMap pannable zoomable className="!bg-blue-300" />
<Background variant={BackgroundVariant.Dots} gap={12} size={1} />
Expand Down

0 comments on commit d29d0ff

Please sign in to comment.