feat(edges): Add source/target nodes to graph edges
# What's changed? * Bind source and target nodes to graph edges for convenience
This commit is contained in:
@@ -249,6 +249,8 @@ export default (state: State, getters: ComputedGetters): Actions => {
|
||||
...state.defaultEdgeOptions,
|
||||
...storedEdge,
|
||||
}),
|
||||
sourceNode,
|
||||
targetNode,
|
||||
})
|
||||
|
||||
return res
|
||||
@@ -287,6 +289,8 @@ export default (state: State, getters: ComputedGetters): Actions => {
|
||||
state.edges.push({
|
||||
...state.defaultEdgeOptions,
|
||||
...edge,
|
||||
sourceNode,
|
||||
targetNode,
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@@ -97,6 +97,8 @@ export interface EdgePositions {
|
||||
export type GraphEdge<Data = ElementData> = Edge<Data> & {
|
||||
selected?: boolean
|
||||
z?: number
|
||||
sourceNode: GraphNode
|
||||
targetNode: GraphNode
|
||||
} & EdgePositions
|
||||
|
||||
/** these props are passed to edge components */
|
||||
|
||||
Reference in New Issue
Block a user