new EditorSvgAnnotation(viewer, layer [, options])
Creates an EditorSvgAnnotation instance
Parameters:
Name | Type | Argument | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
viewer |
Viewer | The OpenLIME viewer instance |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
layer |
LayerSvgAnnotation | The annotation layer to edit |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
<optional> |
Configuration options Properties
|
- Source:
Example
```javascript // Create annotation layer const anno = new OpenLIME.Layer(options); viewer.addLayer('annotations', anno); // Initialize editor const editor = new OpenLIME.EditorSvgAnnotation(viewer, anno, { classes: { 'default': { stroke: '#000', label: 'Default' }, 'highlight': { stroke: '#ff0', label: 'Highlight' } } }); // Setup callbacks editor.createCallback = (anno) => { console.log("Created:", anno); return saveToDatabase(anno); }; ```
Methods
-
createAnnotation()
-
Creates a new annotation
- Source:
Returns:
- Type
- void
-
deleteSelected()
-
Deletes the selected annotation
- Source:
Returns:
- Type
- void
-
exportAnnotations()
-
Exports all annotations as SVG
- Source:
Returns:
- Type
- void
-
redo()
-
Performs a redo operation
- Source:
Returns:
- Type
- void
-
undo()
-
Performs an undo operation
- Source:
Returns:
- Type
- void