boundingBox method

  1. @override
Rectangle<num> boundingBox(
  1. Rectangle<num> other
)

Returns a new rectangle which completely contains this and other.

Implementation

@override
Rectangle<num> boundingBox(Rectangle<num> other) {
  var right = max(this.left + width, other.left + other.width);
  var bottom = max(this.top + height, other.top + other.height);

  var left = min(this.left, other.left);
  var top = min(this.top, other.top);

  return Rectangle<num>(left, top, right - left, bottom - top);
}