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>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="vue-flow">
|
<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}`">
|
<template v-for="nodeName of Object.keys(getNodeTypes)" #[`node-${nodeName}`]="nodeProps" :key="`node-${nodeName}-${id}`">
|
||||||
<slot :name="`node-${nodeName}`" v-bind="nodeProps" />
|
<slot :name="`node-${nodeName}`" v-bind="nodeProps" />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import {
|
|||||||
import SelectionPane from '../SelectionPane/SelectionPane.vue'
|
import SelectionPane from '../SelectionPane/SelectionPane.vue'
|
||||||
import TransformationPane from '../TransformationPane/TransformationPane.vue'
|
import TransformationPane from '../TransformationPane/TransformationPane.vue'
|
||||||
|
|
||||||
|
const props = defineProps<{ fitViewOnInit?: boolean }>()
|
||||||
|
|
||||||
const { id, store } = useVueFlow()
|
const { id, store } = useVueFlow()
|
||||||
const zoomPaneEl = templateRef<HTMLDivElement>('zoomPane', null)
|
const zoomPaneEl = templateRef<HTMLDivElement>('zoomPane', null)
|
||||||
|
|
||||||
@@ -206,7 +208,7 @@ onMounted(async () => {
|
|||||||
toObject: onLoadToObject(store),
|
toObject: onLoadToObject(store),
|
||||||
}
|
}
|
||||||
store.instance = instance
|
store.instance = instance
|
||||||
store.fitViewOnInit && instance.fitView()
|
props.fitViewOnInit && instance.fitView()
|
||||||
store.hooks.paneReady.trigger(instance)
|
store.hooks.paneReady.trigger(instance)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user