@syncfusion/ej2-image-editor 26.2.10 → 27.1.48

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 (187) 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 +3207 -732
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +3286 -797
  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 +14 -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 +377 -45
  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 +6 -0
  22. package/src/image-editor/action/selection.js +382 -97
  23. package/src/image-editor/action/shape.d.ts +5 -0
  24. package/src/image-editor/action/shape.js +287 -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 +816 -149
  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 +873 -191
  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
  187. package/hotfix/26.1.35_Vol2.txt +0 -1
@@ -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);
@@ -743,6 +765,9 @@ var ImageEditor = /** @class */ (function (_super) {
743
765
  this.lowerCanvas = canvasWrapper.appendChild(this.createElement('canvas', {
744
766
  id: this.element.id + '_lowerCanvas', attrs: { name: 'canvasImage' }
745
767
  }));
768
+ this.maskCanvas = canvasWrapper.appendChild(this.createElement('canvas', {
769
+ id: this.element.id + '_maskCanvas', attrs: { name: 'canvasImage' }
770
+ }));
746
771
  this.upperCanvas = canvasWrapper.appendChild(this.createElement('canvas', {
747
772
  id: this.element.id + '_upperCanvas', attrs: { name: 'canvasImage' }
748
773
  }));
@@ -767,12 +792,15 @@ var ImageEditor = /** @class */ (function (_super) {
767
792
  uploader.style.display = 'none';
768
793
  this.textArea.setAttribute('spellcheck', 'false');
769
794
  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';
795
+ this.lowerCanvas.style.width = this.upperCanvas.style.width = this.maskCanvas.style.width =
796
+ this.inMemoryCanvas.style.width = '100%';
797
+ this.lowerCanvas.style.height = this.upperCanvas.style.height = this.maskCanvas.style.height =
798
+ this.inMemoryCanvas.style.height = '100%';
799
+ this.upperCanvas.style.position = this.lowerCanvas.style.position = this.maskCanvas.style.position =
800
+ this.textArea.style.position = 'absolute';
773
801
  this.textArea.style.backgroundColor = 'transparent';
774
802
  this.textArea.style.display = 'none';
775
- this.textArea.style.resize = 'none';
803
+ this.maskCanvas.style.display = this.textArea.style.resize = 'none';
776
804
  this.lowerContext = this.lowerCanvas.getContext('2d');
777
805
  this.baseImg = this.createElement('img', {
778
806
  id: this.element.id + '_orgImg', attrs: { name: 'Image', crossorigin: 'anonymous' }
@@ -909,41 +937,66 @@ var ImageEditor = /** @class */ (function (_super) {
909
937
  this.notify('transform', { prop: 'flip', value: { direction: direction } });
910
938
  this.notify('draw', { prop: 'redrawDownScale' });
911
939
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
940
+ var actionArgs = { action: 'flip', actionEventArgs: this.editCompleteArgs };
941
+ this.triggerEditCompleteEvent(actionArgs);
912
942
  };
913
943
  /**
914
944
  * Returns an image as ImageData to load it in to a canvas.
915
945
  *
946
+ * @param {boolean} [includeAnnotations=true] - Optional. Specifies whether the returned image data should include annotations. The default value is true, meaning annotations are included.
947
+ *
916
948
  * @remarks
917
949
  * The data returned from this method is directly drawn in a canvas using 'putImageData' method.
918
950
  * And then the user can get the base64 string from the canvas using toDataURL method.
919
951
  *
920
952
  * @returns {ImageData}.
921
953
  */
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);
954
+ ImageEditor.prototype.getImageData = function (includeAnnotations) {
955
+ includeAnnotations = isNullOrUndefined(includeAnnotations) ? true : includeAnnotations;
956
+ var imageData;
957
+ if (includeAnnotations) {
958
+ var obj = { canvas: null };
959
+ this.applyShapes();
960
+ this.notify('export', { prop: 'exportToCanvas', value: { object: obj } });
961
+ imageData = obj['canvas'].getContext('2d').getImageData(0, 0, obj['canvas'].width, obj['canvas'].height);
962
+ }
963
+ else if (this.isMaskImage && this.element.getAttribute('data-value') === 'mask-drawing') {
964
+ imageData = this.getData(true);
965
+ this.updateColl('reset');
966
+ }
967
+ else {
968
+ imageData = this.getData();
969
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
970
+ }
971
+ return imageData;
927
972
  };
928
973
  /**
929
974
  * Opens an image as URL or ImageData for editing in an image editor.
930
975
  *
931
976
  * @param {string | ImageData } data - Specifies url of the image or image data.
977
+ * @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.
978
+ * @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
979
  *
933
980
  * @remarks
934
981
  * The supported file types are JPG, JPEG, PNG, and SVG.
935
982
  *
936
983
  * @returns {void}.
937
984
  */
938
- ImageEditor.prototype.open = function (data) {
939
- if (isNullOrUndefined(data)) {
940
- return;
985
+ ImageEditor.prototype.open = function (data, resetChanges, imageSettings) {
986
+ resetChanges = isNullOrUndefined(resetChanges) ? true : resetChanges;
987
+ if (resetChanges) {
988
+ if (isNullOrUndefined(data)) {
989
+ return;
990
+ }
991
+ var dropArea = document.getElementById(this.element.id + '_dropArea');
992
+ if (dropArea) {
993
+ dropArea.style.display = 'none';
994
+ }
995
+ this.notify('draw', { prop: 'open', value: { data: data } });
941
996
  }
942
- var dropArea = document.getElementById(this.element.id + '_dropArea');
943
- if (dropArea) {
944
- dropArea.style.display = 'none';
997
+ else {
998
+ this.updateImage(data, imageSettings.backgroundColor);
945
999
  }
946
- this.notify('draw', { prop: 'open', value: { data: data } });
947
1000
  };
948
1001
  /**
949
1002
  * Reset all the changes done in an image editor and revert to original image.
@@ -954,12 +1007,14 @@ var ImageEditor = /** @class */ (function (_super) {
954
1007
  * @returns {void}.
955
1008
  */
956
1009
  ImageEditor.prototype.reset = function () {
1010
+ this.updateColl('reset');
957
1011
  var obj = { isErrorImage: false };
958
1012
  this.notify('draw', { prop: 'getErrorImage', value: { obj: obj } });
959
1013
  if (!this.disabled && !obj['isErrorImage']) {
960
1014
  this.clearContext(this.inMemoryContext);
961
1015
  this.clearContext(this.lowerContext);
962
1016
  this.clearContext(this.upperContext);
1017
+ this.notify('shape', { prop: 'setRedactType', onPropertyChange: false, value: { redactType: 'blur' } });
963
1018
  this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
964
1019
  this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
965
1020
  isApplyBtn: false, isCropping: false, isZooming: null, cType: null } });
@@ -968,7 +1023,6 @@ var ImageEditor = /** @class */ (function (_super) {
968
1023
  this.notify('toolbar', { prop: 'create-bottom-toolbar', onPropertyChange: false });
969
1024
  }
970
1025
  var isImageLoaded = this.isImageLoaded;
971
- // eslint-disable-next-line max-len
972
1026
  this.currObjType.isUndoAction = this.isUndoRedo = this.togglePan = this.togglePen = this.isImageLoaded = this.isFinetuning = false;
973
1027
  this.isCircleCrop = this.isCropTab = false;
974
1028
  this.objColl = [];
@@ -1002,7 +1056,7 @@ var ImageEditor = /** @class */ (function (_super) {
1002
1056
  this.tempFrameObj = { type: 'none', color: '#fff', size: 20, inset: 20, offset: 20, radius: 0, amount: 1, border: 'solid', gradientColor: '' };
1003
1057
  this.currObjType = { shape: '', isDragging: false, isActiveObj: false, isText: false, isInitialText: false, isLine: false,
1004
1058
  isInitialLine: false, isCustomCrop: false, isZoomed: false, isUndoZoom: false,
1005
- isUndoAction: false, isFiltered: false, isSave: false, isResize: false };
1059
+ isUndoAction: false, isFiltered: false, isSave: false, isResize: false, isRedact: false };
1006
1060
  this.cropObj = { cropZoom: 0, defaultZoom: 0, totalPannedPoint: { x: 0, y: 0 }, totalPannedClientPoint: { x: 0, y: 0 },
1007
1061
  totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {},
1008
1062
  rotateFlipColl: [], degree: 0, currFlipState: '', straighten: 0, zoomFactor: 0, previousZoomValue: 0,
@@ -1019,11 +1073,21 @@ var ImageEditor = /** @class */ (function (_super) {
1019
1073
  this.transform.straighten = 0;
1020
1074
  this.cancelCropSelection = null;
1021
1075
  this.aspectWidth = this.aspectHeight = null;
1022
- this.isResize = false;
1076
+ this.isResize = this.isMaskImage = false;
1023
1077
  this.drawingShape = null;
1024
1078
  this.isShapeDrawing = this.noPushUndo = this.isUndoRedoStack = this.isKBDNavigation = false;
1025
1079
  this.shapeColl = [];
1080
+ this.tempObjColl = [];
1081
+ this.tempPointColl = [];
1082
+ this.tempShapeColl = [];
1083
+ this.isImageUpdated = false;
1084
+ this.tempToolbarHeight = 0;
1085
+ this.tempToolbar = [];
1086
+ this.tempRedactBlur = 50;
1087
+ this.tempRedactPixel = 40;
1026
1088
  var obj_1 = { initialZoomValue: false };
1089
+ this.editCompleteArgs = null;
1090
+ this.isFinetuneBtnClick = false;
1027
1091
  this.notify('draw', { prop: 'getInitialZoomValue', onPropertyChange: false, value: { obj: obj_1 } });
1028
1092
  if (obj_1['initialZoomValue']) {
1029
1093
  this.setProperties({ zoomSettings: { zoomFactor: obj_1['initialZoomValue'] } }, true);
@@ -1057,6 +1121,8 @@ var ImageEditor = /** @class */ (function (_super) {
1057
1121
  if (Browser.isDevice && straightenObj['bool']) {
1058
1122
  this.notify('crop', { prop: 'resizeWrapper' });
1059
1123
  }
1124
+ var actionArgs = { action: 'reset', actionEventArgs: null };
1125
+ this.triggerEditCompleteEvent(actionArgs);
1060
1126
  }
1061
1127
  };
1062
1128
  /**
@@ -1080,6 +1146,8 @@ var ImageEditor = /** @class */ (function (_super) {
1080
1146
  }
1081
1147
  this.notify('transform', { prop: 'rotate', value: { degree: degree, obj: obj } });
1082
1148
  this.notify('draw', { prop: 'redrawDownScale' });
1149
+ var actionArgs = { action: 'rotate', actionEventArgs: this.editCompleteArgs };
1150
+ this.triggerEditCompleteEvent(actionArgs);
1083
1151
  return obj['isRotate'];
1084
1152
  };
1085
1153
  /**
@@ -1158,8 +1226,19 @@ var ImageEditor = /** @class */ (function (_super) {
1158
1226
  */
1159
1227
  ImageEditor.prototype.freehandDraw = function (value) {
1160
1228
  if (!this.disabled && this.isImageLoaded) {
1229
+ if (!value && this.isMaskImage) {
1230
+ this.discard();
1231
+ return;
1232
+ }
1161
1233
  this.applyShapes();
1162
1234
  this.freeHandDraw(value);
1235
+ var prevObj = { shapeSettingsObj: {} };
1236
+ this.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: prevObj } });
1237
+ var shapeSettings = prevObj['shapeSettingsObj'];
1238
+ shapeSettings.type = ShapeType.FreehandDraw;
1239
+ var shapeChangingArgs = { cancel: false, action: 'insert', previousShapeSettings: shapeSettings,
1240
+ currentShapeSettings: shapeSettings };
1241
+ this.notify('freehand-draw', { prop: 'triggerShapeChanging', value: { shapeChangingArgs: shapeChangingArgs } });
1163
1242
  }
1164
1243
  };
1165
1244
  /**
@@ -1220,7 +1299,7 @@ var ImageEditor = /** @class */ (function (_super) {
1220
1299
  isEllipse = true;
1221
1300
  this.notify('shape', { prop: 'drawEllipse', onPropertyChange: false, value: { x: x, y: y, radiusX: radiusX, radiusY: radiusY,
1222
1301
  strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree, isSelected: isSelected } });
1223
- this.notify('draw', { prop: 'redrawDownScale' });
1302
+ this.editCompleted();
1224
1303
  }
1225
1304
  return isEllipse;
1226
1305
  };
@@ -1243,7 +1322,7 @@ var ImageEditor = /** @class */ (function (_super) {
1243
1322
  isLine = true;
1244
1323
  this.notify('shape', { prop: 'drawLine', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
1245
1324
  endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, isSelected: isSelected } });
1246
- this.notify('draw', { prop: 'redrawDownScale' });
1325
+ this.editCompleted();
1247
1326
  }
1248
1327
  return isLine;
1249
1328
  };
@@ -1269,7 +1348,7 @@ var ImageEditor = /** @class */ (function (_super) {
1269
1348
  this.notify('shape', { prop: 'drawArrow', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
1270
1349
  endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, arrowStart: arrowStart, arrowEnd: arrowEnd,
1271
1350
  isSelected: isSelected } });
1272
- this.notify('draw', { prop: 'redrawDownScale' });
1351
+ this.editCompleted();
1273
1352
  }
1274
1353
  return isArrow;
1275
1354
  };
@@ -1300,7 +1379,7 @@ var ImageEditor = /** @class */ (function (_super) {
1300
1379
  this.applyShapes();
1301
1380
  this.notify('shape', { prop: 'drawPath', onPropertyChange: false, value: { pointColl: pointColl,
1302
1381
  strokeWidth: strokeWidth, strokeColor: strokeColor, isSelected: isSelected } });
1303
- this.notify('draw', { prop: 'redrawDownScale' });
1382
+ this.editCompleted();
1304
1383
  }
1305
1384
  return isPath;
1306
1385
  };
@@ -1316,16 +1395,18 @@ var ImageEditor = /** @class */ (function (_super) {
1316
1395
  * @param {string} fillColor - Specifies the fill color of the rectangle.
1317
1396
  * @param {number} degree - Specifies the degree to rotate the rectangle.
1318
1397
  * @param {boolean} isSelected - Specifies to show the rectangle in the selected state.
1398
+ * @param {number} borderRadius - Specifies the radius to apply border radius to rectangle.
1319
1399
  * @returns {boolean}.
1320
1400
  */
1321
- ImageEditor.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor, degree, isSelected) {
1401
+ ImageEditor.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor, degree, isSelected, borderRadius) {
1322
1402
  var isRectangle = false;
1323
1403
  var isPointsInRange = this.allowShape(x, y);
1324
1404
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
1325
1405
  isRectangle = true;
1326
1406
  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' });
1407
+ strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree, isSelected: isSelected,
1408
+ radius: borderRadius } });
1409
+ this.editCompleted();
1329
1410
  }
1330
1411
  return isRectangle;
1331
1412
  };
@@ -1344,17 +1425,21 @@ var ImageEditor = /** @class */ (function (_super) {
1344
1425
  * @param {string} color - Specifies font color of the text.
1345
1426
  * @param {boolean} isSelected - Specifies to show the text in the selected state.
1346
1427
  * @param {number} degree - Specifies the degree to rotate the text.
1428
+ * @param {fillColor} fillColor - Specifies the background Color of the text.
1429
+ * @param {string} strokeColor - Specifies the outline color of the text annotation.
1430
+ * @param {number} strokeWidth - Specifies the outline stroke width of the text annotation.
1347
1431
  * @returns {boolean}.
1348
1432
  *
1349
1433
  */
1350
- ImageEditor.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color, isSelected, degree) {
1434
+ ImageEditor.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color, isSelected, degree, fillColor, strokeColor, strokeWidth) {
1351
1435
  var isText = false;
1352
1436
  var isPointsInRange = this.allowShape(x, y);
1353
1437
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
1354
1438
  isText = true;
1355
1439
  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' });
1440
+ fontSize: fontSize, bold: bold, italic: italic, color: color, isSelected: isSelected, degree: degree, fillColor: fillColor,
1441
+ outlineColor: strokeColor, outlineWidth: strokeWidth } });
1442
+ this.editCompleted();
1358
1443
  }
1359
1444
  return isText;
1360
1445
  };
@@ -1381,13 +1466,97 @@ var ImageEditor = /** @class */ (function (_super) {
1381
1466
  var length_1 = this.objColl.length;
1382
1467
  this.notify('shape', { prop: 'drawImage', onPropertyChange: false, value: { x: x, y: y, width: width, height: height,
1383
1468
  src: data, degree: degree, isAspectRatio: isAspectRatio, opacity: opacity, isSelected: isSelected } });
1384
- this.notify('draw', { prop: 'redrawDownScale' });
1469
+ this.editCompleted();
1385
1470
  if (this.objColl.length > length_1) {
1386
1471
  isImage = true;
1387
1472
  }
1388
1473
  }
1389
1474
  return isImage;
1390
1475
  };
1476
+ /**
1477
+ * This method is used to update the existing shapes by changing its height, width, color, and font styles in the component.
1478
+ * Use 'getShapeSettings' method to get the shape which is then passed to change the options of a shape.
1479
+ * {% codeBlock src='image-editor/updateShape/index.md' %}{% endcodeBlock %}
1480
+ *
1481
+ * @param {ShapeSettings} setting - Specifies the shape settings to be updated for the shape on an image.
1482
+ * @param {boolean} isSelected - Specifies to show the shape in the selected state.
1483
+ * @returns {boolean}.
1484
+ *
1485
+ */
1486
+ ImageEditor.prototype.updateShape = function (setting, isSelected) {
1487
+ var obj = { isSelected: false };
1488
+ var isTextArea = false;
1489
+ var freehandObj = { bool: false };
1490
+ if (isNullOrUndefined(setting.id)) {
1491
+ if (setting.strokeColor) {
1492
+ this.activeObj.strokeSettings.strokeColor = setting.strokeColor;
1493
+ }
1494
+ if (setting.fillColor) {
1495
+ this.activeObj.strokeSettings.fillColor = setting.fillColor;
1496
+ }
1497
+ if (setting.strokeWidth) {
1498
+ this.activeObj.strokeSettings.strokeWidth = setting.strokeWidth;
1499
+ }
1500
+ if (setting.index) {
1501
+ this.activeObj.order = setting.index;
1502
+ }
1503
+ if (setting.type === 'FreehandDraw' && setting.strokeWidth) {
1504
+ this.notify('freehand-draw', { prop: 'setPenStrokeWidth', onPropertyChange: false, value: { value: setting.strokeWidth } });
1505
+ }
1506
+ }
1507
+ else {
1508
+ if (setting.type.toLowerCase() === 'text' && (this.textArea.style.display === 'block' ||
1509
+ this.textArea.style.display === 'inline-block')) {
1510
+ this.okBtn(null, true);
1511
+ isTextArea = true;
1512
+ }
1513
+ this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: setting.id, obj: obj } });
1514
+ this.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: freehandObj } });
1515
+ if (obj['isSelected']) {
1516
+ var tempFontSize = this.activeObj.textSettings.fontSize;
1517
+ this.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
1518
+ value: { shapeSettings: setting } });
1519
+ if (this.activeObj.shape === 'text' && tempFontSize) {
1520
+ var diff = this.activeObj.textSettings.fontSize - tempFontSize;
1521
+ if (diff !== 0) {
1522
+ this.activeObj.activePoint.height += diff;
1523
+ this.activeObj.activePoint.startY -= (diff / 2);
1524
+ this.activeObj.activePoint.endY += (diff / 2);
1525
+ this.notify('draw', { prop: 'updateActiveObject', onPropertyChange: false, value: { actPoint: this.activeObj.activePoint, obj: this.activeObj,
1526
+ isMouseMove: null, x: null, y: null } });
1527
+ }
1528
+ }
1529
+ var activeObj = extend({}, this.activeObj, {}, true);
1530
+ this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
1531
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: null } });
1532
+ this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
1533
+ if (activeObj.shape) {
1534
+ this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: activeObj } });
1535
+ }
1536
+ if (this.activeObj.shape === 'text') {
1537
+ this.notify('toolbar', { prop: 'editText', onPropertyChange: false });
1538
+ }
1539
+ if (freehandObj['bool']) {
1540
+ this.notify('undo-redo', { prop: 'setPreventUR', value: { bool: true } });
1541
+ }
1542
+ this.okBtn(isSelected, true);
1543
+ if (freehandObj['bool']) {
1544
+ this.notify('undo-redo', { prop: 'setPreventUR', value: { bool: false } });
1545
+ }
1546
+ this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
1547
+ this.editCompleteArgs = { action: 'shape-update', currentShapeSettings: setting };
1548
+ this.editCompleted('shape-customize');
1549
+ if (isTextArea) {
1550
+ this.enableTextEditing();
1551
+ }
1552
+ if (isSelected) {
1553
+ this.noRedact = true;
1554
+ this.selectShape(setting.id);
1555
+ }
1556
+ }
1557
+ }
1558
+ return obj['isSelected'];
1559
+ };
1391
1560
  /**
1392
1561
  * Select a shape based on the given shape id.
1393
1562
  * Use 'getShapeSettings' method to get the shape id which is then passed to perform selection.
@@ -1402,7 +1571,8 @@ var ImageEditor = /** @class */ (function (_super) {
1402
1571
  this.applyShapes();
1403
1572
  var obj = { isSelected: false };
1404
1573
  this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: id, obj: obj } });
