Skip to content

BlockSuite API Documentation / @blocksuite/blocks / GroupElementModel

Class: GroupElementModel

Extends

Constructors

new GroupElementModel(options)

new GroupElementModel(options): GroupElementModel

Parameters

options

options.model: SurfaceBlockModel

options.onChange

options.stashedStore: Map<unknown, unknown>

options.yMap: Map<unknown>

Returns

GroupElementModel

Inherited from

ElementModel.constructor

Source

packages/blocks/src/surface-block/element-model/base.ts:113

Properties

_disposable

protected _disposable: DisposableGroup

Inherited from

ElementModel._disposable

Source

packages/blocks/src/surface-block/element-model/base.ts:72


_local

protected _local: Map<string | symbol, unknown>

Inherited from

ElementModel._local

Source

packages/blocks/src/surface-block/element-model/base.ts:67


_onChange

protected _onChange: (payload) => void

Parameters

payload

payload.oldValues: Record<string, unknown>

payload.props: Record<string, unknown>

Returns

void

Inherited from

ElementModel._onChange

Source

packages/blocks/src/surface-block/element-model/base.ts:68


_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.

Inherited from

ElementModel._preserved

Source

packages/blocks/src/surface-block/element-model/base.ts:65


_stashed

protected _stashed: Map<string, unknown>

Inherited from

ElementModel._stashed

Source

packages/blocks/src/surface-block/element-model/base.ts:66


childIds

childIds: string[] = []

Source

packages/blocks/src/surface-block/element-model/group.ts:83


children

children: Map<boolean>

Source

packages/blocks/src/surface-block/element-model/group.ts:46


display

display: boolean = true

Inherited from

ElementModel.display

Source

packages/blocks/src/surface-block/element-model/base.ts:90


externalXYWH

externalXYWH: undefined | `[${number},${number},${number},${number}]` = undefined

Inherited from

ElementModel.externalXYWH

Source

packages/blocks/src/surface-block/element-model/base.ts:99


index

index: string

Inherited from

ElementModel.index

Source

packages/blocks/src/surface-block/element-model/base.ts:84


opacity

opacity: number = 1

Inherited from

ElementModel.opacity

Source

packages/blocks/src/surface-block/element-model/base.ts:93


seed

seed: number

Inherited from

ElementModel.seed

Source

packages/blocks/src/surface-block/element-model/base.ts:87


showTitle

showTitle: boolean = true

Source

packages/blocks/src/surface-block/element-model/group.ts:52


surface

surface: SurfaceBlockModel

Inherited from

ElementModel.surface

Source

packages/blocks/src/surface-block/element-model/base.ts:75


title

title: Text

Source

packages/blocks/src/surface-block/element-model/group.ts:49


yMap

yMap: Map<unknown>

Inherited from

ElementModel.yMap

Source

packages/blocks/src/surface-block/element-model/base.ts:74

Accessors

childElements

get childElements(): (ElementModel<BaseProps> | EdgelessBlock<EdgelessSelectableProps>)[]

Returns

(ElementModel<BaseProps> | EdgelessBlock<EdgelessSelectableProps>)[]

Source

packages/blocks/src/surface-block/element-model/group.ts:85


connectable

get connectable(): boolean

Returns

boolean

Source

packages/blocks/src/surface-block/element-model/group.ts:74


deserializedXYWH

get deserializedXYWH(): XYWH

Returns

XYWH

Source

packages/blocks/src/surface-block/element-model/base.ts:141


elementBound

get elementBound(): Bound

Returns

Bound

Source

packages/blocks/src/surface-block/element-model/base.ts:179


externalBound

get externalBound(): null | Bound

Returns

null | Bound

Source

packages/blocks/src/surface-block/element-model/base.ts:101


group

get group(): null | GroupElementModel

Returns

null | GroupElementModel

Source

packages/blocks/src/surface-block/element-model/base.ts:167


groups

get groups(): GroupElementModel[]

Returns

GroupElementModel[]

Source

packages/blocks/src/surface-block/element-model/base.ts:171


