BlockSuite API Documentation / @blocksuite/affine-block-surface / SurfaceGroupLikeModel
Class: abstract
SurfaceGroupLikeModel<Props>
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:108
Extends
SurfaceElementModel
<Props
>
Extended by
Type Parameters
Props
Props
extends BaseElementProps
= BaseElementProps
Implements
GfxGroupCompatibleInterface
Constructors
new SurfaceGroupLikeModel()
new SurfaceGroupLikeModel<
Props
>(options
):GfxGroupLikeElementModel
<Props
>
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:66
Parameters
options
id
string
model
onChange
(payload
) => void
stashedStore
Map
<unknown
, unknown
>
yMap
YMap
<unknown
>
Returns
GfxGroupLikeElementModel
<Props
>
Inherited from
SurfaceElementModel
.constructor
Properties
_disposable
protected
_disposable:DisposableGroup
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:25
Inherited from
SurfaceElementModel
._disposable
_id
protected
_id:string
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:26
Inherited from
_local
protected
_local:Map
<string
|symbol
,unknown
>
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:27
Inherited from
_onChange()
protected
_onChange: (payload
) =>void
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:28
Parameters
payload
local
boolean
oldValues
Record
<string
, unknown
>
props
Record
<string
, unknown
>
Returns
void
Inherited from
_preserved
protected
_preserved:Map
<string
,unknown
>
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:36
Used to store a copy of data in the yMap.
Inherited from
SurfaceElementModel
._preserved
_stashed
protected
_stashed:Map
<string
| keyofProps
,unknown
>
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:37
Inherited from
[gfxGroupCompatibleSymbol]
[gfxGroupCompatibleSymbol]:
true
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:112
Implementation of
GfxGroupCompatibleInterface.[gfxGroupCompatibleSymbol]
children
abstract
children:YMap
<any
>
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:111
propsUpdated
propsUpdated:
Subject
<{key
:string
; }>
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:38
Inherited from
SurfaceElementModel
.propsUpdated
rotate
abstract
rotate:number
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:41
Implementation of
GfxGroupCompatibleInterface.rotate
Inherited from
surface
surface:
SurfaceBlockModel
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:42
Inherited from
yMap
yMap:
YMap
<unknown
>
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:44
Inherited from
Accessors
childElements
Get Signature
get childElements():
GfxModel
[]
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:113
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
childIds
Get Signature
get childIds():
string
[]
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:118
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
connectable
Get Signature
get connectable():
boolean
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:45
Returns
boolean
Inherited from
SurfaceElementModel
.connectable
descendantElements
Get Signature
get descendantElements():
GfxModel
[]
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:119
Returns
GfxModel
[]
Implementation of
GfxGroupCompatibleInterface.descendantElements
deserializedXYWH
Get Signature
get deserializedXYWH():
XYWH
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:46
Returns
XYWH
Implementation of
GfxGroupCompatibleInterface.deserializedXYWH
Inherited from
SurfaceElementModel
.deserializedXYWH
display
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:93
Inherited from
elementBound
Get Signature
get elementBound():
Bound
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:51
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
externalBound
Get Signature
get externalBound():
null
|Bound
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:52
Returns
null
| Bound
Inherited from
SurfaceElementModel
.externalBound
externalXYWH
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:100
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
group
Get Signature
get group():
null
|GfxGroupModel
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:53
Returns
null
| GfxGroupModel
Implementation of
GfxGroupCompatibleInterface.group
Inherited from
groups
Get Signature
get groups():
GfxGroupModel
[]
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:57
Return the ancestor elements in order from the most recent to the earliest.
Returns
GfxGroupModel
[]
Implementation of
GfxGroupCompatibleInterface.groups
Inherited from
h
Get Signature
get h():
number
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:58
Returns
number
Implementation of
GfxGroupCompatibleInterface.h
Inherited from
hidden
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:101
Inherited from
id
Get Signature
get id():
string
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:59
Returns
string
Inherited from
index
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:102
Implementation of
GfxGroupCompatibleInterface.index
Inherited from
isConnected
Get Signature
get isConnected():
boolean
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:60
Returns
boolean
Inherited from
SurfaceElementModel
.isConnected
lockedBySelf
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:103
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
opacity
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:104
Inherited from
responseBound
Get Signature
get responseBound():
Bound
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:61
The bound of the element considering the response extension.
Returns
Bound
Implementation of
GfxGroupCompatibleInterface.responseBound
Inherited from
SurfaceElementModel
.responseBound
responseExtension
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:105
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
seed
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:106
Inherited from
type
Get Signature
get
abstract
type():string
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:62
Returns
string
Inherited from
w
Get Signature
get w():
number
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:63
Returns
number
Implementation of
GfxGroupCompatibleInterface.w
Inherited from
x
Get Signature
get x():
number
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:64
Returns
number
Implementation of
GfxGroupCompatibleInterface.x
Inherited from
xywh
Get Signature
get xywh():
`[${number},${number},${number},${number}]`
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:120
Returns
`[${number},${number},${number},${number}]`
Set Signature
set xywh(
_
):void
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:121
Parameters
_
`[${number},${number},${number},${number}]`
Returns
void
Implementation of
GfxGroupCompatibleInterface.xywh
Overrides
y
Get Signature
get y():
number
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:65
Returns
number
Implementation of
GfxGroupCompatibleInterface.y
Inherited from
Methods
_getXYWH()
protected
_getXYWH():Bound
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:122
Returns
Bound
addChild()
abstract
addChild(element
):void
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:123
Parameters
element
GfxModel
Returns
void
Implementation of
GfxGroupCompatibleInterface.addChild
containsBound()
containsBound(
bounds
):boolean
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:77
Parameters
bounds
Bound
Returns
boolean
Implementation of
GfxGroupCompatibleInterface.containsBound
Inherited from
SurfaceElementModel
.containsBound
getLineIntersections()
getLineIntersections(
start
,end
):null
|PointLocation
[]
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:78
Parameters
start
IVec
end
IVec
Returns
null
| PointLocation
[]
Implementation of
GfxGroupCompatibleInterface.getLineIntersections
Inherited from
SurfaceElementModel
.getLineIntersections
getNearestPoint()
getNearestPoint(
point
):IVec
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:79
Parameters
point
IVec
Returns
IVec
Implementation of
GfxGroupCompatibleInterface.getNearestPoint
Inherited from
SurfaceElementModel
.getNearestPoint
getRelativePointLocation()
getRelativePointLocation(
relativePoint
):PointLocation
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:80
Parameters
relativePoint
IVec
Returns
PointLocation
Implementation of
GfxGroupCompatibleInterface.getRelativePointLocation
Inherited from
SurfaceElementModel
.getRelativePointLocation
hasChild()
hasChild(
element
):boolean
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:128
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
hasDescendant()
hasDescendant(
element
):boolean
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:132
Check if the group has the given descendant.
Parameters
element
GfxCompatibleInterface
Returns
boolean
Implementation of
GfxGroupCompatibleInterface.hasDescendant
includesPoint()
includesPoint(
x
,y
,opt
,__
):boolean
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:81
Parameters
x
number
y
number
opt
PointTestOptions
__
Returns
boolean
Implementation of
GfxGroupCompatibleInterface.includesPoint
Inherited from
SurfaceElementModel
.includesPoint
intersectsBound()
intersectsBound(
bound
):boolean
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:82
Parameters
bound
Bound
Returns
boolean
Implementation of
GfxGroupCompatibleInterface.intersectsBound
Inherited from
SurfaceElementModel
.intersectsBound
isLocked()
isLocked():
boolean
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:83
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
isLockedByAncestor()
isLockedByAncestor():
boolean
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:84
Returns
boolean
Implementation of
GfxGroupCompatibleInterface.isLockedByAncestor
Inherited from
SurfaceElementModel
.isLockedByAncestor
isLockedBySelf()
isLockedBySelf():
boolean
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:85
Returns
boolean
Implementation of
GfxGroupCompatibleInterface.isLockedBySelf
Inherited from
SurfaceElementModel
.isLockedBySelf
lock()
lock():
void
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:86
Returns
void
Implementation of
GfxGroupCompatibleInterface.lock
Inherited from
onCreated()
onCreated():
void
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:87
Returns
void
Inherited from
onDestroyed()
onDestroyed():
void
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:88
Returns
void
Inherited from
SurfaceElementModel
.onDestroyed
pop()
pop(
prop
):void
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:89
Parameters
prop
string
| keyof Props
Returns
void
Inherited from
removeChild()
abstract
removeChild(element
):void
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:136
Remove the child from the group
Parameters
element
GfxCompatibleInterface
Returns
void
Implementation of
GfxGroupCompatibleInterface.removeChild
serialize()
serialize():
SerializedElement
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:90
Returns
SerializedElement
Inherited from
setChildIds()
setChildIds(
value
,fromLocal
):void
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:142
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
stash()
stash(
prop
):void
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:91
Parameters
prop
string
| keyof Props
Returns
void
Inherited from
unlock()
unlock():
void
Defined in: packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:92
Returns
void
Implementation of
GfxGroupCompatibleInterface.unlock