onContextAttached method

  1. @override
void onContextAttached()
override

Called when the context is attached (on add to graph or load).

For explicit/parent behaviors, this ensures:

  1. Child groups have correct z-indices (above this parent)
  2. Group is properly sized/positioned to fit all children with padding

Implementation

@override
void onContextAttached() {
  super.onContextAttached();

  // For explicit/parent behaviors, fix z-indices and fit to children
  if (behavior != GroupBehavior.bounds && _nodeIds.isNotEmpty) {
    _ensureExplicitChildGroupsAbove();
    // Fit to nodes to ensure proper padding around all children
    if (groupContext != null) {
      fitToNodes(groupContext!.getNode);
    }
  }
}