@syncfusion/ej2-image-editor 26.2.14 → 27.1.50

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 (186) hide show
  1. package/README.md +1 -1
  2. package/dist/ej2-image-editor.umd.min.js +2 -2
  3. package/dist/ej2-image-editor.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-image-editor.es2015.js +3267 -731
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +3345 -795
  7. package/dist/es6/ej2-image-editor.es5.js.map +1 -1
  8. package/dist/global/ej2-image-editor.min.js +2 -2
  9. package/dist/global/ej2-image-editor.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/package.json +13 -13
  12. package/src/image-editor/action/crop.d.ts +0 -1
  13. package/src/image-editor/action/crop.js +8 -19
  14. package/src/image-editor/action/draw.d.ts +4 -0
  15. package/src/image-editor/action/draw.js +401 -47
  16. package/src/image-editor/action/export.js +21 -13
  17. package/src/image-editor/action/filter.d.ts +13 -0
  18. package/src/image-editor/action/filter.js +272 -1
  19. package/src/image-editor/action/freehand-draw.d.ts +1 -0
  20. package/src/image-editor/action/freehand-draw.js +44 -23
  21. package/src/image-editor/action/selection.d.ts +9 -0
  22. package/src/image-editor/action/selection.js +420 -98
  23. package/src/image-editor/action/shape.d.ts +5 -0
  24. package/src/image-editor/action/shape.js +291 -141
  25. package/src/image-editor/action/transform.js +56 -82
  26. package/src/image-editor/action/undo-redo.d.ts +2 -0
  27. package/src/image-editor/action/undo-redo.js +100 -1
  28. package/src/image-editor/base/enum.d.ts +11 -0
  29. package/src/image-editor/base/enum.js +12 -0
  30. package/src/image-editor/base/image-editor-model.d.ts +13 -1
  31. package/src/image-editor/base/image-editor.d.ts +142 -20
  32. package/src/image-editor/base/image-editor.js +814 -150
  33. package/src/image-editor/base/interface.d.ts +140 -1
  34. package/src/image-editor/renderer/toolbar.d.ts +8 -0
  35. package/src/image-editor/renderer/toolbar.js +876 -193
  36. package/styles/bootstrap-dark-lite.css +746 -0
  37. package/styles/bootstrap-dark-lite.scss +13 -0
  38. package/styles/bootstrap-dark.css +150 -105
  39. package/styles/bootstrap-dark.scss +1 -0
  40. package/styles/bootstrap-lite.css +747 -0
  41. package/styles/bootstrap-lite.scss +13 -0
  42. package/styles/bootstrap.css +151 -106
  43. package/styles/bootstrap.scss +1 -0
  44. package/styles/bootstrap4-lite.css +747 -0
  45. package/styles/bootstrap4-lite.scss +13 -0
  46. package/styles/bootstrap4.css +150 -105
  47. package/styles/bootstrap4.scss +1 -0
  48. package/styles/bootstrap5-dark-lite.css +757 -0
  49. package/styles/bootstrap5-dark-lite.scss +13 -0
  50. package/styles/bootstrap5-dark.css +152 -113
  51. package/styles/bootstrap5-dark.scss +1 -0
  52. package/styles/bootstrap5-lite.css +757 -0
  53. package/styles/bootstrap5-lite.scss +13 -0
  54. package/styles/bootstrap5.3-lite.css +760 -0
  55. package/styles/bootstrap5.3-lite.scss +13 -0
  56. package/styles/bootstrap5.3.css +867 -0
  57. package/styles/bootstrap5.3.scss +14 -0
  58. package/styles/bootstrap5.css +152 -113
  59. package/styles/bootstrap5.scss +1 -0
  60. package/styles/fabric-dark-lite.css +749 -0
  61. package/styles/fabric-dark-lite.scss +13 -0
  62. package/styles/fabric-dark.css +150 -105
  63. package/styles/fabric-dark.scss +1 -0
  64. package/styles/fabric-lite.css +751 -0
  65. package/styles/fabric-lite.scss +13 -0
  66. package/styles/fabric.css +151 -106
  67. package/styles/fabric.scss +1 -0
  68. package/styles/fluent-dark-lite.css +758 -0
  69. package/styles/fluent-dark-lite.scss +13 -0
  70. package/styles/fluent-dark.css +150 -111
  71. package/styles/fluent-dark.scss +1 -0
  72. package/styles/fluent-lite.css +758 -0
  73. package/styles/fluent-lite.scss +13 -0
  74. package/styles/fluent.css +150 -111
  75. package/styles/fluent.scss +1 -0
  76. package/styles/fluent2-lite.css +791 -0
  77. package/styles/fluent2-lite.scss +13 -0
  78. package/styles/fluent2.css +173 -117
  79. package/styles/fluent2.scss +1 -0
  80. package/styles/highcontrast-light-lite.css +748 -0
  81. package/styles/highcontrast-light-lite.scss +13 -0
  82. package/styles/highcontrast-light.css +149 -104
  83. package/styles/highcontrast-light.scss +1 -0
  84. package/styles/highcontrast-lite.css +753 -0
  85. package/styles/highcontrast-lite.scss +13 -0
  86. package/styles/highcontrast.css +150 -104
  87. package/styles/highcontrast.scss +1 -0
  88. package/styles/image-editor/_bds-definition.scss +3 -1
  89. package/styles/image-editor/_bigger.scss +216 -0
  90. package/styles/image-editor/_bootstrap-dark-definition.scss +3 -1
  91. package/styles/image-editor/_bootstrap-definition.scss +3 -1
  92. package/styles/image-editor/_bootstrap4-definition.scss +3 -1
  93. package/styles/image-editor/_bootstrap5-definition.scss +3 -1
  94. package/styles/image-editor/_bootstrap5.3-definition.scss +3 -1
  95. package/styles/image-editor/_fabric-dark-definition.scss +3 -1
  96. package/styles/image-editor/_fabric-definition.scss +3 -1
  97. package/styles/image-editor/_fluent-definition.scss +3 -1
  98. package/styles/image-editor/_fluent2-definition.scss +4 -2
  99. package/styles/image-editor/_fusionnew-definition.scss +3 -1
  100. package/styles/image-editor/_highcontrast-definition.scss +3 -1
  101. package/styles/image-editor/_highcontrast-light-definition.scss +3 -1
  102. package/styles/image-editor/_layout.scss +75 -212
  103. package/styles/image-editor/_material-dark-definition.scss +3 -1
  104. package/styles/image-editor/_material-definition.scss +3 -1
  105. package/styles/image-editor/_material3-definition.scss +5 -3
  106. package/styles/image-editor/_tailwind-definition.scss +5 -3
  107. package/styles/image-editor/_theme.scss +48 -11
  108. package/styles/image-editor/bootstrap-dark.css +150 -105
  109. package/styles/image-editor/bootstrap-dark.scss +1 -0
  110. package/styles/image-editor/bootstrap.css +151 -106
  111. package/styles/image-editor/bootstrap.scss +1 -0
  112. package/styles/image-editor/bootstrap4.css +150 -105
  113. package/styles/image-editor/bootstrap4.scss +1 -0
  114. package/styles/image-editor/bootstrap5-dark.css +152 -113
  115. package/styles/image-editor/bootstrap5-dark.scss +1 -0
  116. package/styles/image-editor/bootstrap5.3.css +867 -0
  117. package/styles/image-editor/bootstrap5.3.scss +14 -0
  118. package/styles/image-editor/bootstrap5.css +152 -113
  119. package/styles/image-editor/bootstrap5.scss +1 -0
  120. package/styles/image-editor/fabric-dark.css +150 -105
  121. package/styles/image-editor/fabric-dark.scss +1 -0
  122. package/styles/image-editor/fabric.css +151 -106
  123. package/styles/image-editor/fabric.scss +1 -0
  124. package/styles/image-editor/fluent-dark.css +150 -111
  125. package/styles/image-editor/fluent-dark.scss +1 -0
  126. package/styles/image-editor/fluent.css +150 -111
  127. package/styles/image-editor/fluent.scss +1 -0
  128. package/styles/image-editor/fluent2.css +173 -117
  129. package/styles/image-editor/fluent2.scss +1 -0
  130. package/styles/image-editor/highcontrast-light.css +149 -104
  131. package/styles/image-editor/highcontrast-light.scss +1 -0
  132. package/styles/image-editor/highcontrast.css +150 -104
  133. package/styles/image-editor/highcontrast.scss +1 -0
  134. package/styles/image-editor/icons/_bds.scss +10 -1
  135. package/styles/image-editor/icons/_bootstrap-dark.scss +10 -1
  136. package/styles/image-editor/icons/_bootstrap.scss +10 -1
  137. package/styles/image-editor/icons/_bootstrap4.scss +10 -1
  138. package/styles/image-editor/icons/_bootstrap5.3.scss +10 -1
  139. package/styles/image-editor/icons/_bootstrap5.scss +10 -1
  140. package/styles/image-editor/icons/_fabric-dark.scss +10 -1
  141. package/styles/image-editor/icons/_fabric.scss +10 -1
  142. package/styles/image-editor/icons/_fluent.scss +10 -1
  143. package/styles/image-editor/icons/_fluent2.scss +10 -1
  144. package/styles/image-editor/icons/_fusionnew.scss +10 -1
  145. package/styles/image-editor/icons/_highcontrast-light.scss +10 -1
  146. package/styles/image-editor/icons/_highcontrast.scss +10 -1
  147. package/styles/image-editor/icons/_material-dark.scss +10 -1
  148. package/styles/image-editor/icons/_material.scss +10 -1
  149. package/styles/image-editor/icons/_material3.scss +10 -1
  150. package/styles/image-editor/icons/_tailwind.scss +10 -1
  151. package/styles/image-editor/material-dark.css +153 -108
  152. package/styles/image-editor/material-dark.scss +1 -0
  153. package/styles/image-editor/material.css +159 -114
  154. package/styles/image-editor/material.scss +1 -0
  155. package/styles/image-editor/material3-dark.css +171 -123
  156. package/styles/image-editor/material3-dark.scss +1 -0
  157. package/styles/image-editor/material3.css +171 -123
  158. package/styles/image-editor/material3.scss +1 -0
  159. package/styles/image-editor/tailwind-dark.css +154 -116
  160. package/styles/image-editor/tailwind-dark.scss +1 -0
  161. package/styles/image-editor/tailwind.css +154 -116
  162. package/styles/image-editor/tailwind.scss +1 -0
  163. package/styles/material-dark-lite.css +767 -0
  164. package/styles/material-dark-lite.scss +13 -0
  165. package/styles/material-dark.css +153 -108
  166. package/styles/material-dark.scss +1 -0
  167. package/styles/material-lite.css +769 -0
  168. package/styles/material-lite.scss +13 -0
  169. package/styles/material.css +159 -114
  170. package/styles/material.scss +1 -0
  171. package/styles/material3-dark-lite.css +799 -0
  172. package/styles/material3-dark-lite.scss +13 -0
  173. package/styles/material3-dark.css +171 -123
  174. package/styles/material3-dark.scss +1 -0
  175. package/styles/material3-lite.css +801 -0
  176. package/styles/material3-lite.scss +13 -0
  177. package/styles/material3.css +171 -123
  178. package/styles/material3.scss +1 -0
  179. package/styles/tailwind-dark-lite.css +751 -0
  180. package/styles/tailwind-dark-lite.scss +13 -0
  181. package/styles/tailwind-dark.css +154 -116
  182. package/styles/tailwind-dark.scss +1 -0
  183. package/styles/tailwind-lite.css +751 -0
  184. package/styles/tailwind-lite.scss +13 -0
  185. package/styles/tailwind.css +154 -116
  186. package/styles/tailwind.scss +1 -0
@@ -17,6 +17,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
17
17
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
18
18
  return c > 3 && r && Object.defineProperty(target, key, r), r;
19
19
  };
20
+ /* eslint-disable max-len */
20
21
  import { Component, NotifyPropertyChanges, Property, addClass, removeClass, extend } from '@syncfusion/ej2-base';
