ShapeFactory
Shape factory
Constructors
new ShapeFactory()
new ShapeFactory(
editor
):ShapeFactory
Parameters
• editor: Editor
Returns
Source
Properties
onCreate
onCreate:
TypedEvent
<Shape
>
Event emitter for shape creation
Source
onShapeInitialize
onShapeInitialize:
TypedEvent
<Shape
>
Event emitter for shape initialization
Source
Methods
createAnchoredText()
createAnchoredText(
anchorPosition
,initialText
):Text
Create an anchored text
Parameters
• anchorPosition: number
• initialText: string
= ""
Returns
Source
createConnector()
createConnector(
tail
,tailAnchor
,head
,headAnchor
,points
):Connector
Create a connector
Parameters
• tail: null
| Shape
• tailAnchor: number
[]
• head: null
| Shape
• headAnchor: number
[]
• points: number
[][]
Returns
Source
createEllipse()
createEllipse(
rect
):Ellipse
Create an ellipse
Parameters
• rect: number
[][]
Returns
Source
createEmbed()
createEmbed(
rect
):Embed
Create an embed
Parameters
• rect: number
[][]
Returns
Source
createFrame()
createFrame(
rect
):Frame
Create a frame
Parameters
• rect: number
[][]
Returns
Source
createFreehand()
createFreehand(
points
,closed
):Freehand
Create a freehand lines
Parameters
• points: number
[][]
• closed: boolean
= false
Returns
Source
createHighlighter()
createHighlighter(
points
):Highlighter
Create a freehand lines
Parameters
• points: number
[][]
Returns
Source
createIcon()
createIcon(
rect
,viewWidth
,viewHeight
,data
):Icon
Parameters
• rect: number
[][]
• viewWidth: number
• viewHeight: number
• data: VGElement
[]
Returns
Source
createImage()
createImage(
fileOrBlob
,position
):Promise
<Image
>
Create an image
Parameters
• fileOrBlob: Blob
| File
• position: number
[]
Returns
Promise
<Image
>
Source
createLine()
createLine(
points
,closed
):Line
create a line (or polygon)
Parameters
• points: number
[][]
• closed: boolean
= false
Returns
Source
createMirror()
createMirror(
rect
,subject
?):Mirror
Create a mirror
Parameters
• rect: number
[][]
• subject?: Shape
Returns
Source
createRectangle()
createRectangle(
rect
):Rectangle
Create a rectangle
Parameters
• rect: number
[][]
Returns
Source
createText()
createText(
rect
,initialText
):Text
Create a text
Parameters
• rect: number
[][]
• initialText: string
= ""