@syncfusion/ej2-image-editor 29.1.38 → 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.
Files changed (80) 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 +68 -9
  4. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  5. package/dist/es6/ej2-image-editor.es5.js +68 -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/base/image-editor-model.d.ts +25 -0
  13. package/src/image-editor/base/image-editor.d.ts +24 -0
  14. package/src/image-editor/base/image-editor.js +14 -0
  15. package/src/image-editor/renderer/toolbar.d.ts +1 -0
  16. package/src/image-editor/renderer/toolbar.js +53 -9
  17. package/styles/bds-lite.css +2 -2
  18. package/styles/bds.css +2 -2
  19. package/styles/bootstrap-dark-lite.css +2 -2
  20. package/styles/bootstrap-dark.css +2 -2
  21. package/styles/bootstrap-lite.css +2 -2
  22. package/styles/bootstrap.css +2 -2
  23. package/styles/bootstrap4-lite.css +2 -2
  24. package/styles/bootstrap4.css +2 -2
  25. package/styles/bootstrap5-dark-lite.css +2 -2
  26. package/styles/bootstrap5-dark.css +2 -2
  27. package/styles/bootstrap5-lite.css +2 -2
  28. package/styles/bootstrap5.3-lite.css +2 -2
  29. package/styles/bootstrap5.3.css +2 -2
  30. package/styles/bootstrap5.css +2 -2
  31. package/styles/fabric-dark-lite.css +2 -2
  32. package/styles/fabric-dark.css +2 -2
  33. package/styles/fabric-lite.css +2 -2
  34. package/styles/fabric.css +2 -2
  35. package/styles/fluent-dark-lite.css +2 -2
  36. package/styles/fluent-dark.css +2 -2
  37. package/styles/fluent-lite.css +2 -2
  38. package/styles/fluent.css +2 -2
  39. package/styles/fluent2-lite.css +2 -2
  40. package/styles/fluent2.css +2 -2
  41. package/styles/highcontrast-light-lite.css +2 -2
  42. package/styles/highcontrast-light.css +2 -2
  43. package/styles/highcontrast-lite.css +2 -2
  44. package/styles/highcontrast.css +2 -2
  45. package/styles/image-editor/_layout.scss +2 -2
  46. package/styles/image-editor/bds.css +2 -2
  47. package/styles/image-editor/bootstrap-dark.css +2 -2
  48. package/styles/image-editor/bootstrap.css +2 -2
  49. package/styles/image-editor/bootstrap4.css +2 -2
  50. package/styles/image-editor/bootstrap5-dark.css +2 -2
  51. package/styles/image-editor/bootstrap5.3.css +2 -2
  52. package/styles/image-editor/bootstrap5.css +2 -2
  53. package/styles/image-editor/fabric-dark.css +2 -2
  54. package/styles/image-editor/fabric.css +2 -2
  55. package/styles/image-editor/fluent-dark.css +2 -2
  56. package/styles/image-editor/fluent.css +2 -2
  57. package/styles/image-editor/fluent2.css +2 -2
  58. package/styles/image-editor/highcontrast-light.css +2 -2
  59. package/styles/image-editor/highcontrast.css +2 -2
  60. package/styles/image-editor/material-dark.css +2 -2
  61. package/styles/image-editor/material.css +2 -2
  62. package/styles/image-editor/material3-dark.css +2 -2
  63. package/styles/image-editor/material3.css +2 -2
  64. package/styles/image-editor/tailwind-dark.css +2 -2
  65. package/styles/image-editor/tailwind.css +2 -2
  66. package/styles/image-editor/tailwind3.css +2 -2
  67. package/styles/material-dark-lite.css +2 -2
  68. package/styles/material-dark.css +2 -2
  69. package/styles/material-lite.css +2 -2
  70. package/styles/material.css +2 -2
  71. package/styles/material3-dark-lite.css +2 -2
  72. package/styles/material3-dark.css +2 -2
  73. package/styles/material3-lite.css +2 -2
  74. package/styles/material3.css +2 -2
  75. package/styles/tailwind-dark-lite.css +2 -2
  76. package/styles/tailwind-dark.css +2 -2
  77. package/styles/tailwind-lite.css +2 -2
  78. package/styles/tailwind.css +2 -2
  79. package/styles/tailwind3-lite.css +2 -2
  80. 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;
@@ -22481,6 +22482,17 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
22481
22482
  }
22482
22483
  this.updateDropInfoContent(this.element.querySelector('.e-ie-drop-info'));
22483
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;
22484
22496
  }
22485
22497
  }
22486
22498
  };
@@ -26626,6 +26638,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
26626
26638
  __decorate([
26627
26639
  Property()
26628
26640
  ], ImageEditor.prototype, "quickAccessToolbarTemplate", void 0);
26641
+ __decorate([
26642
+ Property(false)
26643
+ ], ImageEditor.prototype, "imageSmoothingEnabled", void 0);
26629
26644
  __decorate([
26630
26645
  Property(false)
26631
26646
  ], ImageEditor.prototype, "isReadOnly", void 0);
