Skip to content

BlockSuite API Documentation / @blocksuite/blocks / GroupElementModel

Class: GroupElementModel

Extends

Constructors

new GroupElementModel()

new GroupElementModel(options): GroupElementModel

Parameters

options

options.id: string

options.model: SurfaceBlockModel

options.onChange

options.stashedStore: Map<unknown, unknown>

options.yMap: YMap<unknown>

Returns

GroupElementModel

Inherited from

SurfaceGroupLikeModel.constructor

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:87

Properties

_disposable

protected _disposable: DisposableGroup

Inherited from

SurfaceGroupLikeModel._disposable

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:52


_id

protected _id: string

Inherited from

SurfaceGroupLikeModel._id

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:53


_local

protected _local: Map<string | symbol, unknown>

Inherited from

SurfaceGroupLikeModel._local

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:54


_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

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:55


_preserved

protected _preserved: Map<string, unknown>

Used to store a copy of data in the yMap.

Inherited from

SurfaceGroupLikeModel._preserved

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:63


_stashed

protected _stashed: Map<string, unknown>

Inherited from

SurfaceGroupLikeModel._stashed

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:64


[gfxContainerSymbol]

[gfxContainerSymbol]: true

Inherited from

SurfaceGroupLikeModel.[gfxContainerSymbol]

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:119


surface

surface: SurfaceBlockModel

Inherited from

SurfaceGroupLikeModel.surface

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:66


yMap

yMap: YMap<unknown>

Inherited from

SurfaceGroupLikeModel.yMap

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:68

Accessors

childElements

get childElements(): GfxModel[]

! Note that childElements may not match the childIds during doc loading stage.

Returns

GfxModel[]

Inherited from

SurfaceGroupLikeModel.childElements

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:120


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[]

Inherited from

SurfaceGroupLikeModel.childIds

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:125


children

Overrides

SurfaceGroupLikeModel.children

Defined in

packages/affine/model/dist/elements/group/group.d.ts:24


connectable

get connectable(): boolean

Returns

boolean

Inherited from

SurfaceGroupLikeModel.connectable

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:69


container

get container(): null | GfxModel & GfxContainerElement

Returns

null | GfxModel & GfxContainerElement

Inherited from

SurfaceGroupLikeModel.container

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:70


descendantElements

get descendantElements(): GfxModel[]

Returns

GfxModel[]

Inherited from

SurfaceGroupLikeModel.descendantElements

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:126


deserializedXYWH

get deserializedXYWH(): XYWH

Returns

XYWH

Inherited from

SurfaceGroupLikeModel.deserializedXYWH

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:71


display

Inherited from

SurfaceGroupLikeModel.display

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:109


elementBound

get elementBound(): Bound

The bound of the element after rotation. The bound without rotation should be created by Bound.deserialize(this.xywh).

Returns

Bound

Inherited from

SurfaceGroupLikeModel.elementBound

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:76


externalBound

get externalBound(): null | Bound

Returns

null | Bound

Inherited from

SurfaceGroupLikeModel.externalBound

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:77


externalXYWH

Inherited from

SurfaceGroupLikeModel.externalXYWH

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:110


group

get group(): null | SurfaceGroupLikeModel<BaseElementProps>

Returns

null | SurfaceGroupLikeModel<BaseElementProps>

Inherited from

SurfaceGroupLikeModel.group

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:78


groups

get groups(): SurfaceGroupLikeModel<BaseElementProps>[]

Returns

SurfaceGroupLikeModel<BaseElementProps>[]

Inherited from

SurfaceGroupLikeModel.groups

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:79


h

get h(): number

Returns

number

Inherited from

SurfaceGroupLikeModel.h

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:80


id

get id(): string

Returns

string

Inherited from

SurfaceGroupLikeModel.id

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:81


index

Inherited from

SurfaceGroupLikeModel.index

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:111


isConnected

get isConnected(): boolean

Returns

boolean

Inherited from

SurfaceGroupLikeModel.isConnected

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:82


opacity

Inherited from

SurfaceGroupLikeModel.opacity

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:112


rotate

get rotate(): number

set rotate(_): void

Parameters

_: number

Returns

number

Overrides

SurfaceGroupLikeModel.rotate

Defined in

packages/affine/model/dist/elements/group/group.d.ts:15


seed

Inherited from

SurfaceGroupLikeModel.seed

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:113


