boundingRect method

void boundingRect(
  1. Rect rect
)

Expand this rectangle to also include the area of the given rectangle. @param {goog.math.Rect} rect The other rectangle.

Implementation

void boundingRect(Rect rect)
{
  // We compute right and bottom before we change left and top below.
  double right = Math.max(this.left + this.width, rect.left + rect.width);
  double bottom = Math.max(this.top + this.height, rect.top + rect.height);

  this.left = Math.min(this.left, rect.left);
  this.top = Math.min(this.top, rect.top);

  this.width = right - this.left;
  this.height = bottom - this.top;
}