Home

# Class goog.math.Box

Class for representing a box. A box is specified as a top, right, bottom, and left. A box is useful for representing margins and padding.

Instance Method Summary
| `clone() ⇒ !goog.math.Box` Creates a copy of the box with the same dimensions.
| `contains((goog.math.Box|goog.math.Coordinate|null) other) ⇒ boolean` Returns whether the box contains a coordinate or another box.
| `expand((goog.math.Box|null|number) top, number= opt_right, number= opt_bottom, number= opt_left) ⇒ !goog.math.Box` Expands box with the given margins.
| `expandToInclude(?goog.math.Box box)` Expand this box to include another box. NOTE(user): This is used in code that needs to be very fast, please don't add functionality to this function at the expense of speed (variable arguments, accepting multiple argument types, etc).
| `toString() ⇒ string` Returns a nice string representing the box.

Static Method Summary
| `boundingBox((goog.math.Coordinate|null|undefined) var_args) ⇒ !goog.math.Box` Creates a Box by bounding a collection of goog.math.Coordinate objects
| `contains(?goog.math.Box box, (goog.math.Box|goog.math.Coordinate|null) other) ⇒ boolean` Returns whether a box contains a coordinate or another box.
| `distance(?goog.math.Box box, ?goog.math.Coordinate coord) ⇒ number` Returns the distance between a coordinate and the nearest corner/side of a box. Returns zero if the coordinate is inside the box.
| `equals(?goog.math.Box a, ?goog.math.Box b) ⇒ boolean` Compares boxes for equality.
| `intersects(?goog.math.Box a, ?goog.math.Box b) ⇒ boolean` Returns whether two boxes intersect.
| `intersectsWithPadding(?goog.math.Box a, ?goog.math.Box b, number padding) ⇒ boolean` Returns whether two boxes would intersect with additional padding.