Skip to content
  1. API
  2. Ogma
  3. tools

Ogma.tools.connectNodes

Connect Nodes API: functions to connect nodes by drawing edges.

ogma.tools.connectNodes.disable()

Disable the "connectNodes" mode.

ogma.tools.connectNodes.enable([options])

Enable the "connectNodes" mode, allowing the user to draw edges with the mouse.

Arguments

  • options(optional) object
    • condition(optional) function(source: Node, target: Node): boolean If specified, will only connect nodes that satisfy this condition.
    • continueDrawing(optional) boolean[=false] If true, the mode will not be disabled after the first connection is created.
    • createEdge(optional) function(rawEdge: RawEdge):RawEdge Callback called before creating a new edge: allows you to change the id, data and attributes of the new edge.
    • createNode(optional) function(rawNode: RawNode):RawNode Callback called before creating a new node: allows you to change the id, data and attributes of the new node.
    • createNodes(optional) boolean[=true] Indicates if a node should be created when pointing on an empty space.
    • cursorStyle(optional) CursorStyle[="cell"]
    • dashLength(optional) number[=8]
    • onComplete(optional) function(source:Node, target: Node, edge: Edge):void Called when a new connection is created. Note that target and edge could be null in case of no edge is created.
    • onEdgeCreated(optional) function(edge: Edge):void In this callback you can add properties or styles to the created edge.
    • onNodeCreated(optional) function(node: Node):void If createNodes is set to true, a new node will be created and here you can add properties or styles to it.
    • strokeColor(optional) Color[="black"]
    • strokeWidth(optional) number[=2]

ogma.tools.connectNodes.enabled()

Indicates if the "connectNodes" mode is enabled.