21
22
  import { Event, EventHandler, getComponent, isNullOrUndefined, getUniqueID, setValue } from '@syncfusion/ej2-base';
22
23
  import { Dialog, createSpinner } from '@syncfusion/ej2-popups';
@@ -151,7 +152,7 @@ var ImageEditor = /** @class */ (function (_super) {
151
152
  // current object's ui interaction properties
152
153
  /** @hidden */
153
154
  _this.currObjType = { shape: '', isDragging: false, isActiveObj: false, isText: false, isInitialText: false, isLine: false, isInitialLine: false,
154
- isCustomCrop: false, isZoomed: false, isUndoZoom: false, isUndoAction: false, isFiltered: false, isSave: false, isResize: false };
155
+ isCustomCrop: false, isZoomed: false, isUndoZoom: false, isUndoAction: false, isFiltered: false, isSave: false, isResize: false, isRedact: false };
155
156
  /** @hidden */
156
157
  _this.objColl = [];
157
158
  /** @hidden */
@@ -263,6 +264,25 @@ var ImageEditor = /** @class */ (function (_super) {
263
264
  _this.shapeColl = [];
264
265
  /** @hidden */
265
266
  _this.isKBDNavigation = false;
267
+ /** @hidden */
268
+ _this.isMaskImage = false;
269
+ /** @hidden */
270
+ _this.tempObjColl = [];
271
+ /** @hidden */
272
+ _this.tempPointColl = [];
273
+ /** @hidden */
274
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
275
+ _this.tempShapeColl = [];
276
+ /** @hidden */
277
+ _this.isImageUpdated = false;
278
+ /** @hidden */
279
+ _this.noRedact = false;
280
+ /** @hidden */
281
+ _this.tempRedactBlur = 50;
282
+ /** @hidden */
283
+ _this.tempRedactPixel = 40;
284
+ _this.tempToolbarHeight = 0;
285
+ _this.tempToolbar = [];
266
286
  ImageEditor_1.Inject(Crop, Draw, Selection, Transform, Export, ToolbarModule);
267
287
  ImageEditor_1.Inject(UndoRedo);
268
288
  ImageEditor_1.Inject(Filter);
@@ -297,6 +317,7 @@ var ImageEditor = /** @class */ (function (_super) {
297
317
  ImageEditor.prototype.preRender = function () {
298
318
  // pre render code snippets
299
319
  this.element.id = this.element.id || getUniqueID('ej2-image-editor');
320
+ this.isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
300
321
  if (Browser.isDevice) {
301
322
  this.element.classList.add('e-device');
302
323
  }
@@ -310,6 +331,7 @@ var ImageEditor = /** @class */ (function (_super) {
310
331
  * @returns {void}
311
332
  */
312
333
  ImageEditor.prototype.render = function () {
334
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
313
335
  if (this.isAngular) {
314
336
  var originalElement = this.element;
315
337
  var clonedElement = originalElement.cloneNode(true);
@@ -714,6 +736,8 @@ var ImageEditor = /** @class */ (function (_super) {
714
736
  this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: browseObj } });
715
737
  var supportObj = { key: 'SupportText' };
716
738
  this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: supportObj } });
739
+ var andObj = { key: 'And' };
740
+ this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: andObj } });
717
741
  var dropAreaElement = this.createElement('div', { id: this.element.id + '_dropArea', className: 'e-ie-drop-area', attrs: { style: 'position: relative;' } });
718
742
  var dropIconElement = this.createElement('span', { className: 'e-ie-drop-icon e-icons e-image', attrs: { style: 'position: absolute;' } });
719
743
  var dropContentElement = this.createElement('span', { className: 'e-ie-drop-content', attrs: { style: 'position: absolute; display: none;' } });
@@ -729,7 +753,7 @@ var ImageEditor = /** @class */ (function (_super) {
729
753
  dropAnchorElement.href = '';
730
754
  minDropAnchorElem.href = '';
731
755
  var dropInfoElement = this.createElement('span', { className: 'e-ie-drop-info', attrs: { position: 'absolute' } });
732
- dropInfoElement.textContent = supportObj['value'] + ' SVG, PNG, and JPG';
756
+ dropInfoElement.textContent = supportObj['value'] + ' SVG, PNG, ' + andObj['value'] + ' JPG';
733
757
  var dropUploader = dropAreaElement.appendChild(this.createElement('input', {
734
758
  id: this.element.id + '_dropfileUpload', className: 'e-fileUpload e-image-upload'
735
759
  }));
@@ -743,6 +767,9 @@ var ImageEditor = /** @class */ (function (_super) {
743
767
  this.lowerCanvas = canvasWrapper.appendChild(this.createElement('canvas', {
744
768
  id: this.element.id + '_lowerCanvas', attrs: { name: 'canvasImage' }
745
769
  }));
770
+ this.maskCanvas = canvasWrapper.appendChild(this.createElement('canvas', {
771
+ id: this.element.id + '_maskCanvas', attrs: { name: 'canvasImage' }
772
+ }));
746
773
  this.upperCanvas = canvasWrapper.appendChild(this.createElement('canvas', {
747
774
  id: this.element.id + '_upperCanvas', attrs: { name: 'canvasImage' }
748
775
  }));
@@ -767,12 +794,15 @@ var ImageEditor = /** @class */ (function (_super) {
767
794
  uploader.style.display = 'none';
768
795
  this.textArea.setAttribute('spellcheck', 'false');
769
796
  this.textArea.style.lineHeight = 'normal';
770
- this.lowerCanvas.style.width = this.upperCanvas.style.width = this.inMemoryCanvas.style.width = '100%';
771
- this.lowerCanvas.style.height = this.upperCanvas.style.height = this.inMemoryCanvas.style.height = '100%';
772
- this.upperCanvas.style.position = this.lowerCanvas.style.position = this.textArea.style.position = 'absolute';
797
+ this.lowerCanvas.style.width = this.upperCanvas.style.width = this.maskCanvas.style.width =
798
+ this.inMemoryCanvas.style.width = '100%';
799
+ this.lowerCanvas.style.height = this.upperCanvas.style.height = this.maskCanvas.style.height =
800
+ this.inMemoryCanvas.style.height = '100%';
801
+ this.upperCanvas.style.position = this.lowerCanvas.style.position = this.maskCanvas.style.position =
802
+ this.textArea.style.position = 'absolute';
773
803
  this.textArea.style.backgroundColor = 'transparent';
774
804
  this.textArea.style.display = 'none';
775
- this.textArea.style.resize = 'none';
805
+ this.maskCanvas.style.display = this.textArea.style.resize = 'none';
776
806
  this.lowerContext = this.lowerCanvas.getContext('2d');
777
807
  this.baseImg = this.createElement('img', {
778
808
  id: this.element.id + '_orgImg', attrs: { name: 'Image', crossorigin: 'anonymous' }
@@ -909,41 +939,66 @@ var ImageEditor = /** @class */ (function (_super) {
909
939
  this.notify('transform', { prop: 'flip', value: { direction: direction } });
910
940
  this.notify('draw', { prop: 'redrawDownScale' });
911
941
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
942
+ var actionArgs = { action: 'flip', actionEventArgs: this.editCompleteArgs };
943
+ this.triggerEditCompleteEvent(actionArgs);
912
944
  };
913
945
  /**
914
946
  * Returns an image as ImageData to load it in to a canvas.
915
947
  *
948
+ * @param {boolean} [includeAnnotations=true] - Optional. Specifies whether the returned image data should include annotations. The default value is true, meaning annotations are included.
949
+ *
916
950
  * @remarks
917
951
  * The data returned from this method is directly drawn in a canvas using 'putImageData' method.
918
952
  * And then the user can get the base64 string from the canvas using toDataURL method.
919
953
  *
920
954
  * @returns {ImageData}.
921
955
  */
922
- ImageEditor.prototype.getImageData = function () {
923
- var obj = { canvas: null };
924
- this.applyShapes();
925
- this.notify('export', { prop: 'exportToCanvas', value: { object: obj } });
926
- return obj['canvas'].getContext('2d').getImageData(0, 0, obj['canvas'].width, obj['canvas'].height);
956
+ ImageEditor.prototype.getImageData = function (includeAnnotations) {
957
+ includeAnnotations = isNullOrUndefined(includeAnnotations) ? true : includeAnnotations;
958
+ var imageData;
959
+ if (includeAnnotations) {
960
+ var obj = { canvas: null };
961
+ this.applyShapes();
962
+ this.notify('export', { prop: 'exportToCanvas', value: { object: obj } });
963
+ imageData = obj['canvas'].getContext('2d').getImageData(0, 0, obj['canvas'].width, obj['canvas'].height);
964
+ }
965
+ else if (this.isMaskImage && this.element.getAttribute('data-value') === 'mask-drawing') {
966
+ imageData = this.getData(true);
967
+ this.updateColl('reset');
968
+ }
969
+ else {
970
+ imageData = this.getData();
971
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
972
+ }
973
+ return imageData;
927
974
  };
928
975
  /**
929
976
  * Opens an image as URL or ImageData for editing in an image editor.
930
977
  *
931
978
  * @param {string | ImageData } data - Specifies url of the image or image data.
979
+ * @param {boolean} [resetChanges=true] - Optional. Determines whether to reset existing changes when opening the image. The default value is true, which resets all existing changes.
980
+ * @param {ImageSettings} imageSettings - Optional. Specifies the image setting that contains background color to apply when opening a transparent image. The default value of background color is an empty string (''), meaning no background color is applied by default when a transparent image is opened.
932
981
  *
933
982
  * @remarks
934
983
  * The supported file types are JPG, JPEG, PNG, and SVG.
935
984
  *
936
985
  * @returns {void}.
937
986
  */
938
- ImageEditor.prototype.open = function (data) {
939
- if (isNullOrUndefined(data)) {
940
- return;
987
+ ImageEditor.prototype.open = function (data, resetChanges, imageSettings) {
988
+ resetChanges = isNullOrUndefined(resetChanges) ? true : resetChanges;
989
+ if (resetChanges) {
990
+ if (isNullOrUndefined(data)) {
991
+ return;
992
+ }
993
+ var dropArea = document.getElementById(this.element.id + '_dropArea');
994
+ if (dropArea) {
995
+ dropArea.style.display = 'none';
996
+ }
997
+ this.notify('draw', { prop: 'open', value: { data: data } });
941
998
  }
942
- var dropArea = document.getElementById(this.element.id + '_dropArea');
943
- if (dropArea) {
944
- dropArea.style.display = 'none';
999
+ else {
1000
+ this.updateImage(data, imageSettings ? imageSettings.backgroundColor : null);
945
1001
  }
946
- this.notify('draw', { prop: 'open', value: { data: data } });
947
1002
  };
948
1003
  /**
949
1004
  * Reset all the changes done in an image editor and revert to original image.
@@ -954,12 +1009,14 @@ var ImageEditor = /** @class */ (function (_super) {
954
1009
  * @returns {void}.
955
1010
  */
956
1011
  ImageEditor.prototype.reset = function () {
1012
+ this.updateColl('reset');
957
1013
  var obj = { isErrorImage: false };
958
1014
  this.notify('draw', { prop: 'getErrorImage', value: { obj: obj } });
959
1015
  if (!this.disabled && !obj['isErrorImage']) {
960
1016
  this.clearContext(this.inMemoryContext);
961
1017
  this.clearContext(this.lowerContext);
962
1018
  this.clearContext(this.upperContext);
1019
+ this.notify('shape', { prop: 'setRedactType', onPropertyChange: false, value: { redactType: 'blur' } });
963
1020
  this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
964
1021
  this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
965
1022
  isApplyBtn: false, isCropping: false, isZooming: null, cType: null } });
@@ -968,7 +1025,6 @@ var ImageEditor = /** @class */ (function (_super) {
968
1025
  this.notify('toolbar', { prop: 'create-bottom-toolbar', onPropertyChange: false });
969
1026
  }
970
1027
  var isImageLoaded = this.isImageLoaded;
971
- // eslint-disable-next-line max-len
972
1028
  this.currObjType.isUndoAction = this.isUndoRedo = this.togglePan = this.togglePen = this.isImageLoaded = this.isFinetuning = false;
973
1029
  this.isCircleCrop = this.isCropTab = false;
974
1030
  this.objColl = [];
@@ -1002,7 +1058,7 @@ var ImageEditor = /** @class */ (function (_super) {
1002
1058
  this.tempFrameObj = { type: 'none', color: '#fff', size: 20, inset: 20, offset: 20, radius: 0, amount: 1, border: 'solid', gradientColor: '' };
1003
1059
  this.currObjType = { shape: '', isDragging: false, isActiveObj: false, isText: false, isInitialText: false, isLine: false,
1004
1060
  isInitialLine: false, isCustomCrop: false, isZoomed: false, isUndoZoom: false,
1005
- isUndoAction: false, isFiltered: false, isSave: false, isResize: false };
1061
+ isUndoAction: false, isFiltered: false, isSave: false, isResize: false, isRedact: false };
1006
1062
  this.cropObj = { cropZoom: 0, defaultZoom: 0, totalPannedPoint: { x: 0, y: 0 }, totalPannedClientPoint: { x: 0, y: 0 },
1007
1063
  totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {},
1008
1064
  rotateFlipColl: [], degree: 0, currFlipState: '', straighten: 0, zoomFactor: 0, previousZoomValue: 0,
@@ -1019,11 +1075,21 @@ var ImageEditor = /** @class */ (function (_super) {
1019
1075
  this.transform.straighten = 0;
1020
1076
  this.cancelCropSelection = null;
1021
1077
  this.aspectWidth = this.aspectHeight = null;
1022
- this.isResize = false;
1078
+ this.isResize = this.isMaskImage = false;
1023
1079
  this.drawingShape = null;
1024
1080
  this.isShapeDrawing = this.noPushUndo = this.isUndoRedoStack = this.isKBDNavigation = false;
1025
1081
  this.shapeColl = [];
1082
+ this.tempObjColl = [];
1083
+ this.tempPointColl = [];
1084
+ this.tempShapeColl = [];
1085
+ this.isImageUpdated = false;
1086
+ this.tempToolbarHeight = 0;
1087
+ this.tempToolbar = [];
1088
+ this.tempRedactBlur = 50;
1089
+ this.tempRedactPixel = 40;
1026
1090
  var obj_1 = { initialZoomValue: false };
1091
+ this.editCompleteArgs = null;
1092
+ this.isFinetuneBtnClick = false;
1027
1093
  this.notify('draw', { prop: 'getInitialZoomValue', onPropertyChange: false, value: { obj: obj_1 } });
1028
1094
  if (obj_1['initialZoomValue']) {
1029
1095
  this.setProperties({ zoomSettings: { zoomFactor: obj_1['initialZoomValue'] } }, true);
@@ -1057,6 +1123,8 @@ var ImageEditor = /** @class */ (function (_super) {
1057
1123
  if (Browser.isDevice && straightenObj['bool']) {
1058
1124
  this.notify('crop', { prop: 'resizeWrapper' });
1059
1125
  }
1126
+ var actionArgs = { action: 'reset', actionEventArgs: null };
1127
+ this.triggerEditCompleteEvent(actionArgs);
1060
1128
  }
1061
1129
  };
1062
1130
  /**
@@ -1080,6 +1148,8 @@ var ImageEditor = /** @class */ (function (_super) {
1080
1148
  }
1081
1149
  this.notify('transform', { prop: 'rotate', value: { degree: degree, obj: obj } });
1082
1150
  this.notify('draw', { prop: 'redrawDownScale' });
1151
+ var actionArgs = { action: 'rotate', actionEventArgs: this.editCompleteArgs };
1152
+ this.triggerEditCompleteEvent(actionArgs);
1083
1153
  return obj['isRotate'];
1084
1154
  };
1085
1155
  /**
@@ -1158,8 +1228,19 @@ var ImageEditor = /** @class */ (function (_super) {
1158
1228
  */
1159
1229
  ImageEditor.prototype.freehandDraw = function (value) {
1160
1230
  if (!this.disabled && this.isImageLoaded) {
1231
+ if (!value && this.isMaskImage) {
1232
+ this.discard();
1233
+ return;
1234
+ }
1161
1235
  this.applyShapes();
1162
1236
  this.freeHandDraw(value);
1237
+ var prevObj = { shapeSettingsObj: {} };
1238
+ this.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: prevObj } });
1239
+ var shapeSettings = prevObj['shapeSettingsObj'];
1240
+ shapeSettings.type = ShapeType.FreehandDraw;
1241
+ var shapeChangingArgs = { cancel: false, action: 'insert', previousShapeSettings: shapeSettings,
1242
+ currentShapeSettings: shapeSettings };
1243
+ this.notify('freehand-draw', { prop: 'triggerShapeChanging', value: { shapeChangingArgs: shapeChangingArgs } });
1163
1244
  }
1164
1245
  };
1165
1246
  /**
@@ -1220,7 +1301,7 @@ var ImageEditor = /** @class */ (function (_super) {
1220
1301
  isEllipse = true;
1221
1302
  this.notify('shape', { prop: 'drawEllipse', onPropertyChange: false, value: { x: x, y: y, radiusX: radiusX, radiusY: radiusY,
1222
1303
  strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree, isSelected: isSelected } });
1223
- this.notify('draw', { prop: 'redrawDownScale' });
1304
+ this.editCompleted();
1224
1305
  }
1225
1306
  return isEllipse;
1226
1307
  };
@@ -1243,7 +1324,7 @@ var ImageEditor = /** @class */ (function (_super) {
1243
1324
  isLine = true;
1244
1325
  this.notify('shape', { prop: 'drawLine', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
1245
1326
  endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, isSelected: isSelected } });
1246
- this.notify('draw', { prop: 'redrawDownScale' });
1327
+ this.editCompleted();
1247
1328
  }
1248
1329
  return isLine;
1249
1330
  };
@@ -1269,7 +1350,7 @@ var ImageEditor = /** @class */ (function (_super) {
1269
1350
  this.notify('shape', { prop: 'drawArrow', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
1270
1351
  endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, arrowStart: arrowStart, arrowEnd: arrowEnd,
1271
1352
  isSelected: isSelected } });
1272
- this.notify('draw', { prop: 'redrawDownScale' });
1353
+ this.editCompleted();
1273
1354
  }
1274
1355
  return isArrow;
1275
1356
  };
@@ -1300,7 +1381,7 @@ var ImageEditor = /** @class */ (function (_super) {
1300
1381
  this.applyShapes();
1301
1382
  this.notify('shape', { prop: 'drawPath', onPropertyChange: false, value: { pointColl: pointColl,
1302
1383
  strokeWidth: strokeWidth, strokeColor: strokeColor, isSelected: isSelected } });
1303
- this.notify('draw', { prop: 'redrawDownScale' });
1384
+ this.editCompleted();
1304
1385
  }
1305
1386
  return isPath;
1306
1387
  };
@@ -1316,16 +1397,18 @@ var ImageEditor = /** @class */ (function (_super) {
1316
1397
  * @param {string} fillColor - Specifies the fill color of the rectangle.
1317
1398
  * @param {number} degree - Specifies the degree to rotate the rectangle.
1318
1399
  * @param {boolean} isSelected - Specifies to show the rectangle in the selected state.
1400
+ * @param {number} borderRadius - Specifies the radius to apply border radius to rectangle.
1319
1401
  * @returns {boolean}.
1320
1402
  */
1321
- ImageEditor.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor, degree, isSelected) {
1403
+ ImageEditor.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor, degree, isSelected, borderRadius) {
1322
1404
  var isRectangle = false;
1323
1405
  var isPointsInRange = this.allowShape(x, y);
1324
1406
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
1325
1407
  isRectangle = true;
1326
1408
  this.notify('shape', { prop: 'drawRectangle', onPropertyChange: false, value: { x: x, y: y, width: width, height: height,
1327
- strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree, isSelected: isSelected } });
1328
- this.notify('draw', { prop: 'redrawDownScale' });
1409
+ strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree, isSelected: isSelected,
1410
+ radius: borderRadius } });
1411
+ this.editCompleted();
1329
1412
  }
1330
1413
  return isRectangle;
1331
1414
  };
@@ -1344,17 +1427,21 @@ var ImageEditor = /** @class */ (function (_super) {
1344
1427
  * @param {string} color - Specifies font color of the text.
1345
1428
  * @param {boolean} isSelected - Specifies to show the text in the selected state.
1346
1429
  * @param {number} degree - Specifies the degree to rotate the text.
1430
+ * @param {fillColor} fillColor - Specifies the background Color of the text.
1431
+ * @param {string} strokeColor - Specifies the outline color of the text annotation.
1432
+ * @param {number} strokeWidth - Specifies the outline stroke width of the text annotation.
1347
1433
  * @returns {boolean}.
1348
1434
  *
1349
1435
  */
1350
- ImageEditor.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color, isSelected, degree) {
1436
+ ImageEditor.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color, isSelected, degree, fillColor, strokeColor, strokeWidth) {
1351
1437
  var isText = false;
1352
1438
  var isPointsInRange = this.allowShape(x, y);
1353
1439
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
1354
1440
  isText = true;
1355
1441
  this.notify('shape', { prop: 'drawText', onPropertyChange: false, value: { x: x, y: y, text: text, fontFamily: fontFamily,
1356
- fontSize: fontSize, bold: bold, italic: italic, color: color, isSelected: isSelected, degree: degree } });
1357
- this.notify('draw', { prop: 'redrawDownScale' });
1442
+ fontSize: fontSize, bold: bold, italic: italic, color: color, isSelected: isSelected, degree: degree, fillColor: fillColor,
1443
+ outlineColor: strokeColor, outlineWidth: strokeWidth } });
1444
+ this.editCompleted();
1358
1445
  }
1359
1446
  return isText;
1360
1447
  };
@@ -1381,13 +1468,97 @@ var ImageEditor = /** @class */ (function (_super) {
1381
1468
  var length_1 = this.objColl.length;
1382
1469
  this.notify('shape', { prop: 'drawImage', onPropertyChange: false, value: { x: x, y: y, width: width, height: height,
1383
1470
  src: data, degree: degree, isAspectRatio: isAspectRatio, opacity: opacity, isSelected: isSelected } });
1384
- this.notify('draw', { prop: 'redrawDownScale' });
1471
+ this.editCompleted();
1385
1472
  if (this.objColl.length > length_1) {
1386
1473
  isImage = true;
1387
1474
  }
1388
1475
  }
1389
1476
  return isImage;
1390
1477
  };
1478
+ /**
1479
+ * This method is used to update the existing shapes by changing its height, width, color, and font styles in the component.
1480
+ * Use 'getShapeSettings' method to get the shape which is then passed to change the options of a shape.
1481
+ * {% codeBlock src='image-editor/updateShape/index.md' %}{% endcodeBlock %}
1482
+ *
1483
+ * @param {ShapeSettings} setting - Specifies the shape settings to be updated for the shape on an image.
1484
+ * @param {boolean} isSelected - Specifies to show the shape in the selected state.
1485
+ * @returns {boolean}.
1486
+ *
1487
+ */
1488
+ ImageEditor.prototype.updateShape = function (setting, isSelected) {
1489
+ var obj = { isSelected: false };
1490
+ var isTextArea = false;
1491
+ var freehandObj = { bool: false };
1492
+ if (isNullOrUndefined(setting.id)) {
1493
+ if (setting.strokeColor) {
1494
+ this.activeObj.strokeSettings.strokeColor = setting.strokeColor;
1495
+ }
1496
+ if (setting.fillColor) {
1497
+ this.activeObj.strokeSettings.fillColor = setting.fillColor;
1498
+ }
1499
+ if (setting.strokeWidth) {
1500
+ this.activeObj.strokeSettings.strokeWidth = setting.strokeWidth;
1501
+ }
1502
+ if (setting.index) {
1503
+ this.activeObj.order = setting.index;
1504
+ }
1505
+ if (setting.type === 'FreehandDraw' && setting.strokeWidth) {
1506
+ this.notify('freehand-draw', { prop: 'setPenStrokeWidth', onPropertyChange: false, value: { value: setting.strokeWidth } });
1507
+ }
1508
+ }
1509
+ else {
1510
+ if (setting.type.toLowerCase() === 'text' && (this.textArea.style.display === 'block' ||
1511
+ this.textArea.style.display === 'inline-block')) {
1512
+ this.okBtn(null, true);
1513
+ isTextArea = true;
1514
+ }
1515
+ this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: setting.id, obj: obj } });
1516
+ this.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: freehandObj } });
1517
+ if (obj['isSelected']) {
1518
+ var tempFontSize = this.activeObj.textSettings.fontSize;
1519
+ this.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
1520
+ value: { shapeSettings: setting } });
1521
+ if (this.activeObj.shape === 'text' && tempFontSize) {
1522
+ var diff = this.activeObj.textSettings.fontSize - tempFontSize;
1523
+ if (diff !== 0) {
1524
+ this.activeObj.activePoint.height += diff;
1525
+ this.activeObj.activePoint.startY -= (diff / 2);
1526
+ this.activeObj.activePoint.endY += (diff / 2);
1527
+ this.notify('draw', { prop: 'updateActiveObject', onPropertyChange: false, value: { actPoint: this.activeObj.activePoint, obj: this.activeObj,
1528
+ isMouseMove: null, x: null, y: null } });
1529
+ }
1530
+ }
1531
+ var activeObj = extend({}, this.activeObj, {}, true);
1532
+ this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
1533
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: null } });
1534
+ this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
1535
+ if (activeObj.shape) {
1536
+ this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: activeObj } });
1537
+ }
1538
+ if (this.activeObj.shape === 'text') {
1539
+ this.notify('toolbar', { prop: 'editText', onPropertyChange: false });
1540
+ }
1541
+ if (freehandObj['bool']) {
1542
+ this.notify('undo-redo', { prop: 'setPreventUR', value: { bool: true } });
1543
+ }
1544
+ this.okBtn(isSelected, true);
1545
+ if (freehandObj['bool']) {
1546
+ this.notify('undo-redo', { prop: 'setPreventUR', value: { bool: false } });
1547
+ }
1548
+ this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
1549
+ this.editCompleteArgs = { action: 'shape-update', currentShapeSettings: setting };
1550
+ this.editCompleted('shape-customize');
1551
+ if (isTextArea) {
1552
+ this.enableTextEditing();
1553
+ }
1554
+ if (isSelected) {
1555
+ this.noRedact = true;
1556
+ this.selectShape(setting.id);
1557
+ }
1558
+ }
1559
+ }
1560
+ return obj['isSelected'];
1561
+ };
1391
1562
  /**
1392
1563
  * Select a shape based on the given shape id.
1393
1564
  * Use 'getShapeSettings' method to get the shape id which is then passed to perform selection.
@@ -1402,7 +1573,8 @@ var ImageEditor = /** @class */ (function (_super) {
1402
1573
  this.applyShapes();
1403
1574
  var obj = { isSelected: false };
1404
1575
  this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: id, obj: obj } });
