update(zoom): set store instance before emitting pane-ready event

* add missing generics on getters
* replace ? notation with undefined (does not mean the exact same, i.e.
`instance?: FlowInstance` will become `Ref<FlowInstance | undefined> | undefined`
using `instance: FlowInstance | undefined` results in `Ref<FlowInstance | undefined>`

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2022-02-21 20:25:17 +01:00
parent 082bc51599
commit 16997494ab
3 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -205,9 +205,9 @@ onMounted(async () => {
getEdges: onLoadGetEdges(store),
toObject: onLoadToObject(store),
}
store.hooks.paneReady.trigger(instance)
store.instance = instance
store.fitViewOnInit && instance.fitView()
store.hooks.paneReady.trigger(instance)
})
</script>
<script lang="ts">
+1 -1
View File
@@ -179,5 +179,5 @@ export type UseVueFlow<N = any, E = N> = {
store: FlowStore<N, E>
} & FlowHooksOn<N, E> &
ToRefs<State<N, E>> &
Getters &
Getters<N, E> &
Actions<N, E>
+7 -7
View File
@@ -10,14 +10,14 @@ import { FlowHooks, FlowHooksOn } from './hooks'
export interface State<N = any, E = N> extends Omit<FlowOptions<N, E>, 'id' | 'modelValue'> {
hooks: FlowHooks
instance?: FlowInstance
instance: FlowInstance | undefined
nodes: GraphNode<N>[]
edges: GraphEdge<E>[]
d3Zoom?: D3Zoom
d3Selection?: D3Selection
d3ZoomHandler?: D3ZoomHandler
d3Zoom: D3Zoom | undefined
d3Selection: D3Selection | undefined
d3ZoomHandler: D3ZoomHandler | undefined
minZoom: number
maxZoom: number
defaultZoom: number
@@ -37,9 +37,9 @@ export interface State<N = any, E = N> extends Omit<FlowOptions<N, E>, 'id' | 'm
multiSelectionKeyCode: KeyCode
zoomActivationKeyCode: KeyCode
connectionNodeId?: string
connectionHandleId?: string
connectionHandleType?: HandleType
connectionNodeId: string | undefined
connectionHandleId: string | undefined
connectionHandleType: HandleType | undefined
connectionPosition: XYPosition
connectionMode: ConnectionMode
connectionLineType: ConnectionLineType