@tbib-image-viewer/react 0.1.1 → 0.1.2

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.
package/dist/index.mjs CHANGED
@@ -1221,16 +1221,18 @@ var ImageViewer = ({
1221
1221
  return () => window.removeEventListener("keydown", handleKeyDown);
1222
1222
  }, [handleUndo, handleRedo, zoomIn, zoomOut, resetTransform]);
1223
1223
  const handleDownloadAnnotated = async () => {
1224
- if (!imgRef.current) return;
1225
- await downloadAnnotatedImage(imgRef.current, strokes, {
1224
+ const targetSource = effectiveSrc || imgRef.current?.src || "";
1225
+ if (!targetSource) return;
1226
+ await downloadAnnotatedImage(targetSource, strokes, {
1226
1227
  format: "image/png",
1227
1228
  includeAnnotations: true,
1228
1229
  fileName: `tbib-annotated-${Date.now()}.png`
1229
1230
  });
1230
1231
  };
1231
1232
  const handleDownloadClean = async () => {
1232
- if (!imgRef.current) return;
1233
- await downloadAnnotatedImage(imgRef.current, [], {
1233
+ const targetSource = effectiveSrc || imgRef.current?.src || "";
1234
+ if (!targetSource) return;
1235
+ await downloadAnnotatedImage(targetSource, [], {
1234
1236
  format: "image/png",
1235
1237
  includeAnnotations: false,
1236
1238
  fileName: `tbib-clean-${Date.now()}.png`
@@ -1655,16 +1657,18 @@ var ImageGalleryLightbox = ({
1655
1657
  }
1656
1658
  };
1657
1659
  const handleDownloadAnnotated = async () => {
1658
- if (!imgRef.current) return;
1659
- await downloadAnnotatedImage2(imgRef.current, strokes, {
1660
+ const targetSource = effectiveSrc || currentItem?.src || imgRef.current?.src || "";
1661
+ if (!targetSource) return;
1662
+ await downloadAnnotatedImage2(targetSource, strokes, {
1660
1663
  format: "image/png",
1661
1664
  includeAnnotations: true,
1662
1665
  fileName: `tbib-gallery-${currentIndex + 1}-annotated.png`
1663
1666
  });
1664
1667
  };
1665
1668
  const handleDownloadClean = async () => {
1666
- if (!imgRef.current) return;
1667
- await downloadAnnotatedImage2(imgRef.current, [], {
1669
+ const targetSource = effectiveSrc || currentItem?.src || imgRef.current?.src || "";
1670
+ if (!targetSource) return;
1671
+ await downloadAnnotatedImage2(targetSource, [], {
1668
1672
  format: "image/png",
1669
1673
  includeAnnotations: false,
1670
1674
  fileName: `tbib-gallery-${currentIndex + 1}-clean.png`