1405
- this.notify('draw', { prop: 'redrawDownScale' });
1576
+ this.editCompleted('shape-select');
1577
+ this.noRedact = false;
1406
1578
  return obj['isSelected'];
1407
1579
  };
1408
1580
  /**
@@ -1416,9 +1588,14 @@ var ImageEditor = /** @class */ (function (_super) {
1416
1588
  *
1417
1589
  */
1418
1590
  ImageEditor.prototype.deleteShape = function (id) {
1591
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1592
+ var shape = this.getShapeSetting(id);
1593
+ if (shape.type === 'Redact') {
1594
+ return;
1595
+ }
1419
1596
  this.applyShapes();
1420
1597
  this.notify('shape', { prop: 'deleteShape', onPropertyChange: false, value: { id: id } });
1421
- this.notify('draw', { prop: 'redrawDownScale' });
1598
+ this.editCompleted('shape-delete');
1422
1599
  };
1423
1600
  /**
1424
1601
  * Get particular shapes details based on id of the shape which is drawn on an image editor.
@@ -1448,7 +1625,92 @@ var ImageEditor = /** @class */ (function (_super) {
1448
1625
  var obj = { shapeDetailsColl: [] };
1449
1626
  this.notify('shape', { prop: 'getShapeSettings', onPropertyChange: false, value: { obj: obj } });
1450
1627
  this.notify('draw', { prop: 'redrawDownScale' });
1451
- return obj['shapeDetailsColl'];
1628
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1629
+ return obj.shapeDetailsColl.filter(function (item) { return item.type !== 'redact'; });
1630
+ };
1631
+ /**
1632
+ * Get all the shapes details which is drawn on an image editor.
1633
+ *
1634
+ * @returns {RedactSettings[]}.
1635
+ */
1636
+ ImageEditor.prototype.getRedacts = function () {
1637
+ this.applyShapes();
1638
+ var obj = { shapeDetailsColl: [] };
1639
+ this.notify('shape', { prop: 'getRedactSettings', onPropertyChange: false, value: { obj: obj } });
1640
+ this.notify('draw', { prop: 'redrawDownScale' });
1641
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1642
+ return obj.shapeDetailsColl.filter(function (item) { return item.type !== 'redact'; });
1643
+ };
1644
+ /**
1645
+ * Select a redaction based on the given redaction id.
1646
+ * Use 'getRedacts' method to get the shape id which is then passed to perform selection.
1647
+ *
1648
+ *
1649
+ * @param {string} id - Specifies the shape id to select a redact on an image.
1650
+ * @returns {boolean}.
1651
+ *
1652
+ */
1653
+ ImageEditor.prototype.selectRedact = function (id) {
1654
+ this.applyShapes();
1655
+ var obj = { isSelected: false };
1656
+ this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: id, obj: obj } });
1657
+ this.editCompleted('redact-select');
1658
+ this.noRedact = false;
1659
+ return obj['isSelected'];
1660
+ };
1661
+ /**
1662
+ * Deletes a redaction based on the given shape id.
1663
+ * Use 'getRedacts' method to get the redaaction id which is then passed to perform deletion.
1664
+ *
1665
+ *
1666
+ * @param {string} id - Specifies the redaction id to delete the redaction on an image.
1667
+ * @returns {void}.
1668
+ *
1669
+ */
1670
+ ImageEditor.prototype.deleteRedact = function (id) {
1671
+ this.applyShapes();
1672
+ this.notify('shape', { prop: 'deleteShape', onPropertyChange: false, value: { id: id } });
1673
+ this.editCompleted('redact-delete');
1674
+ };
1675
+ /**
1676
+ * This method is used to update the existing redacts by changing its height, width, blur, and pixel size in the component.
1677
+ * Use 'getRedacts' method to get the redacts which is then passed to change the options of a redacts.
1678
+ *
1679
+ * @param {RedactSettings} setting - Specifies the redact settings to be updated for the shape on an image.
1680
+ * @param {boolean} isSelected - Specifies to show the redacts in the selected state.
1681
+ * @returns {boolean}.
1682
+ *
1683
+ */
1684
+ ImageEditor.prototype.updateRedact = function (setting, isSelected) {
1685
+ this.applyShapes();
1686
+ var obj = { isSelected: false };
1687
+ this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: setting.id, obj: obj } });
1688
+ if (obj['isSelected']) {
1689
+ this.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
1690
+ value: { shapeSettings: setting } });
1691
+ if (setting.blurIntensity) {
1692
+ this.activeObj.redactBlur = setting.blurIntensity;
1693
+ }
1694
+ if (setting.pixelSize) {
1695
+ this.activeObj.redactPixelate = setting.pixelSize;
1696
+ }
1697
+ this.activeObj.redactType = setting.type.toLowerCase() === 'blur' ? 'blur' : 'pixelate';
1698
+ var activeObj = extend({}, this.activeObj, {}, true);
1699
+ this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
1700
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: null } });
1701
+ this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
1702
+ if (activeObj.shape) {
1703
+ this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: activeObj } });
1704
+ }
1705
+ this.okBtn(isSelected, true);
1706
+ this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
1707
+ this.editCompleteArgs = { action: 'redact-update', currentShapeSettings: setting };
1708
+ this.editCompleted('redact-customize');
1709
+ if (isSelected) {
1710
+ this.selectRedact(setting.id);
1711
+ }
1712
+ }
1713
+ return obj['isSelected'];
1452
1714
  };
