@syncfusion/ej2-image-editor 29.1.37 → 29.2.4
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 +80 -17
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +80 -17
- 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/selection.js +12 -8
- 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
|
@@ -3483,6 +3483,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
3483
3483
|
if (!parent.isUndoRedo) {
|
|
3484
3484
|
parent.notify('filter', { prop: 'update-finetunes', onPropertyChange: false });
|
|
3485
3485
|
}
|
|
3486
|
+
proxy.lowerContext.imageSmoothingQuality = parent.imageSmoothingEnabled ? 'high' : 'low';
|
|
3486
3487
|
proxy.lowerContext.drawImage(parent.baseImg, 0, 0, proxy.parent.lowerCanvas.width, proxy.parent.lowerCanvas.height);
|
|
3487
3488
|
var isCropped = false;
|
|
3488
3489
|
var isSameDimension = false;
|
|
@@ -10486,18 +10487,22 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
10486
10487
|
var endY = isStart ? actPoint.endY : actPoint.startY;
|
|
10487
10488
|
var wrapperWidth = parent.upperCanvas.width;
|
|
10488
10489
|
var wrapperHeight = parent.upperCanvas.height;
|
|
10490
|
+
var minX = destLeft < 0 ? 0 : destLeft;
|
|
10491
|
+
var minY = destTop < 0 ? 0 : destTop;
|
|
10492
|
+
var maxX = destLeft + destWidth > wrapperWidth ? wrapperWidth : destLeft + destWidth;
|
|
10493
|
+
var maxY = destTop + destHeight > wrapperHeight ? wrapperHeight : destTop + destHeight;
|
|
10489
10494
|
if (Browser.isDevice) {
|
|
10490
|
-
if (startX <
|
|
10491
|
-
startX =
|
|
10495
|
+
if (startX < minX) {
|
|
10496
|
+
startX = minX;
|
|
10492
10497
|
}
|
|
10493
|
-
if (startY <
|
|
10494
|
-
startY =
|
|
10498
|
+
if (startY < minY) {
|
|
10499
|
+
startY = minY;
|
|
10495
10500
|
}
|
|
10496
|
-
if (endX >
|
|
10497
|
-
endX =
|
|
10501
|
+
if (endX > maxX) {
|
|
10502
|
+
endX = maxX;
|
|
10498
10503
|
}
|
|
10499
|
-
if (endY >
|
|
10500
|
-
endY =
|
|
10504
|
+
if (endY > maxY) {
|
|
10505
|
+
endY = maxY;
|
|
10501
10506
|
}
|
|
10502
10507
|
}
|
|
10503
10508
|
else {
|
|
@@ -22477,6 +22482,17 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22477
22482
|
}
|
|
22478
22483
|
this.updateDropInfoContent(this.element.querySelector('.e-ie-drop-info'));
|
|
22479
22484
|
break;
|
|
22485
|
+
case 'imageSmoothingEnabled':
|
|
22486
|
+
if (newProperties.imageSmoothingEnabled) {
|
|
22487
|
+
this.imageSmoothingEnabled = true;
|
|
22488
|
+
this.lowerContext.imageSmoothingQuality = 'high';
|
|
22489
|
+
}
|
|
22490
|
+
else {
|
|
22491
|
+
this.imageSmoothingEnabled = false;
|
|
22492
|
+
this.lowerContext.imageSmoothingQuality = 'low';
|
|
22493
|
+
}
|
|
22494
|
+
this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
|
|
22495
|
+
break;
|
|
22480
22496
|
}
|
|
22481
22497
|
}
|
|
22482
22498
|
};
|
|
@@ -26622,6 +26638,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
26622
26638
|
__decorate([
|
|
26623
26639
|
Property()
|
|
26624
26640
|
], ImageEditor.prototype, "quickAccessToolbarTemplate", void 0);
|
|
26641
|
+
__decorate([
|
|
26642
|
+
Property(false)
|
|
26643
|
+
], ImageEditor.prototype, "imageSmoothingEnabled", void 0);
|
|
26625
26644
|
__decorate([
|
|
26626
26645
|
Property(false)
|
|
26627
26646
|
], ImageEditor.prototype, "isReadOnly", void 0);
|
|
@@ -28731,6 +28750,47 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
28731
28750
|
]
|
|
28732
28751
|
});
|
|
28733
28752
|
dialog.appendTo('#' + id + '_saveDialog');
|
|
28753
|
+
this.updateSavePreviewImage();
|
|
28754
|
+
};
|
|
28755
|
+
ToolbarModule.prototype.updateSavePreviewImage = function () {
|
|
28756
|
+
var parent = this.parent;
|
|
28757
|
+
var id = parent.element.id;
|
|
28758
|
+
var elem = parent.element.querySelector('#' + id + '_saveDialog');
|
|
28759
|
+
if (Browser.isDevice || !elem) {
|
|
28760
|
+
return;
|
|
28761
|
+
}
|
|
28762
|
+
var dialogWidth = elem.offsetWidth;
|
|
28763
|
+
var dialogMaxHeight = parseInt(elem.style.maxHeight, 10);
|
|
28764
|
+
var headerHeight = elem.querySelector('.e-dlg-header-content').offsetHeight;
|
|
28765
|
+
var footerHeight = elem.querySelector('.e-footer-content').offsetHeight;
|
|
28766
|
+
var padding = parseInt(window.getComputedStyle(elem.querySelector('#' + id + '_saveDialog_dialog-content')).padding, 10);
|
|
28767
|
+
var imageSizeContent = 20; // Image size text container div height
|
|
28768
|
+
var canvasMaxWidth = dialogWidth * (35 / 100); // 35% of dialog's width
|
|
28769
|
+
var canvasMaxHeight = dialogMaxHeight - headerHeight - footerHeight - imageSizeContent - (padding * 2);
|
|
28770
|
+
var canvas = parent.element.querySelector('#' + id + '_imgPic');
|
|
28771
|
+
var width = canvas.width;
|
|
28772
|
+
var height = canvas.height;
|
|
28773
|
+
var widthScale = canvasMaxWidth / width;
|
|
28774
|
+
var heightScale = canvasMaxHeight / height;
|
|
28775
|
+
var cssMaxWidth = Math.min(width, canvasMaxWidth);
|
|
28776
|
+
var cssMaxHeight = Math.min(height, canvasMaxHeight);
|
|
28777
|
+
if (widthScale < 1 && widthScale < heightScale) {
|
|
28778
|
+
cssMaxWidth = width * widthScale;
|
|
28779
|
+
cssMaxHeight = height * widthScale;
|
|
28780
|
+
}
|
|
28781
|
+
else if (heightScale < 1 && heightScale < widthScale) {
|
|
28782
|
+
cssMaxWidth = width * heightScale;
|
|
28783
|
+
cssMaxHeight = height * heightScale;
|
|
28784
|
+
}
|
|
28785
|
+
var imageObj = { canvas: null };
|
|
28786
|
+
parent.notify('export', { prop: 'exportToCanvas', value: { object: imageObj } });
|
|
28787
|
+
var ctx = canvas.getContext('2d');
|
|
28788
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
28789
|
+
canvas.width = cssMaxWidth;
|
|
28790
|
+
canvas.height = cssMaxHeight;
|
|
28791
|
+
var tempCanvas = imageObj['canvas'];
|
|
28792
|
+
ctx.imageSmoothingQuality = 'medium';
|
|
28793
|
+
ctx.drawImage(tempCanvas, 0, 0, tempCanvas.width, tempCanvas.height, 0, 0, cssMaxWidth, cssMaxHeight);
|
|
28734
28794
|
};
|
|
28735
28795
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
28736
28796
|
ToolbarModule.prototype.saveDialogClosed = function (id) {
|
|
@@ -28831,6 +28891,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
28831
28891
|
_this.updateImageSize(isNullOrUndefined(_this.currentQuality) ? 1 : _this.currentQuality, obj['canvas'], _this.fileType);
|
|
28832
28892
|
document.getElementById(id + '_' + _this.imageQuality).checked = true;
|
|
28833
28893
|
}
|
|
28894
|
+
_this.updateSavePreviewImage();
|
|
28834
28895
|
}
|
|
28835
28896
|
});
|
|
28836
28897
|
drpDownBtn_1.appendTo('#' + id + '_saveDropdownbtn');
|
|
@@ -28886,12 +28947,14 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
28886
28947
|
created: function () {
|
|
28887
28948
|
_this.updateImageSize(_this.currentQuality, obj['canvas'], 'jpeg');
|
|
28888
28949
|
qualitySliderValueSpan.innerHTML = (Math.round(_this.currentQuality * 100)).toString();
|
|
28950
|
+
_this.updateSavePreviewImage();
|
|
28889
28951
|
},
|
|
28890
28952
|
changed: function (args) {
|
|
28891
28953
|
_this.currentQuality = args.value;
|
|
28892
28954
|
qualitySliderValueSpan.innerHTML = (Math.round(_this.currentQuality * 100)).toString();
|
|
28893
28955
|
parent.notify('export', { prop: 'setImageQuality', value: { value: args.value } });
|
|
28894
28956
|
_this.updateImageSize(args.value, obj['canvas'], 'jpeg');
|
|
28957
|
+
_this.updateSavePreviewImage();
|
|
28895
28958
|
}
|
|
28896
28959
|
});
|
|
28897
28960
|
sliderObj.appendTo('#' + id + '_qualitySlider');
|
|
@@ -28912,6 +28975,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
28912
28975
|
this.currentQuality = compressionValues[target.textContent];
|
|
28913
28976
|
this.imageQuality = target.textContent.toLowerCase();
|
|
28914
28977
|
this.updateImageSize(compressionValues[target.textContent], obj['canvas'], 'jpeg');
|
|
28978
|
+
this.updateSavePreviewImage();
|
|
28915
28979
|
}
|
|
28916
28980
|
};
|
|
28917
28981
|
ToolbarModule.prototype.updateImageSize = function (quality, tempCanvas, fileType) {
|
|
@@ -28928,7 +28992,11 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
28928
28992
|
else {
|
|
28929
28993
|
imageNameLabel = document.getElementById(id + '_imageNameLabel');
|
|
28930
28994
|
}
|
|
28995
|
+
var imageSmoothingEnabled = parent.imageSmoothingEnabled;
|
|
28996
|
+
ctx.canvas.getContext('2d').imageSmoothingQuality = imageSmoothingEnabled ? 'high' : 'low';
|
|
28931
28997
|
if (fileType.toLowerCase() === 'jpeg') {
|
|
28998
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
28999
|
+
ctx.drawImage(tempCanvas, 0, 0);
|
|
28932
29000
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
28933
29001
|
tempCanvas.toBlob((function (blob) {
|
|
28934
29002
|
fileSize = Math.floor(blob.size / 1024);
|
|
@@ -28944,20 +29012,12 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
28944
29012
|
if (Browser.isDevice) {
|
|
28945
29013
|
canvas.style.display = 'none';
|
|
28946
29014
|
}
|
|
28947
|
-
else {
|
|
28948
|
-
var compressedImage_1 = new Image();
|
|
28949
|
-
compressedImage_1.src = URL.createObjectURL(blob);
|
|
28950
|
-
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
28951
|
-
compressedImage_1.onload = function () {
|
|
28952
|
-
ctx.drawImage(compressedImage_1, 0, 0);
|
|
28953
|
-
URL.revokeObjectURL(compressedImage_1.src);
|
|
28954
|
-
};
|
|
28955
|
-
}
|
|
28956
29015
|
this.fileSize = fileSize;
|
|
28957
29016
|
}).bind(this), 'image/jpeg', quality);
|
|
28958
29017
|
}
|
|
28959
29018
|
else if (!isNullOrUndefined(fileType) && (fileType.toLowerCase() === 'png' || fileType.toLowerCase() === 'webp')) {
|
|
28960
29019
|
var type = 'image/' + fileType.toLowerCase();
|
|
29020
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
28961
29021
|
ctx.drawImage(tempCanvas, 0, 0);
|
|
28962
29022
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
28963
29023
|
tempCanvas.toBlob((function (blob) {
|
|
@@ -28978,6 +29038,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
28978
29038
|
}).bind(this), type, 1);
|
|
28979
29039
|
}
|
|
28980
29040
|
else if (!isNullOrUndefined(fileType) && fileType.toLowerCase() === 'svg') {
|
|
29041
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
28981
29042
|
ctx.drawImage(tempCanvas, 0, 0);
|
|
28982
29043
|
var svgDataUrl = tempCanvas.toDataURL('image/svg+xml');
|
|
28983
29044
|
var base64Data = svgDataUrl.split(',')[1];
|
|
@@ -29003,6 +29064,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
29003
29064
|
canvas.style.display = 'none';
|
|
29004
29065
|
}
|
|
29005
29066
|
else {
|
|
29067
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
29006
29068
|
ctx.drawImage(tempCanvas, 0, 0);
|
|
29007
29069
|
if (this.initialSize > 1000) {
|
|
29008
29070
|
var megabytes = this.initialSize / 1048576;
|
|
@@ -31673,6 +31735,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
31673
31735
|
if (filter) {
|
|
31674
31736
|
var ctx = filter.getContext('2d');
|
|
31675
31737
|
ctx = filter.getContext('2d');
|
|
31738
|
+
ctx.imageSmoothingQuality = parent.imageSmoothingEnabled ? 'high' : 'low';
|
|
31676
31739
|
filter.style.width = '100px';
|
|
31677
31740
|
filter.style.height = '100px';
|
|
31678
31741
|
parent.notify('filter', { prop: 'updateAdj', value: { type: type, value: null, isPreview: true, ctx: ctx } });
|