refactor(core): call fitViewOnInit when node dimensions are initially set
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { zoomIdentity } from 'd3-zoom'
|
||||
import type { ComputedRef } from 'vue'
|
||||
import { nextTick } from 'vue'
|
||||
import { until } from '@vueuse/core'
|
||||
import type {
|
||||
Actions,
|
||||
@@ -180,6 +181,13 @@ export function useActions(
|
||||
return res
|
||||
}, [])
|
||||
|
||||
if (!state.fitViewOnInitDone && state.fitViewOnInit) {
|
||||
nextTick(() => {
|
||||
viewportHelper.value.fitView()
|
||||
state.fitViewOnInitDone = true
|
||||
})
|
||||
}
|
||||
|
||||
if (changes.length) {
|
||||
state.hooks.nodesChange.trigger(changes)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user