1405
- this.notify('draw', { prop: 'redrawDownScale' });
1574
+ this.editCompleted('shape-select');
1575
+ this.noRedact = false;
1406
1576
  return obj['isSelected'];
1407
1577
  };
1408
1578
  /**
@@ -1416,9 +1586,14 @@ var ImageEditor = /** @class */ (function (_super) {
1416
1586
  *
1417
1587
  */
1418
1588
  ImageEditor.prototype.deleteShape = function (id) {
1589
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1590
+ var shape = this.getShapeSetting(id);
1591
+ if (shape.type === 'Redact') {
1592
+ return;
1593
+ }
1419
1594
  this.applyShapes();
1420
1595
  this.notify('shape', { prop: 'deleteShape', onPropertyChange: false, value: { id: id } });
1421
- this.notify('draw', { prop: 'redrawDownScale' });
1596
+ this.editCompleted('shape-delete');
1422
1597
  };
1423
1598
  /**
1424
1599
  * Get particular shapes details based on id of the shape which is drawn on an image editor.
@@ -1448,7 +1623,92 @@ var ImageEditor = /** @class */ (function (_super) {
1448
1623
  var obj = { shapeDetailsColl: [] };
1449
1624
  this.notify('shape', { prop: 'getShapeSettings', onPropertyChange: false, value: { obj: obj } });
1450
1625
  this.notify('draw', { prop: 'redrawDownScale' });
1451
- return obj['shapeDetailsColl'];
1626
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1627
+ return obj.shapeDetailsColl.filter(function (item) { return item.type !== 'redact'; });
1628
+ };
1629
+ /**
1630
+ * Get all the shapes details which is drawn on an image editor.
1631
+ *
1632
+ * @returns {RedactSettings[]}.
1633
+ */
1634
+ ImageEditor.prototype.getRedacts = function () {
1635
+ this.applyShapes();
1636
+ var obj = { shapeDetailsColl: [] };
1637
+ this.notify('shape', { prop: 'getRedactSettings', onPropertyChange: false, value: { obj: obj } });
1638
+ this.notify('draw', { prop: 'redrawDownScale' });
1639
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1640
+ return obj.shapeDetailsColl.filter(function (item) { return item.type !== 'redact'; });
1641
+ };
1642
+ /**
1643
+ * Select a redaction based on the given redaction id.
1644
+ * Use 'getRedacts' method to get the shape id which is then passed to perform selection.
1645
+ *
1646
+ *
1647
+ * @param {string} id - Specifies the shape id to select a redact on an image.
1648
+ * @returns {boolean}.
1649
+ *
1650
+ */
1651
+ ImageEditor.prototype.selectRedact = function (id) {
1652
+ this.applyShapes();
1653
+ var obj = { isSelected: false };
1654
+ this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: id, obj: obj } });
1655
+ this.editCompleted('redact-select');
1656
+ this.noRedact = false;
1657
+ return obj['isSelected'];
1658
+ };
1659
+ /**
1660
+ * Deletes a redaction based on the given shape id.
1661
+ * Use 'getRedacts' method to get the redaaction id which is then passed to perform deletion.
1662
+ *
1663
+ *
1664
+ * @param {string} id - Specifies the redaction id to delete the redaction on an image.
1665
+ * @returns {void}.
1666
+ *
1667
+ */
1668
+ ImageEditor.prototype.deleteRedact = function (id) {
1669
+ this.applyShapes();
1670
+ this.notify('shape', { prop: 'deleteShape', onPropertyChange: false, value: { id: id } });
1671
+ this.editCompleted('redact-delete');
1672
+ };
1673
+ /**
1674
+ * This method is used to update the existing redacts by changing its height, width, blur, and pixel size in the component.
1675
+ * Use 'getRedacts' method to get the redacts which is then passed to change the options of a redacts.
1676
+ *
1677
+ * @param {RedactSettings} setting - Specifies the redact settings to be updated for the shape on an image.
1678
+ * @param {boolean} isSelected - Specifies to show the redacts in the selected state.
1679
+ * @returns {boolean}.
1680
+ *
1681
+ */
1682
+ ImageEditor.prototype.updateRedact = function (setting, isSelected) {
1683
+ this.applyShapes();
1684
+ var obj = { isSelected: false };
1685
+ this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: setting.id, obj: obj } });
1686
+ if (obj['isSelected']) {
1687
+ this.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
1688
+ value: { shapeSettings: setting } });
1689
+ if (setting.blurIntensity) {
1690
+ this.activeObj.redactBlur = setting.blurIntensity;
1691
+ }
1692
+ if (setting.pixelSize) {
1693
+ this.activeObj.redactPixelate = setting.pixelSize;
1694
+ }
1695
+ this.activeObj.redactType = setting.type.toLowerCase() === 'blur' ? 'blur' : 'pixelate';
1696
+ var activeObj = extend({}, this.activeObj, {}, true);
1697
+ this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
1698
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: null } });
1699
+ this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
1700
+ if (activeObj.shape) {
1701
+ this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: activeObj } });
1702
+ }
1703
+ this.okBtn(isSelected, true);
1704
+ this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
1705
+ this.editCompleteArgs = { action: 'redact-update', currentShapeSettings: setting };
1706
+ this.editCompleted('redact-customize');
1707
+ if (isSelected) {
1708
+ this.selectRedact(setting.id);
1709
+ }
1710
+ }
1711
+ return obj['isSelected'];
1452
1712
  };
