Skip to content

ShapeFactory

Shape factory

Constructors

new ShapeFactory()

new ShapeFactory(editor): ShapeFactory

Parameters

editor: Editor

Returns

ShapeFactory

Source

factory.ts:49

Properties

onCreate

onCreate: TypedEvent<Shape>

Event emitter for shape creation

Source

factory.ts:42


onShapeInitialize

onShapeInitialize: TypedEvent<Shape>

Event emitter for shape initialization

Source

factory.ts:47

Methods

createAnchoredText()

createAnchoredText(anchorPosition, initialText): Text

Create an anchored text

Parameters

anchorPosition: number

initialText: string= ""

Returns

Text

Source

factory.ts:127


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

Connector

Source

factory.ts:196


createEllipse()

createEllipse(rect): Ellipse

Create an ellipse

Parameters

rect: number[][]

Returns

Ellipse

Source

factory.ts:84


createEmbed()

createEmbed(rect): Embed

Create an embed

Parameters

rect: number[][]

Returns

Embed

Source

factory.ts:330


createFrame()

createFrame(rect): Frame

Create a frame

Parameters

rect: number[][]

Returns

Frame

Source

factory.ts:285


createFreehand()

createFreehand(points, closed): Freehand

Create a freehand lines

Parameters

points: number[][]

closed: boolean= false

Returns

Freehand

Source

factory.ts:223


createHighlighter()

createHighlighter(points): Highlighter

Create a freehand lines

Parameters

points: number[][]

Returns

Highlighter

Source

factory.ts:244


createIcon()

createIcon(rect, viewWidth, viewHeight, data): Icon

Parameters

rect: number[][]

viewWidth: number

viewHeight: number

data: VGElement[]

Returns

Icon

Source

factory.ts:264


createImage()

createImage(fileOrBlob, position): Promise<Image>

Create an image

Parameters

fileOrBlob: Blob | File

position: number[]

Returns

Promise<Image>

Source

factory.ts:150


createLine()

createLine(points, closed): Line

create a line (or polygon)

Parameters

points: number[][]

closed: boolean= false

Returns

Line

Source

factory.ts:177


createMirror()

createMirror(rect, subject?): Mirror

Create a mirror

Parameters

rect: number[][]

subject?: Shape

Returns

Mirror

Source

factory.ts:307


createRectangle()

createRectangle(rect): Rectangle

Create a rectangle

Parameters

rect: number[][]

Returns

Rectangle

Source

factory.ts:67


createText()

createText(rect, initialText): Text

Create a text

Parameters

rect: number[][]

initialText: string= ""

Returns

Text

Source

factory.ts:101