BlockSuite API Documentation / @blocksuite/blocks / ConnectorElementModel
Class: ConnectorElementModel
Extends
Constructors
new ConnectorElementModel()
new ConnectorElementModel(
options
):ConnectorElementModel
Parameters
options
id
string
model
onChange
(payload
) => void
stashedStore
Map
<unknown
, unknown
>
yMap
YMap
<unknown
>
Returns
Inherited from
SurfaceElementModel
.constructor
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:65
Properties
_disposable
protected
_disposable:DisposableGroup
Inherited from
SurfaceElementModel
._disposable
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:24
_id
protected
_id:string
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:25
_local
protected
_local:Map
<string
|symbol
,unknown
>
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:26
_onChange()
protected
_onChange: (payload
) =>void
Parameters
payload
local
boolean
oldValues
Record
<string
, unknown
>
props
Record
<string
, unknown
>
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:27
_preserved
protected
_preserved:Map
<string
,unknown
>
Used to store a copy of data in the yMap.
Inherited from
SurfaceElementModel
._preserved
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:35
_stashed
protected
_stashed:Map
<string
,unknown
>
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:36
propsUpdated
propsUpdated:
Slot
<{key
:string
; }>
Inherited from
SurfaceElementModel
.propsUpdated
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:37
surface
surface:
SurfaceBlockModel
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:41
updatingPath
updatingPath:
boolean
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:50
yMap
yMap:
YMap
<unknown
>
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:43
Accessors
absolutePath
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:86
connectable
Get Signature
get connectable():
false
Returns
false
Overrides
SurfaceElementModel
.connectable
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:51
connected
Get Signature
get connected():
boolean
Returns
boolean
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:52
deserializedXYWH
Get Signature
get deserializedXYWH():
XYWH
Returns
XYWH
Inherited from
SurfaceElementModel
.deserializedXYWH
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:45
display
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:93
elementBound
Get Signature
get elementBound():
Bound
The bound of the element after rotation. The bound without rotation should be created by Bound.deserialize(this.xywh)
.
Returns
Bound
Overrides
SurfaceElementModel
.elementBound
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:53
externalBound
Get Signature
get externalBound():
null
|Bound
Returns
null
| Bound
Inherited from
SurfaceElementModel
.externalBound
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:51
externalXYWH
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
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:100
frontEndpointStyle
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:87
group
Get Signature
get group():
null
|GfxGroupModel
Returns
null
| GfxGroupModel
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:52
groups
Get Signature
get groups():
GfxGroupModel
[]
Return the ancestor elements in order from the most recent to the earliest.
Returns
GfxGroupModel
[]
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:56
h
Get Signature
get h():
number
Returns
number
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:57
hidden
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:101
id
Get Signature
get id():
string
Returns
string
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:58
index
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:102
isConnected
Get Signature
get isConnected():
boolean
Returns
boolean
Inherited from
SurfaceElementModel
.isConnected
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:59
labelConstraints
Defines the size constraints of the label.
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:91
labelDisplay
Control display and hide.
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:95
labelOffset
The offset property specifies the label along the connector path.
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:99
labelStyle
Defines the style of the label.
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:103
labelXYWH
Returns a XYWH
array providing information about the size of a label and its position relative to the viewport.
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:108
lableEditing
Local control display and hide, mainly used in editing scenarios.
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:112
lockedBySelf
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
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:103
mode
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:113
opacity
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:104
path
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:114
rearEndpointStyle
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:115
responseBound
Get Signature
get responseBound():
Bound
The bound of the element considering the response extension.
Returns
Bound
Inherited from
SurfaceElementModel
.responseBound
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:60
responseExtension
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
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:105
rotate
Overrides
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:116
rough
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:117
roughness
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:118
seed
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:106
source
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:119
stroke
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:120
strokeStyle
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:121
strokeWidth
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:122
target
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:123
text
The content of the label.
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:127
type
Get Signature
get type():
string
Returns
string
Overrides
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:54
w
Get Signature
get w():
number
Returns
number
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:62
x
Get Signature
get x():
number
Returns
number
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:63
xywh
Overrides
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:128
y
Get Signature
get y():
number
Returns
number
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:64
Methods
containsBound()
containsBound(
bounds
):boolean
Parameters
bounds
Bound
Returns
boolean
Overrides
SurfaceElementModel
.containsBound
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:56
getLineIntersections()
getLineIntersections(
start
,end
):null
|PointLocation
[]
Parameters
start
IVec
end
IVec
Returns
null
| PointLocation
[]
Overrides
SurfaceElementModel
.getLineIntersections
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:57
getNearestPoint()
getNearestPoint(
point
):IVec
Calculate the closest point on the curve via a point.
Parameters
point
IVec
Returns
IVec
Overrides
SurfaceElementModel
.getNearestPoint
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:61
getOffsetDistanceByPoint()
getOffsetDistanceByPoint(
point
,bounds
?):number
Calculating the computed distance along a path via a point.
The point is relative to the viewport.
Parameters
point
IVec
bounds?
Bound
Returns
number
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:67
getPointByOffsetDistance()
getPointByOffsetDistance(
offsetDistance
?,bounds
?):IVec
Calculating the computed point along a path via a offset distance.
Returns a point relative to the viewport.
Parameters
offsetDistance?
number
bounds?
Bound
Returns
IVec
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:73
getRelativePointLocation()
getRelativePointLocation(
point
):PointLocation
Parameters
point
IVec
Returns
PointLocation
Overrides
SurfaceElementModel
.getRelativePointLocation
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:74
hasLabel()
hasLabel():
boolean
Returns
boolean
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:75
includesPoint()
includesPoint(
x
,y
,options
?):boolean
Parameters
x
number
y
number
options?
PointTestOptions
Returns
boolean
Overrides
SurfaceElementModel
.includesPoint
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:76
intersectsBound()
intersectsBound(
bound
):boolean
Parameters
bound
Bound
Returns
boolean
Inherited from
SurfaceElementModel
.intersectsBound
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:82
isLocked()
isLocked():
boolean
Check if the element is locked. It will check the lock status of the element and its ancestors.
Returns
boolean
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:83
isLockedByAncestor()
isLockedByAncestor():
boolean
Returns
boolean
Inherited from
SurfaceElementModel
.isLockedByAncestor
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:84
isLockedBySelf()
isLockedBySelf():
boolean
Returns
boolean
Inherited from
SurfaceElementModel
.isLockedBySelf
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:85
labelIncludesPoint()
labelIncludesPoint(
point
):boolean
Parameters
point
IVec
Returns
boolean
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:77
lock()
lock():
void
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:86
moveTo()
moveTo(
bound
):void
Parameters
bound
Bound
Returns
void
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:78
onCreated()
onCreated():
void
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:87
onDestroyed()
onDestroyed():
void
Returns
void
Inherited from
SurfaceElementModel
.onDestroyed
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:88
pop()
pop(
prop
):void
Parameters
prop
string
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:89
resize()
resize(
bounds
,originalPath
,matrix
):object
Parameters
bounds
Bound
originalPath
PointLocation
[]
matrix
DOMMatrix
Returns
object
labelXYWH?
optional
labelXYWH:XYWH
source?
optional
source:Connection
target?
optional
target:Connection
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:79
resizePath()
resizePath(
originalPath
,matrix
):PointLocation
[]
Parameters
originalPath
PointLocation
[]
matrix
DOMMatrix
Returns
PointLocation
[]
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:84
serialize()
serialize():
SerializedConnectorElement
Returns
Overrides
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:85
stash()
stash(
prop
):void
Parameters
prop
string
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:91
unlock()
unlock():
void
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:92
propsToY()
static
propsToY(props
):ConnectorElementProps
Parameters
props
Returns
Overrides
Defined in
packages/affine/model/dist/elements/connector/connector.d.ts:55