Skip to content

API > @blocksuite/blocks > Rect

Class: Rect ​

Constructors ​

constructor ​

new Rect( left, top, right, bottom): Rect

Parameters ​

ParameterType
leftnumber
topnumber
rightnumber
bottomnumber

Returns ​

Rect

Defined In ​

packages/blocks/src/_common/utils/rect.ts:94

Properties ​

max ​

max: Point

Defined In ​

packages/blocks/src/_common/utils/rect.ts:92


min ​

min: Point

Defined In ​

packages/blocks/src/_common/utils/rect.ts:90

Accessors ​

bottom ​

get bottom(): number

Defined In ​

packages/blocks/src/_common/utils/rect.ts:141

packages/blocks/src/_common/utils/rect.ts:145


height ​

get height(): number

Defined In ​

packages/blocks/src/_common/utils/rect.ts:109

packages/blocks/src/_common/utils/rect.ts:113


left ​

get left(): number

Defined In ​

packages/blocks/src/_common/utils/rect.ts:117

packages/blocks/src/_common/utils/rect.ts:121


get right(): number

Defined In ​

packages/blocks/src/_common/utils/rect.ts:133

packages/blocks/src/_common/utils/rect.ts:137


top ​

get top(): number

Defined In ​

packages/blocks/src/_common/utils/rect.ts:125

packages/blocks/src/_common/utils/rect.ts:129


width ​

get width(): number

Defined In ​

packages/blocks/src/_common/utils/rect.ts:101

packages/blocks/src/_common/utils/rect.ts:105

Methods ​

center ​

center(): Point

Returns ​

Point

Defined In ​

packages/blocks/src/_common/utils/rect.ts:149


clamp ​

clamp(p): Point

Parameters ​

ParameterType
pPoint

Returns ​

Point

Defined In ​

packages/blocks/src/_common/utils/rect.ts:217


clone ​

clone(): Rect

Returns ​

Rect

Defined In ​

packages/blocks/src/_common/utils/rect.ts:221


contains ​

contains(__namedParameters): boolean

Parameters ​

ParameterType
__namedParametersRect

Returns ​

boolean

Defined In ​

packages/blocks/src/_common/utils/rect.ts:175


equals ​

equals(__namedParameters): boolean

Parameters ​

ParameterType
__namedParametersRect

Returns ​

boolean

Defined In ​

packages/blocks/src/_common/utils/rect.ts:171


extend_with ​

extend_with(point): void

Parameters ​

ParameterType
pointPoint

Returns ​

void

Defined In ​

packages/blocks/src/_common/utils/rect.ts:156


extend_with_x ​

extend_with_x(x): void

Parameters ​

ParameterType
xnumber

Returns ​

void

Defined In ​

packages/blocks/src/_common/utils/rect.ts:161


extend_with_y ​

extend_with_y(y): void

Parameters ​

ParameterType
ynumber

Returns ​

void

Defined In ​

packages/blocks/src/_common/utils/rect.ts:166


intersect ​

intersect(other): Rect

Parameters ​

ParameterType
otherRect

Returns ​

Rect

Defined In ​

packages/blocks/src/_common/utils/rect.ts:210


intersects ​

intersects(__namedParameters): boolean

Parameters ​

ParameterType
__namedParametersRect

Returns ​

boolean

Defined In ​

packages/blocks/src/_common/utils/rect.ts:179


isPointDown ​

isPointDown(__namedParameters): boolean

Parameters ​

ParameterType
__namedParametersPoint

Returns ​

boolean

Defined In ​

packages/blocks/src/_common/utils/rect.ts:194


isPointIn ​

isPointIn(__namedParameters): boolean

Parameters ​

ParameterType
__namedParametersPoint

Returns ​

boolean

Defined In ​

packages/blocks/src/_common/utils/rect.ts:188


isPointLeft ​

isPointLeft(__namedParameters): boolean

Parameters ​

ParameterType
__namedParametersPoint

Returns ​

boolean

Defined In ​

packages/blocks/src/_common/utils/rect.ts:202


isPointRight ​

isPointRight(__namedParameters): boolean

Parameters ​

ParameterType
__namedParametersPoint

Returns ​

boolean

Defined In ​

packages/blocks/src/_common/utils/rect.ts:206


isPointUp ​

isPointUp(__namedParameters): boolean

Parameters ​

ParameterType
__namedParametersPoint

Returns ​

boolean

Defined In ​

packages/blocks/src/_common/utils/rect.ts:198


toDOMRect ​

toDOMRect(): DOMRect

Returns ​

DOMRect

Defined In ​

packages/blocks/src/_common/utils/rect.ts:226


fromDOM ​

static fromDOM(dom): Rect

Parameters ​

ParameterType
domElement

Returns ​

Rect

Defined In ​

packages/blocks/src/_common/utils/rect.ts:259


fromDOMRect ​

static fromDOMRect(__namedParameters): Rect

Parameters ​

ParameterType
__namedParametersDOMRect

Returns ​

Rect

Defined In ​

packages/blocks/src/_common/utils/rect.ts:255


fromLTRB ​

static fromLTRB( left, top, right, bottom): Rect

Parameters ​

ParameterType
leftnumber
topnumber
rightnumber
bottomnumber

Returns ​

Rect

Defined In ​

packages/blocks/src/_common/utils/rect.ts:231


fromLWTH ​

static fromLWTH( left, width, top, height): Rect

Parameters ​

ParameterType
leftnumber
widthnumber
topnumber
heightnumber

Returns ​

Rect

Defined In ​

packages/blocks/src/_common/utils/rect.ts:235


fromPoint ​

static fromPoint(point): Rect

Parameters ​

ParameterType
pointPoint

Returns ​

Rect

Defined In ​

packages/blocks/src/_common/utils/rect.ts:243


fromPoints ​

static fromPoints(start, end): Rect

Parameters ​

ParameterType
startPoint
endPoint

Returns ​

Rect

Defined In ​

packages/blocks/src/_common/utils/rect.ts:247


fromXY ​

static fromXY(x, y): Rect

Parameters ​

ParameterType
xnumber
ynumber

Returns ​

Rect

Defined In ​

packages/blocks/src/_common/utils/rect.ts:239