Skip to content

maxrects-packer / IRectangleJSON

Interface: IRectangleJSON ​

Defined in: geom/Rectangle.ts:27

What toJSON() returns: the placed rect's public shape (issue #53).

width, height, x, y and rot are always present. The rest are optional because they are only written when they carry something: oversized when the packer tagged the rect, allowRotation when the rect has an explicit override, data when the payload is not the constructor's {} placeholder. The index signature leaves room for a subclass's own fields, which are serialized as well.

The shape satisfies IRectangleInput, so the result of JSON.parse(JSON.stringify(rect)) can be handed straight back to addArray().

Extends ​

Indexable ​

[propName: string]: any

Properties ​

allowRotation? ​

optional allowRotation?: boolean

Defined in: geom/Rectangle.ts:32


height ​

height: number

Defined in: geom/Rectangle.ts:12

Inherited from ​

IRectangleInput.height


oversized? ​

optional oversized?: boolean

Defined in: geom/Rectangle.ts:31


rot ​

rot: boolean

Defined in: geom/Rectangle.ts:30


width ​

width: number

Defined in: geom/Rectangle.ts:11

Inherited from ​

IRectangleInput.width


x ​

x: number

Defined in: geom/Rectangle.ts:28


y ​

y: number

Defined in: geom/Rectangle.ts:29