BlockSuite API Documentation / @blocksuite/blocks / ShapeElement
Class: ShapeElement
Extends
SurfaceElement
<IShape
>
Contents
- Constructors
- Properties
- Accessors
- batch
- color
- connectable
- display
- elementBound
- fillColor
- filled
- font
- fontFamily
- fontSize
- fontStyle
- fontWeight
- h
- horizontalOffset
- id
- index
- opacity
- radius
- realFillColor
- realStrokeColor
- rotate
- roughness
- seed
- shapeStyle
- shapeType
- strokeColor
- strokeStyle
- strokeWidth
- text
- textAlign
- textDisplay
- textHorizontalAlign
- textVerticalAlign
- type
- w
- wrapTextDeltas
- x
- xywh
- y
- Methods
Constructors
new ShapeElement(yMap, options, data)
new ShapeElement(
yMap
,options
,data
):ShapeElement
Parameters
• yMap: Map
<unknown
>
• options: Object
• options.getGroupParent: (element
) => GroupElement
• options.onElementUpdated: (update
) => void
• options.pickById: (id
) => null
| EdgelessElement
• options.removeElement: (id
) => void
• options.selectionManager?: EdgelessSelectionManager
• options.setGroupParent: (element
, group
) => void
• data: Partial
<IShape
>= {}
Returns
Inherited from
SurfaceElement<IShape>.constructor
Source
packages/blocks/src/surface-block/elements/surface-element.ts:82
Properties
_connectable
protected
_connectable:boolean
=true
Inherited from
SurfaceElement._connectable
Source
packages/blocks/src/surface-block/elements/surface-element.ts:76
_localProps
protected
_localProps:string
[]
Overrides
SurfaceElement._localProps
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:28
_stashedValues
protected
_stashedValues:Map
<string
,unknown
>
Inherited from
SurfaceElement._stashedValues
Source
packages/blocks/src/surface-block/elements/surface-element.ts:77
computedValue
computedValue:
ComputedValue
Inherited from
SurfaceElement.computedValue
Source
packages/blocks/src/surface-block/elements/surface-element.ts:80
options
protected
options:Object
Type declaration
getGroupParent
getGroupParent: (
element
) =>GroupElement
Parameters
• element: string
| EdgelessElement
Returns
GroupElement
onElementUpdated
onElementUpdated: (
update
) =>void
Parameters
• update: Object
• update.id: string
• update.props: Record
<string
, unknown
>
Returns
void
pickById
pickById: (
id
) =>null
|EdgelessElement
Parameters
• id: string
Returns
null
| EdgelessElement
removeElement
removeElement: (
id
) =>void
Parameters
• id: string
Returns
void
selectionManager?
selectionManager?:
EdgelessSelectionManager
setGroupParent
setGroupParent: (
element
,group
) =>void
Parameters
• element: string
• group: GroupElement
Returns
void
Inherited from
SurfaceElement.options
Source
packages/blocks/src/surface-block/elements/surface-element.ts:64
renderer
protected
renderer:null
|Renderer
=null
Inherited from
SurfaceElement.renderer
Source
packages/blocks/src/surface-block/elements/surface-element.ts:75
yMap
yMap:
Map
<unknown
>
Inherited from
SurfaceElement.yMap
Source
packages/blocks/src/surface-block/elements/surface-element.ts:62
Accessors
batch
get
batch():null
|NonNullable
<T
["batch"
]>
Returns
null
| NonNullable
<T
["batch"
]>
Source
packages/blocks/src/surface-block/elements/surface-element.ts:152
color
get
color():string
Returns
string
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:97
connectable
get
connectable():boolean
Returns
boolean
Source
packages/blocks/src/surface-block/elements/surface-element.ts:183
display
get
display():boolean
set
display(val
):void
Parameters
• val: boolean
Returns
boolean
Source
packages/blocks/src/surface-block/elements/surface-element.ts:101
elementBound
get
elementBound():Bound
Returns
Source
packages/blocks/src/surface-block/elements/surface-element.ts:156
fillColor
get
fillColor():string
Returns
string
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:53
filled
get
filled():boolean
Returns
boolean
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:48
font
get
font():string
Returns
string
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:164
fontFamily
get
fontFamily():CanvasTextFontFamily
Returns
CanvasTextFontFamily
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:109
fontSize
get
fontSize():SHAPE_TEXT_FONT_SIZE
Returns
SHAPE_TEXT_FONT_SIZE
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:102
fontStyle
get
fontStyle():CanvasTextFontStyle
Returns
CanvasTextFontStyle
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:123
fontWeight
get
fontWeight():CanvasTextFontWeight
Returns
CanvasTextFontWeight
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:116
h
get
h():number
Returns
number
Source
packages/blocks/src/surface-block/elements/surface-element.ts:178
horizontalOffset
get
horizontalOffset():number
Returns
number
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:174
id
get
id():T
["id"
]
Returns
T
["id"
]
Source
packages/blocks/src/surface-block/elements/surface-element.ts:117
index
get
index():T
["index"
]
Returns
T
["index"
]
Source
packages/blocks/src/surface-block/elements/surface-element.ts:122
opacity
get
opacity():number
set
opacity(val
):void
Parameters
• val: number
Returns
number
Source
packages/blocks/src/surface-block/elements/surface-element.ts:109
radius
get
radius():number
Returns
number
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:43
realFillColor
get
realFillColor():string
Returns
string
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:83
realStrokeColor
get
realStrokeColor():string
Returns
string
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:79
rotate
get
rotate():T
["rotate"
]
Returns
T
["rotate"
]
Source
packages/blocks/src/surface-block/elements/surface-element.ts:144
roughness
get
roughness():number
Returns
number
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:73
seed
get
seed():T
["seed"
]
Returns
T
["seed"
]
Source
packages/blocks/src/surface-block/elements/surface-element.ts:139
shapeStyle
get
shapeStyle():ShapeStyle
Returns
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:87
shapeType
get
shapeType():ShapeType
Returns
ShapeType
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:38
strokeColor
get
strokeColor():string
Returns
string
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:63
strokeStyle
get
strokeStyle():StrokeStyle
Returns
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:68
strokeWidth
get
strokeWidth():number
Returns
number
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:58
text
get
text():undefined
|Text
Returns
undefined
| Text
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:92
textAlign
get
textAlign():TextAlign
Returns
TextAlign
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:130
textDisplay
get
textDisplay():boolean
set
textDisplay(val
):void
Parameters
• val: boolean
Returns
boolean
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:30
textHorizontalAlign
get
textHorizontalAlign():"center"
|TextAlign
Returns
"center"
| TextAlign
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:136
textVerticalAlign
get
textVerticalAlign():"center"
|TextVerticalAlign
Returns
"center"
| TextVerticalAlign
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:143
type
get
type():T
["type"
]
Returns
T
["type"
]
Source
packages/blocks/src/surface-block/elements/surface-element.ts:127
w
get
w():number
Returns
number
Source
packages/blocks/src/surface-block/elements/surface-element.ts:173
wrapTextDeltas
get
wrapTextDeltas():ITextDelta
[]
Returns
ITextDelta
[]
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:150
x
get
x():number
Returns
number
Source
packages/blocks/src/surface-block/elements/surface-element.ts:163
xywh
get
xywh():T
["xywh"
]
Returns
T
["xywh"
]
Source
packages/blocks/src/surface-block/elements/surface-element.ts:132
y
get
y():number
Returns
number
Source
packages/blocks/src/surface-block/elements/surface-element.ts:168
Methods
_renderText()
private
_renderText(ctx
):void
Parameters
• ctx: CanvasRenderingContext2D
Returns
void
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:234
applyUpdate()
applyUpdate(
updates
):void
Parameters
• updates: Partial
<IShape
>
Returns
void
Inherited from
SurfaceElement.applyUpdate
Source
packages/blocks/src/surface-block/elements/surface-element.ts:187
boxSelect()
boxSelect(
bound
):boolean
Parameters
• bound: Bound
Returns
boolean
Inherited from
SurfaceElement.boxSelect
Source
packages/blocks/src/surface-block/elements/surface-element.ts:53
containedByBounds()
containedByBounds(
bounds
):boolean
Parameters
• bounds: Bound
Returns
boolean
Overrides
SurfaceElement.containedByBounds
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:203
deserializeXYWH()
deserializeXYWH():
XYWH
Returns
XYWH
Inherited from
SurfaceElement.deserializeXYWH
Source
packages/blocks/src/surface-block/elements/surface-element.ts:202
getNearestPoint()
getNearestPoint(
point
):IVec
Parameters
• point: IVec
Returns
IVec
Overrides
SurfaceElement.getNearestPoint
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:211
getRelativePointLocation()
getRelativePointLocation(
point
):PointLocation
Parameters
• point: IVec
Returns
PointLocation
Overrides
SurfaceElement.getRelativePointLocation
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:215
hitTest()
hitTest(
x
,y
,options
):boolean
Parameters
• x: number
• y: number
• options: HitTestOptions
Returns
boolean
Overrides
SurfaceElement.hitTest
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:192
init()
init():
void
Returns
void
Inherited from
SurfaceElement.init
Source
packages/blocks/src/surface-block/elements/surface-element.ts:99
intersectWithLine()
intersectWithLine(
start
,end
):null
|PointLocation
[]
Parameters
• start: IVec
• end: IVec
Returns
null
| PointLocation
[]
Overrides
SurfaceElement.intersectWithLine
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:207
mount()
mount(
renderer
):void
Parameters
• renderer: Renderer
Returns
void
Inherited from
SurfaceElement.mount
Source
packages/blocks/src/surface-block/elements/surface-element.ts:228
pop()
pop(
key
):void
Parameters
• key: string
Returns
void
Inherited from
SurfaceElement.pop
Source
packages/blocks/src/surface-block/elements/surface-element.ts:249
render()
render(
ctx
,matrix
,rc
):void
Parameters
• ctx: CanvasRenderingContext2D
• matrix: DOMMatrix
• rc: RoughCanvas
Returns
void
Overrides
SurfaceElement.render
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:222
serialize()
serialize():
IShape
Returns
IShape
Inherited from
SurfaceElement.serialize
Source
packages/blocks/src/surface-block/elements/surface-element.ts:206
stash()
stash(
key
):void
Parameters
• key: string
Returns
void
Inherited from
SurfaceElement.stash
Source
packages/blocks/src/surface-block/elements/surface-element.ts:244
unmount()
unmount():
void
Returns
void
Inherited from
SurfaceElement.unmount
Source
packages/blocks/src/surface-block/elements/surface-element.ts:234
verticalOffset()
verticalOffset(
lines
,lineHeight
):number
Parameters
• lines: ITextDelta
[][]
• lineHeight: number
Returns
number
Source
packages/blocks/src/surface-block/elements/shape/shape-element.ts:183
Generated using typedoc-plugin-markdown and TypeDoc