Rect

Hierarchy

  • Rect

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

+ new Rect(value: RectInput): Rect

Parameters:

Returns: Rect

Properties

b

b: number

l

l: number

r

r: number

t

t: number

Accessors

height

get height(): number

Returns: number

width

get width(): number

Returns: number

Methods

clone

clone(): Rect‹›

Returns a copy of Rect that can be mutated separately.

Returns: Rect‹›

cloneTo

cloneTo(rect: Rect): Rect‹›

Copies all of this Rect's properties to a Rect specified in an argument. Returns the line passed as argument.

Parameters:

Returns: Rect‹›

contains

contains(x: number, y: number): boolean

Parameters:

Returns: boolean

expand

expand(expansion: Rect | number): this

Expands this Rect by other Rect's dimensions (i.e. to reduce padding) or by a constant numeric value from each side. Resulting Rect is the same, mutated Rect.

Parameters:

Returns: this

inset

inset(shrink: Rect | number): this

Shrinks this Rect by other Rect's dimensions (i.e. to apply padding) or by a constant numeric value from each side. Resulting Rect is the same, mutated Rect.

Parameters:

Returns: this

intersects

intersects(rect: Rect): boolean

Parameters:

Returns: boolean

offset

offset(offset: Rect | Point): this

Moves this Rect by left top position of passed rect or by XY coordinates of a Point. Resulting Rect is the same, mutated Rect.

Parameters:

Returns: this

offset(x: number, y: number): this

Moves this Rect by passed x and y coordinates. Resulting Rect is the same, mutated Rect.

Parameters:

Returns: this

toString

toString(): string

Returns: string

Static from

from(rectLike: RectLike): Rect

Parameters:

Returns: Rect

Last updated