Skip to content

API > @blocksuite/blocks > Point

Class: Point ​

Constructors ​

constructor ​

new Point(x = 0, y = 0): Point

Parameters ​

ParameterTypeDefault value
xnumber0
ynumber0

Returns ​

Point

Defined In ​

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

Properties ​

x ​

x: number

Defined In ​

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


y ​

y: number

Defined In ​

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

Methods ​

add ​

add(point): Point

Parameters ​

ParameterType
pointIPoint

Returns ​

Point

Defined In ​

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


clone ​

clone(): Point

Returns a copy of the point.

Returns ​

Point

Defined In ​

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


cross ​

cross(point): number

Parameters ​

ParameterType
pointIPoint

Returns ​

number

Defined In ​

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


equals ​

equals(__namedParameters): boolean

Parameters ​

ParameterType
__namedParametersPoint

Returns ​

boolean

Defined In ​

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


lerp ​

lerp(point, t): Point

Parameters ​

ParameterType
pointIPoint
tnumber

Returns ​

Point

Defined In ​

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


scale ​

scale(factor): Point

Parameters ​

ParameterType
factornumber

Returns ​

Point

Defined In ​

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


set ​

set(x, y): void

Parameters ​

ParameterType
xnumber
ynumber

Returns ​

void

Defined In ​

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


subtract ​

subtract(point): Point

Parameters ​

ParameterType
pointIPoint

Returns ​

Point

Defined In ​

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


toArray ​

toArray(): number[]

Returns ​

number[]

Defined In ​

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


clamp ​

static clamp( p, min, max): Point

Restrict a value to a certain interval.

Parameters ​

ParameterType
pPoint
minPoint
maxPoint

Returns ​

Point

Defined In ​

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


from ​

static from(point, y?): Point

Parameters ​

ParameterType
pointnumber | number[] | IPoint
y?number

Returns ​

Point

Defined In ​

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


max ​

static max(a, b): Point

Compares and returns the maximum of two points.

Parameters ​

ParameterType
aPoint
bPoint

Returns ​

Point

Defined In ​

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


min ​

static min(a, b): Point

Compares and returns the minimum of two points.

Parameters ​

ParameterType
aPoint
bPoint

Returns ​

Point

Defined In ​

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