Skip to content

BlockSuite API Documentation / @blocksuite/affine-model / ConnectorElementModel

Class: ConnectorElementModel

Defined in: packages/affine/model/src/elements/connector/connector.ts:105

Extends

Constructors

new ConnectorElementModel()

new ConnectorElementModel(options): ConnectorElementModel

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:66

Parameters

options
id

string

model

SurfaceBlockModel

onChange

(payload) => void

stashedStore

Map<unknown, unknown>

yMap

YMap<unknown>

Returns

ConnectorElementModel

Inherited from

SurfaceElementModel.constructor

Properties

_disposable

protected _disposable: DisposableGroup

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:25

Inherited from

SurfaceElementModel._disposable


_id

protected _id: string

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:26

Inherited from

SurfaceElementModel._id


_local

protected _local: Map<string | symbol, unknown>

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:27

Inherited from

SurfaceElementModel._local


_onChange()

protected _onChange: (payload) => void

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:28

Parameters

payload
local

boolean

oldValues

Record<string, unknown>

props

Record<string, unknown>

Returns

void

Inherited from

SurfaceElementModel._onChange


_preserved

protected _preserved: Map<string, unknown>

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:36

Used to store a copy of data in the yMap.

Inherited from

SurfaceElementModel._preserved


_stashed

protected _stashed: Map<string, unknown>

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:37

Inherited from

SurfaceElementModel._stashed


propsUpdated

propsUpdated: Subject<{ key: string; }>

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:38

Inherited from

SurfaceElementModel.propsUpdated


surface

surface: SurfaceBlockModel

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:42

Inherited from

SurfaceElementModel.surface


updatingPath

updatingPath: boolean = false

Defined in: packages/affine/model/src/elements/connector/connector.ts:106


yMap

yMap: YMap<unknown>

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:44

Inherited from

SurfaceElementModel.yMap

Accessors

absolutePath

Defined in: packages/affine/model/src/elements/connector/connector.ts:407


connectable

Get Signature

get connectable(): false

Defined in: packages/affine/model/src/elements/connector/connector.ts:108

Returns

false

Overrides

SurfaceElementModel.connectable


connected

Get Signature

get connected(): boolean

Defined in: packages/affine/model/src/elements/connector/connector.ts:112

Returns

boolean


deserializedXYWH

Get Signature

get deserializedXYWH(): XYWH

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:46

Returns

XYWH

Inherited from

SurfaceElementModel.deserializedXYWH


display

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:93

Inherited from

SurfaceElementModel.display


elementBound

Get Signature

get elementBound(): Bound

Defined in: packages/affine/model/src/elements/connector/connector.ts:116

The bound of the element after rotation. The bound without rotation should be created by Bound.deserialize(this.xywh).

Returns

Bound

Overrides

SurfaceElementModel.elementBound


externalBound

Get Signature

get externalBound(): null | Bound

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:52

Returns

null | Bound

Inherited from

SurfaceElementModel.externalBound


externalXYWH

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:100

In some cases, you need to draw something related to the element, but it does not belong to the element itself. And it is also interactive, you can select element by clicking on it. E.g. the title of the group element. In this case, we need to store this kind of external xywh in order to do hit test. This property should not be synced to the doc. This property should be updated every time it gets rendered.

Inherited from

SurfaceElementModel.externalXYWH


frontEndpointStyle

Defined in: packages/affine/model/src/elements/connector/connector.ts:410


group

Get Signature

get group(): null | GfxGroupModel

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:53

Returns

null | GfxGroupModel

Inherited from

SurfaceElementModel.group


groups

Get Signature

get groups(): GfxGroupModel[]

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:57

Return the ancestor elements in order from the most recent to the earliest.

Returns

GfxGroupModel[]

Inherited from

SurfaceElementModel.groups


h

Get Signature

get h(): number

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:58

Returns

number

Inherited from

SurfaceElementModel.h


hidden

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:101

Inherited from

SurfaceElementModel.hidden


id

Get Signature

get id(): string

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:59

Returns

string

Inherited from

SurfaceElementModel.id


index

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:102

Inherited from

SurfaceElementModel.index


isConnected

Get Signature

get isConnected(): boolean

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:60

Returns

boolean

Inherited from

SurfaceElementModel.isConnected


