BlockSuite API Documentation / @blocksuite/affine-model / BrushElementModel
Class: BrushElementModel
Extends
Constructors
new BrushElementModel()
new BrushElementModel(
options
):BrushElementModel
Parameters
options
id
string
model
onChange
(payload
) => void
stashedStore
Map
<unknown
, unknown
>
yMap
YMap
<unknown
>
Returns
Inherited from
SurfaceElementModel
.constructor
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:61
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
,unknown
>
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:36
surface
surface:
SurfaceBlockModel
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:38
yMap
yMap:
YMap
<unknown
>
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:40
Accessors
color
Defined in
packages/affine/model/src/elements/brush/brush.ts:135
commands
Get Signature
get commands():
string
The SVG path commands for the brush.
Returns
string
Defined in
packages/affine/model/src/elements/brush/brush.ts:48
connectable
Get Signature
get connectable():
boolean
Returns
boolean
Overrides
SurfaceElementModel
.connectable
Defined in
packages/affine/model/src/elements/brush/brush.ts:59
deserializedXYWH
Get Signature
get deserializedXYWH():
XYWH
Returns
XYWH
Inherited from
SurfaceElementModel
.deserializedXYWH
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:42
display
Inherited from
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
Inherited from
SurfaceElementModel
.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
Inherited from
SurfaceElementModel
.externalBound
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.
Inherited from
SurfaceElementModel
.externalXYWH
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
Inherited from
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
[]
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:53
h
Get Signature
get h():
number
Returns
number
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:54
id
Get Signature
get id():
string
Returns
string
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:55
index
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:96
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:56
lineWidth
Defined in
packages/affine/model/src/elements/brush/brush.ts:169
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.
Inherited from
SurfaceElementModel
.lockedBySelf
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:97
opacity
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:98
points
Defined in
packages/affine/model/src/elements/brush/brush.ts:196
rotate
Overrides
Defined in
packages/affine/model/src/elements/brush/brush.ts:199
seed
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:99
type
Get Signature
get type():
string
Returns
string
Overrides
Defined in
packages/affine/model/src/elements/brush/brush.ts:63
w
Get Signature
get w():
number
Returns
number
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:58
x
Get Signature
get x():
number
Returns
number
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:59
xywh
Overrides
Defined in
packages/affine/model/src/elements/brush/brush.ts:224
y
Get Signature
get y():
number
Returns
number
Inherited from
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
Overrides
SurfaceElementModel
.containsBound
Defined in
packages/affine/model/src/elements/brush/brush.ts:71
getLineIntersections()
getLineIntersections(
start
,end
):null
|PointLocation
[]
Parameters
start
IVec
end
IVec
Returns
null
| PointLocation
[]
Overrides
SurfaceElementModel
.getLineIntersections
Defined in
packages/affine/model/src/elements/brush/brush.ts:76
getNearestPoint()
getNearestPoint(
point
):IVec
Parameters
point
IVec
Returns
IVec
Overrides
SurfaceElementModel
.getNearestPoint
Defined in
packages/affine/model/src/elements/brush/brush.ts:105
getRelativePointLocation()
getRelativePointLocation(
position
):PointLocation
Parameters
position
IVec
Returns
PointLocation
Overrides
SurfaceElementModel
.getRelativePointLocation
Defined in
packages/affine/model/src/elements/brush/brush.ts:114
includesPoint()
includesPoint(
px
,py
,options
?):boolean
Parameters
px
number
py
number
options?
PointTestOptions
Returns
boolean
Overrides
SurfaceElementModel
.includesPoint
Defined in
packages/affine/model/src/elements/brush/brush.ts:119
intersectsBound()
intersectsBound(
bound
):boolean
Parameters
bound
Bound
Returns
boolean
Inherited from
SurfaceElementModel
.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
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:79
isLockedByAncestor()
isLockedByAncestor():
boolean
Returns
boolean
Inherited from
SurfaceElementModel
.isLockedByAncestor
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:80
isLockedBySelf()
isLockedBySelf():
boolean
Returns
boolean
Inherited from
SurfaceElementModel
.isLockedBySelf
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:81
lock()
lock():
void
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:82
onCreated()
onCreated():
void
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:83
pop()
pop(
prop
):void
Parameters
prop
string
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:84
serialize()
serialize():
SerializedElement
Returns
SerializedElement
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:85
stash()
stash(
prop
):void
Parameters
prop
string
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:86
unlock()
unlock():
void
Returns
void
Inherited from
Defined in
packages/framework/block-std/dist/gfx/model/surface/element-model.d.ts:87
propsToY()
static
propsToY(props
):BrushProps
Parameters
props
Returns
Overrides
Defined in
packages/affine/model/src/elements/brush/brush.ts:67