Skip to content

UseNodeGraphReturn

Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:64

Properties

addGroup()

addGroup: (bounds, options?) => string

Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:109

Append a group. Returns the group id.

Parameters

bounds

WorldRect

options?

AddGroupOptions

Returns

string


addNode()

addNode: (node) => string

Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:76

Append a node (generating an id when omitted). Returns the node id.

Parameters

node

NodeGraphNodeInput

Returns

string


bind

bind: NodeGraphBind

Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:116

Spread onto <NodeGraph {...bind} /> to wire all four controlled props.


clearSelection()

clearSelection: () => void

Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:113

Clear the selection.

Returns

void


connect()

connect: (source, target, data?) => string

Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:103

Add an edge between two ports, de-duplicating identical endpoints. Returns the new (or existing) edge id.

Parameters

source

NodeGraphPortRef

target

NodeGraphPortRef

data?

unknown

Returns

string


disconnectPort()

disconnectPort: (node, port) => void

Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:85

Remove every edge connected to a port — “detach all” for one socket.

Parameters

node

string

port

string

Returns

void


duplicateNodes()

duplicateNodes: (ids?, options?) => string[]

Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:95

Clone nodes (defaults to the current selection), append the copies, and select them. Returns the new node ids.

Parameters

ids?

readonly string[]

options?

DuplicateNodesOptions

Returns

string[]


edges

edges: NodeGraphEdge[]

Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:66


groups

groups: NodeGraphGroup[]

Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:67


nodes

nodes: NodeGraphNode[]

Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:65


removeEdges()

removeEdges: (ids) => void

Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:83

Remove the given edges and prune them from the selection.

Parameters

ids

readonly string[]

Returns

void


removeGroups()

removeGroups: (ids) => void

Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:111

Remove the given groups and prune them from the selection.

Parameters

ids

readonly string[]

Returns

void


removeNodes()

removeNodes: (ids) => void

Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:81

Cascade-delete the given nodes — removes them, drops any edge touching them, and prunes them from the selection.

Parameters

ids

readonly string[]

Returns

void


removeSelection()

removeSelection: () => void

Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:90

Cascade-delete the current selection (nodes + edges + groups) and clear it — the programmatic equivalent of pressing Delete.

Returns

void


selection

selection: NodeGraphSelection

Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:68


setEdges

setEdges: Dispatch<SetStateAction<NodeGraphEdge[]>>

Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:71


setGroups

setGroups: Dispatch<SetStateAction<NodeGraphGroup[]>>

Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:72


setNodes

setNodes: Dispatch<SetStateAction<NodeGraphNode[]>>

Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:70


setSelection

setSelection: Dispatch<SetStateAction<NodeGraphSelection>>

Defined in: src/components/editor/NodeGraph/useNodeGraph.ts:73