RSX Code Reference
    Preparing search index...

    Class Size2

    The Size2 implements a 2D size with a width and height. The class follows the 'copy-on-write' pattern, which means that every operation such as Size2.add or Size2.subtract returns a copy of the size2 with updates values. It also implies that the values of the size2 cannot be directly modified.

    The concept of immutability improves sharing of objects as all types in TypeScript are assigned by identity, instead of by-value (e.g. a copy) as in other programming languages like C.

    Index
    • Parameters

      • Optionalwidth: number
      • Optionalheight: number

      Returns Size2

    _height: number
    _width: number

    A Size2 with all components set to zero.

    • get height(): number

      The height.

      Returns number

    • set height(value: number): void

      Parameters

      • value: number

      Returns void

    • get isZero(): boolean

      Determines if width and height are zero.

      Returns boolean

    • get width(): number

      The width.

      Returns number

    • set width(value: number): void

      Parameters

      • value: number

      Returns void

    • Copies all properties defined by the prototype of Size2 from other to this instance.

      Parameters

      Returns Size2

    • Clones this instance and returns a new Size2 with identical values.

      Returns Size2

    • Returns a copy of the current Size2 divided by a factor.

      Parameters

      • factor: number

      Returns Size2

    • Sets width and height to zero.

      Returns Size2

    • Divides this Size2 by a factor.

      Parameters

      • factor: number

      Returns Size2

    • Multiplies the width and height with the given factor.

      Parameters

      • factor: number

      Returns Size2

    • Sets the values.

      Parameters

      • width: number
      • height: number

      Returns Size2

    • Returns whether the provided Size2, given a error margin, has the same width and height values as this one.

      Parameters

      • rhs: Immutable<Size2>

        The other Size2 to compare with.

      • Optionalepsilon: number

        Optional. Error margin within which the numbers should be considered equal.

      Returns boolean

      True if equal, false otherwise.

    • Returns whether the given Size2 contains the same width and height as this one.

      Parameters

      Returns boolean

    • Returns a copy of this Size2 multiplied by the factor.

      Parameters

      • factor: number

      Returns Size2

    • Returns a string representation of an object.

      Returns string

    • Creates a new Size2 with the given width and height.

      Parameters

      • width: number
      • height: number

      Returns Size2

    • Compares two Size2 with an error margin.

      Parameters

      • lhs: Immutable<Size2>

        First size2 to compare.

      • rhs: Immutable<Size2>

        Second size2 to compare.

      • Optionalepsilon: number

        Optional. Error margin within which the numbers should be considered equal.

      Returns boolean

      True if equal, false otherwise.