@acorex/components 21.0.3-next.15 → 21.0.3-next.17
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/fesm2022/acorex-components-conversation2.mjs +102 -53
- package/fesm2022/acorex-components-conversation2.mjs.map +1 -1
- package/fesm2022/acorex-components-image-editor.mjs +12 -7
- package/fesm2022/acorex-components-image-editor.mjs.map +1 -1
- package/package.json +3 -3
- package/types/acorex-components-conversation2.d.ts +24 -11
|
@@ -535,12 +535,17 @@ class AXImageEditorViewComponent extends MXBaseComponent {
|
|
|
535
535
|
return;
|
|
536
536
|
}
|
|
537
537
|
const cropRect = cropper.getCropperArea();
|
|
538
|
-
const
|
|
539
|
-
const
|
|
540
|
-
const
|
|
541
|
-
const
|
|
542
|
-
|
|
543
|
-
|
|
538
|
+
const canvas = this.canvasElem().nativeElement;
|
|
539
|
+
const canvasRect = canvas.getBoundingClientRect();
|
|
540
|
+
const scaleX = canvas.width / canvasRect.width;
|
|
541
|
+
const scaleY = canvas.height / canvasRect.height;
|
|
542
|
+
const dx = (cropRect.x - canvasRect.x) * scaleX;
|
|
543
|
+
const dy = (cropRect.y - canvasRect.y) * scaleY;
|
|
544
|
+
const cropWidth = cropRect.width * scaleX;
|
|
545
|
+
const cropHeight = cropRect.height * scaleY;
|
|
546
|
+
const imageData = this.ctx().getImageData(Math.round(dx), Math.round(dy), Math.round(cropWidth), Math.round(cropHeight));
|
|
547
|
+
canvas.width = Math.round(cropWidth);
|
|
548
|
+
canvas.height = Math.round(cropHeight);
|
|
544
549
|
this.ctx().putImageData(imageData, 0, 0);
|
|
545
550
|
const cropImage = this.canvasElem().nativeElement.toDataURL('image/jpeg', 1);
|
|
546
551
|
await this.saveImageChange();
|
|
@@ -634,7 +639,7 @@ class AXImageEditorContainerComponent extends classes((MXInputBaseValueComponent
|
|
|
634
639
|
await this.view()?.crop();
|
|
635
640
|
const blobs = this.service.imageBlob();
|
|
636
641
|
if (blobs.length && this.value === oldValue) {
|
|
637
|
-
this.
|
|
642
|
+
this.commitValue(blobs, true);
|
|
638
643
|
}
|
|
639
644
|
}
|
|
640
645
|
get __hostClass() {
|