Skip to main content

Class: AnnotationElement

Defined in: editor/annotationCells.ts:14

Diagram-only annotation element, exported and imported with the diagram.

Extends

Constructors

Constructor

new AnnotationElement(props): AnnotationElement

Defined in: diagram/elements.ts:118

Parameters

ParameterType

props

ElementProps

Returns

AnnotationElement

Inherited from

Element.constructor

Properties

PropertyModifierTypeDefault valueDescriptionInherited from

events

readonly

Events<ElementEvents>

undefined

Events for the graph element.

Element.events

id

readonly

string

undefined

Unique and immutable element ID on the diagram.

Element.id

fromJSONType

readonly

"Annotation"

'Annotation'

Accessors

elementState

Get Signature

get elementState(): TemplateState

Defined in: diagram/elements.ts:195

Gets a serializable template-specific state for the element.

Returns

TemplateState

Inherited from

Element.elementState


isExpanded

Get Signature

get isExpanded(): boolean

Defined in: diagram/elements.ts:173

Whether the element should be displayed as expanded (as defined by the element template).

Expanded state is stored in the element state with TemplateProperties.Expanded property.

Returns

boolean

Inherited from

Element.isExpanded


position

Get Signature

get position(): Vector

Defined in: diagram/elements.ts:143

Gets the element position on the canvas in paper coordinates.

Returns

Vector

Inherited from

Element.position

Methods

focus()

focus(): void

Defined in: diagram/elements.ts:215

Focuses on the element template on a canvas (if possible).

Returns

void

Inherited from

Element.focus


redraw()

redraw(level?): void

Defined in: diagram/elements.ts:224

Forces a re-render of the element displayed by a template on a canvas.

Parameters

ParameterTypeDescription

level?

ElementRedrawLevel

specifies which cached state should be invalidated on re-render

Returns

void

Inherited from

Element.redraw


setElementState()

setElementState(value): void

Defined in: diagram/elements.ts:205

Sets a new value for elementState property.

Triggers ElementEvents.changeElementState event if new value does not equal to the previous one.

Parameters

ParameterType

value

TemplateState

Returns

void

Inherited from

Element.setElementState


setExpanded()

setExpanded(value): void

Defined in: diagram/elements.ts:186

Sets a new value for isExpanded property.

Expanded state is stored in the element state with TemplateProperties.Expanded property.

Triggers ElementEvents.changeElementState event if new value does not equal to the previous one.

Parameters

ParameterType

value

boolean

Returns

void

Inherited from

Element.setExpanded


setPosition()

setPosition(value): void

Defined in: diagram/elements.ts:155

Sets a new value for position property.

Triggers ElementEvents.changePosition event if new value does not equal to the previous one.

Parameters

ParameterType

value

Vector

Returns

void

See

RestoreGeometry

Inherited from

Element.setPosition


toJSON()

toJSON(): SerializedAnnotationElement

Defined in: editor/annotationCells.ts:31

Returns

SerializedAnnotationElement


fromJSON()

static fromJSON(state, options): undefined | AnnotationElement

Defined in: editor/annotationCells.ts:17

Parameters

ParameterType

state

SerializedAnnotationElement

options

ElementFromJsonOptions

Returns

undefined | AnnotationElement


generateId()

static generateId(): string

Defined in: diagram/elements.ts:136

Generates a new unique ID for an element.

Returns

string

Inherited from

Element.generateId