RoundRect
class RoundRect extends Rect
a rectangle object with rounded corners
Constructor
new RoundRect(x: number, y: number, width: number, height: number, radius: number) → {}
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
x | number |
position of the rounded rectangle |
||
y | number |
position of the rounded rectangle |
||
width | number |
the rectangle width |
||
height | number |
the rectangle height |
||
radius | number |
<optional> |
20 |
the radius of the rounded corner |
Summary
Properties from RoundRect
number |
|
string |
|
Methods from RoundRect
RoundRect |
|
boolean |
|
RoundRect |
|
boolean |
|
Properties inherited from Rect
Methods inherited from Rect
Methods inherited from Polygon
Bounds |
|
Array<number> |
|
boolean |
|
Polygon |
|
Polygon |
|
Polygon |
|
Polygon |
|
|
|
Polygon |
|
Polygon |
|
Polygon |
|
Polygon |
|
Bounds |
|
Public Properties
Public Methods
clone() → {RoundRect}
clone this RoundRect
Type | Description |
---|---|
RoundRect |
new RoundRect |
contains(x: number | Vector2d | Rect, y: number) → {boolean}
Returns true if the rounded rectangle contains the given point or rectangle
if (rect.contains(10, 10)) {
// do something
}
// or
if (rect.contains(myVector2d)) {
// do something
}
if (rect.contains(myRect)) {
// do something
}
Name | Type | Attributes | Description |
---|---|---|---|
x | number | Vector2d | Rect |
x coordinate or a vector point, or a Rect to test |
|
y | number |
<optional> |
y coordinate |
Type | Description |
---|---|
boolean |
True if the rounded rectangle contain the given point or rectangle, otherwise false |
copy(rrect: RoundRect) → {RoundRect}
copy the position, size and radius of the given rounded rectangle into this one
Name | Type | Description |
---|---|---|
rrect | RoundRect |
source rounded rectangle |
Type | Description |
---|---|
RoundRect |
new rectangle |
equals(rrect: RoundRect) → {boolean}
check if this RoundRect is identical to the specified one
Name | Type | Description |
---|---|---|
rrect | RoundRect |
Type | Description |
---|---|
boolean |
true if equals |