getConnectionPoints method

  1. @override
GraphConnectionPoints? getConnectionPoints(
  1. GraphNode source,
  2. GraphNode target,
  3. Widget sourceWidget,
  4. Widget targetWidget,
)
override

Calculates connection points between two nodes.

Returns intersection points where links should connect to the nodes' shapes, based on their current geometry.

Implementation

@override
GraphConnectionPoints? getConnectionPoints(
  GraphNode source,
  GraphNode target,
  Widget sourceWidget,
  Widget targetWidget,
) {
  final outgoing = _getLineIntersections(source, target);
  final incoming = _getLineIntersections(target, source);

  if (outgoing == null || incoming == null) {
    return null;
  }
  return GraphConnectionPoints(outgoing: outgoing, incoming: incoming);
}