Skip to content

ShapeFactory

Shape factory

Constructors

new ShapeFactory()

new ShapeFactory(editor): ShapeFactory

Parameters

editor: Editor

Returns

ShapeFactory

Source

factory.ts:46

Properties

onCreate

onCreate: TypedEvent<Shape>

Event emitter for shape creation

Source

factory.ts:39


onShapeInitialize

onShapeInitialize: TypedEvent<Shape>

Event emitter for shape initialization

Source

factory.ts:44

Methods

createAnchoredText()

createAnchoredText(anchorPosition, initialText): Text

Create an anchored text

Parameters

anchorPosition: number

initialText: string= ""

Returns

Text

Source

factory.ts:124


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:193


createEllipse()

createEllipse(rect): Ellipse

Create an ellipse

Parameters

rect: number[][]

Returns

Ellipse

Source

factory.ts:81


createEmbed()

createEmbed(rect): Embed

Create an embed

Parameters

rect: number[][]

Returns

Embed

Source

factory.ts:286


createFrame()

createFrame(rect): Frame

Create a frame

Parameters

rect: number[][]

Returns

Frame

Source

factory.ts:264


createFreehand()

createFreehand(points, closed): Freehand

Create a freehand lines

Parameters

points: number[][]

closed: boolean= false

Returns

Freehand

Source

factory.ts:220


createHighlighter()

createHighlighter(points): Highlighter

Create a freehand lines

Parameters

points: number[][]

Returns

Highlighter

Source

factory.ts:241


createImage()

createImage(fileOrBlob, position): Promise<Image>

Create an image

Parameters

fileOrBlob: Blob | File

position: number[]

Returns

Promise<Image>

Source

factory.ts:147


createLine()

createLine(points, closed): Line

create a line (or polygon)

Parameters

points: number[][]

closed: boolean= false

Returns

Line

Source

factory.ts:174


createRectangle()

createRectangle(rect): Rectangle

Create a rectangle

Parameters

rect: number[][]

Returns

Rectangle

Source

factory.ts:64


createText()

createText(rect, initialText): Text

Create a text

Parameters

rect: number[][]

initialText: string= ""

Returns

Text

Source

factory.ts:98