goog.math.Box
Classgoog.math.Box(top, right, bottom, left)
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.
top
{number
}
right
{number
}
bottom
{number
}
left
{number
}
.bottom
{number
}Bottom
.boundingBox(var_args)
Creates a Box by bounding a collection of goog.math.Coordinate objects
var_args
{...goog.math.Coordinate
}
goog.math.Box
}
.clone()
Creates a copy of the box with the same dimensions.
goog.math.Box
}
.contains(other)
Returns whether the box contains a coordinate or another box.
other
{goog.math.Coordinate
|goog.math.Box
}
boolean
}
.distance(box, coord)
Returns the distance between a coordinate and the nearest corner/side of a box. Returns zero if the coordinate is inside the box.
box
{goog.math.Box
}
coord
{goog.math.Coordinate
}
number
}
.equals(a, b)
Compares boxes for equality.
a
{goog.math.Box
}
b
{goog.math.Box
}
boolean
}
.expand(top, opt_right, opt_bottom, opt_left)
Expands box with the given margins.
top
{number
|goog.math.Box
}
opt_right
{number
=}
opt_bottom
{number
=}
opt_left
{number
=}
goog.math.Box
}
.expandToInclude(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).
box
{goog.math.Box
}
.intersects(a, b)
Returns whether two boxes intersect.
a
{goog.math.Box
}
b
{goog.math.Box
}
boolean
}
.intersectsWithPadding(a, b, padding)
Returns whether two boxes would intersect with additional padding.
a
{goog.math.Box
}
b
{goog.math.Box
}
padding
{number
}
boolean
}
.left
{number
}Left
.relativePositionX(box, coord)
Returns the relative x position of a coordinate compared to a box. Returns zero if the coordinate is inside the box.
box
{goog.math.Box
}
coord
{goog.math.Coordinate
}
number
}
.relativePositionY(box, coord)
Returns the relative y position of a coordinate compared to a box. Returns zero if the coordinate is inside the box.
box
{goog.math.Box
}
coord
{goog.math.Coordinate
}
number
}
.right
{number
}Right
.toString()
Returns a nice string representing the box.
string
}
.top
{number
}Top