labelConstraints

Defined in: packages/affine/model/src/elements/connector/connector.ts:419

Defines the size constraints of the label.


labelDisplay

Defined in: packages/affine/model/src/elements/connector/connector.ts:425

Control display and hide.


labelOffset

Defined in: packages/affine/model/src/elements/connector/connector.ts:434

The offset property specifies the label along the connector path.


labelStyle

Defined in: packages/affine/model/src/elements/connector/connector.ts:447

Defines the style of the label.


labelXYWH

Defined in: packages/affine/model/src/elements/connector/connector.ts:454

Returns a XYWH array providing information about the size of a label and its position relative to the viewport.


lableEditing

Defined in: packages/affine/model/src/elements/connector/connector.ts:460

Local control display and hide, mainly used in editing scenarios.


lockedBySelf

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:103

Indicates whether the current block is explicitly locked by self. For checking the lock status of the element, use isLocked instead. For (un)locking the element, use (un)lock instead.

Inherited from

SurfaceElementModel.lockedBySelf


mode

Defined in: packages/affine/model/src/elements/connector/connector.ts:463


opacity

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:104

Inherited from

SurfaceElementModel.opacity


path

Defined in: packages/affine/model/src/elements/connector/connector.ts:473


rearEndpointStyle

Defined in: packages/affine/model/src/elements/connector/connector.ts:476


responseBound

Get Signature

get responseBound(): Bound

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:61

The bound of the element considering the response extension.

Returns

Bound

Inherited from

SurfaceElementModel.responseBound


responseExtension

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:105

Defines the extension of the response area beyond the element's bounding box. This tuple specifies the horizontal and vertical margins to be added to the element's bound.

The first value represents the horizontal extension (added to both left and right sides), and the second value represents the vertical extension (added to both top and bottom sides).

The response area is computed as: [x - horizontal, y - vertical, w + 2 * horizontal, h + 2 * vertical].

Example:

  • xywh: [0, 0, 100, 100], responseExtension: [10, 20] Resulting response area: [-10, -20, 120, 140].
  • responseExtension: [0, 0] keeps the response area equal to the bounding box.

Inherited from

SurfaceElementModel.responseExtension


rotate

Defined in: packages/affine/model/src/elements/connector/connector.ts:479

Overrides

SurfaceElementModel.rotate


rough

Defined in: packages/affine/model/src/elements/connector/connector.ts:482


roughness

Defined in: packages/affine/model/src/elements/connector/connector.ts:485


seed

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:106

Inherited from

SurfaceElementModel.seed


source

Defined in: packages/affine/model/src/elements/connector/connector.ts:488


stroke

Defined in: packages/affine/model/src/elements/connector/connector.ts:493


strokeStyle

Defined in: packages/affine/model/src/elements/connector/connector.ts:496


strokeWidth

Defined in: packages/affine/model/src/elements/connector/connector.ts:499


target

Defined in: packages/affine/model/src/elements/connector/connector.ts:502


text

Defined in: packages/affine/model/src/elements/connector/connector.ts:510

The content of the label.


type

Get Signature

get type(): string

Defined in: packages/affine/model/src/elements/connector/connector.ts:124

Returns

string

Overrides

SurfaceElementModel.type


w

Get Signature

get w(): number

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:63

Returns

number

Inherited from

SurfaceElementModel.w


x

Get Signature

get x(): number

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:64

Returns

number

Inherited from

SurfaceElementModel.x


xywh

Defined in: packages/affine/model/src/elements/connector/connector.ts:513

Overrides

SurfaceElementModel.xywh


y

Get Signature

get y(): number

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:65

Returns

number

Inherited from

SurfaceElementModel.y

Methods

containsBound()

containsBound(bounds): boolean

Defined in: packages/affine/model/src/elements/connector/connector.ts:136

Parameters

bounds

Bound

Returns

boolean

Overrides

SurfaceElementModel.containsBound


getLineIntersections()

getLineIntersections(start, end): null | PointLocation[]

Defined in: packages/affine/model/src/elements/connector/connector.ts:146

Parameters

start

IVec

end

IVec

Returns

null | PointLocation[]

Overrides

SurfaceElementModel.getLineIntersections


getNearestPoint()

getNearestPoint(point): IVec

