@syncfusion/ej2-image-editor 29.1.38 → 29.2.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/ej2-image-editor.umd.min.js +2 -2
- package/dist/ej2-image-editor.umd.min.js.map +1 -1
- package/dist/es6/ej2-image-editor.es2015.js +69 -9
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +69 -9
- package/dist/es6/ej2-image-editor.es5.js.map +1 -1
- package/dist/global/ej2-image-editor.min.js +2 -2
- package/dist/global/ej2-image-editor.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +12 -12
- package/src/image-editor/action/draw.js +1 -0
- package/src/image-editor/action/transform.js +1 -0
- package/src/image-editor/base/image-editor-model.d.ts +25 -0
- package/src/image-editor/base/image-editor.d.ts +24 -0
- package/src/image-editor/base/image-editor.js +14 -0
- package/src/image-editor/renderer/toolbar.d.ts +1 -0
- package/src/image-editor/renderer/toolbar.js +53 -9
- package/styles/bds-lite.css +2 -2
- package/styles/bds.css +2 -2
- package/styles/bootstrap-dark-lite.css +2 -2
- package/styles/bootstrap-dark.css +2 -2
- package/styles/bootstrap-lite.css +2 -2
- package/styles/bootstrap.css +2 -2
- package/styles/bootstrap4-lite.css +2 -2
- package/styles/bootstrap4.css +2 -2
- package/styles/bootstrap5-dark-lite.css +2 -2
- package/styles/bootstrap5-dark.css +2 -2
- package/styles/bootstrap5-lite.css +2 -2
- package/styles/bootstrap5.3-lite.css +2 -2
- package/styles/bootstrap5.3.css +2 -2
- package/styles/bootstrap5.css +2 -2
- package/styles/fabric-dark-lite.css +2 -2
- package/styles/fabric-dark.css +2 -2
- package/styles/fabric-lite.css +2 -2
- package/styles/fabric.css +2 -2
- package/styles/fluent-dark-lite.css +2 -2
- package/styles/fluent-dark.css +2 -2
- package/styles/fluent-lite.css +2 -2
- package/styles/fluent.css +2 -2
- package/styles/fluent2-lite.css +2 -2
- package/styles/fluent2.css +2 -2
- package/styles/highcontrast-light-lite.css +2 -2
- package/styles/highcontrast-light.css +2 -2
- package/styles/highcontrast-lite.css +2 -2
- package/styles/highcontrast.css +2 -2
- package/styles/image-editor/_layout.scss +2 -2
- package/styles/image-editor/bds.css +2 -2
- package/styles/image-editor/bootstrap-dark.css +2 -2
- package/styles/image-editor/bootstrap.css +2 -2
- package/styles/image-editor/bootstrap4.css +2 -2
- package/styles/image-editor/bootstrap5-dark.css +2 -2
- package/styles/image-editor/bootstrap5.3.css +2 -2
- package/styles/image-editor/bootstrap5.css +2 -2
- package/styles/image-editor/fabric-dark.css +2 -2
- package/styles/image-editor/fabric.css +2 -2
- package/styles/image-editor/fluent-dark.css +2 -2
- package/styles/image-editor/fluent.css +2 -2
- package/styles/image-editor/fluent2.css +2 -2
- package/styles/image-editor/highcontrast-light.css +2 -2
- package/styles/image-editor/highcontrast.css +2 -2
- package/styles/image-editor/material-dark.css +2 -2
- package/styles/image-editor/material.css +2 -2
- package/styles/image-editor/material3-dark.css +2 -2
- package/styles/image-editor/material3.css +2 -2
- package/styles/image-editor/tailwind-dark.css +2 -2
- package/styles/image-editor/tailwind.css +2 -2
- package/styles/image-editor/tailwind3.css +2 -2
- package/styles/material-dark-lite.css +2 -2
- package/styles/material-dark.css +2 -2
- package/styles/material-lite.css +2 -2
- package/styles/material.css +2 -2
- package/styles/material3-dark-lite.css +2 -2
- package/styles/material3-dark.css +2 -2
- package/styles/material3-lite.css +2 -2
- package/styles/material3.css +2 -2
- package/styles/tailwind-dark-lite.css +2 -2
- package/styles/tailwind-dark.css +2 -2
- package/styles/tailwind-lite.css +2 -2
- package/styles/tailwind.css +2 -2
- package/styles/tailwind3-lite.css +2 -2
- package/styles/tailwind3.css +2 -2
|
@@ -3453,6 +3453,7 @@ class Draw {
|
|
|
3453
3453
|
if (!parent.isUndoRedo) {
|
|
3454
3454
|
parent.notify('filter', { prop: 'update-finetunes', onPropertyChange: false });
|
|
3455
3455
|
}
|
|
3456
|
+
proxy.lowerContext.imageSmoothingQuality = parent.imageSmoothingEnabled ? 'high' : 'low';
|
|
3456
3457
|
proxy.lowerContext.drawImage(parent.baseImg, 0, 0, proxy.parent.lowerCanvas.width, proxy.parent.lowerCanvas.height);
|
|
3457
3458
|
let isCropped = false;
|
|
3458
3459
|
let isSameDimension = false;
|
|
@@ -20123,6 +20124,7 @@ class Transform {
|
|
|
20123
20124
|
parent.lowerCanvas.height = parent.upperCanvas.height = parent.maskCanvas.height =
|
|
20124
20125
|
parseFloat(canvasWrapper.style.height);
|
|
20125
20126
|
this.lowerContext.filter = tempFilter;
|
|
20127
|
+
this.lowerContext.imageSmoothingQuality = parent.imageSmoothingEnabled ? 'high' : 'low';
|
|
20126
20128
|
const obj = { width: 0, height: 0 };
|
|
20127
20129
|
this.calcMaxDimension(parent.img.srcWidth, parent.img.srcHeight, obj);
|
|
20128
20130
|
const maxDimension = obj;
|
|
@@ -22370,6 +22372,17 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
22370
22372
|
}
|
|
22371
22373
|
this.updateDropInfoContent(this.element.querySelector('.e-ie-drop-info'));
|
|
22372
22374
|
break;
|
|
22375
|
+
case 'imageSmoothingEnabled':
|
|
22376
|
+
if (newProperties.imageSmoothingEnabled) {
|
|
22377
|
+
this.imageSmoothingEnabled = true;
|
|
22378
|
+
this.lowerContext.imageSmoothingQuality = 'high';
|
|
22379
|
+
}
|
|
22380
|
+
else {
|
|
22381
|
+
this.imageSmoothingEnabled = false;
|
|
22382
|
+
this.lowerContext.imageSmoothingQuality = 'low';
|
|
22383
|
+
}
|
|
22384
|
+
this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
|
|
22385
|
+
break;
|
|
22373
22386
|
}
|
|
22374
22387
|
}
|
|
22375
22388
|
}
|
|
@@ -26511,6 +26524,9 @@ __decorate([
|
|
|
26511
26524
|
__decorate([
|
|
26512
26525
|
Property()
|
|
26513
26526
|
], ImageEditor.prototype, "quickAccessToolbarTemplate", void 0);
|
|
26527
|
+
__decorate([
|
|
26528
|
+
Property(false)
|
|
26529
|
+
], ImageEditor.prototype, "imageSmoothingEnabled", void 0);
|
|
26514
26530
|
__decorate([
|
|
26515
26531
|
Property(false)
|
|
26516
26532
|
], ImageEditor.prototype, "isReadOnly", void 0);
|
|
@@ -28610,6 +28626,47 @@ class ToolbarModule {
|
|
|
28610
28626
|
]
|
|
28611
28627
|
});
|
|
28612
28628
|
dialog.appendTo('#' + id + '_saveDialog');
|
|
28629
|
+
this.updateSavePreviewImage();
|
|
28630
|
+
}
|
|
28631
|
+
updateSavePreviewImage() {
|
|
28632
|
+
const parent = this.parent;
|
|
28633
|
+
const id = parent.element.id;
|
|
28634
|
+
const elem = parent.element.querySelector('#' + id + '_saveDialog');
|
|
28635
|
+
if (Browser.isDevice || !elem) {
|
|
28636
|
+
return;
|
|
28637
|
+
}
|
|
28638
|
+
const dialogWidth = elem.offsetWidth;
|
|
28639
|
+
const dialogMaxHeight = parseInt(elem.style.maxHeight, 10);
|
|
28640
|
+
const headerHeight = elem.querySelector('.e-dlg-header-content').offsetHeight;
|
|
28641
|
+
const footerHeight = elem.querySelector('.e-footer-content').offsetHeight;
|
|
28642
|
+
const padding = parseInt(window.getComputedStyle(elem.querySelector('#' + id + '_saveDialog_dialog-content')).padding, 10);
|
|
28643
|
+
const imageSizeContent = 20; // Image size text container div height
|
|
28644
|
+
const canvasMaxWidth = dialogWidth * (35 / 100); // 35% of dialog's width
|
|
28645
|
+
const canvasMaxHeight = dialogMaxHeight - headerHeight - footerHeight - imageSizeContent - (padding * 2);
|
|
28646
|
+
const canvas = parent.element.querySelector('#' + id + '_imgPic');
|
|
28647
|
+
const width = canvas.width;
|
|
28648
|
+
const height = canvas.height;
|
|
28649
|
+
const widthScale = canvasMaxWidth / width;
|
|
28650
|
+
const heightScale = canvasMaxHeight / height;
|
|
28651
|
+
let cssMaxWidth = Math.min(width, canvasMaxWidth);
|
|
28652
|
+
let cssMaxHeight = Math.min(height, canvasMaxHeight);
|
|
28653
|
+
if (widthScale < 1 && widthScale < heightScale) {
|
|
28654
|
+
cssMaxWidth = width * widthScale;
|
|
28655
|
+
cssMaxHeight = height * widthScale;
|
|
28656
|
+
}
|
|
28657
|
+
else if (heightScale < 1 && heightScale < widthScale) {
|
|
28658
|
+
cssMaxWidth = width * heightScale;
|
|
28659
|
+
cssMaxHeight = height * heightScale;
|
|
28660
|
+
}
|
|
28661
|
+
const imageObj = { canvas: null };
|
|
28662
|
+
parent.notify('export', { prop: 'exportToCanvas', value: { object: imageObj } });
|
|
28663
|
+
const ctx = canvas.getContext('2d');
|
|
28664
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
28665
|
+
canvas.width = cssMaxWidth;
|
|
28666
|
+
canvas.height = cssMaxHeight;
|
|
28667
|
+
const tempCanvas = imageObj['canvas'];
|
|
28668
|
+
ctx.imageSmoothingQuality = 'medium';
|
|
28669
|
+
ctx.drawImage(tempCanvas, 0, 0, tempCanvas.width, tempCanvas.height, 0, 0, cssMaxWidth, cssMaxHeight);
|
|
28613
28670
|
}
|
|
28614
28671
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
28615
28672
|
saveDialogClosed(id) {
|
|
@@ -28709,6 +28766,7 @@ class ToolbarModule {
|
|
|
28709
28766
|
this.updateImageSize(isNullOrUndefined(this.currentQuality) ? 1 : this.currentQuality, obj['canvas'], this.fileType);
|
|
28710
28767
|
document.getElementById(id + '_' + this.imageQuality).checked = true;
|
|
28711
28768
|
}
|
|
28769
|
+
this.updateSavePreviewImage();
|
|
28712
28770
|
}
|
|
28713
28771
|
});
|
|
28714
28772
|
drpDownBtn.appendTo('#' + id + '_saveDropdownbtn');
|
|
@@ -28763,12 +28821,14 @@ class ToolbarModule {
|
|
|
28763
28821
|
created: () => {
|
|
28764
28822
|
this.updateImageSize(this.currentQuality, obj['canvas'], 'jpeg');
|
|
28765
28823
|
qualitySliderValueSpan.innerHTML = (Math.round(this.currentQuality * 100)).toString();
|
|
28824
|
+
this.updateSavePreviewImage();
|
|
28766
28825
|
},
|
|
28767
28826
|
changed: (args) => {
|
|
28768
28827
|
this.currentQuality = args.value;
|
|
28769
28828
|
qualitySliderValueSpan.innerHTML = (Math.round(this.currentQuality * 100)).toString();
|
|
28770
28829
|
parent.notify('export', { prop: 'setImageQuality', value: { value: args.value } });
|
|
28771
28830
|
this.updateImageSize(args.value, obj['canvas'], 'jpeg');
|
|
28831
|
+
this.updateSavePreviewImage();
|
|
28772
28832
|
}
|
|
28773
28833
|
});
|
|
28774
28834
|
sliderObj.appendTo('#' + id + '_qualitySlider');
|
|
@@ -28789,6 +28849,7 @@ class ToolbarModule {
|
|
|
28789
28849
|
this.currentQuality = compressionValues[target.textContent];
|
|
28790
28850
|
this.imageQuality = target.textContent.toLowerCase();
|
|
28791
28851
|
this.updateImageSize(compressionValues[target.textContent], obj['canvas'], 'jpeg');
|
|
28852
|
+
this.updateSavePreviewImage();
|
|
28792
28853
|
}
|
|
28793
28854
|
}
|
|
28794
28855
|
updateImageSize(quality, tempCanvas, fileType) {
|
|
@@ -28805,7 +28866,11 @@ class ToolbarModule {
|
|
|
28805
28866
|
else {
|
|
28806
28867
|
imageNameLabel = document.getElementById(id + '_imageNameLabel');
|
|
28807
28868
|
}
|
|
28869
|
+
const imageSmoothingEnabled = parent.imageSmoothingEnabled;
|
|
28870
|
+
ctx.canvas.getContext('2d').imageSmoothingQuality = imageSmoothingEnabled ? 'high' : 'low';
|
|
28808
28871
|
if (fileType.toLowerCase() === 'jpeg') {
|
|
28872
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
28873
|
+
ctx.drawImage(tempCanvas, 0, 0);
|
|
28809
28874
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
28810
28875
|
tempCanvas.toBlob((function (blob) {
|
|
28811
28876
|
fileSize = Math.floor(blob.size / 1024);
|
|
@@ -28821,20 +28886,12 @@ class ToolbarModule {
|
|
|
28821
28886
|
if (Browser.isDevice) {
|
|
28822
28887
|
canvas.style.display = 'none';
|
|
28823
28888
|
}
|
|
28824
|
-
else {
|
|
28825
|
-
const compressedImage = new Image();
|
|
28826
|
-
compressedImage.src = URL.createObjectURL(blob);
|
|
28827
|
-
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
28828
|
-
compressedImage.onload = function () {
|
|
28829
|
-
ctx.drawImage(compressedImage, 0, 0);
|
|
28830
|
-
URL.revokeObjectURL(compressedImage.src);
|
|
28831
|
-
};
|
|
28832
|
-
}
|
|
28833
28889
|
this.fileSize = fileSize;
|
|
28834
28890
|
}).bind(this), 'image/jpeg', quality);
|
|
28835
28891
|
}
|
|
28836
28892
|
else if (!isNullOrUndefined(fileType) && (fileType.toLowerCase() === 'png' || fileType.toLowerCase() === 'webp')) {
|
|
28837
28893
|
const type = 'image/' + fileType.toLowerCase();
|
|
28894
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
28838
28895
|
ctx.drawImage(tempCanvas, 0, 0);
|
|
28839
28896
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
28840
28897
|
tempCanvas.toBlob((function (blob) {
|
|
@@ -28855,6 +28912,7 @@ class ToolbarModule {
|
|
|
28855
28912
|
}).bind(this), type, 1);
|
|
28856
28913
|
}
|
|
28857
28914
|
else if (!isNullOrUndefined(fileType) && fileType.toLowerCase() === 'svg') {
|
|
28915
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
28858
28916
|
ctx.drawImage(tempCanvas, 0, 0);
|
|
28859
28917
|
const svgDataUrl = tempCanvas.toDataURL('image/svg+xml');
|
|
28860
28918
|
const base64Data = svgDataUrl.split(',')[1];
|
|
@@ -28880,6 +28938,7 @@ class ToolbarModule {
|
|
|
28880
28938
|
canvas.style.display = 'none';
|
|
28881
28939
|
}
|
|
28882
28940
|
else {
|
|
28941
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
28883
28942
|
ctx.drawImage(tempCanvas, 0, 0);
|
|
28884
28943
|
if (this.initialSize > 1000) {
|
|
28885
28944
|
const megabytes = this.initialSize / 1048576;
|
|
@@ -31525,6 +31584,7 @@ class ToolbarModule {
|
|
|
31525
31584
|
if (filter) {
|
|
31526
31585
|
let ctx = filter.getContext('2d');
|
|
31527
31586
|
ctx = filter.getContext('2d');
|
|
31587
|
+
ctx.imageSmoothingQuality = parent.imageSmoothingEnabled ? 'high' : 'low';
|
|
31528
31588
|
filter.style.width = '100px';
|
|
31529
31589
|
filter.style.height = '100px';
|
|
31530
31590
|
parent.notify('filter', { prop: 'updateAdj', value: { type: type, value: null, isPreview: true, ctx: ctx } });
|