computeAABB method

AABB? computeAABB()

Implementation

AABB? computeAABB() {
  AABB? aabb;
  for (final ActorDrawable drawable in _drawableNodes) {
    // This is the axis aligned bounding box in the space
    // of the parent (this case our shape).
    AABB pathAABB = drawable.computeAABB();
    if (aabb == null) {
      aabb = pathAABB;
    } else {
      // Combine.
      aabb[0] = min(aabb[0], pathAABB[0]);
      aabb[1] = min(aabb[1], pathAABB[1]);

      aabb[2] = max(aabb[2], pathAABB[2]);
      aabb[3] = max(aabb[3], pathAABB[3]);
    }
  }

  return aabb;
}