showTitle

Defined in

packages/affine/model/dist/elements/group/group.d.ts:25


title

Defined in

packages/affine/model/dist/elements/group/group.d.ts:26


type

get type(): string

Returns

string

Overrides

SurfaceGroupLikeModel.type

Defined in

packages/affine/model/dist/elements/group/group.d.ts:17


w

get w(): number

Returns

number

Inherited from

SurfaceGroupLikeModel.w

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:84


x

get x(): number

Returns

number

Inherited from

SurfaceGroupLikeModel.x

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:85


xywh

get xywh(): `[${number},${number},${number},${number}]`

set xywh(_): void

Parameters

_: `[${number},${number},${number},${number}]`

Returns

`[${number},${number},${number},${number}]`

Inherited from

SurfaceGroupLikeModel.xywh

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:127


y

get y(): number

Returns

number

Inherited from

SurfaceGroupLikeModel.y

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:86

Methods

_getXYWH()

protected _getXYWH(): Bound

Returns

Bound

Inherited from

SurfaceGroupLikeModel._getXYWH

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:129


addChild()

addChild(element): void

Parameters

element: GfxModel

Returns

void

Overrides

SurfaceGroupLikeModel.addChild

Defined in

packages/affine/model/dist/elements/group/group.d.ts:19


containsBound()

containsBound(bound): boolean

Parameters

bound: Bound

Returns

boolean

Overrides

SurfaceGroupLikeModel.containsBound

Defined in

packages/affine/model/dist/elements/group/group.d.ts:20


getLineIntersections()

getLineIntersections(start, end): null | PointLocation[]

Parameters

start: IVec

end: IVec

Returns

null | PointLocation[]

Overrides

SurfaceGroupLikeModel.getLineIntersections

Defined in

packages/affine/model/dist/elements/group/group.d.ts:21


getNearestPoint()

getNearestPoint(point): IVec

Parameters

point: IVec

Returns

IVec

Inherited from

SurfaceGroupLikeModel.getNearestPoint

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:101


getRelativePointLocation()

getRelativePointLocation(relativePoint): PointLocation

Parameters

relativePoint: IVec

Returns

PointLocation

Inherited from

SurfaceGroupLikeModel.getRelativePointLocation

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:102


hasChild()

hasChild(element): boolean

The actual field that stores the children of the group. It should be a ymap decorated with @field.

Parameters

element: GfxModel

Returns

boolean

Inherited from

SurfaceGroupLikeModel.hasChild

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:135


hasDescendant()

hasDescendant(element): boolean

Check if the group has the given descendant.

Parameters

element: GfxModel

Returns

boolean

Inherited from

SurfaceGroupLikeModel.hasDescendant

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:139


includesPoint()

includesPoint(x, y, _, __): boolean

Parameters

x: number

y: number

_: PointTestOptions

__: EditorHost

Returns

boolean

Inherited from

SurfaceGroupLikeModel.includesPoint

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:103


intersectsBound()

intersectsBound(bound): boolean

Parameters

bound: Bound

Returns

boolean

Inherited from

SurfaceGroupLikeModel.intersectsBound

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:104


onCreated()

onCreated(): void

Returns

void

Inherited from

SurfaceGroupLikeModel.onCreated

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:105


pop()

pop(prop): void

Parameters

prop: string

Returns

void

Inherited from

SurfaceGroupLikeModel.pop

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:106


removeChild()

removeChild(element): void

Remove the child from the group

Parameters

element: GfxModel

Returns

void

Overrides

SurfaceGroupLikeModel.removeChild

Defined in

packages/affine/model/dist/elements/group/group.d.ts:22


serialize()

serialize(): SerializedGroupElement

Returns

SerializedGroupElement

Overrides

SurfaceGroupLikeModel.serialize

Defined in

packages/affine/model/dist/elements/group/group.d.ts:23


setChildIds()

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

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:149


stash()

stash(prop): void

Parameters

prop: string

Returns

void

Inherited from

SurfaceGroupLikeModel.stash

Defined in

packages/framework/block-std/dist/gfx/surface/element-model.d.ts:108


propsToY()

static propsToY(props): GroupElementProps

Parameters

props: Record<string, unknown>

Returns

GroupElementProps

Overrides

SurfaceGroupLikeModel.propsToY

Defined in

packages/affine/model/dist/elements/group/group.d.ts:18