1453
1713
  /**
1454
1714
  * To refresh the Canvas Wrapper.
@@ -1474,7 +1734,8 @@ var ImageEditor = /** @class */ (function (_super) {
1474
1734
  if (!this.disabled && this.isImageLoaded) {
1475
1735
  this.applyShapes();
1476
1736
  this.notify('filter', { prop: 'finetuneImage', value: { value: value, option: finetuneOption } });
1477
- this.notify('draw', { prop: 'redrawDownScale' });
1737
+ this.editCompleteArgs = { finetune: finetuneOption, value: value };
1738
+ this.editCompleted('fine-tune');
1478
1739
  }
1479
1740
  };
1480
1741
  /**
@@ -1490,7 +1751,8 @@ var ImageEditor = /** @class */ (function (_super) {
1490
1751
  if (!this.disabled && this.isImageLoaded) {
1491
1752
  this.applyShapes();
1492
1753
  this.notify('filter', { prop: 'applyImageFilter', value: { option: filterOption.toString() } });
1493
- this.notify('draw', { prop: 'redrawDownScale' });
1754
+ this.editCompleteArgs = { filter: filterOption };
1755
+ this.editCompleted('filter');
1494
1756
  this.canvasFilter = this.lowerContext.filter;
1495
1757
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
1496
1758
  }
@@ -1660,88 +1922,6 @@ var ImageEditor = /** @class */ (function (_super) {
1660
1922
  }
1661
1923
  return isStraightened;
1662
1924
  };
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
1925
  /**
1746
1926
  * Duplicates a shape based on the given shape ID in the ImageEditor.
1747
1927
  * Use 'getShapeSettings' method to get the shape and then pass a shapeId from the returned shape to clone a shape.
@@ -1788,6 +1968,7 @@ var ImageEditor = /** @class */ (function (_super) {
1788
1968
  this.noPushUndo = true;
1789
1969
  this.okBtn();
1790
1970
  this.noPushUndo = false;
1971
+ this.noRedact = true;
1791
1972
  this.selectShape(activeObj.currIndex);
1792
1973
  activeObj.order = this.activeObj.order;
1793
1974
  }
@@ -1844,8 +2025,14 @@ var ImageEditor = /** @class */ (function (_super) {
1844
2025
  * This method applies the actions performed after enabling annotation drawings, ensuring that the drawn annotations are applied to the image.
1845
2026
  */
1846
2027
  ImageEditor.prototype.apply = function () {
1847
- this.closeOverlayTbar();
1848
- this.okBtn(null, true);
2028
+ if (this.isMaskImage) {
2029
+ this.discard();
2030
+ }
2031
+ else {
2032
+ this.updateColl('reset');
2033
+ this.closeOverlayTbar();
2034
+ this.okBtn(null, true);
2035
+ }
1849
2036
  };
1850
2037
  /**
1851
2038
  * Discards the operations performed in the Image Editor, such as annotation drawings.
@@ -1855,6 +2042,7 @@ var ImageEditor = /** @class */ (function (_super) {
1855
2042
  * This method discards the actions performed after enabling annotation drawings, ensuring that the drawn annotations are not applied to the image.
1856
2043
  */
1857
2044
  ImageEditor.prototype.discard = function () {
2045
+ this.updateColl('reset');
1858
2046
  this.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: this.closeOverlayTbar(), isFinalCancel: true } });
1859
2047
  };
1860
2048
  /**
@@ -1888,6 +2076,10 @@ var ImageEditor = /** @class */ (function (_super) {
1888
2076
  this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
1889
2077
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
1890
2078
  }
2079
+ else if (this.currObjType.shape === 'redact') {
2080
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'redact',
2081
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
2082
+ }
1891
2083
  else {
1892
2084
  this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
1893
2085
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
@@ -1907,6 +2099,7 @@ var ImageEditor = /** @class */ (function (_super) {
1907
2099
  *
1908
2100
  */
1909
2101
  ImageEditor.prototype.bringToFront = function (shapeId) {
2102
+ this.noRedact = true;
1910
2103
  if (this.selectShape(shapeId)) {
1911
2104
  this.updateShapeOrder(shapeId, 'bringToFront');
1912
2105
  this.apply();
@@ -1921,6 +2114,7 @@ var ImageEditor = /** @class */ (function (_super) {
1921
2114
  *
1922
2115
  */
1923
2116
  ImageEditor.prototype.bringForward = function (shapeId) {
2117
+ this.noRedact = true;
1924
2118
  if (this.selectShape(shapeId)) {
1925
2119
  this.updateShapeOrder(shapeId, 'bringForward');
1926
2120
  this.apply();
@@ -1935,6 +2129,7 @@ var ImageEditor = /** @class */ (function (_super) {
1935
2129
  *
1936
2130
  */
1937
2131
  ImageEditor.prototype.sendToBack = function (shapeId) {
2132
+ this.noRedact = true;
1938
2133
  if (this.selectShape(shapeId)) {
1939
2134
  this.updateShapeOrder(shapeId, 'sendToBack');
1940
2135
  this.apply();
@@ -1949,6 +2144,7 @@ var ImageEditor = /** @class */ (function (_super) {
1949
2144
  *
1950
2145
  */
1951
2146
  ImageEditor.prototype.sendBackward = function (shapeId) {
2147
+ this.noRedact = true;
1952
2148
  if (this.selectShape(shapeId)) {
1953
2149
  this.updateShapeOrder(shapeId, 'sendBackward');
1954
2150
  this.apply();
@@ -1978,7 +2174,291 @@ var ImageEditor = /** @class */ (function (_super) {
1978
2174
  dropArea.style.display = 'block';
1979
2175
  }
1980
2176
  };
2177
+ // AI related codes
2178
+ /**
2179
+ * Enables overlay drawing to erase objects in an image editor. The eraser tool assists in selecting the mask image.
2180
+ *
2181
+ * @remarks
2182
+ * The selection UI is based on the 'theme' property.
2183
+ *
2184
+ * @param {number} strokeWidth - Specifies the stroke width of the drawing.
2185
+ * @param {string} color - Specifies the color of the drawing.
2186
+ * @hidden
2187
+ * @returns {void}.
2188
+ *
2189
+ */
2190
+ ImageEditor.prototype.selectMaskImage = function (strokeWidth, color) {
2191
+ strokeWidth = strokeWidth ? strokeWidth : 10;
2192
+ color = color ? color : '#512da880';
2193
+ this.applyShapes();
2194
+ this.isMaskImage = true;
2195
+ this.updateColl('empty');
2196
+ this.enableDisableToolbar(true);
2197
+ this.update();
2198
+ this.activeObj.strokeSettings.strokeWidth = strokeWidth;
2199
+ this.notify('freehand-draw', { prop: 'setPenStrokeWidth', onPropertyChange: false, value: { value: strokeWidth } });
2200
+ this.activeObj.strokeSettings.strokeColor = color;
2201
+ this.notify('freehand-draw', { prop: 'freeHandDraw', onPropertyChange: false, value: { value: true } });
2202
+ this.maskCanvas.style.display = 'block';
2203
+ };
2204
+ ImageEditor.prototype.enableDisableToolbar = function (value) {
2205
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2206
+ var toolbar;
2207
+ var elem = document.getElementById(this.element.id + '_toolbar');
2208
+ if (elem) {
2209
+ toolbar = getComponent(elem, 'toolbar');
2210
+ if (toolbar) {
2211
+ toolbar.disable(value);
2212
+ }
2213
+ }
2214
+ elem = document.getElementById(this.element.id + '_bottomToolbar');
2215
+ if (elem) {
2216
+ toolbar = getComponent(elem, 'toolbar');
2217
+ if (toolbar) {
2218
+ toolbar.disable(value);
2219
+ }
2220
+ }
2221
+ };
2222
+ ImageEditor.prototype.updateImage = function (data, imageBackgroundColor) {
2223
+ var _this = this;
2224
+ if (data || imageBackgroundColor) {
2225
+ var prevCropObj_1 = extend({}, this.cropObj, {}, true);
2226
+ var object = { currObj: {} };
2227
+ this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
2228
+ var prevObj_1 = object['currObj'];
2229
+ prevObj_1.objColl = extend([], this.objColl, [], true);
2230
+ prevObj_1.pointColl = extend([], this.pointColl, [], true);
2231
+ prevObj_1.afterCropActions = extend([], this.afterCropActions, [], true);
2232
+ var selPointCollObj = { selPointColl: null };
2233
+ this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false, value: { obj: selPointCollObj } });
2234
+ prevObj_1.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
2235
+ if (data) {
2236
+ this.isImageUpdated = true;
2237
+ if (typeof (data) !== 'string') {
2238
+ var canvas = this.createElement('canvas');
2239
+ canvas.width = data.width;
2240
+ canvas.height = data.height;
2241
+ canvas.getContext('2d').putImageData(data, 0, 0);
2242
+ data = canvas.toDataURL();
2243
+ }
2244
+ this.baseImg.src = data;
2245
+ setTimeout(function () {
2246
+ if (_this.cropObj.straighten !== 0) {
2247
+ _this.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: 'crop-' + 'custom' } });
2248
+ _this.noPushUndo = true;
2249
+ _this.crop();
2250
+ _this.noPushUndo = false;
2251
+ }
2252
+ else {
2253
+ _this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
2254
+ }
2255
+ _this.isImageUpdated = false;
2256
+ if (!imageBackgroundColor) {
2257
+ _this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false, value: { operation: 'updateImage', previousObj: prevObj_1,
2258
+ previousObjColl: prevObj_1.objColl, previousPointColl: prevObj_1.pointColl,
2259
+ previousSelPointColl: prevObj_1.selPointColl, previousCropObj: prevCropObj_1,
2260
+ previousText: null, currentText: null, previousFilter: null, isCircleCrop: null
2261
+ } });
2262
+ _this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
2263
+ }
2264
+ }, 100);
2265
+ }
2266
+ if (imageBackgroundColor) {
2267
+ this.notify('draw', { prop: 'imageBackgroundColor', onPropertyChange: false, value: { color: imageBackgroundColor } });
2268
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
2269
+ if (!data) {
2270
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false, value: { operation: 'bgColor', previousObj: prevObj_1,
2271
+ previousObjColl: prevObj_1.objColl, previousPointColl: prevObj_1.pointColl, previousSelPointColl: prevObj_1.selPointColl,
2272
+ previousCropObj: prevCropObj_1, previousText: null, currentText: null, previousFilter: null, isCircleCrop: null
2273
+ } });
2274
+ this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
2275
+ }
2276
+ }
2277
+ if (data && imageBackgroundColor) {
2278
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false, value: { operation: 'updateImage', previousObj: prevObj_1,
2279
+ previousObjColl: prevObj_1.objColl, previousPointColl: prevObj_1.pointColl, previousSelPointColl: prevObj_1.selPointColl,
2280
+ previousCropObj: prevCropObj_1, previousText: null, currentText: null, previousFilter: null, isCircleCrop: null
2281
+ } });
2282
+ this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
2283
+ }
2284
+ }
2285
+ };
2286
+ ImageEditor.prototype.editCompleted = function (type) {
2287
+ this.notify('draw', { prop: 'redrawDownScale' });
2288
+ var actionArgs = { action: type ? type : 'shape-insert',
2289
+ actionEventArgs: this.editCompleteArgs };
2290
+ this.triggerEditCompleteEvent(actionArgs);
2291
+ };
2292
+ ImageEditor.prototype.updateColl = function (type) {
2293
+ if (!this.isMaskImage) {
2294
+ return;
2295
+ }
2296
+ if (type === 'empty') {
2297
+ this.tempToolbarHeight = this.toolbarHeight;
2298
+ this.tempToolbar = this.toolbar ? extend([], this.toolbar, [], true) : null;
2299
+ this.tempObjColl = extend([], this.objColl, [], true);
2300
+ this.tempPointColl = extend([], this.pointColl, [], true);
2301
+ this.tempShapeColl = extend([], this.shapeColl, [], true);
2302
+ this.objColl = [];
2303
+ this.pointColl = [];
2304
+ this.shapeColl = [];
2305
+ this.freehandCounter = 0;
2306
+ this.notify('freehand-draw', { prop: 'setCurrentFreehandDrawIndex',
2307
+ value: { value: 0 } });
2308
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
2309
+ }
2310
+ else if (type === 'reset') {
2311
+ this.objColl = this.tempObjColl;
2312
+ this.pointColl = this.tempPointColl;
2313
+ this.shapeColl = this.tempShapeColl;
2314
+ this.freehandCounter = this.pointColl.length;
2315
+ this.notify('freehand-draw', { prop: 'setCurrentFreehandDrawIndex',
2316
+ value: { value: this.freehandCounter } });
2317
+ this.enableDisableToolbar(false);
2318
+ if (this.cropObj.straighten !== 0) {
2319
+ this.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: 'crop-' + 'custom' } });
2320
+ this.noPushUndo = true;
2321
+ this.crop();
2322
+ this.noPushUndo = false;
2323
+ }
2324
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
2325
+ this.isMaskImage = false;
2326
+ this.upperContext.globalCompositeOperation = 'source-over';
2327
+ this.maskCanvas.style.display = 'none';
2328
+ this.activeObj.strokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null,
2329
+ radius: null, outlineColor: '', outlineWidth: null };
2330
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: this.activeObj.strokeSettings,
2331
+ strokeColor: '#fff', fillColor: '', strokeWidth: null, outlineWidth: null } });
2332
+ this.notify('freehand-draw', { prop: 'setPenStrokeWidth', onPropertyChange: false, value: { value: 2 } });
2333
+ this.notify('freehand-draw', { prop: 'setMasking', onPropertyChange: false, value: { value: false } });
2334
+ }
2335
+ };
1981
2336
  // Toolbar related codes
2337
+ ImageEditor.prototype.resetToolbar = function () {
2338
+ if (this.toolbarHeight !== this.tempToolbarHeight && !((isNullOrUndefined(this.toolbar) ||
2339
+ (this.toolbar && this.toolbar.length > 0)
2340
+ || !isNullOrUndefined(this.toolbarTemplate)))) {
2341
+ this.toolbarHeight = this.tempToolbarHeight;
2342
+ this.notify('toolbar', { prop: 'setToolbarHeight', value: { height: this.toolbarHeight } });
2343
+ this.toolbar = this.tempToolbar;
2344
+ if (!this.toolbarTemplate) {
2345
+ this.notify('toolbar', { prop: 'create-toolbar', onPropertyChange: false });
2346
+ this.notify('toolbar', { prop: 'create-contextual-toolbar', onPropertyChange: false });
2347
+ }
2348
+ this.update();
2349
+ }
2350
+ };
2351
+ ImageEditor.prototype.getData = function (isMaskImage) {
2352
+ if (isMaskImage) {
2353
+ this.resetToolbar();
2354
+ }
2355
+ var objColl = extend([], this.objColl, null, true);
2356
+ var pointColl = extend([], this.pointColl, null, true);
2357
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2358
+ var shapeColl = extend([], this.shapeColl, null, true);
2359
+ if (isMaskImage) {
2360
+ this.notify('shape', { prop: 'updateShapeColl', onPropertyChange: false });
2361
+ for (var i = 0; i < this.freehandCounter; i++) {
2362
+ this.pointColl[i].strokeColor = '#fff';
2363
+ }
2364
+ }
2365
+ else {
2366
+ this.objColl = [];
2367
+ this.pointColl = [];
2368
+ this.shapeColl = [];
2369
+ this.freehandCounter = 0;
2370
+ }
2371
+ var frameType = this.frameObj.type;
2372
+ this.frameObj.type = 'none';
2373
+ var aspectWidth = this.aspectWidth;
2374
+ var aspectHeight = this.aspectHeight;
2375
+ this.aspectWidth = this.aspectHeight = null;
2376
+ var straighten = this.cropObj.straighten;
2377
+ this.togglePen = false;
2378
+ this.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: 'crop-' + 'custom' } });
2379
+ var tempDestPoints = extend({}, this.img, {}, true);
2380
+ var tempCropObj = extend({}, this.cropObj, {}, true);
2381
+ var tempSel = extend({}, this.activeObj, {}, true);
2382
+ var tempTransform = extend({}, this.transform, {}, true);
2383
+ var panPoint = extend({}, this.panPoint, {}, true);
2384
+ if (straighten !== 0) {
2385
+ this.setStraighten(0);
2386
+ }
2387
+ var point = this.activeObj.activePoint;
2388
+ point.startX = this.img.destLeft;
2389
+ point.startY = this.img.destTop;
2390
+ point.width = this.img.destWidth;
2391
+ point.height = this.img.destHeight;
2392
+ point.endX = point.startX + point.width;
2393
+ point.endY = point.startY + point.height;
2394
+ this.notify('draw', { prop: 'updateActiveObject', onPropertyChange: false, value: { actPoint: point, obj: this.activeObj,
2395
+ isMouseMove: null, x: null, y: null } });
2396
+ this.noPushUndo = true;
2397
+ this.crop();
2398
+ this.noPushUndo = false;
2399
+ this.isCropTab = false;
2400
+ this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
2401
+ this.notify('crop', { prop: 'resetZoom', onPropertyChange: false });
2402
+ this.isCropTab = true;
2403
+ var afterCropActions = extend([], this.afterCropActions, [], true);
2404
+ var coll = extend([], this.rotateFlipColl, [], true);
2405
+ this.notify('crop', { prop: 'revertTransform', value: { type: 'initial', coll: coll } });
2406
+ var imageData = this.getImageData();
2407
+ if (isMaskImage) {
2408
+ var canvas = this.createElement('canvas');
2409
+ var ctx = canvas.getContext('2d');
2410
+ canvas.width = imageData.width;
2411
+ canvas.height = imageData.height;
2412
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
2413
+ if (this.pointColl.length > 0) {
2414
+ var obj = { width: 0, height: 0 };
2415
+ this.notify('crop', { prop: 'calcRatio', onPropertyChange: false,
2416
+ value: { obj: obj, dimension: { width: canvas.width, height: canvas.height } } });
2417
+ var ratio = obj;
2418
+ this.notify('export', { prop: 'drawAnnotation', value: { context: ctx, ratio: ratio } });
2419
+ }
2420
+ this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
2421
+ imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
2422
+ }
2423
+ this.notify('crop', { prop: 'revertTransform', value: { type: 'reverse', coll: coll } });
2424
+ this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
2425
+ this.afterCropActions = afterCropActions;
2426
+ if (!isMaskImage) {
2427
+ this.objColl = objColl;
2428
+ this.pointColl = pointColl;
2429
+ this.shapeColl = shapeColl;
2430
+ this.freehandCounter = this.pointColl.length;
2431
+ }
2432
+ this.frameObj.type = frameType;
2433
+ this.aspectWidth = aspectWidth;
2434
+ this.aspectHeight = aspectHeight;
2435
+ this.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: 'crop-' + 'custom' } });
2436
+ if (straighten !== 0) {
2437
+ this.setStraighten(straighten);
2438
+ }
2439
+ this.img = tempDestPoints;
2440
+ this.cropObj = tempCropObj;
2441
+ this.activeObj = tempSel;
2442
+ this.transform = tempTransform;
2443
+ this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
2444
+ value: { zoomFactor: 0.1, zoomPoint: null, isResize: null } });
2445
+ this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
2446
+ value: { zoomFactor: -0.1, zoomPoint: null, isResize: null } });
2447
+ if (this.transform.degree !== 0) {
2448
+ this.panPoint.currentPannedPoint = { x: panPoint.totalPannedClientPoint.x,
2449
+ y: panPoint.totalPannedClientPoint.y };
2450
+ this.notify('transform', { prop: 'drawPannedImage', value: { xDiff: panPoint.totalPannedClientPoint.x,
2451
+ yDiff: panPoint.totalPannedClientPoint.y } });
2452
+ this.panPoint.currentPannedPoint = { x: 0, y: 0 };
2453
+ this.notify('transform', { prop: 'setTempPanMove', value: { point: null } });
2454
+ }
2455
+ this.noPushUndo = true;
2456
+ this.crop();
2457
+ this.noPushUndo = false;
2458
+ this.transform.straighten = 0;
2459
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
2460
+ return imageData;
2461
+ };
1982
2462
  ImageEditor.prototype.applyShapes = function () {
1983
2463
  if (this.isUndoRedoStack) {
1984
2464
  return;
@@ -2248,7 +2728,16 @@ var ImageEditor = /** @class */ (function (_super) {
2248
2728
  shapeSettings.type = ShapeType.FreehandDraw;
2249
2729
  }
2250
2730
  var shapeChangedArgs = { action: 'apply', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2251
- this.trigger('shapeChange', shapeChangedArgs);
2731
+ if (!this.currObjType.isRedact && (isFinalApply || this.isShapeDrawing)) {
2732
+ if (this.isShapeDrawing) {
2733
+ shapeChangedArgs.action = 'draw-end';
2734
+ }
2735
+ this.trigger('shapeChange', shapeChangedArgs);
2736
+ }
2737
+ this.editCompleteArgs = shapeChangedArgs;
2738
+ if (this.currObjType.isRedact) {
2739
+ this.currObjType.isRedact = false;
2740
+ }
2252
2741
  }
2253
2742
  if (aspectIcon || nonAspectIcon) {
2254
2743
  var obj_2 = { width: null, height: null };
@@ -2324,7 +2813,12 @@ var ImageEditor = /** @class */ (function (_super) {
2324
2813
  }
2325
2814
  else if (this.togglePen) {
2326
2815
  this.freeHandDraw(false);
2327
- this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
2816
+ if (!this.isMaskImage) {
2817
+ var widthObj = { penStrokeWidth: null };
2818
+ this.notify('freehand-draw', { prop: 'getPenStrokeWidth', onPropertyChange: false, value: { obj: widthObj } });
2819
+ this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
2820
+ this.notify('freehand-draw', { prop: 'setPenStrokeWidth', onPropertyChange: false, value: { value: widthObj['penStrokeWidth'] } });
2821
+ }
2328
2822
  this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
2329
2823
  this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
2330
2824
  }
@@ -2339,13 +2833,12 @@ var ImageEditor = /** @class */ (function (_super) {
2339
2833
  this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
2340
2834
  this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
2341
2835
  }
2342
- else if (sliderWrap || this.currObjType.isFiltered) {
2836
+ else if ((sliderWrap || this.currObjType.isFiltered) && !this.drawingShape && this.activeObj.shape !== 'redact') {
2343
2837
  this.initialAdjustmentValue = this.canvasFilter = this.lowerContext.filter;
2344
2838
  this.currObjType.isFiltered = false;
2345
2839
  var obj_4 = { value: null };
2346
2840
  this.notify('draw', { prop: 'getTempAdjustmentValue', value: { obj: obj_4 } });
2347
- if (obj_4['value'] !== this.lowerContext.filter && (!sliderWrap ||
2348
- !sliderWrap.classList.contains('e-ie-finetune-slider-wrap'))) {
2841
+ if (!sliderWrap || sliderWrap.parentElement.previousElementSibling.textContent !== 'Opacity') {
2349
2842
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
2350
2843
  }
2351
2844
  if ((this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) ||
@@ -2378,6 +2871,17 @@ var ImageEditor = /** @class */ (function (_super) {
2378
2871
  previousFilter: null, isCircleCrop: null
2379
2872
  } });
2380
2873
  this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
2874
+ var currFrameSettings = { type: this.toPascalCase(this.frameObj.type),
2875
+ color: this.frameObj.color, gradientColor: this.frameObj.gradientColor, size: this.frameObj.size,
2876
+ inset: this.frameObj.inset, offset: this.frameObj.offset, borderRadius: this.frameObj.radius,
2877
+ frameLineStyle: this.toPascalCase(this.frameObj.border), lineCount: this.frameObj.amount };
2878
+ var prevFrameSettings = { type: this.toPascalCase(this.tempFrameObj.type),
2879
+ color: this.tempFrameObj.color, gradientColor: this.tempFrameObj.gradientColor, size: this.tempFrameObj.size,
2880
+ inset: this.tempFrameObj.inset, offset: this.tempFrameObj.offset, borderRadius: this.tempFrameObj.radius,
2881
+ frameLineStyle: this.toPascalCase(this.tempFrameObj.border), lineCount: this.tempFrameObj.amount };
2882
+ var frameChange = { cancel: false, previousFrameSetting: prevFrameSettings,
2883
+ currentFrameSetting: currFrameSettings };
2884
+ this.editCompleteArgs = frameChange;
2381
2885
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
2382
2886
  this.tempFrameObj = extend({}, this.frameObj, {}, true);
2383
2887
  }
@@ -2386,19 +2890,29 @@ var ImageEditor = /** @class */ (function (_super) {
2386
2890
  if (!obj['isCropToolbar']) {
2387
2891
  this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
2388
2892
  isApplyBtn: false, isCropping: null, isZooming: null, cType: null } });
2893
+ this.currObjType.isRedact = false;
2389
2894
  }
2390
2895
  this.notify('draw', { prop: 'setNewPath', value: { bool: false } });
2391
2896
  this.transform.zoomFactor = this.transform.defaultZoomFactor;
2392
2897
  this.notify('selection', { prop: 'setCurrentDrawingShape', onPropertyChange: false, value: { value: '' } });
2393
2898
  this.isResizeOkBtn = false;
2394
2899
  this.notify('draw', { prop: 'redrawDownScale' });
2395
- this.isChangesSaved = false;
2900
+ this.isChangesSaved = this.isFinetuneBtnClick = false;
2396
2901
  if (isFinalApply) {
2397
2902
  this.drawingShape = null;
2398
2903
  this.notify('draw', { prop: 'resetTempObjColl' });
2399
2904
  this.notify('draw', { prop: 'resetTempPointColl' });
2400
2905
  }
2401
2906
  };
2907
+ ImageEditor.prototype.triggerEditCompleteEvent = function (args) {
2908
+ if (args.action === 'shape-insert' && args.actionEventArgs &&
2909
+ args.actionEventArgs.currentShapeSettings &&
2910
+ args.actionEventArgs.currentShapeSettings.type.toString() === 'Redact') {
2911
+ args.action = 'redact';
2912
+ }
2913
+ this.trigger('editComplete', args);
2914
+ this.editCompleteArgs = null;
2915
+ };
2402
2916
  /**
2403
2917
  * Handles the OK button operation
2404
2918
  *
@@ -2506,6 +3020,7 @@ var ImageEditor = /** @class */ (function (_super) {
2506
3020
  ImageEditor.prototype.setCurrAdjustmentValue = function (type, value) {
2507
3021
  var finetuneValueChanging = { finetune: this.getFinetuneOption(type), value: value, cancel: false };
2508
3022
  this.trigger('finetuneValueChanging', finetuneValueChanging);
3023
+ this.editCompleteArgs = finetuneValueChanging;
2509
3024
  if (finetuneValueChanging.cancel) {
2510
3025
  return;
2511
3026
  }
@@ -2625,9 +3140,9 @@ var ImageEditor = /** @class */ (function (_super) {
2625
3140
  toolbar_2.refreshOverflow();
2626
3141
  }
2627
3142
  }
2628
- // eslint-disable-next-line max-len
2629
3143
  var shapeChangedArgs = { action: type, currentShapeSettings: extend({}, shapeSettings, {}, true) };
2630
3144
  this.trigger('shapeChange', shapeChangedArgs);
3145
+ this.editCompleteArgs = shapeChangedArgs;
2631
3146
  };
2632
3147
  /**
2633
3148
  * Apply Font style for text.
@@ -2710,6 +3225,7 @@ var ImageEditor = /** @class */ (function (_super) {
2710
3225
  var shapeChangedArgs = { action: 'font-family', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2711
3226
  shapeChangedArgs.currentShapeSettings.fontFamily = this.textArea.style.fontFamily;
2712
3227
  this.trigger('shapeChange', shapeChangedArgs);
3228
+ this.editCompleteArgs = shapeChangedArgs;
2713
3229
  };
2714
3230
  /**
2715
3231
  * Apply Font size for text.
@@ -2821,15 +3337,17 @@ var ImageEditor = /** @class */ (function (_super) {
2821
3337
  var shapeChangedArgs = { action: 'font-size', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2822
3338
  shapeChangedArgs.currentShapeSettings.fontSize = this.activeObj.textSettings.fontSize;
2823
3339
  this.trigger('shapeChange', shapeChangedArgs);
3340
+ this.editCompleteArgs = shapeChangedArgs;
2824
3341
  };
2825
3342
  /**
2826
3343
  * Apply Font color for text.
2827
3344
  *
2828
3345
  * @param { string } value - Specifies the selected color item value.
3346
+ * @param { string } color - Specifies the selected color type value.
2829
3347
  * @hidden
2830
3348
  * @returns {void}.
2831
3349
  */
2832
- ImageEditor.prototype.updateFontColor = function (value) {
3350
+ ImageEditor.prototype.updateFontColor = function (value, color) {
2833
3351
  this.notify('selection', { prop: 'setInitialTextEdit', value: { bool: false } });
2834
3352
  var isObjPushed = false;
2835
3353
  var collLength = this.objColl.length;
@@ -2855,12 +3373,19 @@ var ImageEditor = /** @class */ (function (_super) {
2855
3373
  this.objColl.pop();
2856
3374
  }
2857
3375
  if (this.textArea.style.display === 'none') {
2858
- this.activeObj.strokeSettings.strokeColor = value;
2859
- this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null,
2860
- strokeColor: this.activeObj.strokeSettings.strokeColor, fillColor: null, strokeWidth: null } });
3376
+ if (color === 'Text') {
3377
+ this.activeObj.strokeSettings.strokeColor = value;
3378
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null,
3379
+ strokeColor: this.activeObj.strokeSettings.strokeColor, fillColor: null, strokeWidth: null } });
3380
+ }
3381
+ else {
3382
+ this.activeObj.strokeSettings.fillColor = value;
3383
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null,
3384
+ strokeColor: null, fillColor: this.activeObj.strokeSettings.fillColor, strokeWidth: null } });
3385
+ }
2861
3386
  if (!this.togglePen) {
2862
- this.objColl.push(this.activeObj);
2863
3387
  if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
3388
+ this.objColl.push(this.activeObj);
2864
3389
  this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2865
3390
  value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
2866
3391
  previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
@@ -2871,36 +3396,114 @@ var ImageEditor = /** @class */ (function (_super) {
2871
3396
  }
2872
3397
  }
2873
3398
  else if (this.textArea.style.display === 'block' || this.textArea.style.display === 'inline-block') {
2874
- this.textArea.style.color = value;
2875
- var temp = this.activeObj.strokeSettings.strokeColor;
2876
- this.activeObj.strokeSettings.strokeColor = value;
2877
- this.objColl.push(this.activeObj);
3399
+ this.textArea.style[color === 'Text' ? 'color' : 'backgroundColor'] = value;
3400
+ var temp = color === 'Text' ? this.activeObj.strokeSettings.strokeColor : this.activeObj.strokeSettings.fillColor;
3401
+ this.activeObj.strokeSettings[color === 'Text' ? 'strokeColor' : 'fillColor'] = value;
2878
3402
  if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
3403
+ this.objColl.push(this.activeObj);
2879
3404
  this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2880
3405
  value: { operation: 'textAreaCustomization', previousObj: prevObj, previousObjColl: prevObj.objColl,
2881
3406
  previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2882
3407
  previousCropObj: prevCropObj, previousText: null,
2883
3408
  currentText: null, previousFilter: null, isCircleCrop: null } });
3409
+ this.objColl.pop();
2884
3410
  }
2885
- this.objColl.pop();
2886
- this.activeObj.strokeSettings.strokeColor = temp;
3411
+ this.activeObj.strokeSettings[color === 'Text' ? 'strokeColor' : 'fillColor'] = temp;
2887
3412
  }
2888
3413
  else if (!this.togglePen) {
2889
- this.objColl.push(this.activeObj);
2890
3414
  if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
3415
+ this.objColl.push(this.activeObj);
2891
3416
  this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2892
3417
  value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
2893
3418
  previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2894
3419
  previousCropObj: prevCropObj, previousText: null,
2895
3420
  currentText: null, previousFilter: null, isCircleCrop: null } });
3421
+ this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
3422
+ }
3423
+ }
3424
+ var shapeChangedArgs = { action: 'font-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
3425
+ shapeChangedArgs.currentShapeSettings.fillColor = value;
3426
+ this.trigger('shapeChange', shapeChangedArgs);
3427
+ this.editCompleteArgs = shapeChangedArgs;
3428
+ };
3429
+ /**
3430
+ * Apply Font color for text.
3431
+ *
3432
+ * @param { string } value - Specifies the selected color item value.
3433
+ * @hidden
3434
+ * @returns {void}.
3435
+ */
3436
+ ImageEditor.prototype.updateStrokeTextColor = function (value) {
3437
+ this.notify('selection', { prop: 'setInitialTextEdit', value: { bool: false } });
3438
+ var isObjPushed = false;
3439
+ var collLength = this.objColl.length;
3440
+ this.notify('shape', { prop: 'pushActItemIntoObj' });
3441
+ if (collLength !== this.objColl.length) {
3442
+ isObjPushed = true;
3443
+ }
3444
+ var prevCropObj = extend({}, this.cropObj, {}, true);
3445
+ var objt = { shapeSettingsObj: {} };
3446
+ this.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: objt } });
3447
+ var shapeSettings = objt['shapeSettingsObj'];
3448
+ var object = { currObj: {} };
3449
+ this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
3450
+ var prevObj = object['currObj'];
3451
+ prevObj.objColl = extend([], this.objColl, [], true);
3452
+ prevObj.pointColl = extend([], this.pointColl, [], true);
3453
+ prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
3454
+ var selPointCollObj = { selPointColl: null };
3455
+ this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
3456
+ value: { obj: selPointCollObj } });
3457
+ prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
3458
+ if (isObjPushed) {
3459
+ this.objColl.pop();
3460
+ }
3461
+ if (this.textArea.style.display === 'none') {
3462
+ this.activeObj.strokeSettings.outlineColor = value;
3463
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null,
3464
+ strokeColor: null, fillColor: null, strokeWidth: null, outlineColor: this.activeObj.strokeSettings.outlineColor } });
3465
+ if (!this.togglePen) {
3466
+ if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
3467
+ this.objColl.push(this.activeObj);
3468
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
3469
+ value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
3470
+ previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
3471
+ previousCropObj: prevCropObj, previousText: null,
3472
+ currentText: null, previousFilter: null, isCircleCrop: null } });
3473
+ this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
3474
+ }
3475
+ }
3476
+ }
3477
+ else if (this.textArea.style.display === 'block' || this.textArea.style.display === 'inline-block') {
3478
+ this.textArea.style.textShadow = "-1px -1px 0 " + value + ", 1px -1px 0 " + value + ", -1px 1px 0 " + value + ", 1px 1px 0 " + value;
3479
+ var temp = this.activeObj.strokeSettings.outlineColor;
3480
+ this.activeObj.strokeSettings.outlineColor = value;
3481
+ if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
3482
+ this.objColl.push(this.activeObj);
3483
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
3484
+ value: { operation: 'textAreaCustomization', previousObj: prevObj, previousObjColl: prevObj.objColl,
3485
+ previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
3486
+ previousCropObj: prevCropObj, previousText: null,
3487
+ currentText: null, previousFilter: null, isCircleCrop: null } });
3488
+ this.objColl.pop();
2896
3489
  }
