Skip to content

BlockSuite API Documentation / @blocksuite/blocks / SurfaceGroupLikeModel

Class: abstract SurfaceGroupLikeModel<Props>

Extends

Extended by

Type Parameters

Props extends BaseElementProps = BaseElementProps

Implements

  • GfxContainerElement

Constructors

new SurfaceGroupLikeModel()

new SurfaceGroupLikeModel<Props>(options): SurfaceGroupLikeModel<Props>

Parameters

options

options.id: string

options.model: SurfaceBlockModel

options.onChange

options.stashedStore: Map<unknown, unknown>

options.yMap: YMap<unknown>

Returns

SurfaceGroupLikeModel<Props>

Inherited from

SurfaceElementModel.constructor

Defined in

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

Properties

_disposable

protected _disposable: DisposableGroup

Inherited from

SurfaceElementModel._disposable

Defined in

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


_id

protected _id: string

Inherited from

SurfaceElementModel._id

Defined in

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


_local

protected _local: Map<string | symbol, unknown>

Inherited from

SurfaceElementModel._local

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

Inherited from

SurfaceElementModel._onChange

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.

Inherited from

SurfaceElementModel._preserved

Defined in

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


_stashed

protected _stashed: Map<string | keyof Props, unknown>

Inherited from

SurfaceElementModel._stashed

Defined in

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


[gfxContainerSymbol]

[gfxContainerSymbol]: true

Implementation of

GfxContainerElement.[gfxContainerSymbol]

Defined in

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


children

abstract children: YMap<any>

Defined in

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


rotate

abstract rotate: number

Inherited from

SurfaceElementModel.rotate

Defined in

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


surface

surface: SurfaceBlockModel

Inherited from

SurfaceElementModel.surface

Defined in

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


yMap

yMap: YMap<unknown>

Inherited from

SurfaceElementModel.yMap

Defined in

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

Accessors

childElements

get childElements(): GfxModel[]

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

Returns

GfxModel[]

Implementation of

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

Implementation of

GfxContainerElement.childIds

Defined in

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


connectable

get connectable(): boolean

Returns

boolean

Inherited from

SurfaceElementModel.connectable

Defined in

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


container

get container(): null | GfxModel & GfxContainerElement

Returns

null | GfxModel & GfxContainerElement

Inherited from

SurfaceElementModel.container

Defined in

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


descendantElements

get descendantElements(): GfxModel[]

Returns

GfxModel[]

Implementation of

GfxContainerElement.descendantElements

Defined in

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


deserializedXYWH

get deserializedXYWH(): XYWH

Returns

XYWH

Inherited from

SurfaceElementModel.deserializedXYWH

Defined in

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


display

Inherited from

SurfaceElementModel.display

Defined in

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


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

SurfaceElementModel.elementBound

Defined in

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


externalBound

get externalBound(): null | Bound

Returns

null | Bound

Inherited from

SurfaceElementModel.externalBound

Defined in

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


externalXYWH

Inherited from

SurfaceElementModel.externalXYWH

Defined in

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


group

get group(): null | SurfaceGroupLikeModel<BaseElementProps>

Returns

null | SurfaceGroupLikeModel<BaseElementProps>

Inherited from

SurfaceElementModel.group

Defined in

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


groups

get groups(): SurfaceGroupLikeModel<BaseElementProps>[]

Returns

SurfaceGroupLikeModel<BaseElementProps>[]

Inherited from

SurfaceElementModel.groups

Defined in

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


h

get h(): number

Returns

number

Inherited from

SurfaceElementModel.h

Defined in

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


id

get id(): string

Returns

string

Inherited from

SurfaceElementModel.id

Defined in

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


index

Implementation of

GfxContainerElement.index

Inherited from

SurfaceElementModel.index

Defined in

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


isConnected

get isConnected(): boolean

Returns

boolean

Inherited from

SurfaceElementModel.isConnected

Defined in

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


opacity

Inherited from

SurfaceElementModel.opacity

Defined in

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


seed

Inherited from

SurfaceElementModel.seed

Defined in

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


type

get abstract type(): string

Returns

string

Inherited from

SurfaceElementModel.type

Defined in

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


w

get w(): number

Returns

number

Inherited from

SurfaceElementModel.w

Defined in

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


x

get x(): number

Returns

number

Inherited from

SurfaceElementModel.x

Defined in

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


xywh

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

set xywh(_): void

Parameters

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

Returns

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

Implementation of

GfxContainerElement.xywh

Overrides

SurfaceElementModel.xywh

Defined in

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


y

get y(): number

Returns

number

Inherited from

SurfaceElementModel.y

Defined in

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

Methods

addChild()

abstract addChild(element): void

Parameters

element: GfxModel

Returns

void

Implementation of

GfxContainerElement.addChild

Defined in

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


containsBound()

containsBound(bounds): boolean

Parameters

bounds: Bound

Returns

boolean

Inherited from

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

Inherited from

SurfaceElementModel.getLineIntersections

Defined in

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


getNearestPoint()

getNearestPoint(point): IVec

Parameters

point: IVec

Returns

IVec

Inherited from

SurfaceElementModel.getNearestPoint

Defined in

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


getRelativePointLocation()

getRelativePointLocation(relativePoint): PointLocation

Parameters

relativePoint: IVec

Returns

PointLocation

Inherited from

SurfaceElementModel.getRelativePointLocation

Defined in

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


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

Implementation of

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

Implementation of

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

SurfaceElementModel.includesPoint

Defined in

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


intersectsBound()

intersectsBound(bound): boolean

Parameters

bound: Bound

Returns

boolean

Inherited from

SurfaceElementModel.intersectsBound

Defined in

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


onCreated()

onCreated(): void

Returns

void

Inherited from

SurfaceElementModel.onCreated

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

Inherited from

SurfaceElementModel.pop

Defined in

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


removeChild()

abstract removeChild(element): void

Remove the child from the group

Parameters

element: GfxModel

Returns

void

Implementation of

GfxContainerElement.removeChild

Defined in

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


serialize()

serialize(): SerializedElement

Returns

SerializedElement

Inherited from

SurfaceElementModel.serialize

Defined in

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


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

Defined in

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


stash()

stash(prop): void

Parameters

prop: string | keyof Props

Returns

void

Inherited from

SurfaceElementModel.stash

Defined in

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


propsToY()

static propsToY(props): Record<string, unknown>

Parameters

props: Record<string, unknown>

Returns

Record<string, unknown>

Inherited from

SurfaceElementModel.propsToY

Defined in

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