Skip to content

API > @blocksuite/blocks > Bound

Class: Bound ​

Implements ​

Constructors ​

constructor ​

new Bound( x = 0, y = 0, w = 0, h = 0): Bound

Parameters ​

ParameterTypeDefault value
xnumber0
ynumber0
wnumber0
hnumber0

Returns ​

Bound

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:17

Properties ​

h ​

h: number

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:15

Implementation of ​

IBound.h


w ​

w: number

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:14

Implementation of ​

IBound.w


x ​

x: number

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:12

Implementation of ​

IBound.x


y ​

y: number

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:13

Implementation of ​

IBound.y

Accessors ​

bl ​

get bl(): number[]

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:92


br ​

get br(): number[]

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:96


center ​

get center(): IVec

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:64


horizontalLine ​

get horizontalLine(): IVec[]

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:107


leftLine ​

get leftLine(): IVec[]

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:128


lowerLine ​

get lowerLine(): IVec[]

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:121


maxX ​

get maxX(): number

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:76


maxY ​

get maxY(): number

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:80


midPoints ​

get midPoints(): IVec[]

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:55


minX ​

get minX(): number

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:68


minY ​

get minY(): number

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:72


points ​

get points(): IVec[]

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:46


rightLine ​

get rightLine(): IVec[]

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:135


tl ​

get tl(): IVec

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:84


tr ​

get tr(): number[]

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:88


upperLine ​

get upperLine(): IVec[]

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:114


verticalLine ​

get verticalLine(): IVec[]

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:100

Methods ​

clone ​

clone(): Bound

Returns ​

Bound

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:209


contains ​

contains(bound): boolean

Parameters ​

ParameterType
boundBound

Returns ​

boolean

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:268


containsPoint ​

containsPoint(__namedParameters): boolean

Parameters ​

ParameterType
__namedParametersIVec

Returns ​

boolean

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:142


expand ​

expand( left, top = left, right = left, bottom = top): Bound

Parameters ​

ParameterTypeDefault value
leftnumberundefined
topnumberleft
rightnumberleft
bottomnumbertop

Returns ​

Bound

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:235


getRelativePoint ​

getRelativePoint(__namedParameters): IVec

Parameters ​

ParameterType
__namedParametersIVec

Returns ​

IVec

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:197


getVerticesAndMidpoints ​

getVerticesAndMidpoints(): IVec[]

Returns ​

IVec[]

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:277


horizontalDistance ​

horizontalDistance(bound): number

Parameters ​

ParameterType
boundBound

Returns ​

number

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:221


include ​

include(point): Bound

Parameters ​

ParameterType
pointIVec

Returns ​

Bound

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:189


intersectLine ​

intersectLine( sp, ep, infinite = false): null | IVec[]

Parameters ​

ParameterTypeDefault value
spIVecundefined
epIVecundefined
infinitebooleanfalse

Returns ​

null | IVec[]

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:147


isHorizontalCross ​

isHorizontalCross(bound): boolean

Parameters ​

ParameterType
boundBound

Returns ​

boolean

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:213


isIntersectWithBound ​

isIntersectWithBound(bound, epsilon = EPSILON): boolean

Parameters ​

ParameterTypeDefault value
boundBoundundefined
epsilonnumberEPSILON

Returns ​

boolean

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:161


isOverlapWithBound ​

isOverlapWithBound(bound, epsilon = EPSILON): boolean

Parameters ​

ParameterTypeDefault value
boundBoundundefined
epsilonnumberEPSILON

Returns ​

boolean

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:172


isPointInBound ​

isPointInBound(__namedParameters, tolerance = 0.01): boolean

Parameters ​

ParameterTypeDefault value
__namedParametersIVecundefined
tolerancenumber0.01

Returns ​

boolean

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:249


isPointOnBound ​

isPointOnBound(__namedParameters, tolerance = 4): boolean

Parameters ​

ParameterTypeDefault value
__namedParametersIVecundefined
tolerancenumber4

Returns ​

boolean

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:258


isVerticalCross ​

isVerticalCross(bound): boolean

Parameters ​

ParameterType
boundBound

Returns ​

boolean

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:217


serialize ​

serialize(): `[${number},${number},${number},${number}]`

Returns ​

`[${number},${number},${number},${number}]`

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:205


toRelative ​

toRelative(__namedParameters): IVec

Parameters ​

ParameterType
__namedParametersIVec

Returns ​

IVec

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:201


unite ​

unite(bound): Bound

Parameters ​

ParameterType
boundBound

Returns ​

Bound

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:181


verticalDistance ​

verticalDistance(bound): number

Parameters ​

ParameterType
boundBound

Returns ​

number

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:228


deserialize ​

static deserialize(s): Bound

Parameters ​

ParameterType
sstring

Returns ​

Bound

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:281


from ​

static from(arg1): Bound

Parameters ​

ParameterType
arg1IBound

Returns ​

Bound

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:28


fromCenter ​

static fromCenter( center, width, height): Bound

Parameters ​

ParameterType
centerIVec
widthnumber
heightnumber

Returns ​

Bound

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:41


fromDOMRect ​

static fromDOMRect(__namedParameters): Bound

Parameters ​

ParameterType
__namedParametersDOMRect

Returns ​

Bound

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:32


fromPoints ​

static fromPoints(points): Bound

Parameters ​

ParameterType
pointsIVec[]

Returns ​

Bound

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:36


fromXYWH ​

static fromXYWH(xywh): Bound

Parameters ​

ParameterType
xywhXYWH

Returns ​

Bound

Defined In ​

packages/blocks/src/surface-block/utils/bound.ts:24