3490
+ this.activeObj.strokeSettings.outlineColor = temp;
3491
+ }
3492
+ else if (!this.togglePen) {
2897
3493
  if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
3494
+ this.objColl.push(this.activeObj);
3495
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
3496
+ value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
3497
+ previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
3498
+ previousCropObj: prevCropObj, previousText: null,
3499
+ currentText: null, previousFilter: null, isCircleCrop: null } });
2898
3500
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
2899
3501
  }
2900
3502
  }
2901
3503
  var shapeChangedArgs = { action: 'font-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2902
3504
  shapeChangedArgs.currentShapeSettings.fillColor = value;
2903
3505
  this.trigger('shapeChange', shapeChangedArgs);
3506
+ this.editCompleteArgs = shapeChangedArgs;
2904
3507
  };
2905
3508
  /**
2906
3509
  * Apply Pen stroke width.
@@ -2956,6 +3559,7 @@ var ImageEditor = /** @class */ (function (_super) {
2956
3559
  var shapeChangedArgs = { action: 'stroke-width', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2957
3560
  shapeChangedArgs.currentShapeSettings.strokeWidth = this.activeObj.strokeSettings.strokeWidth;
2958
3561
  this.trigger('shapeChange', shapeChangedArgs);
3562
+ this.editCompleteArgs = shapeChangedArgs;
2959
3563
  };
2960
3564
  /**
2961
3565
  * Apply Pen stroke color.
@@ -3016,15 +3620,18 @@ var ImageEditor = /** @class */ (function (_super) {
3016
3620
  var shapeChangedArgs = { action: 'stroke-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
3017
3621
  shapeChangedArgs.currentShapeSettings.strokeColor = value;
3018
3622
  this.trigger('shapeChange', shapeChangedArgs);
3623
+ this.editCompleteArgs = shapeChangedArgs;
3019
3624
  };
3020
3625
  /**
3021
3626
  * Apply Shape stroke width.
3022
3627
  *
3023
3628
  * @param { string } id - Specifies the selected item id.
3629
+ * @param { string } type - Specifies the type of selected item.
3630
+ * @param { string } shapeType - Specifies the shape type of selected item.
3024
3631
  * @hidden
3025
3632
  * @returns {void}.
3026
3633
  */
3027
- ImageEditor.prototype.updateStrokeWidth = function (id) {
3634
+ ImageEditor.prototype.updateStrokeWidth = function (id, type, shapeType) {
3028
3635
  if (this.activeObj.shape && (this.activeObj.shape !== 'path' || (this.activeObj.shape === 'path' &&
3029
3636
  this.activeObj.pointColl.length > 0))) {
3030
3637
  var obj = { shapeSettingsObj: {} };
@@ -3050,13 +3657,25 @@ var ImageEditor = /** @class */ (function (_super) {
3050
3657
  if (isObjPushed) {
3051
3658
  this.objColl.pop();
3052
3659
  }
3053
- this.activeObj.strokeSettings.strokeWidth = parseInt(id, 10);
3660
+ this.activeObj.strokeSettings[type === 'width' ? (shapeType === 'text' ? 'outlineWidth' : 'strokeWidth') : 'radius'] = parseInt(id, 10);
3054
3661
  if (this.activeObj.shape === 'rectangle' || this.activeObj.shape === 'ellipse') {
3055
- this.activeObj.strokeSettings.strokeWidth = parseInt(id, 10) - 1;
3662
+ this.activeObj.strokeSettings[type === 'width' ? (shapeType === 'text' ? 'outlineWidth' : 'strokeWidth') : 'radius'] = parseInt(id, 10) - 1;
3663
+ }
3664
+ this.activeObj.strokeSettings[type === 'width' ? (shapeType === 'text' ? 'outlineWidth' : 'strokeWidth') : 'radius'] *= 2;
3665
+ if (type === 'width') {
3666
+ if (shapeType === 'text') {
3667
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: null, fillColor: null,
3668
+ strokeWidth: null, radius: null, outlineWidth: this.activeObj.strokeSettings.outlineWidth } });
3669
+ }
3670
+ else {
3671
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: null, fillColor: null,
3672
+ strokeWidth: this.activeObj.strokeSettings.strokeWidth, radius: null, outlineWidth: null } });
3673
+ }
3674
+ }
3675
+ else {
3676
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: null, fillColor: null,
3677
+ strokeWidth: null, radius: this.activeObj.strokeSettings.radius } });
3056
3678
  }