1453
1715
  /**
1454
1716
  * To refresh the Canvas Wrapper.
@@ -1474,7 +1736,8 @@ var ImageEditor = /** @class */ (function (_super) {
1474
1736
  if (!this.disabled && this.isImageLoaded) {
1475
1737
  this.applyShapes();
1476
1738
  this.notify('filter', { prop: 'finetuneImage', value: { value: value, option: finetuneOption } });
1477
- this.notify('draw', { prop: 'redrawDownScale' });
1739
+ this.editCompleteArgs = { finetune: finetuneOption, value: value };
1740
+ this.editCompleted('fine-tune');
1478
1741
  }
1479
1742
  };
1480
1743
  /**
@@ -1490,7 +1753,8 @@ var ImageEditor = /** @class */ (function (_super) {
1490
1753
  if (!this.disabled && this.isImageLoaded) {
1491
1754
  this.applyShapes();
1492
1755
  this.notify('filter', { prop: 'applyImageFilter', value: { option: filterOption.toString() } });
1493
- this.notify('draw', { prop: 'redrawDownScale' });
1756
+ this.editCompleteArgs = { filter: filterOption };
1757
+ this.editCompleted('filter');
1494
1758
  this.canvasFilter = this.lowerContext.filter;
1495
1759
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
1496
1760
  }
@@ -1660,88 +1924,6 @@ var ImageEditor = /** @class */ (function (_super) {
1660
1924
  }
1661
1925
  return isStraightened;
1662
1926
  };
1663
- /**
1664
- * This method is used to update the existing shapes by changing its height, width, color, and font styles in the component.
1665
- * Use 'getShapeSettings' method to get the shape which is then passed to change the options of a shape.
1666
- * {% codeBlock src='image-editor/updateShape/index.md' %}{% endcodeBlock %}
1667
- *
1668
- * @param {ShapeSettings} setting - Specifies the shape settings to be updated for the shape on an image.
1669
- * @param {boolean} isSelected - Specifies to show the shape in the selected state.
1670
- * @returns {boolean}.
1671
- *
1672
- */
1673
- ImageEditor.prototype.updateShape = function (setting, isSelected) {
1674
- var obj = { isSelected: false };
1675
- var isTextArea = false;
1676
- var freehandObj = { bool: false };
1677
- if (isNullOrUndefined(setting.id)) {
1678
- if (setting.strokeColor) {
1679
- this.activeObj.strokeSettings.strokeColor = setting.strokeColor;
1680
- }
1681
- if (setting.fillColor) {
1682
- this.activeObj.strokeSettings.fillColor = setting.fillColor;
1683
- }
1684
- if (setting.strokeWidth) {
1685
- this.activeObj.strokeSettings.strokeWidth = setting.strokeWidth;
1686
- }
1687
- if (setting.index) {
1688
- this.activeObj.order = setting.index;
1689
- }
1690
- if (setting.type === 'FreehandDraw' && setting.strokeWidth) {
1691
- this.notify('freehand-draw', { prop: 'setPenStrokeWidth', onPropertyChange: false, value: { value: setting.strokeWidth } });
1692
- }
1693
- }
1694
- else {
1695
- if (setting.type.toLowerCase() === 'text' && (this.textArea.style.display === 'block' ||
1696
- this.textArea.style.display === 'inline-block')) {
1697
- this.okBtn(null, true);
1698
- isTextArea = true;
1699
- }
1700
- this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: setting.id, obj: obj } });
1701
- this.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: freehandObj } });
1702
- if (obj['isSelected']) {
1703
- var tempFontSize = this.activeObj.textSettings.fontSize;
1704
- this.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
1705
- value: { shapeSettings: setting } });
1706
- if (this.activeObj.shape === 'text' && tempFontSize) {
1707
- var diff = this.activeObj.textSettings.fontSize - tempFontSize;
1708
- if (diff !== 0) {
1709
- this.activeObj.activePoint.height += diff;
1710
- this.activeObj.activePoint.startY -= (diff / 2);
1711
- this.activeObj.activePoint.endY += (diff / 2);
1712
- this.notify('draw', { prop: 'updateActiveObject', onPropertyChange: false, value: { actPoint: this.activeObj.activePoint, obj: this.activeObj,
1713
- isMouseMove: null, x: null, y: null } });
1714
- }
1715
- }
1716
- var activeObj = extend({}, this.activeObj, {}, true);
1717
- this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
1718
- this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: null } });
1719
- this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
1720
- if (activeObj.shape) {
1721
- this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: activeObj } });
1722
- }
1723
- if (this.activeObj.shape === 'text') {
1724
- this.notify('toolbar', { prop: 'editText', onPropertyChange: false });
1725
- }
1726
- if (freehandObj['bool']) {
1727
- this.notify('undo-redo', { prop: 'setPreventUR', value: { bool: true } });
1728
- }
1729
- this.okBtn(isSelected, true);
1730
- if (freehandObj['bool']) {
1731
- this.notify('undo-redo', { prop: 'setPreventUR', value: { bool: false } });
1732
- }
1733
- this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
1734
- this.notify('draw', { prop: 'redrawDownScale' });
1735
- if (isTextArea) {
1736
- this.enableTextEditing();
1737
- }
1738
- if (isSelected) {
1739
- this.selectShape(setting.id);
1740
- }
1741
- }
1742
- }
1743
- return obj['isSelected'];
1744
- };
1745
1927
  /**
1746
1928
  * Duplicates a shape based on the given shape ID in the ImageEditor.
1747
1929
  * Use 'getShapeSettings' method to get the shape and then pass a shapeId from the returned shape to clone a shape.
@@ -1788,6 +1970,7 @@ var ImageEditor = /** @class */ (function (_super) {
1788
1970
  this.noPushUndo = true;
1789
1971
  this.okBtn();
1790
1972
  this.noPushUndo = false;
1973
+ this.noRedact = true;
1791
1974
  this.selectShape(activeObj.currIndex);
1792
1975
  activeObj.order = this.activeObj.order;
1793
1976
  }
@@ -1844,8 +2027,14 @@ var ImageEditor = /** @class */ (function (_super) {
1844
2027
  * This method applies the actions performed after enabling annotation drawings, ensuring that the drawn annotations are applied to the image.
1845
2028
  */
1846
2029
  ImageEditor.prototype.apply = function () {
1847
- this.closeOverlayTbar();
1848
- this.okBtn(null, true);
2030
+ if (this.isMaskImage) {
2031
+ this.discard();
2032
+ }
2033
+ else {
2034
+ this.updateColl('reset');
2035
+ this.closeOverlayTbar();
2036
+ this.okBtn(null, true);
2037
+ }
1849
2038
  };
1850
2039
  /**
1851
2040
  * Discards the operations performed in the Image Editor, such as annotation drawings.
@@ -1855,6 +2044,7 @@ var ImageEditor = /** @class */ (function (_super) {
1855
2044
  * This method discards the actions performed after enabling annotation drawings, ensuring that the drawn annotations are not applied to the image.
1856
2045
  */
1857
2046
  ImageEditor.prototype.discard = function () {
2047
+ this.updateColl('reset');
1858
2048
  this.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: this.closeOverlayTbar(), isFinalCancel: true } });
1859
2049
  };
1860
2050
  /**
@@ -1888,6 +2078,10 @@ var ImageEditor = /** @class */ (function (_super) {
1888
2078
  this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
1889
2079
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
1890
2080
  }
2081
+ else if (this.currObjType.shape === 'redact') {
2082
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'redact',
2083
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
2084
+ }
1891
2085
  else {
1892
2086
  this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
1893
2087
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
@@ -1907,6 +2101,7 @@ var ImageEditor = /** @class */ (function (_super) {
1907
2101
  *
1908
2102
  */
1909
2103
  ImageEditor.prototype.bringToFront = function (shapeId) {
2104
+ this.noRedact = true;
1910
2105
  if (this.selectShape(shapeId)) {
1911
2106
  this.updateShapeOrder(shapeId, 'bringToFront');
1912
2107
  this.apply();
@@ -1921,6 +2116,7 @@ var ImageEditor = /** @class */ (function (_super) {
1921
2116
  *
1922
2117
  */
1923
2118
  ImageEditor.prototype.bringForward = function (shapeId) {
2119
+ this.noRedact = true;
1924
2120
  if (this.selectShape(shapeId)) {
1925
2121
  this.updateShapeOrder(shapeId, 'bringForward');
1926
2122
  this.apply();
@@ -1935,6 +2131,7 @@ var ImageEditor = /** @class */ (function (_super) {
1935
2131
  *
1936
2132
  */
1937
2133
  ImageEditor.prototype.sendToBack = function (shapeId) {
2134
+ this.noRedact = true;
1938
2135
  if (this.selectShape(shapeId)) {
1939
2136
  this.updateShapeOrder(shapeId, 'sendToBack');
1940
2137
  this.apply();
@@ -1949,6 +2146,7 @@ var ImageEditor = /** @class */ (function (_super) {
1949
2146
  *
1950
2147
  */
1951
2148
  ImageEditor.prototype.sendBackward = function (shapeId) {
2149
+ this.noRedact = true;
1952
2150
  if (this.selectShape(shapeId)) {
1953
2151
  this.updateShapeOrder(shapeId, 'sendBackward');
1954
2152
  this.apply();
@@ -1978,7 +2176,291 @@ var ImageEditor = /** @class */ (function (_super) {
1978
2176
  dropArea.style.display = 'block';
1979
2177
  }
1980
2178
  };
2179
+ // AI related codes
2180
+ /**
2181
+ * Enables overlay drawing to erase objects in an image editor. The eraser tool assists in selecting the mask image.
2182
+ *
2183
+ * @remarks
2184
+ * The selection UI is based on the 'theme' property.
2185
+ *
2186
+ * @param {number} strokeWidth - Specifies the stroke width of the drawing.
2187
+ * @param {string} color - Specifies the color of the drawing.
2188
+ * @hidden
2189
+ * @returns {void}.
2190
+ *
2191
+ */
2192
+ ImageEditor.prototype.selectMaskImage = function (strokeWidth, color) {
2193
+ strokeWidth = strokeWidth ? strokeWidth : 10;
2194
+ color = color ? color : '#512da880';
2195
+ this.applyShapes();
2196
+ this.isMaskImage = true;
2197
+ this.updateColl('empty');
2198
+ this.enableDisableToolbar(true);
2199
+ this.update();
2200
+ this.activeObj.strokeSettings.strokeWidth = strokeWidth;
2201
+ this.notify('freehand-draw', { prop: 'setPenStrokeWidth', onPropertyChange: false, value: { value: strokeWidth } });
2202
+ this.activeObj.strokeSettings.strokeColor = color;
2203
+ this.notify('freehand-draw', { prop: 'freeHandDraw', onPropertyChange: false, value: { value: true } });
2204
+ this.maskCanvas.style.display = 'block';
2205
+ };
2206
+ ImageEditor.prototype.enableDisableToolbar = function (value) {
2207
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2208
+ var toolbar;
2209
+ var elem = document.getElementById(this.element.id + '_toolbar');
2210
+ if (elem) {
2211
+ toolbar = getComponent(elem, 'toolbar');
2212
+ if (toolbar) {
2213
+ toolbar.disable(value);
2214
+ }
2215
+ }
2216
+ elem = document.getElementById(this.element.id + '_bottomToolbar');
2217
+ if (elem) {
2218
+ toolbar = getComponent(elem, 'toolbar');
2219
+ if (toolbar) {
2220
+ toolbar.disable(value);
2221
+ }
2222
+ }
2223
+ };
2224
+ ImageEditor.prototype.updateImage = function (data, imageBackgroundColor) {
2225
+ var _this = this;
2226
+ if (data || imageBackgroundColor || imageBackgroundColor === '') {
2227
+ var prevCropObj_1 = extend({}, this.cropObj, {}, true);
2228
+ var object = { currObj: {} };
2229
+ this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
2230
+ var prevObj_1 = object['currObj'];
2231
+ prevObj_1.objColl = extend([], this.objColl, [], true);
2232
+ prevObj_1.pointColl = extend([], this.pointColl, [], true);
2233
+ prevObj_1.afterCropActions = extend([], this.afterCropActions, [], true);
2234
+ var selPointCollObj = { selPointColl: null };
2235
+ this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false, value: { obj: selPointCollObj } });
2236
+ prevObj_1.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
2237
+ if (data) {
2238
+ this.isImageUpdated = true;
2239
+ if (typeof (data) !== 'string') {
2240
+ var canvas = this.createElement('canvas');
2241
+ canvas.width = data.width;
2242
+ canvas.height = data.height;
2243
+ canvas.getContext('2d').putImageData(data, 0, 0);
2244
+ data = canvas.toDataURL();
2245
+ }
2246
+ this.baseImg.src = data;
2247
+ setTimeout(function () {
2248
+ if (_this.cropObj.straighten !== 0) {
2249
+ _this.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: 'crop-' + 'custom' } });
2250
+ _this.noPushUndo = true;
2251
+ _this.crop();
2252
+ _this.noPushUndo = false;
2253
+ }
2254
+ else {
2255
+ _this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
2256
+ }
2257
+ _this.isImageUpdated = false;
2258
+ if (!imageBackgroundColor) {
2259
+ _this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false, value: { operation: 'updateImage', previousObj: prevObj_1,
2260
+ previousObjColl: prevObj_1.objColl, previousPointColl: prevObj_1.pointColl,
2261
+ previousSelPointColl: prevObj_1.selPointColl, previousCropObj: prevCropObj_1,
2262
+ previousText: null, currentText: null, previousFilter: null, isCircleCrop: null
2263
+ } });
2264
+ _this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
2265
+ }
2266
+ }, 100);
2267
+ }
2268
+ if (imageBackgroundColor || imageBackgroundColor === '') {
2269
+ this.notify('draw', { prop: 'imageBackgroundColor', onPropertyChange: false, value: { color: imageBackgroundColor } });
2270
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
2271
+ if (!data) {
2272
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false, value: { operation: 'bgColor', previousObj: prevObj_1,
2273
+ previousObjColl: prevObj_1.objColl, previousPointColl: prevObj_1.pointColl, previousSelPointColl: prevObj_1.selPointColl,
2274
+ previousCropObj: prevCropObj_1, previousText: null, currentText: null, previousFilter: null, isCircleCrop: null
2275
+ } });
2276
+ this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
2277
+ }
2278
+ }
2279
+ if (data && imageBackgroundColor) {
2280
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false, value: { operation: 'updateImage', previousObj: prevObj_1,
2281
+ previousObjColl: prevObj_1.objColl, previousPointColl: prevObj_1.pointColl, previousSelPointColl: prevObj_1.selPointColl,
2282
+ previousCropObj: prevCropObj_1, previousText: null, currentText: null, previousFilter: null, isCircleCrop: null
2283
+ } });
2284
+ this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
2285
+ }
2286
+ }
2287
+ };
2288
+ ImageEditor.prototype.editCompleted = function (type) {
2289
+ this.notify('draw', { prop: 'redrawDownScale' });
2290
+ var actionArgs = { action: type ? type : 'shape-insert',
2291
+ actionEventArgs: this.editCompleteArgs };
2292
+ this.triggerEditCompleteEvent(actionArgs);
2293
+ };
2294
+ ImageEditor.prototype.updateColl = function (type) {
2295
+ if (!this.isMaskImage) {
2296
+ return;
2297
+ }
2298
+ if (type === 'empty') {
2299
+ this.tempToolbarHeight = this.toolbarHeight;
2300
+ this.tempToolbar = this.toolbar ? extend([], this.toolbar, [], true) : null;
2301
+ this.tempObjColl = extend([], this.objColl, [], true);
2302
+ this.tempPointColl = extend([], this.pointColl, [], true);
2303
+ this.tempShapeColl = extend([], this.shapeColl, [], true);
2304
+ this.objColl = [];
2305
+ this.pointColl = [];
2306
+ this.shapeColl = [];
2307
+ this.freehandCounter = 0;
2308
+ this.notify('freehand-draw', { prop: 'setCurrentFreehandDrawIndex',
2309
+ value: { value: 0 } });
2310
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
2311
+ }
2312
+ else if (type === 'reset') {
2313
+ this.objColl = this.tempObjColl;
2314
+ this.pointColl = this.tempPointColl;
2315
+ this.shapeColl = this.tempShapeColl;
2316
+ this.freehandCounter = this.pointColl.length;
2317
+ this.notify('freehand-draw', { prop: 'setCurrentFreehandDrawIndex',
2318
+ value: { value: this.freehandCounter } });
2319
+ this.enableDisableToolbar(false);
2320
+ if (this.cropObj.straighten !== 0) {
2321
+ this.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: 'crop-' + 'custom' } });
2322
+ this.noPushUndo = true;
2323
+ this.crop();
2324
+ this.noPushUndo = false;
2325
+ }
2326
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
2327
+ this.isMaskImage = false;
2328
+ this.upperContext.globalCompositeOperation = 'source-over';
2329
+ this.maskCanvas.style.display = 'none';
2330
+ this.activeObj.strokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null,
2331
+ radius: null, outlineColor: '', outlineWidth: null };
2332
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: this.activeObj.strokeSettings,
2333
+ strokeColor: '#fff', fillColor: '', strokeWidth: null, outlineWidth: null } });
2334
+ this.notify('freehand-draw', { prop: 'setPenStrokeWidth', onPropertyChange: false, value: { value: 2 } });
2335
+ this.notify('freehand-draw', { prop: 'setMasking', onPropertyChange: false, value: { value: false } });
2336
+ }
2337
+ };
1981
2338
  // Toolbar related codes
2339
+ ImageEditor.prototype.resetToolbar = function () {
2340
+ if (this.toolbarHeight !== this.tempToolbarHeight && !((isNullOrUndefined(this.toolbar) ||
2341
+ (this.toolbar && this.toolbar.length > 0)
2342
+ || !isNullOrUndefined(this.toolbarTemplate)))) {
2343
+ this.toolbarHeight = this.tempToolbarHeight;
2344
+ this.notify('toolbar', { prop: 'setToolbarHeight', value: { height: this.toolbarHeight } });
2345
+ this.toolbar = this.tempToolbar;
2346
+ if (!this.toolbarTemplate) {
2347
+ this.notify('toolbar', { prop: 'create-toolbar', onPropertyChange: false });
2348
+ this.notify('toolbar', { prop: 'create-contextual-toolbar', onPropertyChange: false });
2349
+ }
2350
+ this.update();
2351
+ }
2352
+ };
2353
+ ImageEditor.prototype.getData = function (isMaskImage) {
2354
+ if (isMaskImage) {
2355
+ this.resetToolbar();
2356
+ }
2357
+ var objColl = extend([], this.objColl, null, true);
2358
+ var pointColl = extend([], this.pointColl, null, true);
2359
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2360
+ var shapeColl = extend([], this.shapeColl, null, true);
2361
+ if (isMaskImage) {
2362
+ this.notify('shape', { prop: 'updateShapeColl', onPropertyChange: false });
2363
+ for (var i = 0; i < this.freehandCounter; i++) {
2364
+ this.pointColl[i].strokeColor = '#fff';
2365
+ }
2366
+ }
2367
+ else {
2368
+ this.objColl = [];
2369
+ this.pointColl = [];
2370
+ this.shapeColl = [];
2371
+ this.freehandCounter = 0;
2372
+ }
2373
+ var frameType = this.frameObj.type;
2374
+ this.frameObj.type = 'none';
2375
+ var aspectWidth = this.aspectWidth;
2376
+ var aspectHeight = this.aspectHeight;
2377
+ this.aspectWidth = this.aspectHeight = null;
2378
+ var straighten = this.cropObj.straighten;
2379
+ this.togglePen = false;
2380
+ this.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: 'crop-' + 'custom' } });
2381
+ var tempDestPoints = extend({}, this.img, {}, true);
2382
+ var tempCropObj = extend({}, this.cropObj, {}, true);
2383
+ var tempSel = extend({}, this.activeObj, {}, true);
2384
+ var tempTransform = extend({}, this.transform, {}, true);
2385
+ var panPoint = extend({}, this.panPoint, {}, true);
2386
+ if (straighten !== 0) {
2387
+ this.setStraighten(0);
2388
+ }
2389
+ var point = this.activeObj.activePoint;
2390
+ point.startX = this.img.destLeft;
2391
+ point.startY = this.img.destTop;
2392
+ point.width = this.img.destWidth;
2393
+ point.height = this.img.destHeight;
2394
+ point.endX = point.startX + point.width;
2395
+ point.endY = point.startY + point.height;
2396
+ this.notify('draw', { prop: 'updateActiveObject', onPropertyChange: false, value: { actPoint: point, obj: this.activeObj,
2397
+ isMouseMove: null, x: null, y: null } });
2398
+ this.noPushUndo = true;
2399
+ this.crop();
2400
+ this.noPushUndo = false;
2401
+ this.isCropTab = false;
2402
+ this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
2403
+ this.notify('crop', { prop: 'resetZoom', onPropertyChange: false });
2404
+ this.isCropTab = true;
2405
+ var afterCropActions = extend([], this.afterCropActions, [], true);
2406
+ var coll = extend([], this.rotateFlipColl, [], true);
2407
+ this.notify('crop', { prop: 'revertTransform', value: { type: 'initial', coll: coll } });
2408
+ var imageData = this.getImageData();
2409
+ if (isMaskImage) {
2410
+ var canvas = this.createElement('canvas');
2411
+ var ctx = canvas.getContext('2d');
2412
+ canvas.width = imageData.width;
2413
+ canvas.height = imageData.height;
2414
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
2415
+ if (this.pointColl.length > 0) {
2416
+ var obj = { width: 0, height: 0 };
2417
+ this.notify('crop', { prop: 'calcRatio', onPropertyChange: false,
2418
+ value: { obj: obj, dimension: { width: canvas.width, height: canvas.height } } });
2419
+ var ratio = obj;
2420
+ this.notify('export', { prop: 'drawAnnotation', value: { context: ctx, ratio: ratio } });
2421
+ }
2422
+ this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
2423
+ imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
2424
+ }
2425
+ this.notify('crop', { prop: 'revertTransform', value: { type: 'reverse', coll: coll } });
2426
+ this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
2427
+ this.afterCropActions = afterCropActions;
2428
+ if (!isMaskImage) {
2429
+ this.objColl = objColl;
2430
+ this.pointColl = pointColl;
2431
+ this.shapeColl = shapeColl;
2432
+ this.freehandCounter = this.pointColl.length;
2433
+ }
2434
+ this.frameObj.type = frameType;
2435
+ this.aspectWidth = aspectWidth;
2436
+ this.aspectHeight = aspectHeight;
2437
+ this.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: 'crop-' + 'custom' } });
2438
+ if (straighten !== 0) {
2439
+ this.setStraighten(straighten);
2440
+ }
2441
+ this.img = tempDestPoints;
2442
+ this.cropObj = tempCropObj;
2443
+ this.activeObj = tempSel;
2444
+ this.transform = tempTransform;
2445
+ this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
2446
+ value: { zoomFactor: 0.1, zoomPoint: null, isResize: null } });
2447
+ this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
2448
+ value: { zoomFactor: -0.1, zoomPoint: null, isResize: null } });
2449
+ if (this.transform.degree !== 0) {
2450
+ this.panPoint.currentPannedPoint = { x: panPoint.totalPannedClientPoint.x,
2451
+ y: panPoint.totalPannedClientPoint.y };
2452
+ this.notify('transform', { prop: 'drawPannedImage', value: { xDiff: panPoint.totalPannedClientPoint.x,
2453
+ yDiff: panPoint.totalPannedClientPoint.y } });
2454
+ this.panPoint.currentPannedPoint = { x: 0, y: 0 };
2455
+ this.notify('transform', { prop: 'setTempPanMove', value: { point: null } });
2456
+ }
2457
+ this.noPushUndo = true;
2458
+ this.crop();
2459
+ this.noPushUndo = false;
2460
+ this.transform.straighten = 0;
2461
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
2462
+ return imageData;
2463
+ };
1982
2464
  ImageEditor.prototype.applyShapes = function () {
1983
2465
  if (this.isUndoRedoStack) {
1984
2466
  return;
@@ -2248,12 +2730,16 @@ var ImageEditor = /** @class */ (function (_super) {
2248
2730
  shapeSettings.type = ShapeType.FreehandDraw;
2249
2731
  }
2250
2732
  var shapeChangedArgs = { action: 'apply', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2251
- if (isFinalApply || this.isShapeDrawing) {
2733
+ if (!this.currObjType.isRedact && (isFinalApply || this.isShapeDrawing)) {
2252
2734
  if (this.isShapeDrawing) {
2253
2735
  shapeChangedArgs.action = 'draw-end';
2254
2736
  }
2255
2737
  this.trigger('shapeChange', shapeChangedArgs);
2256
2738
  }
2739
+ this.editCompleteArgs = shapeChangedArgs;
2740
+ if (this.currObjType.isRedact) {
2741
+ this.currObjType.isRedact = false;
2742
+ }
2257
2743
  }
2258
2744
  if (aspectIcon || nonAspectIcon) {
2259
2745
  var obj_2 = { width: null, height: null };
@@ -2329,7 +2815,12 @@ var ImageEditor = /** @class */ (function (_super) {
2329
2815
  }
2330
2816
  else if (this.togglePen) {
2331
2817
  this.freeHandDraw(false);
2332
- this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
2818
+ if (!this.isMaskImage) {
2819
+ var widthObj = { penStrokeWidth: null };
2820
+ this.notify('freehand-draw', { prop: 'getPenStrokeWidth', onPropertyChange: false, value: { obj: widthObj } });
2821
+ this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
2822
+ this.notify('freehand-draw', { prop: 'setPenStrokeWidth', onPropertyChange: false, value: { value: widthObj['penStrokeWidth'] } });
2823
+ }
2333
2824
  this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
2334
2825
  this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
2335
2826
  }
@@ -2344,13 +2835,12 @@ var ImageEditor = /** @class */ (function (_super) {
2344
2835
  this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
2345
2836
  this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
2346
2837
  }
2347
- else if (sliderWrap || this.currObjType.isFiltered) {
2838
+ else if ((sliderWrap || this.currObjType.isFiltered) && !this.drawingShape && this.activeObj.shape !== 'redact') {
2348
2839
  this.initialAdjustmentValue = this.canvasFilter = this.lowerContext.filter;
2349
2840
  this.currObjType.isFiltered = false;
2350
2841
  var obj_4 = { value: null };
2351
2842
  this.notify('draw', { prop: 'getTempAdjustmentValue', value: { obj: obj_4 } });
2352
- if (obj_4['value'] !== this.lowerContext.filter && (!sliderWrap ||
2353
- !sliderWrap.classList.contains('e-ie-finetune-slider-wrap'))) {
2843
+ if (!sliderWrap || sliderWrap.parentElement.previousElementSibling.textContent !== 'Opacity') {
2354
2844
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
2355
2845
  }
2356
2846
  if ((this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) ||
@@ -2383,6 +2873,17 @@ var ImageEditor = /** @class */ (function (_super) {
2383
2873
  previousFilter: null, isCircleCrop: null
2384
2874
  } });
2385
2875
  this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
2876
+ var currFrameSettings = { type: this.toPascalCase(this.frameObj.type),
2877
+ color: this.frameObj.color, gradientColor: this.frameObj.gradientColor, size: this.frameObj.size,
2878
+ inset: this.frameObj.inset, offset: this.frameObj.offset, borderRadius: this.frameObj.radius,
2879
+ frameLineStyle: this.toPascalCase(this.frameObj.border), lineCount: this.frameObj.amount };
2880
+ var prevFrameSettings = { type: this.toPascalCase(this.tempFrameObj.type),
2881
+ color: this.tempFrameObj.color, gradientColor: this.tempFrameObj.gradientColor, size: this.tempFrameObj.size,
2882
+ inset: this.tempFrameObj.inset, offset: this.tempFrameObj.offset, borderRadius: this.tempFrameObj.radius,
2883
+ frameLineStyle: this.toPascalCase(this.tempFrameObj.border), lineCount: this.tempFrameObj.amount };
2884
+ var frameChange = { cancel: false, previousFrameSetting: prevFrameSettings,
2885
+ currentFrameSetting: currFrameSettings };
2886
+ this.editCompleteArgs = frameChange;
2386
2887
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
2387
2888
  this.tempFrameObj = extend({}, this.frameObj, {}, true);
2388
2889
  }
@@ -2391,19 +2892,29 @@ var ImageEditor = /** @class */ (function (_super) {
2391
2892
  if (!obj['isCropToolbar']) {
2392
2893
  this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
2393
2894
  isApplyBtn: false, isCropping: null, isZooming: null, cType: null } });
2895
+ this.currObjType.isRedact = false;
2394
2896
  }
2395
2897
  this.notify('draw', { prop: 'setNewPath', value: { bool: false } });
2396
2898
  this.transform.zoomFactor = this.transform.defaultZoomFactor;
2397
2899
  this.notify('selection', { prop: 'setCurrentDrawingShape', onPropertyChange: false, value: { value: '' } });
2398
2900
  this.isResizeOkBtn = false;
2399
2901
  this.notify('draw', { prop: 'redrawDownScale' });
2400
- this.isChangesSaved = false;
2902
+ this.isChangesSaved = this.isFinetuneBtnClick = false;
2401
2903
  if (isFinalApply) {
2402
2904
  this.drawingShape = null;
2403
2905
  this.notify('draw', { prop: 'resetTempObjColl' });
2404
2906
  this.notify('draw', { prop: 'resetTempPointColl' });
2405
2907
  }
2406
2908
  };
2909
+ ImageEditor.prototype.triggerEditCompleteEvent = function (args) {
2910
+ if (args.action === 'shape-insert' && args.actionEventArgs &&
2911
+ args.actionEventArgs.currentShapeSettings &&
2912
+ args.actionEventArgs.currentShapeSettings.type.toString() === 'Redact') {
2913
+ args.action = 'redact';
2914
+ }
2915
+ this.trigger('editComplete', args);
2916
+ this.editCompleteArgs = null;
2917
+ };
2407
2918
  /**
2408
2919
  * Handles the OK button operation
2409
2920
  *
@@ -2511,6 +3022,7 @@ var ImageEditor = /** @class */ (function (_super) {
2511
3022
  ImageEditor.prototype.setCurrAdjustmentValue = function (type, value) {
2512
3023
  var finetuneValueChanging = { finetune: this.getFinetuneOption(type), value: value, cancel: false };
2513
3024
  this.trigger('finetuneValueChanging', finetuneValueChanging);
3025
+ this.editCompleteArgs = finetuneValueChanging;
2514
3026
  if (finetuneValueChanging.cancel) {
2515
3027
  return;
2516
3028
  }
@@ -2630,9 +3142,9 @@ var ImageEditor = /** @class */ (function (_super) {
2630
3142
  toolbar_2.refreshOverflow();
2631
3143
  }
2632
3144
  }
2633
- // eslint-disable-next-line max-len
2634
3145
  var shapeChangedArgs = { action: type, currentShapeSettings: extend({}, shapeSettings, {}, true) };
2635
3146
  this.trigger('shapeChange', shapeChangedArgs);
3147
+ this.editCompleteArgs = shapeChangedArgs;
2636
3148
  };
2637
3149
  /**
2638
3150
  * Apply Font style for text.
@@ -2715,6 +3227,7 @@ var ImageEditor = /** @class */ (function (_super) {
2715
3227
  var shapeChangedArgs = { action: 'font-family', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2716
3228
  shapeChangedArgs.currentShapeSettings.fontFamily = this.textArea.style.fontFamily;
2717
3229
  this.trigger('shapeChange', shapeChangedArgs);
3230
+ this.editCompleteArgs = shapeChangedArgs;
2718
3231
  };
2719
3232
  /**
2720
3233
  * Apply Font size for text.
@@ -2826,15 +3339,17 @@ var ImageEditor = /** @class */ (function (_super) {
2826
3339
  var shapeChangedArgs = { action: 'font-size', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2827
3340
  shapeChangedArgs.currentShapeSettings.fontSize = this.activeObj.textSettings.fontSize;
2828
3341
  this.trigger('shapeChange', shapeChangedArgs);
3342
+ this.editCompleteArgs = shapeChangedArgs;
2829
3343
  };
2830
3344
  /**
2831
3345
  * Apply Font color for text.
2832
3346
  *
2833
3347
  * @param { string } value - Specifies the selected color item value.
3348
+ * @param { string } color - Specifies the selected color type value.
2834
3349
  * @hidden
2835
3350
  * @returns {void}.
2836
3351
  */
2837
- ImageEditor.prototype.updateFontColor = function (value) {
3352
+ ImageEditor.prototype.updateFontColor = function (value, color) {
2838
3353
  this.notify('selection', { prop: 'setInitialTextEdit', value: { bool: false } });
2839
3354
  var isObjPushed = false;
2840
3355
  var collLength = this.objColl.length;
@@ -2860,12 +3375,19 @@ var ImageEditor = /** @class */ (function (_super) {
2860
3375
  this.objColl.pop();
2861
3376
  }
2862
3377
  if (this.textArea.style.display === 'none') {
2863
- this.activeObj.strokeSettings.strokeColor = value;
2864
- this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null,
2865
- strokeColor: this.activeObj.strokeSettings.strokeColor, fillColor: null, strokeWidth: null } });
3378
+ if (color === 'Text') {
3379
+ this.activeObj.strokeSettings.strokeColor = value;
3380
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null,
3381
+ strokeColor: this.activeObj.strokeSettings.strokeColor, fillColor: null, strokeWidth: null } });
3382
+ }
3383
+ else {
3384
+ this.activeObj.strokeSettings.fillColor = value;
3385
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null,
3386
+ strokeColor: null, fillColor: this.activeObj.strokeSettings.fillColor, strokeWidth: null } });
3387
+ }
2866
3388
  if (!this.togglePen) {
2867
- this.objColl.push(this.activeObj);
2868
3389
  if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
3390
+ this.objColl.push(this.activeObj);
2869
3391
  this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2870
3392
  value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
2871
3393
  previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
@@ -2876,36 +3398,114 @@ var ImageEditor = /** @class */ (function (_super) {
2876
3398
  }
2877
3399
  }
2878
3400
  else if (this.textArea.style.display === 'block' || this.textArea.style.display === 'inline-block') {
2879
- this.textArea.style.color = value;
2880
- var temp = this.activeObj.strokeSettings.strokeColor;
2881
- this.activeObj.strokeSettings.strokeColor = value;
2882
- this.objColl.push(this.activeObj);
3401
+ this.textArea.style[color === 'Text' ? 'color' : 'backgroundColor'] = value;
3402
+ var temp = color === 'Text' ? this.activeObj.strokeSettings.strokeColor : this.activeObj.strokeSettings.fillColor;
3403
+ this.activeObj.strokeSettings[color === 'Text' ? 'strokeColor' : 'fillColor'] = value;
2883
3404
  if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
3405
+ this.objColl.push(this.activeObj);
2884
3406
  this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2885
3407
  value: { operation: 'textAreaCustomization', previousObj: prevObj, previousObjColl: prevObj.objColl,
2886
3408
  previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2887
3409
  previousCropObj: prevCropObj, previousText: null,
2888
3410
  currentText: null, previousFilter: null, isCircleCrop: null } });
3411
+ this.objColl.pop();
2889
3412
  }
2890
- this.objColl.pop();
2891
- this.activeObj.strokeSettings.strokeColor = temp;
3413
+ this.activeObj.strokeSettings[color === 'Text' ? 'strokeColor' : 'fillColor'] = temp;
2892
3414
  }
2893
3415
  else if (!this.togglePen) {
2894
- this.objColl.push(this.activeObj);
2895
3416
  if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
3417
+ this.objColl.push(this.activeObj);
2896
3418
  this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2897
3419
  value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
2898
3420
  previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2899
3421
  previousCropObj: prevCropObj, previousText: null,
2900
3422
  currentText: null, previousFilter: null, isCircleCrop: null } });
3423
+ this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
2901
3424
  }
3425
+ }
3426
+ var shapeChangedArgs = { action: 'font-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
3427
+ shapeChangedArgs.currentShapeSettings.fillColor = value;
3428
+ this.trigger('shapeChange', shapeChangedArgs);
3429
+ this.editCompleteArgs = shapeChangedArgs;
3430
+ };
3431
+ /**
3432
+ * Apply Font color for text.
3433
+ *
3434
+ * @param { string } value - Specifies the selected color item value.
3435
+ * @hidden
3436
+ * @returns {void}.
3437
+ */
3438
+ ImageEditor.prototype.updateStrokeTextColor = function (value) {
3439
+ this.notify('selection', { prop: 'setInitialTextEdit', value: { bool: false } });
3440
+ var isObjPushed = false;
3441
+ var collLength = this.objColl.length;
3442
+ this.notify('shape', { prop: 'pushActItemIntoObj' });
3443
+ if (collLength !== this.objColl.length) {
3444
+ isObjPushed = true;
3445
+ }
3446
+ var prevCropObj = extend({}, this.cropObj, {}, true);
3447
+ var objt = { shapeSettingsObj: {} };
3448
+ this.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: objt } });
3449
+ var shapeSettings = objt['shapeSettingsObj'];
3450
+ var object = { currObj: {} };
3451
+ this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
3452
+ var prevObj = object['currObj'];
3453
+ prevObj.objColl = extend([], this.objColl, [], true);
3454
+ prevObj.pointColl = extend([], this.pointColl, [], true);
3455
+ prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
3456
+ var selPointCollObj = { selPointColl: null };
3457
+ this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
3458
+ value: { obj: selPointCollObj } });
3459
+ prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
3460
+ if (isObjPushed) {
3461
+ this.objColl.pop();
3462
+ }
3463
+ if (this.textArea.style.display === 'none') {
3464
+ this.activeObj.strokeSettings.outlineColor = value;
3465
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null,
3466
+ strokeColor: null, fillColor: null, strokeWidth: null, outlineColor: this.activeObj.strokeSettings.outlineColor } });
3467
+ if (!this.togglePen) {
3468
+ if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
3469
+ this.objColl.push(this.activeObj);
3470
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
3471
+ value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
3472
+ previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
3473
+ previousCropObj: prevCropObj, previousText: null,
3474
+ currentText: null, previousFilter: null, isCircleCrop: null } });
3475
+ this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
3476
+ }
3477
+ }
3478
+ }
3479
+ else if (this.textArea.style.display === 'block' || this.textArea.style.display === 'inline-block') {
3480
+ this.textArea.style.textShadow = "-1px -1px 0 " + value + ", 1px -1px 0 " + value + ", -1px 1px 0 " + value + ", 1px 1px 0 " + value;
3481
+ var temp = this.activeObj.strokeSettings.outlineColor;
3482
+ this.activeObj.strokeSettings.outlineColor = value;
3483
+ if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
3484
+ this.objColl.push(this.activeObj);
3485
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
3486
+ value: { operation: 'textAreaCustomization', previousObj: prevObj, previousObjColl: prevObj.objColl,
3487
+ previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
3488
+ previousCropObj: prevCropObj, previousText: null,
3489
+ currentText: null, previousFilter: null, isCircleCrop: null } });
3490
+ this.objColl.pop();
3491
+ }
3492
+ this.activeObj.strokeSettings.outlineColor = temp;
3493
+ }
3494
+ else if (!this.togglePen) {
2902
3495
  if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
3496
+ this.objColl.push(this.activeObj);
3497
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
3498
+ value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
3499
+ previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
3500
+ previousCropObj: prevCropObj, previousText: null,
3501
+ currentText: null, previousFilter: null, isCircleCrop: null } });
2903
3502
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
2904
3503
  }
