boundingBox 方法

Rectangle<T> boundingBox(
  1. Rectangle<T> other
)
继承

返回一个新矩形,该矩形完全包含 thisother

实现

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

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

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