BlockSuite API Documentation / @blocksuite/blocks / SurfaceElementModel
Class: abstract SurfaceElementModel<Props>
Extended by
Type Parameters
• Props extends BaseElementProps = BaseElementProps
Implements
GfxElementGeometryIBound
Constructors
new SurfaceElementModel()
new SurfaceElementModel<
Props>(options):SurfaceElementModel<Props>
Parameters
• options
• options.id: string
• options.model: SurfaceBlockModel
• options.onChange
• options.stashedStore: Map<unknown, unknown>
• options.yMap: YMap<unknown>
Returns
SurfaceElementModel<Props>
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:86
Properties
_disposable
protected_disposable:DisposableGroup
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:51
_id
protected_id:string
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:52
_local
protected_local:Map<string|symbol,unknown>
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:53
_onChange()
protected_onChange: (payload) =>void
Parameters
• payload
• payload.local: boolean
• payload.oldValues: Record<string, unknown>
• payload.props: Record<string, unknown>
Returns
void
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:54
_preserved
protected_preserved:Map<string,unknown>
Used to store a copy of data in the yMap.
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:62
_stashed
protected_stashed:Map<string| keyofProps,unknown>
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:63
rotate
abstractrotate:number
Implementation of
IBound.rotate
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:64
surface
surface:
SurfaceBlockModel
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:65
xywh
abstractxywh: `[${number},${number},${number},${number}]`
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:66
yMap
yMap:
YMap<unknown>
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:67
Accessors
connectable
getconnectable():boolean
Returns
boolean
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:68
container
getcontainer():null| GfxModel & GfxContainerElement
Returns
null | GfxModel & GfxContainerElement
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:69
deserializedXYWH
getdeserializedXYWH():XYWH
Returns
XYWH
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:70
display
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:108
elementBound
getelementBound():Bound
The bound of the element after rotation. The bound without rotation should be created by Bound.deserialize(this.xywh).
Returns
Bound
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:75
externalBound
getexternalBound():null|Bound
Returns
null | Bound
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:76
externalXYWH
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:109
group
getgroup():null|SurfaceGroupLikeModel<BaseElementProps>
Returns
null | SurfaceGroupLikeModel<BaseElementProps>
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:77
groups
getgroups():SurfaceGroupLikeModel<BaseElementProps>[]
Returns
SurfaceGroupLikeModel<BaseElementProps>[]
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:78
h
geth():number
Returns
number
Implementation of
IBound.h
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:79
id
getid():string
Returns
string
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:80
index
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:110
isConnected
getisConnected():boolean
Returns
boolean
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:81
opacity
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:111
seed
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:112
type
getabstracttype():string
Returns
string
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:82
w
getw():number
Returns
number
Implementation of
IBound.w
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:83
x
getx():number
Returns
number
Implementation of
IBound.x
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:84
y
gety():number
Returns
number
Implementation of
IBound.y
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:85
Methods
containsBound()
containsBound(
bounds):boolean
Parameters
• bounds: Bound
Returns
boolean
Implementation of
GfxElementGeometry.containsBound
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:98
getLineIntersections()
getLineIntersections(
start,end):null|PointLocation[]
Parameters
• start: IVec
• end: IVec
Returns
null | PointLocation[]
Implementation of
GfxElementGeometry.getLineIntersections
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:99
getNearestPoint()
getNearestPoint(
point):IVec
Parameters
• point: IVec
Returns
IVec
Implementation of
GfxElementGeometry.getNearestPoint
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:100
getRelativePointLocation()
getRelativePointLocation(
relativePoint):PointLocation
Parameters
• relativePoint: IVec
Returns
PointLocation
Implementation of
GfxElementGeometry.getRelativePointLocation
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:101
includesPoint()
includesPoint(
x,y,_,__):boolean
Parameters
• x: number
• y: number
• _: PointTestOptions
• __: EditorHost
Returns
boolean
Implementation of
GfxElementGeometry.includesPoint
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:102
intersectsBound()
intersectsBound(
bound):boolean
Parameters
• bound: Bound
Returns
boolean
Implementation of
GfxElementGeometry.intersectsBound
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:103
onCreated()
onCreated():
void
Returns
void
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:104
pop()
pop(
prop):void
Parameters
• prop: string | keyof Props
Returns
void
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:105
serialize()
serialize():
SerializedElement
Returns
SerializedElement
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:106
stash()
stash(
prop):void
Parameters
• prop: string | keyof Props
Returns
void
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:107
propsToY()
staticpropsToY(props):Record<string,unknown>
Parameters
• props: Record<string, unknown>
Returns
Record<string, unknown>
Defined in
packages/framework/block-std/dist/gfx/surface/element-model.d.ts:97