2905
3504
  }
2906
3505
  var shapeChangedArgs = { action: 'font-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2907
3506
  shapeChangedArgs.currentShapeSettings.fillColor = value;
2908
3507
  this.trigger('shapeChange', shapeChangedArgs);
3508
+ this.editCompleteArgs = shapeChangedArgs;
2909
3509
  };
2910
3510
  /**
2911
3511
  * Apply Pen stroke width.
@@ -2961,6 +3561,7 @@ var ImageEditor = /** @class */ (function (_super) {
2961
3561
  var shapeChangedArgs = { action: 'stroke-width', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2962
3562
  shapeChangedArgs.currentShapeSettings.strokeWidth = this.activeObj.strokeSettings.strokeWidth;
2963
3563
  this.trigger('shapeChange', shapeChangedArgs);
3564
+ this.editCompleteArgs = shapeChangedArgs;
2964
3565
  };
2965
3566
  /**
2966
3567
  * Apply Pen stroke color.
@@ -3021,15 +3622,18 @@ var ImageEditor = /** @class */ (function (_super) {
3021
3622
  var shapeChangedArgs = { action: 'stroke-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
3022
3623
  shapeChangedArgs.currentShapeSettings.strokeColor = value;
3023
3624
  this.trigger('shapeChange', shapeChangedArgs);
3625
+ this.editCompleteArgs = shapeChangedArgs;
3024
3626
  };
3025
3627
  /**
3026
3628
  * Apply Shape stroke width.
3027
3629
  *
3028
3630
  * @param { string } id - Specifies the selected item id.
3631
+ * @param { string } type - Specifies the type of selected item.
3632
+ * @param { string } shapeType - Specifies the shape type of selected item.
3029
3633
  * @hidden
3030
3634
  * @returns {void}.
3031
3635
  */
3032
- ImageEditor.prototype.updateStrokeWidth = function (id) {
3636
+ ImageEditor.prototype.updateStrokeWidth = function (id, type, shapeType) {
3033
3637
  if (this.activeObj.shape && (this.activeObj.shape !== 'path' || (this.activeObj.shape === 'path' &&
3034
3638
  this.activeObj.pointColl.length > 0))) {
3035
3639
  var obj = { shapeSettingsObj: {} };
@@ -3055,13 +3659,25 @@ var ImageEditor = /** @class */ (function (_super) {
3055
3659
  if (isObjPushed) {
3056
3660
  this.objColl.pop();
3057
3661
  }
3058
- this.activeObj.strokeSettings.strokeWidth = parseInt(id, 10);
3662
+ this.activeObj.strokeSettings[type === 'width' ? (shapeType === 'text' ? 'outlineWidth' : 'strokeWidth') : 'radius'] = parseInt(id, 10);
3059
3663
  if (this.activeObj.shape === 'rectangle' || this.activeObj.shape === 'ellipse') {
3060
- this.activeObj.strokeSettings.strokeWidth = parseInt(id, 10) - 1;
3664
+ this.activeObj.strokeSettings[type === 'width' ? (shapeType === 'text' ? 'outlineWidth' : 'strokeWidth') : 'radius'] = parseInt(id, 10) - 1;
3665
+ }
3666
+ this.activeObj.strokeSettings[type === 'width' ? (shapeType === 'text' ? 'outlineWidth' : 'strokeWidth') : 'radius'] *= 2;
3667
+ if (type === 'width') {
3668
+ if (shapeType === 'text') {
3669
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: null, fillColor: null,
3670
+ strokeWidth: null, radius: null, outlineWidth: this.activeObj.strokeSettings.outlineWidth } });
3671
+ }
3672
+ else {
3673
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: null, fillColor: null,
3674
+ strokeWidth: this.activeObj.strokeSettings.strokeWidth, radius: null, outlineWidth: null } });
3675
+ }
3676
+ }
3677
+ else {
3678
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: null, fillColor: null,
3679
+ strokeWidth: null, radius: this.activeObj.strokeSettings.radius } });
3061
3680
  }
