@koraidv/react 1.7.4 → 1.7.5

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.js CHANGED
@@ -1889,9 +1889,13 @@ function DocumentCaptureScreen({
1889
1889
  cropW = Math.max(1, Math.min(Math.round(sw), video.videoWidth - cropX));
1890
1890
  cropH = Math.max(1, Math.min(Math.round(sh), video.videoHeight - cropY));
1891
1891
  }
1892
- canvas.width = cropW;
1893
- canvas.height = cropH;
1894
- ctx.drawImage(video, cropX, cropY, cropW, cropH, 0, 0, cropW, cropH);
1892
+ const TARGET_MIN_WIDTH = 1600;
1893
+ const upscale = cropW < TARGET_MIN_WIDTH ? TARGET_MIN_WIDTH / cropW : 1;
1894
+ const outW = Math.round(cropW * upscale);
1895
+ const outH = Math.round(cropH * upscale);
1896
+ canvas.width = outW;
1897
+ canvas.height = outH;
1898
+ ctx.drawImage(video, cropX, cropY, cropW, cropH, 0, 0, outW, outH);
1895
1899
  const dataUrl = canvas.toDataURL("image/jpeg", 0.85);
1896
1900
  canvas.toBlob(
1897
1901
  (blob) => {
package/dist/index.mjs CHANGED
@@ -1840,9 +1840,13 @@ function DocumentCaptureScreen({
1840
1840
  cropW = Math.max(1, Math.min(Math.round(sw), video.videoWidth - cropX));
1841
1841
  cropH = Math.max(1, Math.min(Math.round(sh), video.videoHeight - cropY));
1842
1842
  }
1843
- canvas.width = cropW;
1844
- canvas.height = cropH;
1845
- ctx.drawImage(video, cropX, cropY, cropW, cropH, 0, 0, cropW, cropH);
1843
+ const TARGET_MIN_WIDTH = 1600;
1844
+ const upscale = cropW < TARGET_MIN_WIDTH ? TARGET_MIN_WIDTH / cropW : 1;
1845
+ const outW = Math.round(cropW * upscale);
1846
+ const outH = Math.round(cropH * upscale);
1847
+ canvas.width = outW;
1848
+ canvas.height = outH;
1849
+ ctx.drawImage(video, cropX, cropY, cropW, cropH, 0, 0, outW, outH);
1846
1850
  const dataUrl = canvas.toDataURL("image/jpeg", 0.85);
1847
1851
  canvas.toBlob(
1848
1852
  (blob) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koraidv/react",
3
- "version": "1.7.4",
3
+ "version": "1.7.5",
4
4
  "description": "Kora IDV React Components for Identity Verification",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -21,7 +21,7 @@
21
21
  "test": "vitest run"
22
22
  },
23
23
  "dependencies": {
24
- "@koraidv/core": "^1.7.4"
24
+ "@koraidv/core": "^1.7.5"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/react": "^18.2.0",