onContextAttached method
Called when the context is attached (on add to graph or load).
For explicit/parent behaviors, this ensures:
- Child groups have correct z-indices (above this parent)
- 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);
}
}
}