3062
- this.activeObj.strokeSettings.strokeWidth *= 2;
3063
- this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: null, fillColor: null,
3064
- strokeWidth: this.activeObj.strokeSettings.strokeWidth } });
3065
3681
  this.objColl.push(this.activeObj);
3066
3682
  if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
3067
3683
  this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
@@ -3072,15 +3688,28 @@ var ImageEditor = /** @class */ (function (_super) {
3072
3688
  }
3073
3689
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
3074
3690
  var shapeChangedArgs = { action: 'stroke-width', currentShapeSettings: extend({}, shapeSettings, {}, true) };
3075
- shapeChangedArgs.currentShapeSettings.strokeWidth = this.activeObj.strokeSettings.strokeWidth;
3691
+ shapeChangedArgs.currentShapeSettings[type === 'width' ? (shapeType === 'text' ? 'outlineWidth' : 'strokeWidth') : 'radius'] = this.activeObj.strokeSettings[type === 'width' ? (shapeType === 'text' ? 'outlineWidth' : 'strokeWidth') : 'radius'];
3076
3692
  this.trigger('shapeChange', shapeChangedArgs);
3693
+ this.editCompleteArgs = shapeChangedArgs;
3077
3694
  }
3078
3695
  else if (this.activeObj.shape && (this.activeObj.shape === 'path' &&
3079
3696
  this.activeObj.pointColl.length === 0)) {
3080
3697
  this.activeObj.strokeSettings.strokeWidth = parseInt(id, 10);
3081
3698
  this.activeObj.strokeSettings.strokeWidth *= 2;
3082
- this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: null, fillColor: null,
3083
- strokeWidth: this.activeObj.strokeSettings.strokeWidth } });
3699
+ if (type === 'width') {
3700
+ if (shapeType === 'text') {
3701
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: null, fillColor: null,
3702
+ strokeWidth: null, radius: null, outlineWidth: this.activeObj.strokeSettings.outlineWidth } });
3703
+ }
3704
+ else {
3705
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: null, fillColor: null,
3706
+ strokeWidth: this.activeObj.strokeSettings.strokeWidth, radius: null, outlineWidth: null } });
3707
+ }
3708
+ }
3709
+ else {
3710
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: null, fillColor: null,
3711
+ strokeWidth: null, radius: this.activeObj.strokeSettings.radius } });
3712
+ }
3084
3713
  }
