clearControlPoints method

void clearControlPoints(
  1. String connectionId
)

Clears all control points from a connection.

This reverts the connection to using its default algorithmic path.

Automatically invalidates the connection's cached path to trigger a repaint.

Does nothing if the connection doesn't exist.

Parameters:

  • connectionId: The ID of the connection to modify

Example:

controller.clearControlPoints('conn1');

Implementation

void clearControlPoints(String connectionId) {
  final connection = _connections.firstWhere(
    (c) => c.id == connectionId,
    orElse: () => throw ArgumentError('Connection $connectionId not found'),
  );

  runInAction(() {
    connection.controlPoints = [];
  });

  // Invalidate cached path
  _connectionPainter?.pathCache.removeConnection(connectionId);
}