onNodeAdded method

bool onNodeAdded(
  1. String nodeId,
  2. Rect nodeBounds,
  3. AnnotationDragContext context
)

Called when a new node is added to the graph.

Override this method to respond when nodes are added. Return true if the annotation took action (e.g., auto-added to group).

Example

@override
bool onNodeAdded(String nodeId, Rect nodeBounds, AnnotationDragContext context) {
  if (bounds.contains(nodeBounds.center)) {
    addNode(nodeId);
    return true;
  }
  return false;
}

Implementation

bool onNodeAdded(
  String nodeId,
  Rect nodeBounds,
  AnnotationDragContext context,
) {
  // Default implementation does nothing
  return false;
}