BlockSuite API Documentation / @blocksuite/blocks / ShapeElement
Class: ShapeElement ​
Contents ​
- Extends
- Constructors
- Properties
- Accessors
- batch
- color
- connectable
- elementBound
- fillColor
- filled
- font
- fontFamily
- fontSize
- fontStyle
- fontWeight
- h
- horizontalOffset
- id
- index
- localRecord
- radius
- realFillColor
- realStrokeColor
- rotate
- roughness
- seed
- shapeStyle
- shapeType
- strokeColor
- strokeStyle
- strokeWidth
- text
- textAlign
- textHorizontalAlign
- textVerticalAlign
- type
- w
- wrapTextDeltas
- x
- xywh
- y
- Methods
Extends ​
SurfaceElement
<IShape
,IShapeLocalRecord
>
Constructors ​
new ShapeElement(yMap, options, data) ​
new ShapeElement(
yMap
,options
,data
):ShapeElement
Parameters ​
• yMap: Map
<unknown
>
• options: Object
• options.getGroupParent: (element
) => GroupElement
• options.getLocalRecord: (id
) => undefined
| CanvasElementLocalRecordValues
• options.onElementUpdated: (update
) => void
• options.pickById: (id
) => null
| EdgelessElement
• options.removeElement: (id
) => void
• options.selectionManager?: EdgelessSelectionManager
• options.setGroupParent: (element
, group
) => void
• options.updateElementLocalRecord: (id
, record
) => void
• data: Partial
<IShape
>= {}
Returns ​
Inherited from ​
SurfaceElement<IShape, IShapeLocalRecord>.constructor
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:95
Properties ​
_connectable ​
protected
_connectable:boolean
=true
Inherited from ​
SurfaceElement._connectable
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:91
computedValue ​
computedValue:
ComputedValue
Inherited from ​
SurfaceElement.computedValue
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:93
options ​
protected
options:Object
Type declaration ​
getGroupParent ​
getGroupParent: (
element
) =>GroupElement
Parameters ​
• element: string
| EdgelessElement
Returns ​
getLocalRecord ​
getLocalRecord: (
id
) =>undefined
|CanvasElementLocalRecordValues
Parameters ​
• id: string
Returns ​
undefined
| CanvasElementLocalRecordValues
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
updateElementLocalRecord ​
updateElementLocalRecord: (
id
,record
) =>void
Parameters ​
• id: string
• record: Record
<string
, unknown
>
Returns ​
void
Inherited from ​
SurfaceElement.options
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:74
renderer ​
protected
renderer:null
|Renderer
=null
Inherited from ​
SurfaceElement.renderer
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:90
yMap ​
yMap:
Map
<unknown
>
Inherited from ​
SurfaceElement.yMap
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:72
Accessors ​
batch ​
get
batch():null
|NonNullable
<T
["batch"
]>
Returns ​
null
| NonNullable
<T
["batch"
]>
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:144
color ​
get
color():string
Returns ​
string
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:86
connectable ​
get
connectable():boolean
Returns ​
boolean
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:179
elementBound ​
get
elementBound():Bound
Returns ​
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:148
fillColor ​
get
fillColor():string
Returns ​
string
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:42
filled ​
get
filled():boolean
Returns ​
boolean
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:37
font ​
get
font():string
Returns ​
string
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:153
fontFamily ​
get
fontFamily():CanvasTextFontFamily
Returns ​
CanvasTextFontFamily
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:98
fontSize ​
get
fontSize():SHAPE_TEXT_FONT_SIZE
Returns ​
SHAPE_TEXT_FONT_SIZE
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:91
fontStyle ​
get
fontStyle():CanvasTextFontStyle
Returns ​
CanvasTextFontStyle
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:112
fontWeight ​
get
fontWeight():CanvasTextFontWeight
Returns ​
CanvasTextFontWeight
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:105
h ​
get
h():number
Returns ​
number
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:170
horizontalOffset ​
get
horizontalOffset():number
Returns ​
number
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:163
id ​
get
id():T
["id"
]
Returns ​
T
["id"
]
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:114
index ​
get
index():T
["index"
]
Returns ​
T
["index"
]
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:119
localRecord ​
get
localRecord():undefined
|CanvasElementLocalRecordValues
Returns ​
undefined
| CanvasElementLocalRecordValues
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:175
radius ​
get
radius():number
Returns ​
number
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:32
realFillColor ​
get
realFillColor():string
Returns ​
string
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:72
realStrokeColor ​
get
realStrokeColor():string
Returns ​
string
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:68
rotate ​
get
rotate():T
["rotate"
]
Returns ​
T
["rotate"
]
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:139
roughness ​
get
roughness():number
Returns ​
number
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:62
seed ​
get
seed():T
["seed"
]
Returns ​
T
["seed"
]
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:134
shapeStyle ​
get
shapeStyle():ShapeStyle
Returns ​
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:76
shapeType ​
get
shapeType():ShapeType
Returns ​
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:27
strokeColor ​
get
strokeColor():string
Returns ​
string
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:52
strokeStyle ​
get
strokeStyle():StrokeStyle
Returns ​
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:57
strokeWidth ​
get
strokeWidth():number
Returns ​
number
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:47
text ​
get
text():undefined
|Text
Returns ​
undefined
| Text
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:81
textAlign ​
get
textAlign():"center"
|"left"
|"right"
Returns ​
"center"
| "left"
| "right"
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:119
textHorizontalAlign ​
get
textHorizontalAlign():"center"
|"left"
|"right"
Returns ​
"center"
| "left"
| "right"
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:125
textVerticalAlign ​
get
textVerticalAlign():"top"
|"center"
|"bottom"
Returns ​
"top"
| "center"
| "bottom"
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:132
type ​
get
type():T
["type"
]
Returns ​
T
["type"
]
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:124
w ​
get
w():number
Returns ​
number
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:165
wrapTextDeltas ​
get
wrapTextDeltas():ITextDelta
[]
Returns ​
ITextDelta
[]
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:139
x ​
get
x():number
Returns ​
number
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:155
xywh ​
get
xywh(): `[${number},${number},${number},${number}]`
Returns ​
`[${number},${number},${number},${number}]`
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:129
y ​
get
y():number
Returns ​
number
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:160
Methods ​
_renderText() ​
private
_renderText(ctx
):void
Parameters ​
• ctx: CanvasRenderingContext2D
Returns ​
void
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:224
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:63
containedByBounds() ​
containedByBounds(
bounds
):boolean
Parameters ​
• bounds: Bound
Returns ​
boolean
Overrides ​
SurfaceElement.containedByBounds
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:192
deserializeXYWH() ​
deserializeXYWH():
XYWH
Returns ​
Inherited from ​
SurfaceElement.deserializeXYWH
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:193
getLocalRecord() ​
getLocalRecord():
IShapeLocalRecord
Returns ​
IShapeLocalRecord
Inherited from ​
SurfaceElement.getLocalRecord
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:183
getNearestPoint() ​
getNearestPoint(
point
):IVec
Parameters ​
• point: IVec
Returns ​
Overrides ​
SurfaceElement.getNearestPoint
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:200
getRelativePointLocation() ​
getRelativePointLocation(
point
):PointLocation
Parameters ​
• point: IVec
Returns ​
Overrides ​
SurfaceElement.getRelativePointLocation
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:204
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:181
init() ​
init():
void
Returns ​
void
Inherited from ​
SurfaceElement.init
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:112
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:196
mount() ​
mount(
renderer
):void
Parameters ​
• renderer: Renderer
Returns ​
void
Inherited from ​
SurfaceElement.mount
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:219
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:211
serialize() ​
serialize():
IShape
Returns ​
Inherited from ​
SurfaceElement.serialize
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:197
unmount() ​
unmount():
void
Returns ​
void
Inherited from ​
SurfaceElement.unmount
Source ​
packages/blocks/src/surface-block/elements/surface-element.ts:225
verticalOffset() ​
verticalOffset(
lines
,lineHeight
):number
Parameters ​
• lines: ITextDelta
[][]
• lineHeight: number
Returns ​
number
Source ​
packages/blocks/src/surface-block/elements/shape/shape-element.ts:172
Generated using typedoc-plugin-markdown and TypeDoc