Class: RoundedRectangle

RoundedRectangle

The RoundedRectangle 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, including a radius property that defines the radius of the rounded corners.

new RoundedRectangle (x, y, width, height, radius)

Name Type Default Description
x number 0

The X coordinate of the upper-left corner of the rounded rectangle

y number 0

The Y coordinate of the upper-left corner of the rounded rectangle

width number 0

The overall width of this rounded rectangle

height number 0

The overall height of this rounded rectangle

radius number 20

Controls the radius of the rounded corners

Implements

Members

height number

The overall height of this rounded rectangle

Default Value:
  • 0

radius number

Controls the radius of the rounded corners

Default Value:
  • 20

type string readonly

The type of the object, mainly used to avoid instanceof checks

Default Value:
  • 'roundedRectangle'

width number

The overall width of this rounded rectangle

Default Value:
  • 0

x number

The X coordinate of the upper-left corner of the rounded rectangle

Default Value:
  • 0

y number

The Y coordinate of the upper-left corner of the rounded rectangle

Default Value:
  • 0

Methods

Creates a clone of this Rounded Rectangle.

Returns:
Type Description
RoundedRectangle
  • A copy of the rounded rectangle.

contains (x, y) boolean

Checks whether the x and y coordinates given are contained within this Rounded Rectangle

Name Type Description
x number

The X coordinate of the point to test.

y number

The Y coordinate of the point to test.

Returns:
Type Description
boolean
  • Whether the x/y coordinates are within this Rounded Rectangle.

copyFrom (rectangle) this

Copies another rectangle to this one.

Name Type Description
rectangle RoundedRectangle

The rectangle to copy from.

Returns:
Type Description
this Returns itself.

copyTo (rectangle) RoundedRectangle

Copies this rectangle to another one.

Name Type Description
rectangle RoundedRectangle

The rectangle to copy to.

Returns:
Type Description
RoundedRectangle Returns given parameter.

getBounds (out) Rectangle

Returns the framing rectangle of the rounded rectangle as a Rectangle object

Name Type Attributes Description
out Rectangle <optional>

optional rectangle to store the result

Returns:
Type Description
Rectangle The framing rectangle

strokeContains (pX, pY, strokeWidth) boolean

Checks whether the x and y coordinates given are contained within this rectangle including the stroke.

Name Type Description
pX number

The X coordinate of the point to test

pY number

The Y coordinate of the point to test

strokeWidth number

The width of the line to check

Returns:
Type Description
boolean Whether the x/y coordinates are within this rectangle