goog.math.Rect
Instance Methods
this.boundingRect( rect ) → void
void
Expand this rectangle to also include the area of the given rectangle.
Parameters |
|
---|
this.ceil() → goog.math.Rect
goog.math.Rect
Rounds the fields to the next larger integer values.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.clone() → goog.math.Rect
goog.math.Rect
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.contains( another ) → boolean
boolean
Tests whether this rectangle entirely contains another rectangle or coordinate.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.difference( rect ) → Array<goog.math.Rect>
Array<goog.math.Rect>
Computes the difference regions between this rectangle and rect
. The
return value is an array of 0 to 4 rectangles defining the remaining regions
of this rectangle after the other has been subtracted.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.distance( point ) → number
number
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.floor() → goog.math.Rect
goog.math.Rect
Rounds the fields to the next smaller integer values.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.getBottomRight() → goog.math.Coordinate
goog.math.Coordinate
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.getCenter() → goog.math.Coordinate
goog.math.Coordinate
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.getSize() → goog.math.Size
goog.math.Size
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.getTopLeft() → goog.math.Coordinate
goog.math.Coordinate
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.intersection( rect ) → boolean
boolean
Computes the intersection of this rectangle and the rectangle parameter. If there is no intersection, returns false and leaves this rectangle as is.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.intersects( rect ) → boolean
boolean
Returns whether a rectangle intersects this rectangle.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.round() → goog.math.Rect
goog.math.Rect
Rounds the fields to nearest integer values.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.scale( sx, opt_sy ) → goog.math.Rect
goog.math.Rect
Scales this rectangle by the given scale factors. The left and width values
are scaled by sx
and the top and height values are scaled by
opt_sy
. If opt_sy
is not given, then all fields are scaled
by sx
.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
this.squaredDistance( point ) → number
number
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.toBox() → goog.math.Box
goog.math.Box
Returns a new Box object with the same position and dimensions as this rectangle.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.toString() → string
string
Returns a nice string representing size and dimensions of rectangle.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.translate( tx, opt_ty ) → goog.math.Rect
goog.math.Rect
Translates this rectangle by the given offsets. If a
goog.math.Coordinate
is given, then the left and top values are
translated by the coordinate's x and y values. Otherwise, left and top are
translated by tx
and opt_ty
respectively.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
Instance Properties
this.height → number
number
Specified by |
---|
this.left → number
number
Specified by |
---|
this.top → number
number
Specified by |
---|
this.width → number
number
Specified by |
---|
Static Functions
Rect.boundingRect( a, b ) → (goog.math.Rect|null)
(goog.math.Rect|null)
Returns a new rectangle which completely contains both input rectangles.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
Rect.createFromBox( box ) → goog.math.Rect
goog.math.Rect
Creates a new Rect object with the same position and dimensions as a given Box. Note that this is only the inverse of toBox if left/top are defined.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
Rect.createFromPositionAndSize( position, size ) → goog.math.Rect
goog.math.Rect
Creates a new Rect object with the position and size given.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
Rect.difference( a, b ) → Array<goog.math.Rect>
Array<goog.math.Rect>
Computes the difference regions between two rectangles. The return value is an array of 0 to 4 rectangles defining the remaining regions of the first rectangle after the second has been subtracted.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
Rect.equals( a, b ) → boolean
boolean
Compares rectangles for equality.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
Rect.intersection( a, b ) → (goog.math.Rect|null)
(goog.math.Rect|null)
Returns the intersection of two rectangles. Two rectangles intersect if they touch at all, for example, two zero width and height rectangles would intersect if they had the same top and left.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
Rect.intersects( a, b ) → boolean
boolean
Returns whether two rectangles intersect. Two rectangles intersect if they touch at all, for example, two zero width and height rectangles would intersect if they had the same top and left.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|