Defined in: packages/affine/model/src/elements/connector/connector.ts:171

Calculate the closest point on the curve via a point.

Parameters

point

IVec

Returns

IVec

Overrides

SurfaceElementModel.getNearestPoint


getOffsetDistanceByPoint()

getOffsetDistanceByPoint(point, bounds?): number

Defined in: packages/affine/model/src/elements/connector/connector.ts:199

Calculating the computed distance along a path via a point.

The point is relative to the viewport.

Parameters

point

IVec

bounds?

Bound

Returns

number


getPointByOffsetDistance()

getPointByOffsetDistance(offsetDistance, bounds?): IVec

Defined in: packages/affine/model/src/elements/connector/connector.ts:238

Calculating the computed point along a path via a offset distance.

Returns a point relative to the viewport.

Parameters

offsetDistance

number = 0.5

bounds?

Bound

Returns

IVec


getRelativePointLocation()

getRelativePointLocation(point): PointLocation

Defined in: packages/affine/model/src/elements/connector/connector.ts:268

Parameters

point

IVec

Returns

PointLocation

Overrides

SurfaceElementModel.getRelativePointLocation


hasLabel()

hasLabel(): boolean

Defined in: packages/affine/model/src/elements/connector/connector.ts:274

Returns

boolean


includesPoint()

includesPoint(x, y, options?): boolean

Defined in: packages/affine/model/src/elements/connector/connector.ts:278

Parameters

x

number

y

number

options?

PointTestOptions

Returns

boolean

Overrides

SurfaceElementModel.includesPoint


intersectsBound()

intersectsBound(bound): boolean

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:82

Parameters

bound

Bound

Returns

boolean

Inherited from

SurfaceElementModel.intersectsBound


isLocked()

isLocked(): boolean

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:83

Check if the element is locked. It will check the lock status of the element and its ancestors.

Returns

boolean

Inherited from

SurfaceElementModel.isLocked


isLockedByAncestor()

isLockedByAncestor(): boolean

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:84

Returns

boolean

Inherited from

SurfaceElementModel.isLockedByAncestor


isLockedBySelf()

isLockedBySelf(): boolean

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:85

Returns

boolean

Inherited from

SurfaceElementModel.isLockedBySelf


labelIncludesPoint()

labelIncludesPoint(point): boolean

Defined in: packages/affine/model/src/elements/connector/connector.ts:306

Parameters

point

IVec

Returns

boolean


lock()

lock(): void

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:86

Returns

void

Inherited from

SurfaceElementModel.lock


moveTo()

moveTo(bound): void

Defined in: packages/affine/model/src/elements/connector/connector.ts:312

Parameters

bound

Bound

Returns

void


onCreated()

onCreated(): void

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:87

Returns

void

Inherited from

SurfaceElementModel.onCreated


onDestroyed()

onDestroyed(): void

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:88

Returns

void

Inherited from

SurfaceElementModel.onDestroyed


pop()

pop(prop): void

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:89

Parameters

prop

string

Returns

void

Inherited from

SurfaceElementModel.pop


resize()

resize(bounds, originalPath, matrix): object

Defined in: packages/affine/model/src/elements/connector/connector.ts:336

Parameters

bounds

Bound

originalPath

PointLocation[]

matrix

DOMMatrix

Returns

object

labelXYWH?

optional labelXYWH: XYWH

source?

optional source: Connection

target?

optional target: Connection


resizePath()

resizePath(originalPath, matrix): PointLocation[]

Defined in: packages/affine/model/src/elements/connector/connector.ts:374

Parameters

originalPath

PointLocation[]

matrix

DOMMatrix

Returns

PointLocation[]


serialize()

serialize(): SerializedConnectorElement

Defined in: packages/affine/model/src/elements/connector/connector.ts:398

Returns

SerializedConnectorElement

Overrides

SurfaceElementModel.serialize


stash()

stash(prop): void

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:91

Parameters

prop

string

Returns

void

Inherited from

SurfaceElementModel.stash


unlock()

unlock(): void

Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:92

Returns

void

Inherited from

SurfaceElementModel.unlock


propsToY()

static propsToY(props): ConnectorElementProps

Defined in: packages/affine/model/src/elements/connector/connector.ts:128

Parameters

props

ConnectorElementProps

Returns

ConnectorElementProps