new Annotation( [options])
Creates a new Annotation instance.
Parameters:
Name | Type | Argument | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
Configuration options for the annotation. Properties
|
- Source:
Methods
-
<static> fromJsonLd(entry)
-
Creates an Annotation instance from a JSON-LD format string.
Parameters:
Name Type Description entry
Object The JSON-LD object representing an annotation.
- Source:
Throws:
-
If the entry is not a valid JSON-LD annotation or contains unsupported selectors.
- Type
- Error
Returns:
A new Annotation instance.
- Type
- Annotation
-
getBBoxFromElements()
-
Calculates and returns the bounding box of the annotation based on its elements or region. The coordinates are always relative to the top-left corner of the canvas.
- Source:
Returns:
The calculated bounding box of the annotation. If the annotation has no elements and no region, returns an empty bounding box. If the annotation has a region but no elements, returns a bounding box based on the region. If the annotation has elements, calculates the bounding box that encompasses all elements.
- Type
- BoundingBox
-
toJsonLd()
-
Converts the annotation to a JSON-LD format object.
- Source:
Returns:
A JSON-LD representation of the annotation including context, id, type, body (with code, class, and description), and target selector information.
- Type
- Object