@deadragdoll/osd
v0.1.6
Published
Internal React package for `OpenSeadragon` annotations, overlays and zoom bookmarks.
Readme
@deadragdoll/osd
Internal React package for OpenSeadragon annotations, overlays and zoom bookmarks.
What it provides
- annotation state provider and hooks;
- SVG overlay renderer;
- toolbar, selector and inspector UI components;
- zoom bookmark state and navigator UI;
- viewer lifecycle hook for
OpenSeadragon; - built-in arrow skins and fallback style fields.
Peer dependencies
reactreact-domopenseadragon
Installation
yarn add @deadragdoll/osd openseadragonImport styles once:
import "@deadragdoll/osd/style.css";Minimal usage
import {
OsdAnnotationsProvider,
OsdAnnotationOverlay,
useOpenSeadragonViewer
} from "@deadragdoll/osd";
function Viewer() {
const { attachViewerElement, viewerInstance } = useOpenSeadragonViewer({
dziUrl: "/tiles/example.dzi",
showViewer: true
});
return (
<div style={{ position: "relative" }}>
<div ref={attachViewerElement} style={{ width: 800, height: 600 }} />
<OsdAnnotationOverlay viewer={viewerInstance} visible />
</div>
);
}
export function AnnotatedViewer() {
return (
<OsdAnnotationsProvider>
<Viewer />
</OsdAnnotationsProvider>
);
}Main exports
UI:
OsdAnnotationOverlayOsdAnnotationToolbarOsdAnnotationSelectorOsdAnnotationInspectorOsdMarkerStyleFieldsOsdZoomNavigatorOsdZoomNavigatorHost
Hooks and provider:
OsdAnnotationsProvideruseOpenSeadragonVieweruseOsdZoomBookmarksuseOsdAnnotationsuseOsdAnnotationObjectsuseOsdAnnotationMarkersuseOsdAnnotationEntitiesuseOsdAnnotationSelectionuseOsdAnnotationDraftuseOsdAnnotationModeuseOsdAnnotationToolsuseOsdAnnotationFocusZoomuseOsdAnnotationNavigationuseOsdAnnotationHighlightuseOsdAnnotationVisibility
Utilities:
OSD_ARROW_SKINSgetOsdArrowSkingetViewerZoomStatenormalizeZoomBookmarks
