refactor(core): emit pane ready after timeout of 1ms

This commit is contained in:
braks
2024-01-29 21:56:44 +01:00
committed by Braks
parent 308cff5f45
commit abe6006a09
+8 -4
View File
@@ -209,6 +209,12 @@ export function useActions(
return res return res
}, []) }, [])
if (!state.fitViewOnInitDone && state.fitViewOnInit) {
viewportHelper.value.fitView()
}
state.fitViewOnInitDone = true
if (changes.length) { if (changes.length) {
state.hooks.nodesChange.trigger(changes) state.hooks.nodesChange.trigger(changes)
} }
@@ -964,10 +970,7 @@ export function useActions(
until(() => viewportHelper.value.initialized) until(() => viewportHelper.value.initialized)
.toBe(true) .toBe(true)
.then(async () => { .then(async () => {
if (state.fitViewOnInit) { setTimeout(() => {
await viewportHelper.value.fitView()
}
state.hooks.paneReady.trigger({ state.hooks.paneReady.trigger({
id, id,
emits, emits,
@@ -977,6 +980,7 @@ export function useActions(
...getters, ...getters,
...actions, ...actions,
}) })
}, 1)
}) })
return actions return actions