connectionsAt method
Gets all visible connections at a point. Only returns connections where both source and target nodes are visible.
Implementation
List<Connection> connectionsAt(Offset point, {double radius = 0}) {
final connectionIds = _grid
.queryPoint(point, radius: radius)
.whereType<ConnectionSegmentItem>()
.map((item) => item.connectionId)
.toSet();
return connectionIds
.map((id) => _connections[id])
.whereType<Connection>()
.where((connection) {
final sourceNode = _nodes[connection.sourceNodeId];
final targetNode = _nodes[connection.targetNodeId];
return sourceNode != null &&
targetNode != null &&
sourceNode.isVisible &&
targetNode.isVisible;
})
.toList();
}