React OpenSeadragon and IIIF
Use Annotorious together with OpenSeadragon to annotate high-resolution zoomable images with React, including images served via the International Image Interoperability Framework (IIIF) standard.
Step-by-Step Guide
-
Import the
Annotorious
,OpenSeadragonViewer
andOpenSeadragonAnnotator
components. -
Import Annotorious base CSS styles.
-
Important: wrap your application with the
<Annotatorious>
root context tag - other Annotorious components depend on it. You can use Annotorious-provided hooks anywhere below the context tag.
Styling
You can apply custom styling to annotations via the style
prop. The style can
be:
- A DrawingStyle object.
- A function that receives the ImageAnnotation and the AnnotationState as an input, and returns a DrawingStyle.
Filters
Using a filter, you can dynamically control the visibility of specific annotations,
based on their data or external criteria. The filter is a function that receives
the ImageAnnotation as an input, and returns a boolean.
true
makes the annotation visible, false
hides it.
Selection Behavior
When a user selects an annotation by click or tap, the default behavior is
that the shape will become editable. You can change this behavior through
the userSelectAction
prop. The prop accepts:
- a UserSelectAction object.
- a function that receives an ImageAnnotation as input, and returns a UserSelectAction.
A UserSelectAction has one of the three following values.
- EDIT: makes the annotation editable, allowing the users to modify its shape (default).
- SELECT: clicking an annotation triggers the relevant selection event, but the annotation will not become editable.
- NONE: the annotation is inert. Clicking or tapping it has no effect.
W3C Format Adapter
A FormatAdapter adds support for different annotation data formats, by introducing crosswalk functionality between Annotorious’ internal annotation data model and other standards.
You can supply a format adapter through the optional adapter
prop.
Currently, the only available adapter is for the
W3C Web Annotation Data Model.
Read more about the Annotorious Data Format, the W3C Format and the differences here.