Interface: IAnnotationsContext
Defines the context interface for managing annotations in a React application.
Description
Provides state and methods for handling annotation collections, current annotation selection, styling, and editor control.
Properties
add()
add: (annotation) => void;Add annotations
Parameters
annotation
AnnotationCollection | Annotation
Returns
void
annotations
annotations: AnnotationCollection;Current annotations in the application.
arrowStyle
arrowStyle: ArrowStyles;The current arrow style for annotations.
arrowWidthFactor
arrowWidthFactor: number;The current width factor for arrow annotations.
cancelDrawing()
cancelDrawing: () => void;Cancel the current drawing operation
Returns
void
canRedo
canRedo: boolean;Whether redo is available
canUndo
canUndo: boolean;Whether undo is available
clearHistory()
clearHistory: () => void;Clear the history
Returns
void
currentAnnotation
currentAnnotation: AnnotationFeature<Geometry, AnnotationProps> | null;The currently selected annotation in the application.
editor
editor: Control;The annotations editor for managing annotations. See AnnotationsEditor
enableBoxDrawing()
enableBoxDrawing: (style?) => void;Enable box drawing mode
Parameters
style?
Partial<BoxStyle | undefined>
Returns
void
enableCommentDrawing()
enableCommentDrawing: (options?) => void;Enable comment drawing mode
Parameters
options?
arrowStyle?
Partial<ArrowProperties>
commentStyle?
Partial<CommentProps>
offsetX?
number
offsetY?
number
Returns
void
enablePolygonDrawing()
enablePolygonDrawing: (style?) => void;Enable polygon drawing mode
Parameters
style?
Partial<PolygonStyle | undefined>
Returns
void
redo()
redo: () => boolean;Redo the last undone action
Returns
boolean
remove()
remove: (annotation) => void;Remove annotations
Parameters
annotation
AnnotationCollection | Annotation
Returns
void
select()
select: (ids) => void;Select annotations by ID
Parameters
ids
string | string[]
Returns
void
setArrowStyle()
setArrowStyle: (arrowStyle) => void;Sets the current arrow style for annotations.
Parameters
arrowStyle
ArrowStyles
Returns
void
setArrowWidthFactor()
setArrowWidthFactor: (arrowWidthFactor) => void;Sets the width factor for arrow annotations.
Parameters
arrowWidthFactor
number
Returns
void
setCurrentAnnotation()
setCurrentAnnotation: (annotation) => void;Sets the currently selected annotation in the application.
Parameters
annotation
AnnotationFeature<Geometry, AnnotationProps> | null
Returns
void
setEditor()
setEditor: (editor) => void;Sets the current annotations editor for managing annotations.
Parameters
editor
Control
Returns
void
setTextSizeFactor()
setTextSizeFactor: (textSizeFactor) => void;Sets the size factor for text annotations.
Parameters
textSizeFactor
number
Returns
void
setTextStyle()
setTextStyle: (textStyle) => void;Sets the current text style for annotations.
Parameters
textStyle
TextStyle
Returns
void
textSizeFactor
textSizeFactor: number;The current size factor for text annotations in regards to node sizes.
textStyle
textStyle: TextStyle;The current text style for annotations.
undo()
undo: () => boolean;Undo the last action
Returns
boolean