clearSelection method

void clearSelection()

Clears all selections (nodes and connections) and exits any active editing mode.

This is a convenience method that calls clearNodeSelection and clearConnectionSelection, and also clears any inline editing state on nodes like CommentNode.

Implementation

void clearSelection() {
  runInAction(() {
    // Clear any inline editing state on nodes
    for (final node in _nodes.values) {
      if (node.isEditing) {
        node.isEditing = false;
      }
    }

    // Only clear selections if something is selected
    if (_selectedNodeIds.isNotEmpty || _selectedConnectionIds.isNotEmpty) {
      clearNodeSelection();
      clearConnectionSelection();
    }
  });
}