3057
- this.activeObj.strokeSettings.strokeWidth *= 2;
3058
- this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: null, fillColor: null,
3059
- strokeWidth: this.activeObj.strokeSettings.strokeWidth } });
3060
3679
  this.objColl.push(this.activeObj);
3061
3680
  if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
3062
3681
  this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
@@ -3067,15 +3686,28 @@ var ImageEditor = /** @class */ (function (_super) {
3067
3686
  }
3068
3687
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
3069
3688
  var shapeChangedArgs = { action: 'stroke-width', currentShapeSettings: extend({}, shapeSettings, {}, true) };
3070
- shapeChangedArgs.currentShapeSettings.strokeWidth = this.activeObj.strokeSettings.strokeWidth;
3689
+ shapeChangedArgs.currentShapeSettings[type === 'width' ? (shapeType === 'text' ? 'outlineWidth' : 'strokeWidth') : 'radius'] = this.activeObj.strokeSettings[type === 'width' ? (shapeType === 'text' ? 'outlineWidth' : 'strokeWidth') : 'radius'];
3071
3690
  this.trigger('shapeChange', shapeChangedArgs);
3691
+ this.editCompleteArgs = shapeChangedArgs;
3072
3692
  }
3073
3693
  else if (this.activeObj.shape && (this.activeObj.shape === 'path' &&
3074
3694
  this.activeObj.pointColl.length === 0)) {
3075
3695
  this.activeObj.strokeSettings.strokeWidth = parseInt(id, 10);
3076
3696
  this.activeObj.strokeSettings.strokeWidth *= 2;
3077
- this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: null, fillColor: null,
3078
- strokeWidth: this.activeObj.strokeSettings.strokeWidth } });
3697
+ if (type === 'width') {
3698
+ if (shapeType === 'text') {
3699
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: null, fillColor: null,
3700
+ strokeWidth: null, radius: null, outlineWidth: this.activeObj.strokeSettings.outlineWidth } });
3701
+ }
3702
+ else {
3703
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: null, fillColor: null,
3704
+ strokeWidth: this.activeObj.strokeSettings.strokeWidth, radius: null, outlineWidth: null } });
3705
+ }
3706
+ }
3707
+ else {
3708
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: null, fillColor: null,
3709
+ strokeWidth: null, radius: this.activeObj.strokeSettings.radius } });
3710
+ }
3079
3711
  }
