Rectangle 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.

Memberof

PIXI

Hierarchy

  • Rectangle
    • Rectangle

Constructors

  • Parameters

    • Optional x: string | number

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

    • Optional y: string | number

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

    • Optional width: string | number

      The overall width of the rectangle

    • Optional height: string | number

      The overall height of the rectangle

    Returns Rectangle

Properties

height: number

Default

0
type: RECT

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

Default

PIXI.SHAPES.RECT

See

PIXI.SHAPES

width: number

Default

0
x: number

Default

0
y: number

Default

0

Accessors

  • get bottom(): number
  • Returns the bottom edge of the rectangle.

    Returns number

  • get left(): number
  • Returns the left edge of the rectangle.

    Returns number

  • get right(): number
  • Returns the right edge of the rectangle.

    Returns number

  • get top(): number
  • Returns the top edge of the rectangle.

    Returns number

  • get EMPTY(): Rectangle
  • A constant empty rectangle.

    Returns Rectangle

Methods

  • Enlarges rectangle that way its corners lie on grid

    Parameters

    • Optional resolution: number

      resolution

    • Optional eps: number

      precision

    Returns this

    Returns itself.

  • Creates a clone of this Rectangle

    Returns Rectangle

    a copy of the rectangle

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

    Parameters

    • x: number

      The X coordinate of the point to test

    • y: number

      The Y coordinate of the point to test

    Returns boolean

    Whether the x/y coordinates are within this Rectangle

  • Copies another rectangle to this one.

    Parameters

    • rectangle: Rectangle

      The rectangle to copy from.

    Returns Rectangle

    Returns itself.

  • Copies this rectangle to another one.

    Parameters

    • rectangle: Rectangle

      The rectangle to copy to.

    Returns Rectangle

    Returns given parameter.

  • Enlarges this rectangle to include the passed rectangle.

    Parameters

    • rectangle: Rectangle

      The rectangle to include.

    Returns this

    Returns itself.

  • Fits this rectangle around the passed one.

    Parameters

    Returns this

    Returns itself.

  • Determines whether the other Rectangle transformed by transform intersects with this Rectangle object. Returns true only if the area of the intersection is >0, this means that Rectangles sharing a side are not overlapping. Another side effect is that an arealess rectangle (width or height equal to zero) can't intersect any other rectangle.

    Parameters

    • other: Rectangle

      The Rectangle to intersect with this.

    • Optional transform: Matrix

      The transformation matrix of other.

    Returns boolean

    A value of true if the transformed other Rectangle intersects with this; otherwise false.

  • Pads the rectangle making it grow in all directions. If paddingY is omitted, both paddingX and paddingY will be set to paddingX.

    Parameters

    • Optional paddingX: number

      The horizontal padding amount.

    • Optional paddingY: number

      The vertical padding amount.

    Returns this

    Returns itself.

Generated using TypeDoc