Skip to main content

RectangleDefinition

Class representing a Rectangle definition.

Extends​

Constructors​

new RectangleDefinition()​

new RectangleDefinition(position, width, height, angle): RectangleDefinition

Creates a new instance of RectangleDefinition.

Parameters​

• position: Point

The position of the rectangle (top-left or center).

• width: number

The width of the rectangle.

• height: number

The height of the rectangle.

• angle: Angle

The angle of the rectangle in degrees.

Returns​

RectangleDefinition

Overrides​

ShapeDefinition.constructor

Defined in​

definitions/RectangleDefinition.ts:29

Properties​

angle​

angle: Angle

The angle of the rectangle.

Defined in​

definitions/RectangleDefinition.ts:19


height​

height: number

The height of the rectangle.

Defined in​

definitions/RectangleDefinition.ts:16


position​

position: Point

The position of the rectangle.

Defined in​

definitions/RectangleDefinition.ts:10


width​

width: number

The width of the rectangle.

Defined in​

definitions/RectangleDefinition.ts:13

Methods​

toArray()​

toArray(): any[]

Converts the object's properties to an array. If any of the properties are objects that implement ISerializable, their toArray method is called.

Returns​

any[]

An array representation of the object's properties.

Inherited from​

ShapeDefinition.toArray

Defined in​

common/Serializable.ts:16


toJson()​

toJson(): string

Converts the object to a JSON string. If any of the properties are objects that implement ISerializable, their toJson method is called. Underscores e.g. of private members are trimmed when setting the serialized name.

Returns​

string

A JSON string representation of the object.

Inherited from​

ShapeDefinition.toJson

Defined in​

common/Serializable.ts:32