Skip to main content
Version: Version 5 beta

Interface: LineAnnotations

Groups all the API actions related to the line annotations.

Properties

addEventListener()

addEventListener: (eventName, callback) => void

Adds an event listener for the line annotations.

Parameters

eventName: "toggled" | "opacityChanged" | "colorChanged" | "thicknessChanged" | "lineEndingChanged"

The name of the event to listen for.

callback: (active) => void | (color) => void | (opacity) => void | (thickness) => void | (lineEnding, direction) => void

The callback function to execute when the event is triggered.

Returns

void

void


emitColorChanged()

emitColorChanged: (color) => void

Emits a color changed event for the line annotations.

Parameters

color: `#${string}`

The new color value.

Returns

void

void


emitLineEndingChanged()

emitLineEndingChanged: (lineEnding, direction) => void

Emits a line ending changed event for the line annotations.

Parameters

lineEnding: number

The new line ending value.

direction: string

The direction of the line ending.

Returns

void

void


emitOpacityChanged()

emitOpacityChanged: (opacity) => void

Emits an opacity changed event for the line annotations.

Parameters

opacity: number

The new opacity value.

Returns

void

void


emitThicknessChanged()

emitThicknessChanged: (thickness) => void

Emits a thickness changed event for the line annotations.

Parameters

thickness: number

The new thickness value.

Returns

void

void


emitToggled()

emitToggled: (active) => void

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

Parameters

active: boolean

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

Returns

void

void

Example

viewer.lineAnnotations.emitToggled(true);


removeEventListener()

removeEventListener: (eventName, callback) => void

Removes an event listener for the line annotations.

Parameters

eventName: "toggled" | "opacityChanged" | "colorChanged" | "thicknessChanged" | "lineEndingChanged"

The name of the event to stop listening for.

callback: (active) => void | (color) => void | (opacity) => void | (thickness) => void | (lineEnding, direction) => void

The callback function to remove.

Returns

void

void