Description

An axis aligned rectangle. Used by anchors and offsets in ScreenTransform to represent screen boundaries. Rect can only store finite numbers in the range Number.MIN_VALUE to Number.MAX_VALUE.

Example

// @input Component.ScreenTransform screenTransform

// Move the ScreenTransform's anchor center
script.screenTransform.anchors.setCenter(new vec2(-0.25, 0.5));

// Change the ScreenTransform's anchor size
script.screenTransform.anchors.setSize(new vec2(0.25, 0.25));
interface Rect {
    bottom: number;
    left: number;
    right: number;
    top: number;
    getCenter(): vec2;
    getSize(): vec2;
    getTypeName(): string;
    isOfType(type): boolean;
    isSame(other): boolean;
    setCenter(value): void;
    setSize(value): void;
    toString(): string;
}

Hierarchy (view full)

Properties

bottom: number

Description

The y position of the rectangle's bottom side.

left: number

Description

The x position of the rectangle's left side.

right: number

Description

The x position of the rectangle's right side.

top: number

Description

The y position of the rectangle's top side.

Methods

  • Returns vec2

    Description

    Returns the rectangle's center position as (x, y).

  • Returns vec2

    Description

    Returns the size of the rectangle as (width, height).

  • Returns string

    Description

    Returns the name of this object's type.

  • Parameters

    • type: string

    Returns boolean

    Description

    Returns true if the object matches or derives from the passed in type.

  • Parameters

    Returns boolean

    Description

    Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

  • Parameters

    Returns void

    Description

    Sets the rectangle's center position while maintaining its size.

  • Parameters

    Returns void

    Description

    Sets the rectangle's size while maintaining its center position.

  • Returns string

    Description

    Returns a string representation of the Rect.

Generated using TypeDoc