BlockSuite API Documentation / @blocksuite/blocks / ConnectorElementModel
Class: ConnectorElementModel
Extends
SurfaceElementModel
<ConnectorElementProps
>
Constructors
new ConnectorElementModel()
new ConnectorElementModel(
options
):ConnectorElementModel
Parameters
• options
• options.id: string
• options.model: SurfaceBlockModel
• options.onChange
• options.stashedStore: Map
<unknown
, unknown
>
• options.yMap: Map
<unknown
>
Returns
Inherited from
SurfaceElementModel<ConnectorElementProps>.constructor
Source
packages/blocks/src/surface-block/element-model/base.ts:229
Properties
_disposable
protected
_disposable:DisposableGroup
Inherited from
SurfaceElementModel._disposable
Source
packages/blocks/src/surface-block/element-model/base.ts:199
_id
protected
_id:string
Inherited from
SurfaceElementModel._id
Source
packages/blocks/src/surface-block/element-model/base.ts:201
_local
protected
_local:Map
<string
|symbol
,unknown
>
Inherited from
SurfaceElementModel._local
Source
packages/blocks/src/surface-block/element-model/base.ts:191
_onChange()
protected
_onChange: (payload
) =>void
Parameters
• payload
• payload.local: boolean
• payload.oldValues: Record
<string
, unknown
>
• payload.props: Record
<string
, unknown
>
Returns
void
Inherited from
SurfaceElementModel._onChange
Source
packages/blocks/src/surface-block/element-model/base.ts:193
_preserved
protected
_preserved:Map
<string
,unknown
>
When the ymap is not connected to the doc, its value cannot be read. But we need to use those value during the creation, so the yfield decorated field's value will be stored in this map too during the creation.
After the ymap is connected to the doc, this map will be cleared.
Inherited from
SurfaceElementModel._preserved
Source
packages/blocks/src/surface-block/element-model/base.ts:187
_stashed
protected
_stashed:Map
<string
,unknown
>
Inherited from
SurfaceElementModel._stashed
Source
packages/blocks/src/surface-block/element-model/base.ts:189
surface
surface:
SurfaceBlockModel
Inherited from
SurfaceElementModel.surface
Source
packages/blocks/src/surface-block/element-model/base.ts:205
updatingPath
updatingPath:
boolean
=false
Source
packages/blocks/src/surface-block/element-model/connector.ts:143
yMap
yMap:
Map
<unknown
>
Inherited from
SurfaceElementModel.yMap
Source
packages/blocks/src/surface-block/element-model/base.ts:203
Accessors
absolutePath
connectable
get
connectable():false
Returns
false
Source
packages/blocks/src/surface-block/element-model/connector.ts:127
connected
get
connected():boolean
Returns
boolean
Source
packages/blocks/src/surface-block/element-model/connector.ts:131
deserializedXYWH
get
deserializedXYWH():XYWH
Returns
XYWH
Source
packages/blocks/src/surface-block/element-model/base.ts:128
display
elementBound
get
elementBound():Bound
Returns
Source
packages/blocks/src/surface-block/element-model/connector.ts:135
externalBound
get
externalBound():null
|Bound
Returns
null
| Bound
Source
packages/blocks/src/surface-block/element-model/base.ts:112
externalXYWH
frontEndpointStyle
group
get
group():null
|SurfaceGroupLikeModel
<IBaseProps
>
Returns
null
| SurfaceGroupLikeModel
<IBaseProps
>
Source
packages/blocks/src/surface-block/element-model/base.ts:154
groups
get
groups():SurfaceGroupLikeModel
<IBaseProps
>[]
Returns
SurfaceGroupLikeModel
<IBaseProps
>[]
Source
packages/blocks/src/surface-block/element-model/base.ts:158
h
get
h():number
Returns
number
Source
packages/blocks/src/surface-block/element-model/base.ts:150
id
get
id():string
Returns
string
Source
packages/blocks/src/surface-block/element-model/base.ts:162
index
isConnected
get
isConnected():boolean
Returns
boolean
Source
packages/blocks/src/surface-block/element-model/base.ts:174
labelConstraints
labelDisplay
labelOffset
labelStyle
labelXYWH
lableEditing
mode
opacity
path
rearEndpointStyle
rotate
rough
roughness
seed
source
stroke
strokeStyle
strokeWidth
target
text
type
get
type():string
Returns
string
Source
packages/blocks/src/surface-block/element-model/connector.ts:122
w
get
w():number
Returns
number
Source
packages/blocks/src/surface-block/element-model/base.ts:146
x
get
x():number
Returns
number
Source
packages/blocks/src/surface-block/element-model/base.ts:138
xywh
y
get
y():number
Returns
number
Source
packages/blocks/src/surface-block/element-model/base.ts:142
Methods
boxSelect()
boxSelect(
bound
):boolean
Parameters
• bound: Bound
Returns
boolean
Inherited from
SurfaceElementModel.boxSelect
Source
packages/blocks/src/surface-block/element-model/base.ts:352
containedByBounds()
containedByBounds(
bounds
):boolean
Parameters
• bounds: Bound
Returns
boolean
Overrides
SurfaceElementModel.containedByBounds
Source
packages/blocks/src/surface-block/element-model/connector.ts:374
getNearestPoint()
getNearestPoint(
point
):number
[]
Calculate the closest point on the curve via a point.
Parameters
• point: IVec2
Returns
number
[]
Overrides
SurfaceElementModel.getNearestPoint
Source
packages/blocks/src/surface-block/element-model/connector.ts:421
getOffsetDistanceByPoint()
getOffsetDistanceByPoint(
point
,bounds
?):number
Calculating the computed distance along a path via a point.
The point is relative to the viewport.
Parameters
• point: IVec2
• bounds?: Bound
Returns
number
Source
packages/blocks/src/surface-block/element-model/connector.ts:484
getPointByOffsetDistance()
getPointByOffsetDistance(
offsetDistance
,bounds
?):number
[]
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
number
[]
Source
packages/blocks/src/surface-block/element-model/connector.ts:449
getRelativePointLocation()
getRelativePointLocation(
point
):PointLocation
Parameters
• point: IVec2
Returns
PointLocation
Overrides
SurfaceElementModel.getRelativePointLocation
Source
packages/blocks/src/surface-block/element-model/connector.ts:406
hasLabel()
hasLabel():
boolean
Returns
boolean
Source
packages/blocks/src/surface-block/element-model/connector.ts:340
hitTest()
hitTest(
x
,y
,options
?):boolean
Parameters
• x: number
• y: number
• options?: IHitTestOptions
Returns
boolean
Overrides
SurfaceElementModel.hitTest
Source
packages/blocks/src/surface-block/element-model/connector.ts:350
intersectWithLine()
intersectWithLine(
start
,end
):null
|PointLocation
[]
Parameters
• start: IVec2
• end: IVec2
Returns
null
| PointLocation
[]
Overrides
SurfaceElementModel.intersectWithLine
Source
packages/blocks/src/surface-block/element-model/connector.ts:384
labelHitTest()
labelHitTest(
point
):boolean
Parameters
• point: IVec2
Returns
boolean
Source
packages/blocks/src/surface-block/element-model/connector.ts:344
moveTo()
moveTo(
bound
):void
Parameters
• bound: Bound
Returns
void
Source
packages/blocks/src/surface-block/element-model/connector.ts:316
onCreated()
onCreated():
void
onCreated
function will be executed when element is created in local rather than remote peers
Returns
void
Inherited from
SurfaceElementModel.onCreated
Source
packages/blocks/src/surface-block/element-model/base.ts:373
pop()
pop(
prop
):void
Parameters
• prop: string
Returns
void
Inherited from
SurfaceElementModel.pop
Source
packages/blocks/src/surface-block/element-model/base.ts:306
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
Source
packages/blocks/src/surface-block/element-model/connector.ts:278
resizePath()
resizePath(
originalPath
,matrix
):PointLocation
[]
Parameters
• originalPath: PointLocation
[]
• matrix: DOMMatrix
Returns
PointLocation
[]
Source
packages/blocks/src/surface-block/element-model/connector.ts:254
serialize()
serialize():
SerializedConnectorElement
Returns
SerializedConnectorElement
Overrides
SurfaceElementModel.serialize
Source
packages/blocks/src/surface-block/element-model/connector.ts:412
stash()
stash(
prop
):void
Parameters
• prop: string
Returns
void
Inherited from
SurfaceElementModel.stash
Source
packages/blocks/src/surface-block/element-model/base.ts:254
propsToY()
static
propsToY(props
):ConnectorElementProps
Parameters
• props: ConnectorElementProps
Returns
ConnectorElementProps
Overrides
SurfaceElementModel.propsToY
Source
packages/blocks/src/surface-block/element-model/connector.ts:518