Skip to main content

useNiceDagEdge(React)

The method is used to get utilities methods for edge deletion and node inserting.

useNiceDagEdge(edge: IEdge): { onEdgeRemove, onNodeInsert}

Arguments(UseNiceDagArgs)

IEdge object is given by nice-dag.

Return

onEdgeRemove

() => void

The function is usually used as an event listener. Once it is bound to a DOM object, it can perform the edge deletion when the event is fired.

onNodeInsert

(nodes: NiceDagTypes.Node[], offset: number) => void

The function is used to insert nodes between source node and target of the edge.

Arguments

NameOptionalDescriptionType
nodesNoGiven node list (You need to give the node list)Node[]
offsetYesThe offset (x,y) position of the start node)Point