BlockSuite API Documentation / @blocksuite/blocks / ElementModel
Class: abstract
ElementModel<Props>
Extended by
Type parameters
• Props extends BaseProps
= BaseProps
Implements
IEdgelessElement
Constructors
new ElementModel(options)
new ElementModel<
Props
>(options
):ElementModel
<Props
>
Parameters
• options: Object
• options.model: SurfaceBlockModel
• options.onChange: (payload
) => void
• options.stashedStore: Map
<unknown
, unknown
>
• options.yMap: Map
<unknown
>
Returns
ElementModel
<Props
>
Source
packages/blocks/src/surface-block/element-model/base.ts:96
Properties
_local
protected
_local:Map
<string
|symbol
,unknown
>
Source
packages/blocks/src/surface-block/element-model/base.ts:61
_observerDisposable
protected
_observerDisposable:Record
<string
|symbol
, () =>void
> ={}
Source
packages/blocks/src/surface-block/element-model/base.ts:66
_onChange
protected
_onChange: (payload
) =>void
Parameters
• payload: Object
• payload.oldValues: Record
<string
, unknown
>
• payload.props: Record
<string
, unknown
>
Returns
void
Source
packages/blocks/src/surface-block/element-model/base.ts:62
_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 yfied 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.
Source
packages/blocks/src/surface-block/element-model/base.ts:59
_stashed
protected
_stashed:Map
<string
| keyofProps
,unknown
>
Source
packages/blocks/src/surface-block/element-model/base.ts:60
display
display:
boolean
=true
Source
packages/blocks/src/surface-block/element-model/base.ts:84
externalXYWH
externalXYWH:
undefined
| `[${number},${number},${number},${number}]` =undefined
Implementation of
IEdgelessElement.externalXYWH
Source
packages/blocks/src/surface-block/element-model/base.ts:90
index
index:
string
Implementation of
IEdgelessElement.index
Source
packages/blocks/src/surface-block/element-model/base.ts:78
opacity
opacity:
number
=1
Source
packages/blocks/src/surface-block/element-model/base.ts:87
rotate
abstract
rotate:number
Implementation of
IEdgelessElement.rotate
Source
packages/blocks/src/surface-block/element-model/base.ts:71
seed
seed:
number
Source
packages/blocks/src/surface-block/element-model/base.ts:81
surface
surface:
SurfaceBlockModel
Source
packages/blocks/src/surface-block/element-model/base.ts:69
xywh
abstract
xywh: `[${number},${number},${number},${number}]`
Implementation of
IEdgelessElement.xywh
Source
packages/blocks/src/surface-block/element-model/base.ts:73
yMap
yMap:
Map
<unknown
>
Source
packages/blocks/src/surface-block/element-model/base.ts:68
Accessors
connectable
get
connectable():boolean
Returns
boolean
Source
packages/blocks/src/surface-block/element-model/base.ts:118
deserializedXYWH
get
deserializedXYWH():XYWH
Returns
XYWH
Source
packages/blocks/src/surface-block/element-model/base.ts:122
elementBound
get
elementBound():Bound
Returns
Source
packages/blocks/src/surface-block/element-model/base.ts:154
externalBound
get
externalBound():null
|Bound
Returns
null
| Bound
Source
packages/blocks/src/surface-block/element-model/base.ts:92
group
get
group():null
|GroupElementModel
Returns
null
| GroupElementModel
Source
packages/blocks/src/surface-block/element-model/base.ts:142
groups
get
groups():GroupElementModel
[]
Returns
Source
packages/blocks/src/surface-block/element-model/base.ts:146
h
get
h():number
Returns
number
Source
packages/blocks/src/surface-block/element-model/base.ts:138
id
get
id():string
Returns
string
Source
packages/blocks/src/surface-block/element-model/base.ts:150
type
get
abstract
type():string
Returns
string
Source
packages/blocks/src/surface-block/element-model/base.ts:75
w
get
w():number
Returns
number
Source
packages/blocks/src/surface-block/element-model/base.ts:134
x
get
x():number
Returns
number
Source
packages/blocks/src/surface-block/element-model/base.ts:126
y
get
y():number
Returns
number
Source
packages/blocks/src/surface-block/element-model/base.ts:130
Methods
boxSelect()
boxSelect(
bound
):boolean
Parameters
• bound: Bound
Returns
boolean
Implementation of
IEdgelessElement.boxSelect
Source
packages/blocks/src/surface-block/element-model/base.ts:250
containedByBounds()
containedByBounds(
bounds
):boolean
Parameters
• bounds: Bound
Returns
boolean
Implementation of
IEdgelessElement.containedByBounds
Source
packages/blocks/src/surface-block/element-model/base.ts:225
getNearestPoint()
getNearestPoint(
point
):IVec
Parameters
• point: IVec
Returns
IVec
Implementation of
IEdgelessElement.getNearestPoint
Source
packages/blocks/src/surface-block/element-model/base.ts:231
getRelativePointLocation()
getRelativePointLocation(
relativePoint
):PointLocation
Parameters
• relativePoint: IVec
Returns
PointLocation
Implementation of
IEdgelessElement.getRelativePointLocation
Source
packages/blocks/src/surface-block/element-model/base.ts:241
hitTest()
hitTest(
x
,y
,_
,__
):boolean
Parameters
• x: number
• y: number
• _: HitTestOptions
• __: EditorHost
Returns
boolean
Implementation of
IEdgelessElement.hitTest
Source
packages/blocks/src/surface-block/element-model/base.ts:259
intersectWithLine()
intersectWithLine(
start
,end
):null
|PointLocation
[]
Parameters
• start: IVec
• end: IVec
Returns
null
| PointLocation
[]
Implementation of
IEdgelessElement.intersectWithLine
Source
packages/blocks/src/surface-block/element-model/base.ts:236
pop()
pop(
prop
):void
Parameters
• prop: string
| keyof Props
Returns
void
Source
packages/blocks/src/surface-block/element-model/base.ts:201
serialize()
serialize():
Object
Returns
Object
Source
packages/blocks/src/surface-block/element-model/base.ts:263
stash()
stash(
prop
):void
Parameters
• prop: string
| keyof Props
Returns
void
Source
packages/blocks/src/surface-block/element-model/base.ts:162
propsToY()
static
propsToY(props
):Record
<string
,unknown
>
Parameters
• props: Record
<string
, unknown
>
Returns
Record
<string
, unknown
>
Source
packages/blocks/src/surface-block/element-model/base.ts:48
Generated using TypeDoc and typedoc-plugin-markdown.