Skip to content

BlockSuite API Documentation / @blocksuite/blocks / SurfaceElementModel

Class: abstract SurfaceElementModel<Props>

Extended by

Type Parameters

Props extends BaseElementProps = BaseElementProps

Implements

  • GfxCompatibleInterface

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/model/surface/element-model.d.ts:56

Properties

_disposable

protected _disposable: DisposableGroup

Defined in

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


_id

protected _id: string

Defined in

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


_local

protected _local: Map<string | symbol, unknown>

Defined in

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


_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/model/surface/element-model.d.ts:25


_preserved

protected _preserved: Map<string, unknown>

Used to store a copy of data in the yMap.

Defined in

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


_stashed

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

Defined in

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


rotate

abstract rotate: number

Implementation of

GfxCompatibleInterface.rotate

Defined in

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


surface

surface: SurfaceBlockModel

Defined in

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


xywh

abstract xywh: `[${number},${number},${number},${number}]`

Implementation of

GfxCompatibleInterface.xywh

Defined in

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


yMap

yMap: YMap<unknown>

Defined in

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

Accessors

connectable

get connectable(): boolean

Returns

boolean

Defined in

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


deserializedXYWH

get deserializedXYWH(): XYWH

Returns

XYWH

Implementation of

GfxCompatibleInterface.deserializedXYWH

Defined in

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


display

Defined in

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


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

Implementation of

GfxCompatibleInterface.elementBound

Defined in

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


externalBound

get externalBound(): null | Bound

Returns

null | Bound

Defined in

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


externalXYWH

Defined in

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


group

get group(): null | GfxGroupModel

Returns

null | GfxGroupModel

Implementation of

GfxCompatibleInterface.group

Defined in

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


groups

get groups(): GfxGroupModel[]

Returns

GfxGroupModel[]

Implementation of

GfxCompatibleInterface.groups

Defined in

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


h

get h(): number

Returns

number

Implementation of

GfxCompatibleInterface.h

Defined in

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


id

get id(): string

Returns

string

Defined in

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


index

Implementation of

GfxCompatibleInterface.index

Defined in

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


isConnected

get isConnected(): boolean

Returns

boolean

Defined in

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


opacity

Defined in

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


seed

Defined in

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


type

get abstract type(): string

Returns

string

Defined in

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


w

get w(): number

Returns

number

Implementation of

GfxCompatibleInterface.w

Defined in

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


x

get x(): number

Returns

number

Implementation of

GfxCompatibleInterface.x

Defined in

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


y

get y(): number

Returns

number

Implementation of

GfxCompatibleInterface.y

Defined in

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

Methods

containsBound()

containsBound(bounds): boolean

Parameters

bounds: Bound

Returns

boolean

Implementation of

GfxCompatibleInterface.containsBound

Defined in

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


getLineIntersections()

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

Parameters

start: IVec

end: IVec

Returns

null | PointLocation[]

Implementation of

GfxCompatibleInterface.getLineIntersections

Defined in

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


getNearestPoint()

getNearestPoint(point): IVec

Parameters

point: IVec

Returns

IVec

Implementation of

GfxCompatibleInterface.getNearestPoint

Defined in

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


getRelativePointLocation()

getRelativePointLocation(relativePoint): PointLocation

Parameters

relativePoint: IVec

Returns

PointLocation

Implementation of

GfxCompatibleInterface.getRelativePointLocation

Defined in

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


includesPoint()

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

Parameters

x: number

y: number

_: PointTestOptions

__: EditorHost

Returns

boolean

Implementation of

GfxCompatibleInterface.includesPoint

Defined in

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


intersectsBound()

intersectsBound(bound): boolean

Parameters

bound: Bound

Returns

boolean

Implementation of

GfxCompatibleInterface.intersectsBound

Defined in

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


onCreated()

onCreated(): void

Returns

void

Defined in

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


pop()

pop(prop): void

Parameters

prop: string | keyof Props

Returns

void

Defined in

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


serialize()

serialize(): SerializedElement

Returns

SerializedElement

Defined in

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


stash()

stash(prop): void

Parameters

prop: string | keyof Props

Returns

void

Defined in

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


propsToY()

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

Parameters

props: Record<string, unknown>

Returns

Record<string, unknown>

Defined in

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