refactor(core): fit view initially when node dimensions are updated
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -21,6 +21,8 @@ import type {
|
||||
} from '~/types'
|
||||
|
||||
export function useActions(state: State, getters: ComputedGetters): Actions {
|
||||
let fitViewOnInitDone = false
|
||||
|
||||
const updateNodeInternals: Actions['updateNodeInternals'] = (ids) => {
|
||||
state.hooks.updateNodeInternals.trigger(ids)
|
||||
}
|
||||
@@ -151,6 +153,13 @@ export function useActions(state: State, getters: ComputedGetters): Actions {
|
||||
return res
|
||||
}, [])
|
||||
|
||||
if (state.fitViewOnInit && !fitViewOnInitDone) {
|
||||
paneReady().then((helper) => {
|
||||
helper.fitView()
|
||||
fitViewOnInitDone = true
|
||||
})
|
||||
}
|
||||
|
||||
if (changes.length) state.hooks.nodesChange.trigger(changes)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user