@deepnoid/canvas 0.1.7 → 0.1.9
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.
|
@@ -149,6 +149,16 @@ const XrayViewer = ({ image, hasZoom, coordinates, onImageLoadError, onImageLoad
|
|
|
149
149
|
catch (error) {
|
|
150
150
|
const errorMessage = error instanceof Error ? error.message : 'Image load failed';
|
|
151
151
|
setImageError(errorMessage);
|
|
152
|
+
imageRef.current = new Image();
|
|
153
|
+
if (viewer.current) {
|
|
154
|
+
const canvas = viewer.current;
|
|
155
|
+
const ctx = canvas.getContext('2d');
|
|
156
|
+
if (ctx) {
|
|
157
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
setZoom(0);
|
|
161
|
+
setInitZoom(0);
|
|
152
162
|
onImageLoadError?.(new Error(errorMessage));
|
|
153
163
|
console.error('Image load failed:', error);
|
|
154
164
|
}
|