BlockSuite API Documentation / @blocksuite/blocks / ShapeElementModel
Class: ShapeElementModel
Extends
ElementModel
<ShapeProps
>
Contents
Constructors
new ShapeElementModel(options)
new ShapeElementModel(
options
):ShapeElementModel
Parameters
• options: Object
• options.model: SurfaceBlockModel
• options.onChange: (props
) => void
• options.stashedStore: Map
<unknown
, unknown
>
• options.yMap: Map
<unknown
>
Returns
Inherited from
ElementModel<ShapeProps>.constructor
Source
packages/blocks/src/surface-block/element-model/base.ts:45
Properties
_local
protected
_local:Map
<string
|symbol
,unknown
>
Inherited from
ElementModel._local
Source
packages/blocks/src/surface-block/element-model/base.ts:24
_onChange
protected
_onChange: (props
) =>void
Parameters
• props: Record
<string
, Object
>
Returns
void
Inherited from
ElementModel._onChange
Source
packages/blocks/src/surface-block/element-model/base.ts:25
_preserved
protected
_preserved:Map
<string
,unknown
>
When the ymap is not connected to the doc, the value cannot be accessed. But sometimes we need to access the value when creating the element model, those temporary values are stored here.
Inherited from
ElementModel._preserved
Source
packages/blocks/src/surface-block/element-model/base.ts:22
_stashed
protected
_stashed:Map
<"text"
|"index"
|"color"
|"shapeStyle"
|"shapeType"
|"fillColor"
|"strokeColor"
|"radius"
|"strokeWidth"
|"roughness"
|"strokeStyle"
|"fontSize"
|"fontFamily"
|"fontWeight"
|"fontStyle"
|"textAlign"
|"filled"
|"textHorizontalAlign"
|"textVerticalAlign"
,unknown
>
Inherited from
ElementModel._stashed
Source
packages/blocks/src/surface-block/element-model/base.ts:23
color?
color?:
string
Source
packages/blocks/src/surface-block/element-model/shape.ts:90
display
display:
boolean
=true
Inherited from
ElementModel.display
Source
packages/blocks/src/surface-block/element-model/base.ts:40
fillColor
fillColor:
string
='--affine-palette-shape-yellow'
Source
packages/blocks/src/surface-block/element-model/shape.ts:69
filled
filled:
boolean
=false
Source
packages/blocks/src/surface-block/element-model/shape.ts:66
fontFamily?
fontFamily?:
string
Source
packages/blocks/src/surface-block/element-model/shape.ts:96
fontSize?
fontSize?:
number
Source
packages/blocks/src/surface-block/element-model/shape.ts:93
fontStyle?
fontStyle?:
FontStyle
Source
packages/blocks/src/surface-block/element-model/shape.ts:102
fontWeight?
fontWeight?:
FontWeight
Source
packages/blocks/src/surface-block/element-model/shape.ts:99
index
index:
string
Inherited from
ElementModel.index
Source
packages/blocks/src/surface-block/element-model/base.ts:37
opacity
opacity:
number
=1
Inherited from
ElementModel.opacity
Source
packages/blocks/src/surface-block/element-model/base.ts:43
radius
radius:
number
=0
Source
packages/blocks/src/surface-block/element-model/shape.ts:63
rotate
rotate:
number
=0
Overrides
ElementModel.rotate
Source
packages/blocks/src/surface-block/element-model/shape.ts:57
roughness
roughness:
number
=DEFAULT_ROUGHNESS
Source
packages/blocks/src/surface-block/element-model/shape.ts:84
shapeStyle
shapeStyle:
ShapeStyle
='General'
Source
packages/blocks/src/surface-block/element-model/shape.ts:81
shapeType
shapeType:
ShapeType
='rect'
Source
packages/blocks/src/surface-block/element-model/shape.ts:60
strokeColor
strokeColor:
string
='--affine-palette-line-yellow'
Source
packages/blocks/src/surface-block/element-model/shape.ts:75
strokeStyle
strokeStyle:
StrokeStyle
='solid'
Source
packages/blocks/src/surface-block/element-model/shape.ts:78
strokeWidth
strokeWidth:
number
=4
Source
packages/blocks/src/surface-block/element-model/shape.ts:72
surfaceModel
surfaceModel:
SurfaceBlockModel
Inherited from
ElementModel.surfaceModel
Source
packages/blocks/src/surface-block/element-model/base.ts:28
text?
text?:
Text
Source
packages/blocks/src/surface-block/element-model/shape.ts:87
textAlign?
textAlign?:
"left"
|"right"
|"center"
Source
packages/blocks/src/surface-block/element-model/shape.ts:105
textHorizontalAlign?
textHorizontalAlign?:
"left"
|"right"
|"center"
Source
packages/blocks/src/surface-block/element-model/shape.ts:108
textVerticalAlign?
textVerticalAlign?:
"top"
|"bottom"
|"center"
Source
packages/blocks/src/surface-block/element-model/shape.ts:111
xywh
xywh: `[${number},${number},${number},${number}]` =
'[0,0,100,100]'
Overrides
ElementModel.xywh
Source
packages/blocks/src/surface-block/element-model/shape.ts:54
yMap
yMap:
Map
<unknown
>
Inherited from
ElementModel.yMap
Source
packages/blocks/src/surface-block/element-model/base.ts:27
Accessors
deserializedXYWH
get
deserializedXYWH():XYWH
Returns
XYWH
Source
packages/blocks/src/surface-block/element-model/base.ts:63
elementBound
get
elementBound():Bound
Returns
Source
packages/blocks/src/surface-block/element-model/base.ts:91
group
get
group():null
|GroupElementModel
Returns
null
| GroupElementModel
Source
packages/blocks/src/surface-block/element-model/base.ts:83
h
get
h():number
Returns
number
Source
packages/blocks/src/surface-block/element-model/base.ts:79
id
get
id():string
Returns
string
Source
packages/blocks/src/surface-block/element-model/base.ts:87
type
get
type():string
Returns
string
Source
packages/blocks/src/surface-block/element-model/shape.ts:113
w
get
w():number
Returns
number
Source
packages/blocks/src/surface-block/element-model/base.ts:75
x
get
x():number
Returns
number
Source
packages/blocks/src/surface-block/element-model/base.ts:67
y
get
y():number
Returns
number
Source
packages/blocks/src/surface-block/element-model/base.ts:71
Methods
pop()
pop(
prop
):void
Parameters
• prop: "text"
| "index"
| "color"
| "shapeStyle"
| "shapeType"
| "fillColor"
| "strokeColor"
| "radius"
| "strokeWidth"
| "roughness"
| "strokeStyle"
| "fontSize"
| "fontFamily"
| "fontWeight"
| "fontStyle"
| "textAlign"
| "filled"
| "textHorizontalAlign"
| "textVerticalAlign"
Returns
void
Inherited from
ElementModel.pop
Source
packages/blocks/src/surface-block/element-model/base.ts:124
stash()
stash(
prop
):void
Parameters
• prop: "text"
| "index"
| "color"
| "shapeStyle"
| "shapeType"
| "fillColor"
| "strokeColor"
| "radius"
| "strokeWidth"
| "roughness"
| "strokeStyle"
| "fontSize"
| "fontFamily"
| "fontWeight"
| "fontStyle"
| "textAlign"
| "filled"
| "textHorizontalAlign"
| "textVerticalAlign"
Returns
void
Inherited from
ElementModel.stash
Source
packages/blocks/src/surface-block/element-model/base.ts:99
propsToY()
static
propsToY(props
):ShapeProps
Parameters
• props: ShapeProps
Returns
ShapeProps
Overrides
ElementModel.propsToY
Source
packages/blocks/src/surface-block/element-model/shape.ts:45
Generated using typedoc-plugin-markdown and TypeDoc