Skip to main content
Version: Version 5 beta

Interface: FreeTextAnnotations

Groups all the API actions related to the free text annotations.

Properties

addEventListener()

addEventListener: (eventName, callback) => void

Adds an event listener for the free text annotations.

Parameters

eventName: "rotationChanged" | "textSelectionChanged" | "toggled" | "deleteCompleted" | "deleteFailed" | "lockChanged" | "backgroundColorChanged" | "borderColorChanged" | "fontColorChanged" | "fontFamilyChanged" | "fontSizeChanged" | "borderWidthChanged" | "textAlignmentChanged" | "textStyleChanged" | "editorToggled"

The name of the event to listen for.

callback: (active) => void | (color) => void | (color) => void | (color) => void | (fontFamily) => void | (fontSize) => void | (width) => void | (alignment) => void | (style) => void | (state) => void | (active) => void | (rotation) => void | (annotation) => void | (annotation, error) => void | (annotation, locked) => void

The callback function to execute when the event is triggered.

Returns

void


emitBackgroundColorChanged()

emitBackgroundColorChanged: (color) => void

Emits a background color changed event for the free text annotations.

Parameters

color: `#${string}`

The new background color value.

Returns

void


emitBorderColorChanged()

emitBorderColorChanged: (color) => void

Emits a border color changed event for the free text annotations.

Parameters

color: `#${string}`

The new border color value.

Returns

void


emitBorderWidthChanged()

emitBorderWidthChanged: (width) => void

Emits a border width changed event for the free text annotations.

Parameters

width: number

The new border width in pixels (px).

Returns

void


emitDeleteCompleted()

emitDeleteCompleted: (annotation) => void

Triggers an event indicating that a free text annotation has been successfully deleted.

Parameters

annotation: FreeTextAnnotation

The free text annotation that was deleted.

Returns

void


emitDeleteFailed()

emitDeleteFailed: (annotation, error) => void

Triggers an event indicating that a free text annotation deletion has failed.

Parameters

annotation: FreeTextAnnotation

The free text annotation that failed to delete.

error: Error

The error that occurred during deletion.

Returns

void


emitEditorToggled()

emitEditorToggled: (active) => void

Triggers an event indicating that the rich text editor has been activated or deactivated.

Parameters

active: boolean

true if the rich text editor is active, false otherwise.

Returns

void


emitFontColorChanged()

emitFontColorChanged: (color) => void

Emits a font color changed event for the free text annotations.

Parameters

color: `#${string}`

The new font color value.

Returns

void


emitFontFamilyChanged()

emitFontFamilyChanged: (fontFamily) => void

Emits a font family changed event for the free text annotations.

Parameters

fontFamily: string

The new font family name.

Returns

void


emitFontSizeChanged()

emitFontSizeChanged: (fontSize) => void

Emits a font size changed event for the free text annotations.

Parameters

fontSize: number

The new font size in points (pt). One pt is equal to 1/72 of an inch.

Returns

void


emitLockChanged()

emitLockChanged: (annotation, locked) => void

Triggers an event indicating that a free text annotation’s lock state has been changed.

Parameters

annotation: FreeTextAnnotation

The free text annotation whose lock state was changed.

locked: boolean

Represents the current state of the lock. true if the annotation was locked, false if unlocked.

Returns

void


emitRotationChanged()

emitRotationChanged: (rotation) => void

Emits a rotation changed event for the free text annotations.

Parameters

rotation: Rotation

The new rotation value.

Returns

void


emitTextAlignmentChanged()

emitTextAlignmentChanged: (alignment) => void

Emits a text alignment changed event for the free text annotations.

Parameters

alignment: TextAlignment

The new text alignment. Supported values are ‘left’, ‘center’, and ‘right’.

Returns

void


emitTextSelectionChanged()

emitTextSelectionChanged: (state) => void

Emits a text selection changed event for the free text annotations. The event is triggered when the selection in the rich text editor changes.

Parameters

state: TextSelectionState

The current text selection state including the selected text and styles.

Returns

void


emitTextStyleChanged()

emitTextStyleChanged: (style) => void

Emits a text style changed event for the free text annotations.

Parameters

style: TextStyle

The text style. Supported values are ‘bold’, ‘italic’, and ‘underline’.

Returns

void


emitToggled()

emitToggled: (active) => void

Triggers an event indicating that the free text annotations panel has been toggled (opened or closed).

Parameters

active: boolean

true if the free text annotations panel has been opened, false otherwise.

Returns

void


removeEventListener()

removeEventListener: (eventName, callback) => void

Removes an event listener for the free text annotations.

Parameters

eventName: "rotationChanged" | "textSelectionChanged" | "toggled" | "deleteCompleted" | "deleteFailed" | "lockChanged" | "backgroundColorChanged" | "borderColorChanged" | "fontColorChanged" | "fontFamilyChanged" | "fontSizeChanged" | "borderWidthChanged" | "textAlignmentChanged" | "textStyleChanged" | "editorToggled"

The name of the event to stop listening for.

callback: (active) => void | (color) => void | (color) => void | (color) => void | (fontFamily) => void | (fontSize) => void | (width) => void | (alignment) => void | (style) => void | (state) => void | (active) => void | (rotation) => void | (annotation) => void | (annotation, error) => void | (annotation, locked) => void

The callback function to remove.

Returns

void