Class: Rect

Rect

A Rect consists of an x and y point (the upper-left corner) and a width and height.

new Rect(x, y, width, height)

A Rect

Name Type Description
x Number

X coordinate of the Rect origin

y Number

Y coordinate of the Rect origin

width Number

Width of the rectangle

height Number

Height of the rectangle

Members

bottomNumber

Get bottom of the Rect

heightNumber

Get or set the height.

leftNumber

Get left of the Rect. Same as X.

Get right of the Rect

topNumber

Get top of the Rect. Same as Y.

widthNumber

Get or set the width.

xNumber

Get or set the x position of the origin.

yNumber

Get or set the y position of the origin.

Methods

containsPt(x, y){Boolean}

Check if the Rect conains the point

Name Type Description
x Number

X coordinate of the point

y Number

Y coordinate of the point

Returns:
Type Description
Boolean

overlap(rectArray){Boolean}

Check if any of the Rect overlaps with any Rects in the array. If there is an overlap the first overlapping Rect is returned.

Name Type Description
rectArray Array

Array of Rects

Returns:
Type Description
Boolean