Rectangle Class
the Rectangle object is an area defined by its position, as indicated by its top-left corner point (x, y) and by its width and its height.
Constructor
Rectangle
(
-
x -
y -
width -
height
Parameters:
-
xNumberThe X coord of the upper-left corner of the rectangle
-
yNumberThe Y coord of the upper-left corner of the rectangle
-
widthNumberThe overall width of this rectangle
-
heightNumberThe overall height of this rectangle
Methods
contains
(
Boolean
-
x -
y
Checks whether the x and y coordinates passed to this function are contained within this Rectangle
Parameters:
-
xNumberThe X coordinate of the point to test
-
yNumberThe Y coordinate of the point to test
Returns:
Boolean:
Whether the x/y coords are within this Rectangle
Properties
height
Number
Default: 0
width
Number
Default: 0
x
Number
Default: 0
y
Number
Default: 0
