|
|
@@ -131,8 +131,11 @@ export function AnnotationCanvas({
|
|
|
useEffect(() => {
|
|
|
const canvas = canvasRef.current;
|
|
|
if (!canvas) return;
|
|
|
- canvas.width = width;
|
|
|
- canvas.height = height;
|
|
|
+ // Read real size from bounding rect — not the stale width/height props
|
|
|
+ const { width: w, height: h } = canvas.getBoundingClientRect();
|
|
|
+ if (w === 0 || h === 0) return;
|
|
|
+ canvas.width = w;
|
|
|
+ canvas.height = h;
|
|
|
redraw();
|
|
|
}, [width, height, pendingStrokes]);
|
|
|
|