UNPKG

@recogito/annotorious

Version:

A JavaScript image annotation library

27 lines (26 loc) 1.02 kB
import { jsx as u } from "./annotorious-react.es16.js"; import { createContext as f, useState as d, useContext as r, useEffect as o } from "react"; import { createOSDAnnotator as m } from "./annotorious-react.es20.js"; import { AnnotoriousContext as w } from "./annotorious-react.es2.js"; const i = f({ viewer: null, setViewer: null }), b = (e) => { const { children: x, keepEnabled: v, tool: A, ...a } = e, [n, l] = d(), { anno: t, setAnno: s } = r(w); return o(() => { if (n) { const c = m(n, a); s(c); } }, [n]), o(() => { t && (e.tool ? t.startDrawing(e.tool, e.keepEnabled) : t.stopDrawing()); }, [e.tool, e.keepEnabled]), o(() => { t && (t.style = e.style); }, [e.style]), /* @__PURE__ */ u(i.Provider, { value: { viewer: n, setViewer: l }, children: e.children }); }, h = () => { const { viewer: e } = r(i); return e; }; export { b as OpenSeadragonAnnotator, i as OpenSeadragonAnnotatorContext, h as useViewer }; //# sourceMappingURL=annotorious-react.es13.js.map