idmission-web-sdk 1.0.127 → 1.0.128

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.
@@ -47,7 +47,7 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
47
47
  var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
48
48
  var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
49
49
 
50
- var webSdkVersion = '1.0.127';
50
+ var webSdkVersion = '1.0.128';
51
51
 
52
52
  function getPlatform() {
53
53
  if (typeof window === 'undefined') return;
@@ -10578,32 +10578,16 @@ var CapturedImage = function CapturedImage(_a) {
10578
10578
  cropped = _c[0],
10579
10579
  setCropped = _c[1];
10580
10580
  var bbox = image.boundingBox;
10581
- function onLoaded(e) {
10581
+ var imgRef = React.useRef(null);
10582
+ function onLoaded() {
10582
10583
  if (!bbox || cropped) return;
10583
10584
  setCropped(true);
10584
- var canvas = document.createElement('canvas');
10585
- // const ctx = canvas.getContext('2d')
10586
- // if (!ctx) throw new Error('could not get 2d context')
10587
- //
10588
- // const [frameWidth, frameHeight] = getFrameDimensions(e.currentTarget)
10589
- // const [xMin, yMin, width, height] = bbox
10590
- // canvas.width = width * frameWidth
10591
- // canvas.height = height * frameHeight
10592
- // ctx.drawImage(
10593
- // e.currentTarget,
10594
- // xMin * frameWidth,
10595
- // yMin * frameHeight,
10596
- // width * frameWidth,
10597
- // height * frameHeight,
10598
- // 0,
10599
- // 0,
10600
- // width * frameWidth,
10601
- // height * frameHeight,
10602
- // )
10603
- drawToCanvas(canvas, e.currentTarget);
10604
- setUrl(canvas.toDataURL('image/jpeg', 0.95));
10585
+ setTimeout(function () {
10586
+ setUrl(cropToBoundingBox(imgRef.current, bbox).toDataURL('image/jpeg', 0.95));
10587
+ }, 100);
10605
10588
  }
10606
10589
  return /*#__PURE__*/React__default['default'].createElement(StyledImage, {
10590
+ ref: imgRef,
10607
10591
  alt: alt,
10608
10592
  className: className,
10609
10593
  src: url,