Rectangle Class
Represents a rectangle as defined by the points (x, y) and (x+width, y+height).
Example
var rect = new createjs.Rectangle(0, 0, 100, 100);
Constructor
Item Index
Methods
clone
()
Rectangle
Returns a clone of the Rectangle instance.
Returns:
a clone of the Rectangle instance.
contains
-
x
-
y
-
[width=0]
-
[height=0]
Returns true if this rectangle fully encloses the described point or rectangle.
Parameters:
Returns:
True if the described point or rectangle is contained within this rectangle.
copy
-
rectangle
Copies all properties from the specified rectangle to this rectangle.
Parameters:
-
rectangle
RectangleThe rectangle to copy properties from.
Returns:
This rectangle. Useful for chaining method calls.
extend
-
x
-
y
-
[width=0]
-
[height=0]
Extends the rectangle's bounds to include the described point or rectangle.
Parameters:
Returns:
This instance. Useful for chaining method calls.
intersection
-
rect
Returns a new rectangle which describes the intersection (overlap) of this rectangle and the specified rectangle, or null if they do not intersect.
Parameters:
-
rect
RectangleThe rectangle to calculate an intersection with.
Returns:
A new rectangle describing the intersection or null.
intersects
-
rect
Returns true if the specified rectangle intersects (has any overlap) with this rectangle.
Parameters:
-
rect
RectangleThe rectangle to compare.
Returns:
True if the rectangles intersect.
isEmpty
()
Boolean
Returns true if the width or height are equal or less than 0.
Returns:
True if the rectangle is empty.
pad
-
top
-
left
-
bottom
-
right
Adds the specified padding to the rectangle's bounds.
Returns:
This instance. Useful for chaining method calls.
setValues
-
[x=0]
-
[y=0]
-
[width=0]
-
[height=0]
Sets the specified values on this instance.
Parameters:
Returns:
This instance. Useful for chaining method calls.