BlockSuite API Documentation / @blocksuite/blocks / SurfaceGroupLikeModel
Class: abstract
SurfaceGroupLikeModel<Props>
Extends
SurfaceElementModel
<Props
>
Extended by
Type Parameters
• Props extends BaseElementProps
= BaseElementProps
Implements
GfxGroupCompatibleInterface
Constructors
new SurfaceGroupLikeModel()
new SurfaceGroupLikeModel<
Props
>(options
):SurfaceGroupLikeModel
<Props
>
Parameters
options
id
string
model
onChange
(payload
) => void
stashedStore
Map
<unknown
, unknown
>
yMap
YMap
<unknown
>
Returns
SurfaceGroupLikeModel
<Props
>
Inherited from
SurfaceElementModel
.constructor
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:65
Properties
_disposable
protected
_disposable:DisposableGroup
Inherited from
SurfaceElementModel
._disposable
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:24
_id
protected
_id:string
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:25
_local
protected
_local:Map
<string
|symbol
,unknown
>
Inherited from
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
Inherited from
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.
Inherited from
SurfaceElementModel
._preserved
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:35
_stashed
protected
_stashed:Map
<string
| keyofProps
,unknown
>
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:36
[gfxGroupCompatibleSymbol]
[gfxGroupCompatibleSymbol]:
true
Implementation of
GfxGroupCompatibleInterface.[gfxGroupCompatibleSymbol]
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:112
children
abstract
children:YMap
<any
>
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:111
propsUpdated
propsUpdated:
Slot
<{key
:string
; }>
Inherited from
SurfaceElementModel
.propsUpdated
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:37
rotate
abstract
rotate:number
Implementation of
GfxGroupCompatibleInterface.rotate
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:40
surface
surface:
SurfaceBlockModel
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:41
yMap
yMap:
YMap
<unknown
>
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:43
Accessors
childElements
Get Signature
get childElements():
GfxModel
[]
All child element models of this container. Note that the childElements
may not contains all the children in childIds
, because some children may not be loaded.
Returns
GfxModel
[]
Implementation of
GfxGroupCompatibleInterface.childElements
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:113
childIds
Get Signature
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
GfxGroupCompatibleInterface.childIds
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:118
connectable
Get Signature
get connectable():
boolean
Returns
boolean
Inherited from
SurfaceElementModel
.connectable
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:44
descendantElements
Get Signature
get descendantElements():
GfxModel
[]
Returns
GfxModel
[]
Implementation of
GfxGroupCompatibleInterface.descendantElements
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:119
deserializedXYWH
Get Signature
get deserializedXYWH():
XYWH
Returns
XYWH
Implementation of
GfxGroupCompatibleInterface.deserializedXYWH
Inherited from
SurfaceElementModel
.deserializedXYWH
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:45
display
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:93
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
GfxGroupCompatibleInterface.elementBound
Inherited from
SurfaceElementModel
.elementBound
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:50
externalBound
Get Signature
get externalBound():
null
|Bound
Returns
null
| Bound
Inherited from
SurfaceElementModel
.externalBound
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:51
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.
Inherited from
SurfaceElementModel
.externalXYWH
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:100
group
Get Signature
get group():
null
|GfxGroupModel
Returns
null
| GfxGroupModel
Implementation of
GfxGroupCompatibleInterface.group
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:52
groups
Get Signature
get groups():
GfxGroupModel
[]
Return the ancestor elements in order from the most recent to the earliest.
Returns
GfxGroupModel
[]
Implementation of
GfxGroupCompatibleInterface.groups
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:56
h
Get Signature
get h():
number
Returns
number
Implementation of
GfxGroupCompatibleInterface.h
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:57
hidden
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:101
id
Get Signature
get id():
string
Returns
string
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:58
index
Implementation of
GfxGroupCompatibleInterface.index
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:102
isConnected
Get Signature
get isConnected():
boolean
Returns
boolean
Inherited from
SurfaceElementModel
.isConnected
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:59
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
GfxGroupCompatibleInterface.lockedBySelf
Inherited from
SurfaceElementModel
.lockedBySelf
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:103
opacity
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:104
responseBound
Get Signature
get responseBound():
Bound
The bound of the element considering the response extension.
Returns
Bound
Implementation of
GfxGroupCompatibleInterface.responseBound
Inherited from
SurfaceElementModel
.responseBound
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:60
responseExtension
Defines the extension of the response area beyond the element's bounding box. This tuple specifies the horizontal and vertical margins to be added to the element's bound.
The first value represents the horizontal extension (added to both left and right sides), and the second value represents the vertical extension (added to both top and bottom sides).
The response area is computed as: [x - horizontal, y - vertical, w + 2 * horizontal, h + 2 * vertical]
.
Example:
- xywh:
[0, 0, 100, 100]
,responseExtension: [10, 20]
Resulting response area:[-10, -20, 120, 140]
. responseExtension: [0, 0]
keeps the response area equal to the bounding box.
Implementation of
GfxGroupCompatibleInterface.responseExtension
Inherited from
SurfaceElementModel
.responseExtension
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:105
seed
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:106
type
Get Signature
get
abstract
type():string
Returns
string
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:61
w
Get Signature
get w():
number
Returns
number
Implementation of
GfxGroupCompatibleInterface.w
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:62
x
Get Signature
get x():
number
Returns
number
Implementation of
GfxGroupCompatibleInterface.x
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:63
xywh
Get Signature
get xywh(): `[${number},${number},${number},${number}]`
Returns
`[${number},${number},${number},${number}]`
Set Signature
set xywh(
_
):void
Parameters
_
`[${number},${number},${number},${number}]`
Returns
void
Implementation of
GfxGroupCompatibleInterface.xywh
Overrides
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:120
y
Get Signature
get y():
number
Returns
number
Implementation of
GfxGroupCompatibleInterface.y
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:64
Methods
_getXYWH()
protected
_getXYWH():Bound
Returns
Bound
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:122
addChild()
abstract
addChild(element
):void
Parameters
element
GfxModel
Returns
void
Implementation of
GfxGroupCompatibleInterface.addChild
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:123
containsBound()
containsBound(
bounds
):boolean
Parameters
bounds
Bound
Returns
boolean
Implementation of
GfxGroupCompatibleInterface.containsBound
Inherited from
SurfaceElementModel
.containsBound
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:77
getLineIntersections()
getLineIntersections(
start
,end
):null
|PointLocation
[]
Parameters
start
IVec
end
IVec
Returns
null
| PointLocation
[]
Implementation of
GfxGroupCompatibleInterface.getLineIntersections
Inherited from
SurfaceElementModel
.getLineIntersections
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:78
getNearestPoint()
getNearestPoint(
point
):IVec
Parameters
point
IVec
Returns
IVec
Implementation of
GfxGroupCompatibleInterface.getNearestPoint
Inherited from
SurfaceElementModel
.getNearestPoint
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:79
getRelativePointLocation()
getRelativePointLocation(
relativePoint
):PointLocation
Parameters
relativePoint
IVec
Returns
PointLocation
Implementation of
GfxGroupCompatibleInterface.getRelativePointLocation
Inherited from
SurfaceElementModel
.getRelativePointLocation
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:80
hasChild()
hasChild(
element
):boolean
The actual field that stores the children of the group. It should be a ymap decorated with @field
.
Parameters
element
GfxCompatibleInterface
Returns
boolean
Implementation of
GfxGroupCompatibleInterface.hasChild
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:128
hasDescendant()
hasDescendant(
element
):boolean
Check if the group has the given descendant.
Parameters
element
GfxCompatibleInterface
Returns
boolean
Implementation of
GfxGroupCompatibleInterface.hasDescendant
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:132
includesPoint()
includesPoint(
x
,y
,opt
,__
):boolean
Parameters
x
number
y
number
opt
PointTestOptions
__
Returns
boolean
Implementation of
GfxGroupCompatibleInterface.includesPoint
Inherited from
SurfaceElementModel
.includesPoint
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:81
intersectsBound()
intersectsBound(
bound
):boolean
Parameters
bound
Bound
Returns
boolean
Implementation of
GfxGroupCompatibleInterface.intersectsBound
Inherited from
SurfaceElementModel
.intersectsBound
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:82
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
GfxGroupCompatibleInterface.isLocked
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:83
isLockedByAncestor()
isLockedByAncestor():
boolean
Returns
boolean
Implementation of
GfxGroupCompatibleInterface.isLockedByAncestor
Inherited from
SurfaceElementModel
.isLockedByAncestor
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:84
isLockedBySelf()
isLockedBySelf():
boolean
Returns
boolean
Implementation of
GfxGroupCompatibleInterface.isLockedBySelf
Inherited from
SurfaceElementModel
.isLockedBySelf
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:85
lock()
lock():
void
Returns
void
Implementation of
GfxGroupCompatibleInterface.lock
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:86
onCreated()
onCreated():
void
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:87
onDestroyed()
onDestroyed():
void
Returns
void
Inherited from
SurfaceElementModel
.onDestroyed
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:88
pop()
pop(
prop
):void
Parameters
prop
string
| keyof Props
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:89
removeChild()
abstract
removeChild(element
):void
Remove the child from the group
Parameters
element
GfxCompatibleInterface
Returns
void
Implementation of
GfxGroupCompatibleInterface.removeChild
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:136
serialize()
serialize():
SerializedElement
Returns
SerializedElement
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:90
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/model/surface/element-model.d.ts:142
stash()
stash(
prop
):void
Parameters
prop
string
| keyof Props
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:91
unlock()
unlock():
void
Returns
void
Implementation of
GfxGroupCompatibleInterface.unlock
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:92
propsToY()
static
propsToY(props
):Record
<string
,unknown
>
Parameters
props
Record
<string
, unknown
>
Returns
Record
<string
, unknown
>
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:76