BlockSuite API Documentation / @blocksuite/blocks / GroupElementModel
Class: GroupElementModel
Extends
SurfaceGroupLikeModel
<GroupElementProps
>
Constructors
new GroupElementModel()
new GroupElementModel(
options
):GroupElementModel
Parameters
• options
• options.id: string
• options.model: SurfaceBlockModel
• options.onChange
• options.stashedStore: Map
<unknown
, unknown
>
• options.yMap: Map
<unknown
>
Returns
Inherited from
SurfaceGroupLikeModel<GroupElementProps>.constructor
Source
packages/blocks/src/surface-block/element-model/base.ts:229
Properties
_disposable
protected
_disposable:DisposableGroup
Inherited from
SurfaceGroupLikeModel._disposable
Source
packages/blocks/src/surface-block/element-model/base.ts:199
_id
protected
_id:string
Inherited from
SurfaceGroupLikeModel._id
Source
packages/blocks/src/surface-block/element-model/base.ts:201
_local
protected
_local:Map
<string
|symbol
,unknown
>
Inherited from
SurfaceGroupLikeModel._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
SurfaceGroupLikeModel._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
SurfaceGroupLikeModel._preserved
Source
packages/blocks/src/surface-block/element-model/base.ts:187
_stashed
protected
_stashed:Map
<string
,unknown
>
Inherited from
SurfaceGroupLikeModel._stashed
Source
packages/blocks/src/surface-block/element-model/base.ts:189
surface
surface:
SurfaceBlockModel
Inherited from
SurfaceGroupLikeModel.surface
Source
packages/blocks/src/surface-block/element-model/base.ts:205
yMap
yMap:
Map
<unknown
>
Inherited from
SurfaceGroupLikeModel.yMap
Source
packages/blocks/src/surface-block/element-model/base.ts:203
Accessors
childElements
get
childElements():EdgelessModelType
[]
Returns
EdgelessModelType
[]
Source
packages/blocks/src/surface-block/element-model/base.ts:391
childIds
get
childIds():string
[]
The ids of the children. Its role is to provide a unique way to access the children. You should update this field through setChildIds
when the children are added or removed.
Returns
string
[]
Source
packages/blocks/src/surface-block/element-model/base.ts:387
children
connectable
get
connectable():boolean
Returns
boolean
Source
packages/blocks/src/surface-block/element-model/base.ts:124
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/base.ts:166
externalBound
get
externalBound():null
|Bound
Returns
null
| Bound
Source
packages/blocks/src/surface-block/element-model/base.ts:112
externalXYWH
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
opacity
rotate
get
rotate():number
set
rotate(_
):void
Parameters
• _: number
Returns
number
Source
packages/blocks/src/surface-block/element-model/group.ts:23
seed
showTitle
title
type
get
type():string
Returns
string
Source
packages/blocks/src/surface-block/element-model/group.ts:29
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
addChild()
addChild(
element
):void
Parameters
• element: string
| EdgelessModelType
Returns
void
Source
packages/blocks/src/surface-block/element-model/group.ts:53
boxSelect()
boxSelect(
bound
):boolean
Parameters
• bound: Bound
Returns
boolean
Inherited from
SurfaceGroupLikeModel.boxSelect
Source
packages/blocks/src/surface-block/element-model/base.ts:352
containedByBounds()
containedByBounds(
bound
):boolean
Parameters
• bound: Bound
Returns
boolean
Overrides
SurfaceGroupLikeModel.containedByBounds
Source
packages/blocks/src/surface-block/element-model/group.ts:73
descendants()
descendants(
withoutGroup
):EdgelessModelType
[]
Get all descendants of this group
Parameters
• withoutGroup: boolean
= true
if true, will not include group element
Returns
EdgelessModelType
[]
Inherited from
SurfaceGroupLikeModel.descendants
Source
packages/blocks/src/surface-block/element-model/base.ts:470
getNearestPoint()
getNearestPoint(
point
):IVec
Parameters
• point: IVec
Returns
IVec
Inherited from
SurfaceGroupLikeModel.getNearestPoint
Source
packages/blocks/src/surface-block/element-model/base.ts:333
getRelativePointLocation()
getRelativePointLocation(
relativePoint
):PointLocation
Parameters
• relativePoint: IVec
Returns
PointLocation
Inherited from
SurfaceGroupLikeModel.getRelativePointLocation
Source
packages/blocks/src/surface-block/element-model/base.ts:343
hasChild()
hasChild(
element
):boolean
Parameters
• element: string
| EdgelessModelType
Returns
boolean
Inherited from
SurfaceGroupLikeModel.hasChild
Source
packages/blocks/src/surface-block/element-model/base.ts:447
hasDescendant()
hasDescendant(
element
):boolean
Check if the group has the given descendant.
Parameters
• element: string
| EdgelessModelType
Returns
boolean
Inherited from
SurfaceGroupLikeModel.hasDescendant
Source
packages/blocks/src/surface-block/element-model/base.ts:458
hitTest()
hitTest(
x
,y
,_
,__
):boolean
Parameters
• x: number
• y: number
• _: IHitTestOptions
• __: EditorHost
Returns
boolean
Inherited from
SurfaceGroupLikeModel.hitTest
Source
packages/blocks/src/surface-block/element-model/base.ts:361
intersectWithLine()
intersectWithLine(
start
,end
):null
|PointLocation
[]
Parameters
• start: IVec2
• end: IVec2
Returns
null
| PointLocation
[]
Overrides
SurfaceGroupLikeModel.intersectWithLine
Source
packages/blocks/src/surface-block/element-model/group.ts:77
onCreated()
onCreated():
void
onCreated
function will be executed when element is created in local rather than remote peers
Returns
void
Inherited from
SurfaceGroupLikeModel.onCreated
Source
packages/blocks/src/surface-block/element-model/base.ts:373
pop()
pop(
prop
):void
Parameters
• prop: string
Returns
void
Inherited from
SurfaceGroupLikeModel.pop
Source
packages/blocks/src/surface-block/element-model/base.ts:306
removeChild()
removeChild(
element
):void
Parameters
• element: string
| EdgelessModelType
Returns
void
Overrides
SurfaceGroupLikeModel.removeChild
Source
packages/blocks/src/surface-block/element-model/group.ts:63
serialize()
serialize():
SerializedGroupElement
Returns
SerializedGroupElement
Overrides
SurfaceGroupLikeModel.serialize
Source
packages/blocks/src/surface-block/element-model/group.ts:48
setChildIds()
protected
setChildIds(value
,fromLocal
):void
Set the new value of the childIds
Parameters
• value: string
[]
the new value of the childIds
• fromLocal: boolean
if true, the change is happened in the local
Returns
void
Inherited from
SurfaceGroupLikeModel.setChildIds
Source
packages/blocks/src/surface-block/element-model/base.ts:422
stash()
stash(
prop
):void
Parameters
• prop: string
Returns
void
Inherited from
SurfaceGroupLikeModel.stash
Source
packages/blocks/src/surface-block/element-model/base.ts:254
propsToY()
static
propsToY(props
):GroupElementProps
Parameters
• props: GroupElementProps
Returns
GroupElementProps
Overrides
SurfaceGroupLikeModel.propsToY
Source
packages/blocks/src/surface-block/element-model/group.ts:82