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
id

string

model

SurfaceBlockModel

onChange

(payload) => void

stashedStore

Map<unknown, unknown>

yMap

YMap<unknown>

Returns

SurfaceElementModel<Props>

Defined in

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

Properties

_disposable

protected _disposable: DisposableGroup

Defined in

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


_id

protected _id: string

Defined in

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


_local

protected _local: Map<string | symbol, unknown>

Defined in

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


_onChange()

protected _onChange: (payload) => void

Parameters

payload
local

boolean

oldValues

Record<string, unknown>

props

Record<string, unknown>

Returns

void

Defined in

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


_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:35


_stashed

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

Defined in

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


rotate

abstract rotate: number

Implementation of

GfxCompatibleInterface.rotate

Defined in

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


surface

surface: SurfaceBlockModel

Defined in

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


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:39


yMap

yMap: YMap<unknown>

Defined in

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

Accessors

connectable

Get Signature

get connectable(): boolean

Returns

boolean

Defined in

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


deserializedXYWH

Get Signature

get deserializedXYWH(): XYWH

Returns

XYWH

Implementation of

GfxCompatibleInterface.deserializedXYWH

Defined in

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


display

Defined in

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


elementBound

Get Signature

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:47


externalBound

Get Signature

get externalBound(): null | Bound

Returns

null | Bound

Defined in

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


externalXYWH

In some cases, you need to draw something related to the element, but it does not belong to the element itself. And it is also interactive, you can select element by clicking on it. E.g. the title of the group element. In this case, we need to store this kind of external xywh in order to do hit test. This property should not be synced to the doc. This property should be updated every time it gets rendered.

Defined in

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


group

Get Signature

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:49


groups

Get Signature

get groups(): GfxGroupModel[]

Return the ancestor elements in order from the most recent to the earliest.

Returns

GfxGroupModel[]

Implementation of

GfxCompatibleInterface.groups

Defined in

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


h

Get Signature

get h(): number

Returns

number

Implementation of

GfxCompatibleInterface.h

Defined in

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


id

Get Signature

get id(): string

Returns

string

Defined in

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


index

Implementation of

GfxCompatibleInterface.index

Defined in

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


isConnected

Get Signature

get isConnected(): boolean

Returns

boolean

Defined in

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


lockedBySelf

Indicates whether the current block is explicitly locked by self. For checking the lock status of the element, use isLocked instead. For (un)locking the element, use (un)lock instead.

Implementation of

GfxCompatibleInterface.lockedBySelf

Defined in

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


opacity

Defined in

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


seed

Defined in

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


type

Get Signature

get abstract type(): string

Returns

string

Defined in

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


w

Get Signature

get w(): number

Returns

number

Implementation of

GfxCompatibleInterface.w

Defined in

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


x

Get Signature

get x(): number

Returns

number

Implementation of

GfxCompatibleInterface.x

Defined in

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


y

Get Signature

get y(): number

Returns

number

Implementation of

GfxCompatibleInterface.y

Defined in

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

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:73


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:74


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:75


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:76


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:77


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:78


isLocked()

isLocked(): boolean

Check if the element is locked. It will check the lock status of the element and its ancestors.

Returns

boolean

Implementation of

GfxCompatibleInterface.isLocked

Defined in

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


isLockedByAncestor()

isLockedByAncestor(): boolean

Returns

boolean

Implementation of

GfxCompatibleInterface.isLockedByAncestor

Defined in

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


isLockedBySelf()

isLockedBySelf(): boolean

Returns

boolean

Implementation of

GfxCompatibleInterface.isLockedBySelf

Defined in

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


lock()

lock(): void

Returns

void

Implementation of

GfxCompatibleInterface.lock

Defined in

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


onCreated()

onCreated(): void

Returns

void

Defined in

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


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:84


serialize()

serialize(): SerializedElement

Returns

SerializedElement

Defined in

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


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:86


unlock()

unlock(): void

Returns

void

Implementation of

GfxCompatibleInterface.unlock

Defined in

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


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:72