@@ -28735,6 +28750,47 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
28735
28750
  ]
28736
28751
  });
28737
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);
28738
28794
  };
28739
28795
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
28740
28796
  ToolbarModule.prototype.saveDialogClosed = function (id) {
@@ -28835,6 +28891,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
28835
28891
  _this.updateImageSize(isNullOrUndefined(_this.currentQuality) ? 1 : _this.currentQuality, obj['canvas'], _this.fileType);
28836
28892
  document.getElementById(id + '_' + _this.imageQuality).checked = true;
28837
28893
  }
28894
+ _this.updateSavePreviewImage();
28838
28895
  }
28839
28896
  });
28840
28897
  drpDownBtn_1.appendTo('#' + id + '_saveDropdownbtn');
@@ -28890,12 +28947,14 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
28890
28947
  created: function () {
28891
28948
  _this.updateImageSize(_this.currentQuality, obj['canvas'], 'jpeg');
28892
28949
  qualitySliderValueSpan.innerHTML = (Math.round(_this.currentQuality * 100)).toString();
28950
+ _this.updateSavePreviewImage();
28893
28951
  },
28894
28952
  changed: function (args) {
28895
28953
  _this.currentQuality = args.value;
28896
28954
  qualitySliderValueSpan.innerHTML = (Math.round(_this.currentQuality * 100)).toString();
28897
28955
  parent.notify('export', { prop: 'setImageQuality', value: { value: args.value } });
28898
28956
  _this.updateImageSize(args.value, obj['canvas'], 'jpeg');
28957
+ _this.updateSavePreviewImage();
28899
28958
  }
28900
28959
  });
28901
28960
  sliderObj.appendTo('#' + id + '_qualitySlider');
@@ -28916,6 +28975,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
28916
28975
  this.currentQuality = compressionValues[target.textContent];
28917
28976
  this.imageQuality = target.textContent.toLowerCase();
28918
28977
  this.updateImageSize(compressionValues[target.textContent], obj['canvas'], 'jpeg');
28978
+ this.updateSavePreviewImage();
28919
28979
  }
28920
28980
  };
28921
28981
  ToolbarModule.prototype.updateImageSize = function (quality, tempCanvas, fileType) {
@@ -28932,7 +28992,11 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
28932
28992
  else {
28933
28993
  imageNameLabel = document.getElementById(id + '_imageNameLabel');
28934
28994
  }
28995
+ var imageSmoothingEnabled = parent.imageSmoothingEnabled;
28996
+ ctx.canvas.getContext('2d').imageSmoothingQuality = imageSmoothingEnabled ? 'high' : 'low';
28935
28997
  if (fileType.toLowerCase() === 'jpeg') {
28998
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
28999
+ ctx.drawImage(tempCanvas, 0, 0);
28936
29000
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
28937
29001
  tempCanvas.toBlob((function (blob) {
28938
29002
  fileSize = Math.floor(blob.size / 1024);
@@ -28948,20 +29012,12 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
28948
29012
  if (Browser.isDevice) {
28949
29013
  canvas.style.display = 'none';
28950
29014
  }
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
29015
  this.fileSize = fileSize;
28961
29016
  }).bind(this), 'image/jpeg', quality);
28962
29017
  }
28963
29018
  else if (!isNullOrUndefined(fileType) && (fileType.toLowerCase() === 'png' || fileType.toLowerCase() === 'webp')) {
28964
29019
  var type = 'image/' + fileType.toLowerCase();
29020
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
28965
29021
  ctx.drawImage(tempCanvas, 0, 0);
28966
29022
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
28967
29023
  tempCanvas.toBlob((function (blob) {
@@ -28982,6 +29038,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
28982
29038
  }).bind(this), type, 1);
28983
29039
  }
28984
29040
  else if (!isNullOrUndefined(fileType) && fileType.toLowerCase() === 'svg') {
29041
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
28985
29042
  ctx.drawImage(tempCanvas, 0, 0);
28986
29043
  var svgDataUrl = tempCanvas.toDataURL('image/svg+xml');
28987
29044
  var base64Data = svgDataUrl.split(',')[1];
@@ -29007,6 +29064,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
29007
29064
  canvas.style.display = 'none';
29008
29065
  }
29009
29066
  else {
29067
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
29010
29068
  ctx.drawImage(tempCanvas, 0, 0);
29011
29069
  if (this.initialSize > 1000) {
29012
29070
  var megabytes = this.initialSize / 1048576;
@@ -31677,6 +31735,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
31677
31735
  if (filter) {
31678
31736
  var ctx = filter.getContext('2d');
31679
31737
  ctx = filter.getContext('2d');
31738
+ ctx.imageSmoothingQuality = parent.imageSmoothingEnabled ? 'high' : 'low';
31680
31739
  filter.style.width = '100px';
31681
31740
  filter.style.height = '100px';
31682
31741
  parent.notify('filter', { prop: 'updateAdj', value: { type: type, value: null, isPreview: true, ctx: ctx } });