rebuildAllConnectionSegments method

void rebuildAllConnectionSegments()

Rebuilds the entire connection spatial index using accurate path segments.

Implementation

void rebuildAllConnectionSegments() {
  if (!isConnectionPainterInitialized || _theme == null) return;

  final pathCache = _connectionPainter!.pathCache;
  final connectionStyle = _theme!.connectionTheme.style;

  _spatialIndex.rebuildConnectionsWithSegments(_connections, (connection) {
    final sourceNode = _nodes[connection.sourceNodeId];
    final targetNode = _nodes[connection.targetNodeId];
    if (sourceNode == null || targetNode == null) return [];

    return pathCache.getOrCreateSegmentBounds(
      connection: connection,
      sourceNode: sourceNode,
      targetNode: targetNode,
      connectionStyle: connectionStyle,
    );
  });
}