@tspro/ts-utils-lib
    Preparing search index...

    Class AnchoredRect

    A mutable AnchoredRect class is a rectangle (left, top, right, bottom) with an anchor point (anchorX, anchorY).

    Index

    Constructors

    • Create rectangle with all zero values.

      Returns AnchoredRect

    • Create rectangle with left, right, top, bottom. Properties anchorX and anchorY will be centered in the middle.

      Parameters

      • left: number

        Left coordinate.

      • right: number

        Right coordinate.

      • top: number

        Top coordinate.

      • bottom: number

        Bottom coordinate.

      Returns AnchoredRect

    • Create rectangle with full arguments.

      Parameters

      • left: number

        Left coordinate.

      • anchorX: number

        Center x-coordinate.

      • right: number

        Right coordinate.

      • top: number

        Top coordinate.

      • anchorY: number

        Center y-coordinate.

      • bottom: number

        Bottom coordinate.

      Returns AnchoredRect

    Properties

    anchorX: number
    anchorY: number
    bottom: number
    left: number
    right: number
    top: number

    Accessors

    • get bottomh(): number

      Bottom section height getter.

      Returns number

    • get centerX(): number

      Get center x-coordinate.

      Returns number

    • get centerY(): number

      Get center ycoordinate.

      Returns number

    • get height(): number

      Height getter.

      Returns number

    • get leftw(): number

      Left section width getter.

      Returns number

    • get rightw(): number

      Right section width getter.

      Returns number

    • get toph(): number

      Top section height getter.

      Returns number

    • get width(): number

      Width getter.

      Returns number

    Methods

    • Does this Rect contain given (x, y)-point?

      Parameters

      • x: number

        X-coordinate.

      • y: number

        Y-coordinate.

      Returns boolean

      • True/false.
    • Check if this rect equals with another rect.

      Parameters

      Returns boolean

      • True/false.
    • Check if edges of this Rect equals with given Rect, ignoring anchorX and anchorY.

      Parameters

      Returns boolean

      • True/false.
    • Move this rect by (dx, dy). Immutable, returns modified copy.

      Parameters

      • dx: number

        Offset amount in x-direction.

      • dy: number

        Offset amount in y-direction.

      Returns AnchoredRect

      • AnchoredRect copy with applied offset.
    • Move this rect by (dx, dy). Modifies this Rect.

      Parameters

      • dx: number

        Offset amount in x-direction.

      • dy: number

        Offset amount in y-direction.

      Returns AnchoredRect

      • This AnchoredRect instance.
    • Scale Rect. Anchor pos is (anchorX, anchorY). Immutable, returns modified copy.

      Parameters

      • scaleX: number

        Scale x-amount.

      • scaleY: number = scaleX

        Scale y-amount. If undefined then scale x-amount is used.

      Returns AnchoredRect

      Scaled copy of this AnchoredRect.

    • Scale Rect. Anchor pos is (anchorX, anchorY). Modifies this Rect.

      Parameters

      • scaleX: number

        Scale x-amount.

      • scaleY: number = scaleX

        Scale y-amount. If undefined then scale x-amount is used.

      Returns AnchoredRect

      This AnchoredRect instance.

    • Set rectangle with all zero values.

      Returns AnchoredRect

    • Set rectangle with left, right, top, bottom. Properties anchorX and anchorY will be centered in the middle.

      Parameters

      • left: number

        Left coordinate.

      • right: number

        Right coordinate.

      • top: number

        Top coordinate.

      • bottom: number

        Bottom coordinate.

      Returns AnchoredRect

    • Set rectangle with full arguments.

      Parameters

      • left: number

        Left coordinate.

      • anchorX: number

        Center x-coordinate.

      • right: number

        Right coordinate.

      • top: number

        Top coordinate.

      • anchorY: number

        Center y-coordinate.

      • bottom: number

        Bottom coordinate.

      Returns AnchoredRect

    • Returns string

    • Create rect from basic left, top, width and height arguments.

      Parameters

      • left: number

        Left coordinate.

      • top: number

        Top coordinate.

      • width: number

        Width.

      • height: number

        Height.

      Returns AnchoredRect

      • AnchoredRect.
    • Create rect from anchorX, anchorY, width, height arguments.

      Parameters

      • centerX: number

        Center x-coordinate.

      • centerY: number

        Center y-coordinate.

      • width: number

        Width.

      • height: number

        Height.

      Returns AnchoredRect

      • AnchoredRect.
    • Create rect from sections.

      Parameters

      • leftw: number

        Left section width.

      • rightw: number

        Right section width.

      • toph: number

        Top section height.

      • bottomh: number

        Bottomsection height.

      Returns AnchoredRect

      • AnchoredRect.
    • Check if given rects are equal.

      Parameters

      Returns boolean

      • True/false.
    • Check if edges of given rects are equal, ignoring anchorX and anchorY.

      Parameters

      Returns boolean

      • True/false.