@deepnoid/canvas 0.1.9 → 0.1.11

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.
@@ -150,15 +150,25 @@ const XrayViewer = ({ image, hasZoom, coordinates, onImageLoadError, onImageLoad
150
150
  const errorMessage = error instanceof Error ? error.message : 'Image load failed';
151
151
  setImageError(errorMessage);
152
152
  imageRef.current = new Image();
153
+ prevImageInfo.current = undefined;
154
+ setZoom(0);
155
+ setInitZoom(0);
156
+ setMoveX(0);
157
+ setMoveY(0);
158
+ setDx(0);
159
+ setDy(0);
160
+ setDw(0);
161
+ setDh(0);
153
162
  if (viewer.current) {
154
163
  const canvas = viewer.current;
155
164
  const ctx = canvas.getContext('2d');
156
165
  if (ctx) {
166
+ canvas.width = canvas.offsetWidth;
167
+ canvas.height = canvas.offsetHeight;
157
168
  ctx.clearRect(0, 0, canvas.width, canvas.height);
158
169
  }
159
170
  }
160
- setZoom(0);
161
- setInitZoom(0);
171
+ setImageOnloadCount((prev) => prev + 1);
162
172
  onImageLoadError?.(new Error(errorMessage));
163
173
  console.error('Image load failed:', error);
164
174
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepnoid/canvas",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.cjs",