Search


Search something to see results

Rectangle

Implements

Index

Constructors

Properties

Accessors

Methods

Constructors

Creates an instance of Rectangle.

Parameters

  • width: number = 0

    width of the rectangle (default is 0)

  • height: number = 0

    height of the rectangle (default is 0)

  • x: number = 0

    x position of the rectangle (default is 0)

  • y: number = 0

    y position of the rectangle (default is 0)

  • rot: boolean = false

    rotation flag (default is false)

  • allowRotation: undefined | boolean = undefined

    allow rotation flag (default is undefined)

Returns Rectangle

Properties

_allowRotation: undefined | boolean = undefined
_data: any
_dirty: number = 0
_height: number
_rot: boolean = false
_width: number
_x: number
_y: number
oversized: boolean = false

Oversized tag on rectangle which is bigger than packer itself.

Accessors

  • get allowRotation(): undefined | boolean

    If the rectangle allow rotation

    Returns undefined | boolean

  • set allowRotation(value: undefined | boolean): void

    Set the allowRotation tag of the rectangle.

    Parameters

    • value: undefined | boolean

    Returns void

  • get rot(): boolean

    If the rectangle is rotated

    Returns boolean

  • set rot(value: boolean): void

    Set the rotate tag of the rectangle.

    note: after rot is set, width/height of this rectangle is swaped.

    Parameters

    • value: boolean

    Returns void

Methods

Get the area (w * h) of the rectangle

Returns number

The area of the rectangle

Test if the given rectangle collide with this rectangle.

Parameters

Returns boolean

true if rectangles collide

Test if this rectangle contains the given rectangle.

Parameters

Returns boolean

true if this rectangle contains the given rectangle

Parameters

  • value: boolean = true

Returns void

Test if two given rectangle collide each other

Parameters

Returns any

true if rectangles collide

Test if the first rectangle contains the second one

Parameters

Returns any

true if first rectangle contains the second