Skip to content

BlockSuite API Documentation / @blocksuite/blocks / SurfaceElementModel

Class: abstract SurfaceElementModel<Props>

Extended by

Type Parameters

Props extends BaseElementProps = BaseElementProps

Implements

  • GfxElementGeometry

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

Properties

_disposable

protected _disposable: DisposableGroup

Defined in

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


_id

protected _id: string

Defined in

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


_local

protected _local: Map<string | symbol, unknown>

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

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.

Defined in

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


_stashed

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

Defined in

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


rotate

abstract rotate: number

Defined in

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


surface

surface: SurfaceBlockModel

Defined in

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


xywh

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

Defined in

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


yMap

yMap: YMap<unknown>

Defined in

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

Accessors

connectable

get connectable(): boolean

Returns

boolean

Defined in

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


container

get container(): null | GfxModel & GfxContainerElement

Returns

null | GfxModel & GfxContainerElement

Defined in

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


deserializedXYWH

get deserializedXYWH(): XYWH

Returns

XYWH

Defined in

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


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

Defined in

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


externalBound

get externalBound(): null | Bound

Returns

null | Bound

Defined in

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


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>

Defined in

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


groups

get groups(): SurfaceGroupLikeModel<BaseElementProps>[]

Returns

SurfaceGroupLikeModel<BaseElementProps>[]

Defined in

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


h

get h(): number

Returns

number

Defined in

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


id

get id(): string

Returns

string

Defined in

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


index

Defined in

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


isConnected

get isConnected(): boolean

Returns

boolean

Defined in

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


opacity

Defined in

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


seed

Defined in

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


type

get abstract type(): string

Returns

string

Defined in

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


w

get w(): number

Returns

number

Defined in

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


x

get x(): number

Returns

number

Defined in

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


y

get y(): number

Returns

number

Defined in

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

Methods

containsBound()

containsBound(bounds): boolean

Parameters

bounds: Bound

Returns

boolean

Implementation of

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

Implementation of

GfxElementGeometry.getLineIntersections

Defined in

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


getNearestPoint()

getNearestPoint(point): IVec

Parameters

point: IVec

Returns

IVec

Implementation of

GfxElementGeometry.getNearestPoint

Defined in

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


getRelativePointLocation()

getRelativePointLocation(relativePoint): PointLocation

Parameters

relativePoint: IVec

Returns

PointLocation

Implementation of

GfxElementGeometry.getRelativePointLocation

Defined in

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


includesPoint()

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

Parameters

x: number

y: number

_: PointTestOptions

__: EditorHost

Returns

boolean

Implementation of

GfxElementGeometry.includesPoint

Defined in

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


intersectsBound()

intersectsBound(bound): boolean

Parameters

bound: Bound

Returns

boolean

Implementation of

GfxElementGeometry.intersectsBound

Defined in

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


onCreated()

onCreated(): void

Returns

void

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

Defined in

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


serialize()

serialize(): SerializedElement

Returns

SerializedElement

Defined in

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


stash()

stash(prop): void

Parameters

prop: string | keyof Props

Returns

void

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>

Defined in

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