3080
3712
  };
3081
3713
  /**
@@ -3133,6 +3765,7 @@ var ImageEditor = /** @class */ (function (_super) {
3133
3765
  var shapeChangedArgs = { action: 'stroke-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
3134
3766
  shapeChangedArgs.currentShapeSettings.strokeColor = value;
3135
3767
  this.trigger('shapeChange', shapeChangedArgs);
3768
+ this.editCompleteArgs = shapeChangedArgs;
3136
3769
  };
3137
3770
  /**
3138
3771
  * Apply Shape fill color.
@@ -3180,6 +3813,7 @@ var ImageEditor = /** @class */ (function (_super) {
3180
3813
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
3181
3814
  var shapeChangedArgs = { action: 'fill-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
3182
3815
  this.trigger('shapeChange', shapeChangedArgs);
3816
+ this.editCompleteArgs = shapeChangedArgs;
3183
3817
  };
3184
3818
  /**
3185
3819
  * Apply horizontal flip.
@@ -3483,8 +4117,11 @@ var ImageEditor = /** @class */ (function (_super) {
3483
4117
  ImageEditor.prototype.setStraighten = function (value) {
3484
4118
  var straightenEventArgs = { cancel: false, previousDegree: this.transform.straighten, currentDegree: value };
3485
4119
  this.trigger('rotating', straightenEventArgs);
4120
+ this.editCompleteArgs = straightenEventArgs;
3486
4121
  if (!straightenEventArgs.cancel) {
3487
4122
  this.performStraighten(straightenEventArgs);
4123
+ var actionArgs = { action: 'straighten', actionEventArgs: this.editCompleteArgs };
4124
+ this.triggerEditCompleteEvent(actionArgs);
3488
4125
  }
3489
4126
  };
3490
4127
  ImageEditor.prototype.duplicateImage = function () {
@@ -3700,9 +4337,36 @@ var ImageEditor = /** @class */ (function (_super) {
3700
4337
  Material3Dark: { primaryColor: '#d0bcff', secondaryColor: '#fff' },
3701
4338
  Fluent2: { primaryColor: '#0f6cbd', secondaryColor: '#fff' },
3702
4339
  Fluent2Dark: { primaryColor: '#115ea3', secondaryColor: '#fff' },
3703
- Fluent2Highcontrast: { primaryColor: '#1aebff', secondaryColor: '#fff' }
4340
+ Fluent2Highcontrast: { primaryColor: '#1aebff', secondaryColor: '#fff' },
4341
+ 'Bootstrap5.3': { primaryColor: '#0d6efd', secondaryColor: '#fff' },
4342
+ 'Bootstrap5.3Dark': { primaryColor: '#0d6efd', secondaryColor: '#fff' }
3704
4343
  };
3705
4344
  };
4345
+ /**
4346
+ * Draw a redaction on an image.
4347
+ *
4348
+ * @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.
4349
+ * @param {number} x – Optional. Specifies x-coordinate of redaction. If not specified, the redaction drawing is initiated with the first parameter.
4350
+ * @param {number} y – Optional. Specifies y-coordinate of redaction. If not specified it draws redaction from the center point of the image.
4351
+ * @param {number} width – Optional. Specifies the width of the redaction. The default value is 100.
4352
+ * @param {number} height – Optional. Specifies the height of the redaction. The default value is 50.
4353
+ * @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.
4354
+ * @returns {boolean}.
4355
+ */
4356
+ ImageEditor.prototype.drawRedact = function (type, x, y, width, height, value) {
4357
+ var isRedact = false;
4358
+ var isPointsInRange = this.allowShape(x, y);
4359
+ if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
4360
+ isRedact = true;
4361
+ this.notify('shape', {
4362
+ prop: 'drawRedact', onPropertyChange: false, value: {
4363
+ x: x, y: y, width: width, height: height, type: type, value: value
4364
+ }
4365
+ });
4366
+ this.notify('draw', { prop: 'redrawDownScale' });
4367
+ }
4368
+ return isRedact;
4369
+ };
3706
4370
  var ImageEditor_1;
3707
4371
  __decorate([
3708
4372
  Property('')
@@ -3824,6 +4488,9 @@ var ImageEditor = /** @class */ (function (_super) {
3824
4488
  __decorate([
3825
4489
  Event()
3826
4490
  ], ImageEditor.prototype, "frameChange", void 0);
4491
+ __decorate([
4492
+ Event()
4493
+ ], ImageEditor.prototype, "editComplete", void 0);
3827
4494
  ImageEditor = ImageEditor_1 = __decorate([
3828
4495
  NotifyPropertyChanges
3829
4496
  ], ImageEditor);