5.20231.904
wijmo Class Rect Wijmo API Class

Rect Class

Class that represents a rectangle (with left, top, width, and height).

Heirarchy

  • Rect

Constructors

constructor

  • new Rect(left: number, top: number, width: number, height: number): Rect
  • Initializes a new instance of the Rect class.

    Parameters

    • left: number

      Left coordinate of the new Rect.

    • top: number

      Top coordinate of the new Rect.

    • width: number

      Width of the new Rect.

    • height: number

      Height of the new Rect.

    Returns Rect

Properties

bottom

bottom: number

Gets the bottom coordinate of this Rect.

height

height: number

Gets or sets the height of this Rect.

left

left: number

Gets or sets the left coordinate of this Rect.

right

right: number

Gets the right coordinate of this Rect.

top

top: number

Gets or sets the top coordinate of this Rect.

width

width: number

Gets or sets the width of this Rect.

Methods

clone

  • Creates a copy of this Rect.

    Returns Rect

contains

  • contains(pt: any): boolean
  • Determines whether the rectangle contains a given point or rectangle.

    Parameters

    Returns boolean

equals

  • equals(rc: Rect): boolean
  • Returns true if a Rect has the same coordinates and dimensions as this Rect.

    Parameters

    Returns boolean

inflate

  • inflate(dx: number, dy: number): Rect
  • Creates a rectangle that results from expanding or shrinking a rectangle by the specified amounts.

    Parameters

    • dx: number

      The amount by which to expand or shrink the left and right sides of the rectangle.

    • dy: number

      The amount by which to expand or shrink the top and bottom sides of the rectangle.

    Returns Rect

Static fromBoundingRect

  • fromBoundingRect(rc: any): Rect
  • Creates a Rect from ClientRect or SVGRect objects.

    Parameters

    • rc: any

      Rectangle obtained by a call to the DOM's getBoundingClientRect or GetBoundingBox methods.

    Returns Rect

Static intersection

  • Gets a rectangle that represents the intersection of two rectangles.

    Parameters

    • rc1: Rect

      First rectangle.

    • rc2: Rect

      Second rectangle.

    Returns Rect

Static union

  • Gets a rectangle that represents the union of two rectangles.

    Parameters

    • rc1: Rect

      First rectangle.

    • rc2: Rect

      Second rectangle.

    Returns Rect