@deepnoid/canvas 0.1.76 → 0.1.78
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.
|
@@ -43,7 +43,7 @@ const AnnotationCanvas = ({ image, annotations = [], setAnnotations, options, dr
|
|
|
43
43
|
imageLoadingRef.current = true;
|
|
44
44
|
const newEngineId = ++engineIdRef.current;
|
|
45
45
|
const prevEngine = engineRef.current;
|
|
46
|
-
pendingAnnotationsRef.current =
|
|
46
|
+
pendingAnnotationsRef.current = null;
|
|
47
47
|
if (!image?.trim()) {
|
|
48
48
|
if (prevEngine) {
|
|
49
49
|
safeRemove(container, prevEngine.getImageCanvas());
|
|
@@ -87,7 +87,7 @@ const AnnotationCanvas = ({ image, annotations = [], setAnnotations, options, dr
|
|
|
87
87
|
annotationsCanvas,
|
|
88
88
|
image: img,
|
|
89
89
|
imageCanvasState,
|
|
90
|
-
annotations:
|
|
90
|
+
annotations: [],
|
|
91
91
|
setAnnotations: (next) => {
|
|
92
92
|
if (engineIdRef.current === newEngineId && setAnnotations) {
|
|
93
93
|
setAnnotations(next);
|
|
@@ -115,8 +115,13 @@ const AnnotationCanvas = ({ image, annotations = [], setAnnotations, options, dr
|
|
|
115
115
|
prevEngine.destroy();
|
|
116
116
|
}
|
|
117
117
|
engineRef.current = engine;
|
|
118
|
-
pendingAnnotationsRef.current = null;
|
|
119
118
|
imageLoadingRef.current = false;
|
|
119
|
+
if (pendingAnnotationsRef.current && pendingAnnotationsRef.current.length > 0) {
|
|
120
|
+
console.log('Applying pending annotations after image load:', pendingAnnotationsRef.current.length);
|
|
121
|
+
engine.setAnnotations(pendingAnnotationsRef.current);
|
|
122
|
+
engine.commitHistory();
|
|
123
|
+
}
|
|
124
|
+
pendingAnnotationsRef.current = null;
|
|
120
125
|
onImageLoadSuccess?.();
|
|
121
126
|
});
|
|
122
127
|
};
|