Skip to content

BlockSuite API Documentation / @blocksuite/blocks / SurfaceElementModel

Class: abstract SurfaceElementModel<Props>

Extended by

Type Parameters

Props extends BaseElementProps = BaseElementProps

Implements

  • GfxElementGeometry
  • IBound

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

Properties

_disposable

protected _disposable: DisposableGroup

Defined in

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


_id

protected _id: string

Defined in

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


_local

protected _local: Map<string | symbol, unknown>

Defined in

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


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


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


_stashed

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

Defined in

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


rotate

abstract rotate: number

Implementation of

IBound.rotate

Defined in

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


surface

surface: SurfaceBlockModel

Defined in

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


xywh

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

Defined in

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


yMap

yMap: YMap<unknown>

Defined in

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

Accessors

connectable

get connectable(): boolean

Returns

boolean

Defined in

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


container

get container(): null | GfxModel & GfxContainerElement

Returns

null | GfxModel & GfxContainerElement

Defined in

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


deserializedXYWH

get deserializedXYWH(): XYWH

Returns

XYWH

Defined in

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


display

Defined in

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


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


externalBound

get externalBound(): null | Bound

Returns

null | Bound

Defined in

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


externalXYWH

Defined in

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


group

get group(): null | SurfaceGroupLikeModel<BaseElementProps>

Returns

null | SurfaceGroupLikeModel<BaseElementProps>

Defined in

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


groups

get groups(): SurfaceGroupLikeModel<BaseElementProps>[]

Returns

SurfaceGroupLikeModel<BaseElementProps>[]

Defined in

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


h

get h(): number

Returns

number

Implementation of

IBound.h

Defined in

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


id

get id(): string

Returns

string

Defined in

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


index

Defined in

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


isConnected

get isConnected(): boolean

Returns

boolean

Defined in

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


opacity

Defined in

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


seed

Defined in

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


type

get abstract type(): string

Returns

string

Defined in

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


w

get w(): number

Returns

number

Implementation of

IBound.w

Defined in

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


x

get x(): number

Returns

number

Implementation of

IBound.x

Defined in

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


y

get y(): number

Returns

number

Implementation of

IBound.y

Defined in

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

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


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


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


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


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


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


onCreated()

onCreated(): void

Returns

void

Defined in

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


pop()

pop(prop): void

Parameters

prop: string | keyof Props

Returns

void

Defined in

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


serialize()

serialize(): SerializedElement

Returns

SerializedElement

Defined in

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


stash()

stash(prop): void

Parameters

prop: string | keyof Props

Returns

void

Defined in

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


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