new Rectangle(x, y, width, height)
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The X coordinate of the upper-left corner of the rectangle |
y |
number | The Y coordinate of the upper-left corner of the rectangle |
width |
number | The overall width of this rectangle |
height |
number | The overall height of this rectangle |
- Source:
Members
-
<static, constant> EMPTY
-
A constant empty rectangle.
- Source:
-
height :number
-
Type:
- number
- Default Value:
-
- 0
- Source:
-
type :number
-
The type of the object, mainly used to avoid
instanceof
checksType:
- number
- Source:
-
width :number
-
Type:
- number
- Default Value:
-
- 0
- Source:
-
x :number
-
Type:
- number
- Default Value:
-
- 0
- Source:
-
y :number
-
Type:
- number
- Default Value:
-
- 0
- Source:
Methods
-
clone()
-
Creates a clone of this Rectangle
- Source:
Returns:
a copy of the rectangle
- Type
- Rectangle
-
contains(x, y)
-
Checks whether the x and y coordinates given are contained within this Rectangle
Parameters:
Name Type Description x
number The X coordinate of the point to test
y
number The Y coordinate of the point to test
- Source:
Returns:
Whether the x/y coordinates are within this Rectangle
- Type
- boolean