Rect

Hierarchy

  • Rect

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

+ new Rect(value: RectInput): Rect

Parameters:

Name

Type

value

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:

Name

Type

rect

Returns: Rect‹›

contains

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

Parameters:

Name

Type

x

number

y

number

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:

Name

Type

expansion

Rect | number

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:

Name

Type

shrink

Rect | number

Returns: this

intersects

intersects(rect: Rect): boolean

Parameters:

Name

Type

rect

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:

Name

Type

offset

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:

Name

Type

x

number

y

number

Returns: this

toString

toString(): string

Returns: string

Static from

from(rectLike: RectLike): Rect

Parameters:

Name

Type

rectLike

Returns: Rect

Last updated