update: use prop for fitViewOnInit
Signed-off-by: bcakmakoglu <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -65,7 +65,7 @@ export default {
|
||||
</script>
|
||||
<template>
|
||||
<div class="vue-flow">
|
||||
<ZoomPane :key="`renderer-${id}`">
|
||||
<ZoomPane :key="`renderer-${id}`" :fit-view-on-init="fitViewOnInit">
|
||||
<template v-for="nodeName of Object.keys(getNodeTypes)" #[`node-${nodeName}`]="nodeProps" :key="`node-${nodeName}-${id}`">
|
||||
<slot :name="`node-${nodeName}`" v-bind="nodeProps" />
|
||||
</template>
|
||||
|
||||
@@ -15,6 +15,8 @@ import {
|
||||
import SelectionPane from '../SelectionPane/SelectionPane.vue'
|
||||
import TransformationPane from '../TransformationPane/TransformationPane.vue'
|
||||
|
||||
const props = defineProps<{ fitViewOnInit?: boolean }>()
|
||||
|
||||
const { id, store } = useVueFlow()
|
||||
const zoomPaneEl = templateRef<HTMLDivElement>('zoomPane', null)
|
||||
|
||||
@@ -206,7 +208,7 @@ onMounted(async () => {
|
||||
toObject: onLoadToObject(store),
|
||||
}
|
||||
store.instance = instance
|
||||
store.fitViewOnInit && instance.fitView()
|
||||
props.fitViewOnInit && instance.fitView()
|
||||
store.hooks.paneReady.trigger(instance)
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user