Browse Source

fix(nc-gui): erd initial transition

pull/4066/head
braks 2 years ago
parent
commit
4de9f308fc
  1. 11
      packages/nc-gui/components/erd/Flow.vue

11
packages/nc-gui/components/erd/Flow.vue

@ -22,7 +22,7 @@ const { tables, config } = defineProps<Props>()
const { metasWithIdAsKey } = useMetas() const { metasWithIdAsKey } = useMetas()
const { $destroy, fitView } = useVueFlow({ minZoom: 0.1, maxZoom: 2 }) const { $destroy, fitView, onPaneReady, updateNodeInternals } = useVueFlow({ minZoom: 0.1, maxZoom: 2 })
const nodes = ref<Node[]>([]) const nodes = ref<Node[]>([])
const edges = ref<Edge[]>([]) const edges = ref<Edge[]>([])
@ -179,13 +179,18 @@ const layoutNodes = () => {
}) })
} }
onPaneReady(() => {
setTimeout(() => {
fitView({ duration: 300 })
updateNodeInternals(nodes.value.map((n) => n.id))
}, 100)
})
const init = () => { const init = () => {
initDagre() initDagre()
populateInitialNodes() populateInitialNodes()
populateEdges() populateEdges()
layoutNodes() layoutNodes()
setTimeout(() => fitView({ duration: 300 }))
} }
init() init()

Loading…
Cancel
Save