Interface: ShapeAnnotations
Groups all the API actions related to the shape annotations.
Properties
addEventListener()
addEventListener: (
eventName
,callback
) =>void
Adds an event listener for the shape annotations.
Parameters
• eventName: "toggled"
| "lineColorChanged"
| "opacityChanged"
| "lineThicknessChanged"
| "fillColorChanged"
| "shapeTypeChanged"
The name of the event to listen for.
• callback: (active
) => void
| (color
) => void
| (color
) => void
| (opacity
) => void
| (thickness
) => void
| (shapeType
) => void
The callback function to execute when the event is triggered.
Returns
void
void
emitFillColorChanged()
emitFillColorChanged: (
color
) =>void
Emits a fill color changed event for the shape annotations.
Parameters
• color: `#${string}`
The new color value.
Returns
void
void
emitLineColorChanged()
emitLineColorChanged: (
color
) =>void
Emits a line color changed event for the shape annotations.
Parameters
• color: `#${string}`
The new color value.
Returns
void
void
emitLineThicknessChanged()
emitLineThicknessChanged: (
thickness
) =>void
Emits a line thickness changed event for the shape annotations.
Parameters
• thickness: number
The new thickness value.
Returns
void
void
emitOpacityChanged()
emitOpacityChanged: (
opacity
) =>void
Emits an opacity changed event for the shape annotations.
Parameters
• opacity: number
The new opacity value.
Returns
void
void
emitShapeTypeChanged()
emitShapeTypeChanged: (
shapeType
) =>void
Emits a shape type changed event for the shape annotations.
Parameters
• shapeType: ShapeType
The new shape type value.
Returns
void
void
emitToggled()
emitToggled: (
active
) =>void
Triggers an event indicating that the shape annotations panel has been toggled (opened or closed).
Parameters
• active: boolean
true
if the shape annotations panel has been opened, false
otherwise.
Returns
void
void
Example
viewer.shapeAnnotations.emitToggled(true);
removeEventListener()
removeEventListener: (
eventName
,callback
) =>void
Removes an event listener for the shape annotations.
Parameters
• eventName: "toggled"
| "lineColorChanged"
| "opacityChanged"
| "lineThicknessChanged"
| "fillColorChanged"
| "shapeTypeChanged"
The name of the event to stop listening for.
• callback: (active
) => void
| (color
) => void
| (color
) => void
| (opacity
) => void
| (thickness
) => void
| (shapeType
) => void
The callback function to remove.
Returns
void
void