math.Rect Extends Object
Class for representing rectangular regions.

Inheritance

Constructor

goog.math.Rect(xywh)

Parameters

x :
Left.
y :
Top.
w :
Width.
h :
Height.

Instance Methods

Public Protected Private
Defined in goog.math.Rect
boundingRect(rect)
Expand this rectangle to also include the area of the given rectangle.
Arguments:
rect :
(goog.math.Rect | null)
The other rectangle.
code »
clone()
Returns a new copy of the rectangle.
Returns:   A clone of this Rectangle.
code »
contains(another)
Tests whether this rectangle entirely contains another rectangle or coordinate.
Arguments:
another :
The rectangle or coordinate to test for containment.
Returns:   Whether this rectangle contains given rectangle or coordinate.
code »
difference(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.
Arguments:
rect :
(goog.math.Rect | null)
A Rectangle.
Returns:   An array with 0 to 4 rectangles which together define the difference area of rectangle a minus rectangle b.
code »
getSize()
Returns the size of this rectangle.
Returns:   The size of this rectangle.
code »
intersection(rect)
Computes the intersection of this rectangle and the rectangle parameter. If there is no intersection, returns false and leaves this rectangle as is.
Arguments:
rect :
(goog.math.Rect | null)
A Rectangle.
Returns:   True iff this rectangle intersects with the parameter.
code »
intersects(rect)
Returns whether a rectangle intersects this rectangle.
Arguments:
rect :
(goog.math.Rect | null)
A rectangle.
Returns:   Whether rect intersects this rectangle.
code »
toBox()
Returns a new Box object with the same position and dimensions as this rectangle.
Returns:   A new Box representation of this Rectangle.
code »
toString()
Returns a nice string representing size and dimensions of rectangle.
Returns:   In the form (50, 73 - 75w x 25h).
code »

Instance Properties

Defined in goog.math.Rect
height :
Height
Code »
left :
Left
Code »
top :
Top
Code »
width :
Width
Code »

Static Methods

goog.math.Rect.boundingRect(ab)
(goog.math.Rect | null)
Returns a new rectangle which completely contains both input rectangles.
Arguments:
a :
(goog.math.Rect | null)
A rectangle.
b :
(goog.math.Rect | null)
A rectangle.
Returns: 
(goog.math.Rect | null)
  A new bounding rect, or null if either rect is null.
code »
goog.math.Rect.createFromBox(box)
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.
Arguments:
box :
(goog.math.Box | null)
A box.
Returns:   A new Rect initialized with the box's position and size.
code »
goog.math.Rect.difference(ab)
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.
Arguments:
a :
(goog.math.Rect | null)
A Rectangle.
b :
(goog.math.Rect | null)
A Rectangle.
Returns:   An array with 0 to 4 rectangles which together define the difference area of rectangle a minus rectangle b.
code »
goog.math.Rect.equals(ab)
Compares rectangles for equality.
Arguments:
a :
(goog.math.Rect | null)
A Rectangle.
b :
(goog.math.Rect | null)
A Rectangle.
Returns:   True iff the rectangles have the same left, top, width, and height, or if both are null.
code »
goog.math.Rect.intersection(ab)
(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.
Arguments:
a :
(goog.math.Rect | null)
A Rectangle.
b :
(goog.math.Rect | null)
A Rectangle.
Returns: 
(goog.math.Rect | null)
  A new intersection rect (even if width and height are 0), or null if there is no intersection.
code »
goog.math.Rect.intersects(ab)
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.
Arguments:
a :
(goog.math.Rect | null)
A Rectangle.
b :
(goog.math.Rect | null)
A Rectangle.
Returns:   Whether a and b intersect.
code »

Package math

Package Reference