Skip to main content
Version: Version 5 beta

Interface: ImageAnnotations

Groups all the API actions related to the image annotations.

Properties

addEventListener()

addEventListener: (eventName, callback) => void

Adds an event listener for the image annotations.

Parameters

eventName: "toggled" | "deleteCompleted" | "deleteFailed" | "lockChanged" | "imageSelected"

The name of the event to listen for.

callback: (active) => void | (file) => void | (annotation) => void | (annotation, error) => void | (annotation, locked) => void

The callback function to execute when the event is triggered.

Returns

void


emitDeleteCompleted()

emitDeleteCompleted: (annotation) => void

Triggers an event indicating that an image annotation has been successfully deleted.

Parameters

annotation: StampAnnotation

The image annotation that was deleted.

Returns

void


emitDeleteFailed()

emitDeleteFailed: (annotation, error) => void

Triggers an event indicating that an image annotation deletion failed.

Parameters

annotation: StampAnnotation

The image annotation that failed to delete.

error: Error

The error that occurred during deletion.

Returns

void


emitImageSelected()

emitImageSelected: (file) => void

Triggers an event indicating that a user selected an image file to be used as the image annotation.

Parameters

file: File

The File object that represents the selected image.

Returns

void


emitLockChanged()

emitLockChanged: (annotation, locked) => void

Triggers an event indicating that an image annotation’s lock state was changed.

Parameters

annotation: StampAnnotation

The image annotation whose lock state was changed.

locked: boolean

true if the annotation was locked, false if unlocked.

Returns

void


emitToggled()

emitToggled: (active) => void

Triggers an event indicating that the image annotations mode toggle was activated or deactivated.

Parameters

active: boolean

true if the image annotations mode has been activated, false otherwise.

Returns

void

Example

viewer.imageAnnotations.emitToggled(true);


removeEventListener()

removeEventListener: (eventName, callback) => void

Removes an event listener for the image annotations.

Parameters

eventName: "toggled" | "deleteCompleted" | "deleteFailed" | "lockChanged" | "imageSelected"

The name of the event to stop listening for.

callback: (active) => void | (file) => void | (annotation) => void | (annotation, error) => void | (annotation, locked) => void

The callback function to remove.

Returns

void