3085
3714
  };
3086
3715
  /**
@@ -3138,6 +3767,7 @@ var ImageEditor = /** @class */ (function (_super) {
3138
3767
  var shapeChangedArgs = { action: 'stroke-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
3139
3768
  shapeChangedArgs.currentShapeSettings.strokeColor = value;
3140
3769
  this.trigger('shapeChange', shapeChangedArgs);
3770
+ this.editCompleteArgs = shapeChangedArgs;
3141
3771
  };
3142
3772
  /**
3143
3773
  * Apply Shape fill color.
@@ -3185,6 +3815,7 @@ var ImageEditor = /** @class */ (function (_super) {
3185
3815
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
3186
3816
  var shapeChangedArgs = { action: 'fill-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
3187
3817
  this.trigger('shapeChange', shapeChangedArgs);
3818
+ this.editCompleteArgs = shapeChangedArgs;
3188
3819
  };
3189
3820
  /**
3190
3821
  * Apply horizontal flip.
@@ -3488,8 +4119,11 @@ var ImageEditor = /** @class */ (function (_super) {
3488
4119
  ImageEditor.prototype.setStraighten = function (value) {
3489
4120
  var straightenEventArgs = { cancel: false, previousDegree: this.transform.straighten, currentDegree: value };
3490
4121
  this.trigger('rotating', straightenEventArgs);
4122
+ this.editCompleteArgs = straightenEventArgs;
3491
4123
  if (!straightenEventArgs.cancel) {
3492
4124
  this.performStraighten(straightenEventArgs);
4125
+ var actionArgs = { action: 'straighten', actionEventArgs: this.editCompleteArgs };
4126
+ this.triggerEditCompleteEvent(actionArgs);
3493
4127
  }
3494
4128
  };
3495
4129
  ImageEditor.prototype.duplicateImage = function () {
@@ -3705,9 +4339,36 @@ var ImageEditor = /** @class */ (function (_super) {
3705
4339
  Material3Dark: { primaryColor: '#d0bcff', secondaryColor: '#fff' },
3706
4340
  Fluent2: { primaryColor: '#0f6cbd', secondaryColor: '#fff' },
3707
4341
  Fluent2Dark: { primaryColor: '#115ea3', secondaryColor: '#fff' },
3708
- Fluent2Highcontrast: { primaryColor: '#1aebff', secondaryColor: '#fff' }
4342
+ Fluent2Highcontrast: { primaryColor: '#1aebff', secondaryColor: '#fff' },
4343
+ 'Bootstrap5.3': { primaryColor: '#0d6efd', secondaryColor: '#fff' },
4344
+ 'Bootstrap5.3Dark': { primaryColor: '#0d6efd', secondaryColor: '#fff' }
3709
4345
  };
3710
4346
  };
4347
+ /**
4348
+ * Draw a redaction on an image.
4349
+ *
4350
+ * @param {RedactType} type – Optional. Specifies the type of redaction to be drawn on the image such as blur or pixelate. If not specified, the redaction drawing is initiated with the default blur value.
4351
+ * @param {number} x – Optional. Specifies x-coordinate of redaction. If not specified, the redaction drawing is initiated with the first parameter.
4352
+ * @param {number} y – Optional. Specifies y-coordinate of redaction. If not specified it draws redaction from the center point of the image.
4353
+ * @param {number} width – Optional. Specifies the width of the redaction. The default value is 100.
4354
+ * @param {number} height – Optional. Specifies the height of the redaction. The default value is 50.
4355
+ * @param {number} value – Optional. Specifies the blur value for blur-type redaction or the pixel size for pixelate-type redaction. Defaults to 20 since the default redaction is blur.
4356
+ * @returns {boolean}.
4357
+ */
4358
+ ImageEditor.prototype.drawRedact = function (type, x, y, width, height, value) {
4359
+ var isRedact = false;
4360
+ var isPointsInRange = this.allowShape(x, y);
4361
+ if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
4362
+ isRedact = true;
4363
+ this.notify('shape', {
4364
+ prop: 'drawRedact', onPropertyChange: false, value: {
4365
+ x: x, y: y, width: width, height: height, type: type, value: value
4366
+ }
4367
+ });
4368
+ this.notify('draw', { prop: 'redrawDownScale' });
4369
+ }
4370
+ return isRedact;
4371
+ };
3711
4372
  var ImageEditor_1;
3712
4373
  __decorate([
3713
4374
  Property('')
@@ -3829,6 +4490,9 @@ var ImageEditor = /** @class */ (function (_super) {
3829
4490
  __decorate([
3830
4491
  Event()
3831
4492
  ], ImageEditor.prototype, "frameChange", void 0);
4493
+ __decorate([
4494
+ Event()
4495
+ ], ImageEditor.prototype, "editComplete", void 0);
3832
4496
  ImageEditor = ImageEditor_1 = __decorate([
3833
4497
  NotifyPropertyChanges
3834
4498
  ], ImageEditor);