An immutable rectangle corresponding to screen coordinates where the vertical coordinates increase downwards.

Constructors

  • Parameters

    • left: number

      the horizontal coordinate of the top-left corner

    • top: number

      the vertical coordinate of the top-left corner

    • width: number

      the width of the rectangle

    • height: number

      the height of the rectangle

    Returns ScreenRect

Properties

EMPTY_RECT: ScreenRect = ...

An empty ScreenRect located at the origin.

Methods

  • Returns true if this ScreenRect is exactly equal to the other ScreenRect.

    Parameters

    • otherRect: ScreenRect

      the ScreenRect to compare to

    Returns boolean

    true if this ScreenRect is exactly equal to the other ScreenRect

  • The horizontal coordinate of this ScreenRect center.

    Returns number

    the horizontal coordinate of this ScreenRect center

  • The vertical coordinate of this ScreenRect center

    Returns number

    the vertical coordinate of this ScreenRect center

  • The height of this ScreenRect.

    Returns number

    the height of this ScreenRect.

  • The left coordinate of this ScreenRect.

    Returns number

    the left coordinate of this ScreenRect.

  • The top coordinate of this ScreenRect.

    Returns number

    the top coordinate of this ScreenRect

  • Returns true if this ScreenRect has zero width or height, within the tolerance

    Parameters

    • Optional opt_tol: number

      tolerance for comparison, default is 1E-14;

    Returns boolean

    true if this ScreenRect has zero width or height

  • Creates an oval path in the Canvas context, with the size of this ScreenRect.

    Parameters

    • context: CanvasRenderingContext2D

      the Canvas context to draw into

    Returns void

  • Creates a rectangle path in the Canvas context, with the size of this ScreenRect.

    Parameters

    • context: CanvasRenderingContext2D

      the Canvas context to draw into

    Returns void

  • Returns true if this ScreenRect is nearly equal to another ScreenRect. The optional tolerance value corresponds to the epsilon in Util.veryDifferent, so the actual tolerance used depends on the magnitude of the numbers being compared.

    Parameters

    • otherRect: ScreenRect

      the ScreenRect to compare to

    • Optional opt_tolerance: number

      optional tolerance for comparison

    Returns boolean

    true if this ScreenRect is nearly equal to the other ScreenRect

Generated using TypeDoc