@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.
Files changed (81) hide show
  1. package/dist/ej2-image-editor.umd.min.js +2 -2
  2. package/dist/ej2-image-editor.umd.min.js.map +1 -1
  3. package/dist/es6/ej2-image-editor.es2015.js +69 -9
  4. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  5. package/dist/es6/ej2-image-editor.es5.js +69 -9
  6. package/dist/es6/ej2-image-editor.es5.js.map +1 -1
  7. package/dist/global/ej2-image-editor.min.js +2 -2
  8. package/dist/global/ej2-image-editor.min.js.map +1 -1
  9. package/dist/global/index.d.ts +1 -1
  10. package/package.json +12 -12
  11. package/src/image-editor/action/draw.js +1 -0
  12. package/src/image-editor/action/transform.js +1 -0
  13. package/src/image-editor/base/image-editor-model.d.ts +25 -0
  14. package/src/image-editor/base/image-editor.d.ts +24 -0
  15. package/src/image-editor/base/image-editor.js +14 -0
  16. package/src/image-editor/renderer/toolbar.d.ts +1 -0
  17. package/src/image-editor/renderer/toolbar.js +53 -9
  18. package/styles/bds-lite.css +2 -2
  19. package/styles/bds.css +2 -2
  20. package/styles/bootstrap-dark-lite.css +2 -2
  21. package/styles/bootstrap-dark.css +2 -2
  22. package/styles/bootstrap-lite.css +2 -2
  23. package/styles/bootstrap.css +2 -2
  24. package/styles/bootstrap4-lite.css +2 -2
  25. package/styles/bootstrap4.css +2 -2
  26. package/styles/bootstrap5-dark-lite.css +2 -2
  27. package/styles/bootstrap5-dark.css +2 -2
  28. package/styles/bootstrap5-lite.css +2 -2
  29. package/styles/bootstrap5.3-lite.css +2 -2
  30. package/styles/bootstrap5.3.css +2 -2
  31. package/styles/bootstrap5.css +2 -2
  32. package/styles/fabric-dark-lite.css +2 -2
  33. package/styles/fabric-dark.css +2 -2
  34. package/styles/fabric-lite.css +2 -2
  35. package/styles/fabric.css +2 -2
  36. package/styles/fluent-dark-lite.css +2 -2
  37. package/styles/fluent-dark.css +2 -2
  38. package/styles/fluent-lite.css +2 -2
  39. package/styles/fluent.css +2 -2
  40. package/styles/fluent2-lite.css +2 -2
  41. package/styles/fluent2.css +2 -2
  42. package/styles/highcontrast-light-lite.css +2 -2
  43. package/styles/highcontrast-light.css +2 -2
  44. package/styles/highcontrast-lite.css +2 -2
  45. package/styles/highcontrast.css +2 -2
  46. package/styles/image-editor/_layout.scss +2 -2
  47. package/styles/image-editor/bds.css +2 -2
  48. package/styles/image-editor/bootstrap-dark.css +2 -2
  49. package/styles/image-editor/bootstrap.css +2 -2
  50. package/styles/image-editor/bootstrap4.css +2 -2
  51. package/styles/image-editor/bootstrap5-dark.css +2 -2
  52. package/styles/image-editor/bootstrap5.3.css +2 -2
  53. package/styles/image-editor/bootstrap5.css +2 -2
  54. package/styles/image-editor/fabric-dark.css +2 -2
  55. package/styles/image-editor/fabric.css +2 -2
  56. package/styles/image-editor/fluent-dark.css +2 -2
  57. package/styles/image-editor/fluent.css +2 -2
  58. package/styles/image-editor/fluent2.css +2 -2
  59. package/styles/image-editor/highcontrast-light.css +2 -2
  60. package/styles/image-editor/highcontrast.css +2 -2
  61. package/styles/image-editor/material-dark.css +2 -2
  62. package/styles/image-editor/material.css +2 -2
  63. package/styles/image-editor/material3-dark.css +2 -2
  64. package/styles/image-editor/material3.css +2 -2
  65. package/styles/image-editor/tailwind-dark.css +2 -2
  66. package/styles/image-editor/tailwind.css +2 -2
  67. package/styles/image-editor/tailwind3.css +2 -2
  68. package/styles/material-dark-lite.css +2 -2
  69. package/styles/material-dark.css +2 -2
  70. package/styles/material-lite.css +2 -2
  71. package/styles/material.css +2 -2
  72. package/styles/material3-dark-lite.css +2 -2
  73. package/styles/material3-dark.css +2 -2
  74. package/styles/material3-lite.css +2 -2
  75. package/styles/material3.css +2 -2
  76. package/styles/tailwind-dark-lite.css +2 -2
  77. package/styles/tailwind-dark.css +2 -2
  78. package/styles/tailwind-lite.css +2 -2
  79. package/styles/tailwind.css +2 -2
  80. package/styles/tailwind3-lite.css +2 -2
  81. 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;
