RoundRect

class RoundRect extends Rect

a rectangle object with rounded corners

Constructor


new RoundRect(x: number, y: number, width: number, height: number, radius: number) → {}
Parameters:
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

Public Properties


radius roundrect.js:40
radius: number = 20

number

the radius of the rounded corner

type roundrect.js:22
type: string = "RoundRect"

string

the shape type (used internally)

Public Methods


clone roundrect.js:149
clone() → {RoundRect}

clone this RoundRect

Returns:
Type Description
RoundRect

new RoundRect

contains roundrect.js:70
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
}
Parameters:
Name Type Attributes Description
x number | Vector2d | Rect

x coordinate or a vector point, or a Rect to test

y number

<optional>

y coordinate

Returns:
Type Description
boolean

True if the rounded rectangle contain the given point or rectangle, otherwise false

copy roundrect.js:59
copy(rrect: RoundRect) → {RoundRect}

copy the position, size and radius of the given rounded rectangle into this one

Parameters:
Name Type Description
rrect RoundRect

source rounded rectangle

Returns:
Type Description
RoundRect

new rectangle

equals roundrect.js:140
equals(rrect: RoundRect) → {boolean}

check if this RoundRect is identical to the specified one

Parameters:
Name Type Description
rrect RoundRect
Returns:
Type Description
boolean

true if equals


Powered by webdoc!