Usage guidesInteraction

Drag edge endpoints

Drag an endpoint of an existing edge and use the drop event to read the proposed connection.

Drag an endpoint of an existing edge and use the drop event to read the proposed connection.

Configuration

Start dragging near an endpoint. On release, edge:dragend reports the proposed connection. Call updateEdgeData() to apply it.

Example

Loading example…
Start on the A–B edge near B, then release on C.
graph.on('edge:dragend', ({ edgeId, source, target, reconnected }) => {
  if (reconnected && edgeId) {
    graph.updateEdgeData([{ id: edgeId, source, target }]);
  }
  ui.setStatus(`dragend reconnected=${reconnected}\n${edgeId ?? '-'}: ${source} → ${target}`);
});

Options and defaults