@@ -20190,6 +20191,7 @@ var Transform = /** @__PURE__ @class */ (function () {
20190
20191
  parent.lowerCanvas.height = parent.upperCanvas.height = parent.maskCanvas.height =
20191
20192
  parseFloat(canvasWrapper.style.height);
20192
20193
  this.lowerContext.filter = tempFilter;
20194
+ this.lowerContext.imageSmoothingQuality = parent.imageSmoothingEnabled ? 'high' : 'low';
20193
20195
  var obj = { width: 0, height: 0 };
20194
20196
  this.calcMaxDimension(parent.img.srcWidth, parent.img.srcHeight, obj);
20195
20197
  var maxDimension = obj;
@@ -22481,6 +22483,17 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
22481
22483
  }
22482
22484
  this.updateDropInfoContent(this.element.querySelector('.e-ie-drop-info'));
22483
22485
  break;
22486
+ case 'imageSmoothingEnabled':
22487
+ if (newProperties.imageSmoothingEnabled) {
22488
+ this.imageSmoothingEnabled = true;
22489
+ this.lowerContext.imageSmoothingQuality = 'high';
22490
+ }
22491
+ else {
22492
+ this.imageSmoothingEnabled = false;
22493
+ this.lowerContext.imageSmoothingQuality = 'low';
22494
+ }
22495
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
22496
+ break;
22484
22497
  }
22485
22498
  }
22486
22499
  };
@@ -26626,6 +26639,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
26626
26639
  __decorate([
26627
26640
  Property()
26628
26641
  ], ImageEditor.prototype, "quickAccessToolbarTemplate", void 0);
26642
+ __decorate([
26643
+ Property(false)
26644
+ ], ImageEditor.prototype, "imageSmoothingEnabled", void 0);
26629
26645
  __decorate([
26630
26646
  Property(false)
26631
26647
  ], ImageEditor.prototype, "isReadOnly", void 0);
@@ -28735,6 +28751,47 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
28735
28751
  ]
28736
28752
  });
28737
28753
  dialog.appendTo('#' + id + '_saveDialog');
28754
+ this.updateSavePreviewImage();
28755
+ };
28756
+ ToolbarModule.prototype.updateSavePreviewImage = function () {
28757
+ var parent = this.parent;
28758
+ var id = parent.element.id;
28759
+ var elem = parent.element.querySelector('#' + id + '_saveDialog');
28760
+ if (Browser.isDevice || !elem) {
28761
+ return;
28762
+ }
28763
+ var dialogWidth = elem.offsetWidth;
28764
+ var dialogMaxHeight = parseInt(elem.style.maxHeight, 10);
28765
+ var headerHeight = elem.querySelector('.e-dlg-header-content').offsetHeight;
28766
+ var footerHeight = elem.querySelector('.e-footer-content').offsetHeight;
28767
+ var padding = parseInt(window.getComputedStyle(elem.querySelector('#' + id + '_saveDialog_dialog-content')).padding, 10);
28768
+ var imageSizeContent = 20; // Image size text container div height
28769
+ var canvasMaxWidth = dialogWidth * (35 / 100); // 35% of dialog's width
28770
+ var canvasMaxHeight = dialogMaxHeight - headerHeight - footerHeight - imageSizeContent - (padding * 2);
28771
+ var canvas = parent.element.querySelector('#' + id + '_imgPic');
28772
+ var width = canvas.width;
28773
+ var height = canvas.height;
28774
+ var widthScale = canvasMaxWidth / width;
28775
+ var heightScale = canvasMaxHeight / height;
28776
+ var cssMaxWidth = Math.min(width, canvasMaxWidth);
28777
+ var cssMaxHeight = Math.min(height, canvasMaxHeight);
28778
+ if (widthScale < 1 && widthScale < heightScale) {
28779
+ cssMaxWidth = width * widthScale;
28780
+ cssMaxHeight = height * widthScale;
28781
+ }
28782
+ else if (heightScale < 1 && heightScale < widthScale) {
28783
+ cssMaxWidth = width * heightScale;
28784
+ cssMaxHeight = height * heightScale;
28785
+ }
28786
+ var imageObj = { canvas: null };
28787
+ parent.notify('export', { prop: 'exportToCanvas', value: { object: imageObj } });
28788
+ var ctx = canvas.getContext('2d');
28789
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
28790
+ canvas.width = cssMaxWidth;
28791
+ canvas.height = cssMaxHeight;
28792
+ var tempCanvas = imageObj['canvas'];
28793
+ ctx.imageSmoothingQuality = 'medium';
28794
+ ctx.drawImage(tempCanvas, 0, 0, tempCanvas.width, tempCanvas.height, 0, 0, cssMaxWidth, cssMaxHeight);
28738
28795
  };
28739
28796
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
28740
28797
  ToolbarModule.prototype.saveDialogClosed = function (id) {
@@ -28835,6 +28892,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
28835
28892
  _this.updateImageSize(isNullOrUndefined(_this.currentQuality) ? 1 : _this.currentQuality, obj['canvas'], _this.fileType);
28836
28893
  document.getElementById(id + '_' + _this.imageQuality).checked = true;
28837
28894
  }
