Dynamic Icons Scripting Reference - v1.3.0
    Preparing search index...

    Class Rectangle

    A rectangle type storing x, y, with, & height values. Convenience methods are provided for various operations.

    The values are stored as origin (Vect2d type) and size (Size type) properties which can be read or manipulated directly using their respective methods.

    Index

    Accessors

    • get x(): number

      Returns number

    • set x(x: number): void

      Parameters

      • x: number

      Returns void

    • get y(): number

      Returns number

    • set y(y: number): void

      Parameters

      • y: number

      Returns void

    • get width(): number

      Returns number

    • set width(w: number): void

      Parameters

      • w: number

      Returns void

    • get height(): number

      Returns number

    • set height(h: number): void

      Parameters

      • h: number

      Returns void

    • get top(): number

      Returns number

    • get right(): number

      Returns number

    • get bottom(): number

      Returns number

    • get left(): number

      Returns number

    • get isEmpty(): boolean

      Returns true if either of the width or height are less than or equal to zero.

      Returns boolean

    • get isNull(): boolean

      Returns true if both the width or height are zero.

      Returns boolean

    • get fuzzyIsNull(): boolean

      Returns true if both width and height values are equal to zero to within 4 decimal places of precision.

      Returns boolean

    Constructors

    Methods

    • Parameters

      Returns this

    • Parameters

      Returns this

    • Parameters

      • origin: PointType
      • Optionalwidth: number
      • Optionalheight: number

      Returns this

    • Parameters

      • x: number
      • y: number
      • Optionalsize: SizeType

      Returns this

    • Parameters

      • Optionalx: number
      • Optionaly: number
      • Optionalwidth: number
      • Optionalheight: number

      Returns this

    • Returns string

    • Sets the top left coordinates of this rectangle to origin and returns itself.

      Parameters

      Returns this

    • Sets the top left coordinates of this rectangle to x and y and returns itself. If y is undefined then value of x is used for both dimensions.

      Parameters

      • x: number
      • Optionaly: number

      Returns this

    • Sets the size of this rectangle to size and returns itself.

      Parameters

      Returns this

    • Sets the size of this rectangle to width and height and returns itself. If height is undefined then value of width is used for both dimensions.

      Parameters

      • width: number
      • Optionalheight: number

      Returns this

    • Resets origin and size of this Rectangle instance to 0s and returns itself.

      Returns this

    • Returns true if this rectangle's origin and size are equal to other rectangle's origin and size.

      Parameters

      Returns boolean

    • Returns true if this rectangle's origin and size are equal to other rectangle's origin and size to within epsilon decimal places of precision.

      Parameters

      Returns boolean

    • Clones this Rectangle, adds origin to both origin coordinates and size to both size coordinates, and returns the new instance.

      Parameters

      Returns Rectangle

    • Clones this Rectangle, adds origin to both origin coordinates and right and bottom to size coordinates, and returns the new instance.

      Parameters

      • origin: number | PointType
      • right: number
      • bottom: number

      Returns Rectangle

    • Adds given offsets to a copy of this rectangle and returns the copy.

      Parameters

      • left: number
      • top: number
      • right: number
      • bottom: number

      Returns Rectangle

    • Adds origin to both origin coordinates and size to both size coordinates of this instance and returns itself.

      Parameters

      Returns this

    • Adds origin to both origin coordinates and right and bottom to size coordinates of this instance and returns itself.

      Parameters

      • origin: number | PointType
      • right: number
      • bottom: number

      Returns this

    • Adds given values to this rectangle's coordinates and returns this instance.

      Parameters

      • left: number
      • top: number
      • right: number
      • bottom: number

      Returns this

    • Combines the bounding area of this rectangle with that of the given rectangle(s) and returns itself.

      Parameters

      Returns Rectangle

    • Returns the bounding area of this rectangle and the given rectangle(s) as a new Rectangle instance. Doesn't modify the original.

      Parameters

      Returns Rectangle

    • Moves the x,y origin of the rectangle by the given offset. Returns itself.

      Parameters

      Returns this

    • Moves the x,y origin of the rectangle by the given amounts. If y is undefined then x value is added to both dimensions. Returns itself.

      Parameters

      • x: number
      • Optionaly: number

      Returns this

    • Scales this rectangle's origin.x and size.width by factor.x and origin.y and size.height by factor.y values. Returns itself.

      Parameters

      Returns this

    • Scales this rectangle's origin and size by factor. Returns itself.

      Parameters

      • factor: number

      Returns this

    • Scales this rectangle's origin.x and size.width by factorX and origin.y and size.height by factorY values.

      Parameters

      • factorX: number
      • factorY: number

      Returns this

    • Creates a new instance of Rectangle with origin(0,0) and the given size for width and height.

      Parameters

      Returns Rectangle

    • Creates a new instance of Rectangle from a "bounds" type object where origin coordinate properties are left/top instead of x/y.

      Parameters

      • Optionalbounds: { left: number; top: number; width: number; height: number }

      Returns Rectangle

    • Adds given offsets to a copy of the rect Rectangle and returns the copied & adjusted Rectangle.

      Parameters

      Returns Rectangle

    • Clones the rect Rectangle, adds origin to both origin coordinates and right and bottom to size coordinates, and returns the new instance.

      Parameters

      Returns Rectangle

    • Adds given offsets to a copy of rect Rectangle and returns the copy.

      Parameters

      • rect: Rectangle
      • left: number
      • top: number
      • right: number
      • bottom: number

      Returns Rectangle

    • Adds origin to both rect.origin coordinates and size to both rect.size coordinates. The input rectangle is modified. Returns the adjusted Rectangle.

      Parameters

      Returns Rectangle

    • Adds origin to both rect.origin coordinates and right and bottom to rect.size coordinates. The input rectangle is modified. Returns the adjusted Rectangle.

      Parameters

      Returns Rectangle

    • Adds given offsets to the given rectangle's coordinates. The input rectangle is modified. Returns the adjusted Rectangle.

      Parameters

      • rect: Rectangle
      • left: number
      • top: number
      • right: number
      • bottom: number

      Returns Rectangle

    • Returns the bounding area of the given rectangle(s) as a new Rectangle instance. Doesn't modify inputs.

      Parameters

      Returns Rectangle

    • Moves the x,y origin of the rectangle rect by the given offset. The input rectangle is modified and returned.

      Parameters

      Returns Rectangle

    • Moves the x,y origin of the rectangle rect by the given amounts. If y is undefined then x value is added to both dimensions. The input rectangle is modified and returned.

      Parameters

      Returns Rectangle

    • Scales rect rectangle's origin.x and size.width by factor.x and origin.y and size.height by factor.y values. The input rectangle is modified and returned.

      Parameters

      Returns Rectangle

    • Scales rect rectangle's origin and size by factor. The input rectangle is modified and returned.

      Parameters

      Returns Rectangle

    • Scales rect rectangle's origin.x and size.width by factorX and origin.y and size.height by factorY values. The input rectangle is modified and returned.

      Parameters

      • rect: Rectangle
      • factorX: number
      • factorY: number

      Returns Rectangle

    • Parameters

      • obj: any

      Returns boolean

    Properties

    origin: Vect2d = ...
    size: Size = ...