Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Constructors

constructor

Properties

height

height: number

Readonly type

type: RECT

width

width: number

x

x: number

y

y: number

Accessors

bottom

  • get bottom(): number
  • returns the bottom edge of the rectangle

    member

    {number}

    Returns number

halfX

  • get halfX(): number

halfY

  • get halfY(): number

left

  • get left(): number
  • returns the left edge of the rectangle

    member

    {number}

    Returns number

right

  • get right(): number
  • returns the right edge of the rectangle

    member

    {number}

    Returns number

top

  • get top(): number
  • returns the top edge of the rectangle

    member

    {number}

    Returns number

Static EMPTY

  • A constant empty rectangle.

    static
    constant
    member

    {PIXI.Rectangle}

    Returns Rectangle

    An empty rectangle

Static WINDOW

Methods

ceil

  • ceil(resolution?: number, eps?: number): Rectangle
  • Enlarges rectangle that way its corners lie on grid

    Parameters

    • Optional resolution: number
    • Optional eps: number

    Returns Rectangle

    Returns itself.

clone

  • Creates a clone of this Rectangle

    Returns Rectangle

    a copy of the rectangle

collidesWith

  • collidesWith(other: Required<IRectangle>): boolean

collisionWith

  • Test if this Rectangle has a collision with another Rectangle.

    remarks

    Expensive function, use {@link Rectangle#collidesWith} to just see if they collide or not.

    Parameters

    Returns null | Hit

    The Hit result or null if not intersecting.

contains

  • contains(x: number, y: number): boolean
  • 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

copyFrom

  • Copies another rectangle to this one.

    Parameters

    • rectangle: Rectangle

      The rectangle to copy from.

    Returns Rectangle

    Returns itself.

copyTo

  • Copies this rectangle to another one.

    Parameters

    • rectangle: Rectangle

      The rectangle to copy to.

    Returns Rectangle

    Returns given parameter.

enlarge

  • Enlarges this rectangle to include the passed rectangle.

    Parameters

    • rectangle: Rectangle

      The rectangle to include.

    Returns Rectangle

    Returns itself.

fit

  • Fits this rectangle around the passed one.

    Parameters

    Returns Rectangle

    Returns itself.

intersectSegment

  • intersectSegment(position: Vector2, delta: Vector2, paddingX?: number, paddingY?: number): null | Hit
  • Test if a segment intersect with this Rectangle.

    Parameters

    • position: Vector2

      Start of the segment.

    • delta: Vector2

      End of the segment.

    • paddingX: number = 0

      Padding X to add to this Rectangle.

    • paddingY: number = 0

      Padding Y to add to this Rectangle.

    Returns null | Hit

    • The Hit result or null if not intersecting.

pad

  • pad(paddingX?: number, paddingY?: number): Rectangle
  • 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
    • Optional paddingY: number

    Returns Rectangle

    Returns itself.

toString

  • toString(): string
  • Returns string

Static appRectangle

Static fromCoords

  • fromCoords(x1: number, y1: number, x2: number, y2: number): Rectangle

Static fromPoints

Static fromSprite

Generated using TypeDoc