h

get h(): number

Returns

number

Source

packages/blocks/src/surface-block/element-model/base.ts:163


id

get id(): string

Returns

string

Source

packages/blocks/src/surface-block/element-model/base.ts:175


rotate

get rotate(): number

set rotate(_): void

Parameters

_: number

Returns

number

Source

packages/blocks/src/surface-block/element-model/group.ts:68


type

get type(): string

Returns

string

Source

packages/blocks/src/surface-block/element-model/group.ts:78


w

get w(): number

Returns

number

Source

packages/blocks/src/surface-block/element-model/base.ts:159


x

get x(): number

Returns

number

Source

packages/blocks/src/surface-block/element-model/base.ts:151


xywh

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

set xywh(_): void

Parameters

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

Returns

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

Source

packages/blocks/src/surface-block/element-model/group.ts:54


y

get y(): number

Returns

number

Source

packages/blocks/src/surface-block/element-model/base.ts:155

Methods

addChild()

addChild(element): void

Parameters

element: string | IEdgelessElement

Returns

void

Source

packages/blocks/src/surface-block/element-model/group.ts:109


boxSelect()

boxSelect(bound): boolean

Parameters

bound: Bound

Returns

boolean

Inherited from

ElementModel.boxSelect

Source

packages/blocks/src/surface-block/element-model/base.ts:275


containedByBounds()

containedByBounds(bound): boolean

Parameters

bound: Bound

Returns

boolean

Overrides

ElementModel.containedByBounds

Source

packages/blocks/src/surface-block/element-model/group.ts:146


decendants()

decendants(withoutGroup): (ElementModel<BaseProps> | EdgelessBlock<EdgelessSelectableProps>)[]

Get all decendants of this group

Parameters

withoutGroup: boolean= true

if true, will not include group element

Returns

(ElementModel<BaseProps> | EdgelessBlock<EdgelessSelectableProps>)[]

Source

packages/blocks/src/surface-block/element-model/group.ts:129


getNearestPoint()

getNearestPoint(point): IVec

Parameters

point: IVec

Returns

IVec

Inherited from

ElementModel.getNearestPoint

Source

packages/blocks/src/surface-block/element-model/base.ts:256


getRelativePointLocation()

getRelativePointLocation(relativePoint): PointLocation

Parameters

relativePoint: IVec

Returns

PointLocation

Inherited from

ElementModel.getRelativePointLocation

Source

packages/blocks/src/surface-block/element-model/base.ts:266


hasDescendant()

hasDescendant(element): boolean

Parameters

element: string | IEdgelessElement

Returns

boolean

Source

packages/blocks/src/surface-block/element-model/group.ts:100


hitTest()

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

Parameters

x: number

y: number

_: HitTestOptions

__: EditorHost

Returns

boolean

Inherited from

ElementModel.hitTest

Source

packages/blocks/src/surface-block/element-model/base.ts:284


intersectWithLine()

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

Parameters

start: IVec2

end: IVec2

Returns

null | PointLocation[]

Overrides

ElementModel.intersectWithLine

Source

packages/blocks/src/surface-block/element-model/group.ts:150


pop()

pop(prop): void

Parameters

prop: string

Returns

void

Inherited from

ElementModel.pop

Source

packages/blocks/src/surface-block/element-model/base.ts:226


removeChild()

removeChild(element): void

Parameters

element: string | IEdgelessElement

Returns

void

Source

packages/blocks/src/surface-block/element-model/group.ts:117


serialize()

serialize(): Object

Returns

Object

Inherited from

ElementModel.serialize

Source

packages/blocks/src/surface-block/element-model/base.ts:288


stash()

stash(prop): void

Parameters

prop: string

Returns

void

Inherited from

ElementModel.stash

Source

packages/blocks/src/surface-block/element-model/base.ts:187


propsToY()

static propsToY(props): GroupElementProps

Parameters

props: GroupElementProps

Returns

GroupElementProps

Overrides

ElementModel.propsToY

Source

packages/blocks/src/surface-block/element-model/group.ts:24