28895
+ _this.updateSavePreviewImage();
28838
28896
  }
28839
28897
  });
28840
28898
  drpDownBtn_1.appendTo('#' + id + '_saveDropdownbtn');
@@ -28890,12 +28948,14 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
28890
28948
  created: function () {
28891
28949
  _this.updateImageSize(_this.currentQuality, obj['canvas'], 'jpeg');
28892
28950
  qualitySliderValueSpan.innerHTML = (Math.round(_this.currentQuality * 100)).toString();
28951
+ _this.updateSavePreviewImage();
28893
28952
  },
28894
28953
  changed: function (args) {
28895
28954
  _this.currentQuality = args.value;
28896
28955
  qualitySliderValueSpan.innerHTML = (Math.round(_this.currentQuality * 100)).toString();
28897
28956
  parent.notify('export', { prop: 'setImageQuality', value: { value: args.value } });
28898
28957
  _this.updateImageSize(args.value, obj['canvas'], 'jpeg');
28958
+ _this.updateSavePreviewImage();
28899
28959
  }
28900
28960
  });
28901
28961
  sliderObj.appendTo('#' + id + '_qualitySlider');
@@ -28916,6 +28976,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
28916
28976
  this.currentQuality = compressionValues[target.textContent];
28917
28977
  this.imageQuality = target.textContent.toLowerCase();
28918
28978
  this.updateImageSize(compressionValues[target.textContent], obj['canvas'], 'jpeg');
28979
+ this.updateSavePreviewImage();
28919
28980
  }
28920
28981
  };
28921
28982
  ToolbarModule.prototype.updateImageSize = function (quality, tempCanvas, fileType) {
@@ -28932,7 +28993,11 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
28932
28993
  else {
28933
28994
  imageNameLabel = document.getElementById(id + '_imageNameLabel');
28934
28995
  }
28996
+ var imageSmoothingEnabled = parent.imageSmoothingEnabled;
28997
+ ctx.canvas.getContext('2d').imageSmoothingQuality = imageSmoothingEnabled ? 'high' : 'low';
28935
28998
  if (fileType.toLowerCase() === 'jpeg') {
28999
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
29000
+ ctx.drawImage(tempCanvas, 0, 0);
28936
29001
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
28937
29002
  tempCanvas.toBlob((function (blob) {
28938
29003
  fileSize = Math.floor(blob.size / 1024);
@@ -28948,20 +29013,12 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
28948
29013
  if (Browser.isDevice) {
28949
29014
  canvas.style.display = 'none';
28950
29015
  }
28951
- else {
28952
- var compressedImage_1 = new Image();
28953
- compressedImage_1.src = URL.createObjectURL(blob);
28954
- // eslint-disable-next-line @typescript-eslint/tslint/config
28955
- compressedImage_1.onload = function () {
28956
- ctx.drawImage(compressedImage_1, 0, 0);
28957
- URL.revokeObjectURL(compressedImage_1.src);
28958
- };
28959
- }
28960
29016
  this.fileSize = fileSize;
28961
29017
  }).bind(this), 'image/jpeg', quality);
28962
29018
  }
28963
29019
  else if (!isNullOrUndefined(fileType) && (fileType.toLowerCase() === 'png' || fileType.toLowerCase() === 'webp')) {
28964
29020
  var type = 'image/' + fileType.toLowerCase();
29021
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
28965
29022
  ctx.drawImage(tempCanvas, 0, 0);
28966
29023
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
28967
29024
  tempCanvas.toBlob((function (blob) {
@@ -28982,6 +29039,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
28982
29039
  }).bind(this), type, 1);
28983
29040
  }
28984
29041
  else if (!isNullOrUndefined(fileType) && fileType.toLowerCase() === 'svg') {
29042
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
28985
29043
  ctx.drawImage(tempCanvas, 0, 0);
28986
29044
  var svgDataUrl = tempCanvas.toDataURL('image/svg+xml');
28987
29045
  var base64Data = svgDataUrl.split(',')[1];
@@ -29007,6 +29065,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
29007
29065
  canvas.style.display = 'none';
29008
29066
  }
29009
29067
  else {
29068
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
29010
29069
  ctx.drawImage(tempCanvas, 0, 0);
29011
29070
  if (this.initialSize > 1000) {
29012
29071
  var megabytes = this.initialSize / 1048576;
@@ -31677,6 +31736,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
31677
31736
  if (filter) {
31678
31737
  var ctx = filter.getContext('2d');
31679
31738
  ctx = filter.getContext('2d');
31739
+ ctx.imageSmoothingQuality = parent.imageSmoothingEnabled ? 'high' : 'low';
31680
31740
  filter.style.width = '100px';
31681
31741
  filter.style.height = '100px';
31682
31742
  parent.notify('filter', { prop: 'updateAdj', value: { type: type, value: null, isPreview: true, ctx: ctx } });