@deepnoid/canvas 0.1.70 → 0.1.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,7 +14,6 @@ export type AnnotationCanvasProps = {
14
14
  zoom?: AnnotationCanvasOptionsZoom;
15
15
  ZoomButton?: ComponentType<ZoomButtonType>;
16
16
  resetOnImageChange?: boolean;
17
- timeout?: number;
18
17
  };
19
18
  drawing: AnnotationCanvasDrawing;
20
19
  events: {
@@ -14,6 +14,7 @@ const AnnotationCanvas = ({ image, annotations = [], setAnnotations, options, dr
14
14
  const pendingAnnotationsRef = useRef(null);
15
15
  const imageLoadingRef = useRef(false);
16
16
  const currentImageRef = useRef(image);
17
+ const engineIdRef = useRef(0);
17
18
  const [, forceRender] = useState(0);
18
19
  /* ---------- Resize ---------- */
19
20
  useResizeObserver({
@@ -36,7 +37,6 @@ const AnnotationCanvas = ({ image, annotations = [], setAnnotations, options, dr
36
37
  enabled: enableHotkeys,
37
38
  });
38
39
  /* ---------- Image / Engine lifecycle ---------- */
39
- const engineIdRef = useRef(0);
40
40
  useEffect(() => {
41
41
  const isImageChanged = currentImageRef.current !== image;
42
42
  const prevImageCanvasState = engineRef.current?.getImageCanvasState();
@@ -58,9 +58,8 @@ const AnnotationCanvas = ({ image, annotations = [], setAnnotations, options, dr
58
58
  let cancelled = false;
59
59
  const img = new Image();
60
60
  img.onload = () => {
61
- if (cancelled || !imageCanvasRef.current || !annotationsCanvasRef.current) {
61
+ if (cancelled || !imageCanvasRef.current || !annotationsCanvasRef.current)
62
62
  return;
63
- }
64
63
  const imageCanvasState = !resetOnImageChange && prevImageCanvasState
65
64
  ? prevImageCanvasState
66
65
  : {
@@ -76,8 +75,8 @@ const AnnotationCanvas = ({ image, annotations = [], setAnnotations, options, dr
76
75
  initZoom: 1,
77
76
  };
78
77
  const initialAnnotations = pendingAnnotationsRef.current ?? [];
79
- pendingAnnotationsRef.current = null;
80
78
  const currentEngineId = engineIdRef.current;
79
+ pendingAnnotationsRef.current = null;
81
80
  engineRef.current = new AnnotationEngine({
82
81
  imageCanvas: imageCanvasRef.current,
83
82
  image: img,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepnoid/canvas",
3
- "version": "0.1.70",
3
+ "version": "0.1.71",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.cjs",