@syncfusion/ej2-image-editor 23.2.7 → 24.1.43

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 (99) hide show
  1. package/CHANGELOG.md +6 -54
  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 +7227 -4367
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +7295 -4422
  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 +12 -12
  12. package/src/image-editor/action/crop.d.ts +6 -0
  13. package/src/image-editor/action/crop.js +347 -188
  14. package/src/image-editor/action/draw.d.ts +35 -2
  15. package/src/image-editor/action/draw.js +1691 -890
  16. package/src/image-editor/action/export.js +90 -29
  17. package/src/image-editor/action/filter.d.ts +3 -1
  18. package/src/image-editor/action/filter.js +74 -94
  19. package/src/image-editor/action/freehand-draw.d.ts +4 -0
  20. package/src/image-editor/action/freehand-draw.js +248 -147
  21. package/src/image-editor/action/selection.d.ts +6 -1
  22. package/src/image-editor/action/selection.js +1133 -1091
  23. package/src/image-editor/action/shape.d.ts +7 -0
  24. package/src/image-editor/action/shape.js +923 -550
  25. package/src/image-editor/action/transform.d.ts +2 -0
  26. package/src/image-editor/action/transform.js +518 -346
  27. package/src/image-editor/action/undo-redo.d.ts +2 -0
  28. package/src/image-editor/action/undo-redo.js +137 -36
  29. package/src/image-editor/base/enum.d.ts +2 -1
  30. package/src/image-editor/base/enum.js +1 -0
  31. package/src/image-editor/base/image-editor-model.d.ts +37 -2
  32. package/src/image-editor/base/image-editor.d.ts +124 -3
  33. package/src/image-editor/base/image-editor.js +675 -172
  34. package/src/image-editor/base/interface.d.ts +69 -15
  35. package/src/image-editor/renderer/toolbar.d.ts +10 -0
  36. package/src/image-editor/renderer/toolbar.js +1415 -835
  37. package/styles/bootstrap-dark.css +113 -8
  38. package/styles/bootstrap.css +112 -7
  39. package/styles/bootstrap4.css +113 -8
  40. package/styles/bootstrap5-dark.css +113 -8
  41. package/styles/bootstrap5.css +113 -8
  42. package/styles/fabric-dark.css +114 -9
  43. package/styles/fabric.css +113 -8
  44. package/styles/fluent-dark.css +118 -9
  45. package/styles/fluent.css +118 -9
  46. package/styles/highcontrast-light.css +112 -7
  47. package/styles/highcontrast.css +116 -7
  48. package/styles/image-editor/_bootstrap-dark-definition.scss +3 -0
  49. package/styles/image-editor/_bootstrap-definition.scss +3 -0
  50. package/styles/image-editor/_bootstrap4-definition.scss +3 -0
  51. package/styles/image-editor/_bootstrap5-definition.scss +3 -0
  52. package/styles/image-editor/_fabric-dark-definition.scss +3 -0
  53. package/styles/image-editor/_fabric-definition.scss +3 -0
  54. package/styles/image-editor/_fluent-definition.scss +3 -0
  55. package/styles/image-editor/_fusionnew-definition.scss +3 -0
  56. package/styles/image-editor/_highcontrast-definition.scss +3 -0
  57. package/styles/image-editor/_highcontrast-light-definition.scss +3 -0
  58. package/styles/image-editor/_layout.scss +138 -4
  59. package/styles/image-editor/_material-dark-definition.scss +3 -0
  60. package/styles/image-editor/_material-definition.scss +3 -0
  61. package/styles/image-editor/_material3-definition.scss +3 -0
  62. package/styles/image-editor/_tailwind-definition.scss +3 -0
  63. package/styles/image-editor/_theme.scss +2 -4
  64. package/styles/image-editor/bootstrap-dark.css +113 -8
  65. package/styles/image-editor/bootstrap.css +112 -7
  66. package/styles/image-editor/bootstrap4.css +113 -8
  67. package/styles/image-editor/bootstrap5-dark.css +113 -8
  68. package/styles/image-editor/bootstrap5.css +113 -8
  69. package/styles/image-editor/fabric-dark.css +114 -9
  70. package/styles/image-editor/fabric.css +113 -8
  71. package/styles/image-editor/fluent-dark.css +118 -9
  72. package/styles/image-editor/fluent.css +118 -9
  73. package/styles/image-editor/highcontrast-light.css +112 -7
  74. package/styles/image-editor/highcontrast.css +116 -7
  75. package/styles/image-editor/icons/_bootstrap-dark.scss +60 -0
  76. package/styles/image-editor/icons/_bootstrap.scss +60 -0
  77. package/styles/image-editor/icons/_bootstrap4.scss +60 -0
  78. package/styles/image-editor/icons/_bootstrap5.scss +60 -0
  79. package/styles/image-editor/icons/_fabric-dark.scss +60 -0
  80. package/styles/image-editor/icons/_fabric.scss +60 -0
  81. package/styles/image-editor/icons/_fluent.scss +66 -0
  82. package/styles/image-editor/icons/_highcontrast-light.scss +60 -0
  83. package/styles/image-editor/icons/_highcontrast.scss +60 -0
  84. package/styles/image-editor/icons/_material-dark.scss +60 -0
  85. package/styles/image-editor/icons/_material.scss +60 -0
  86. package/styles/image-editor/icons/_material3.scss +60 -0
  87. package/styles/image-editor/icons/_tailwind.scss +60 -0
  88. package/styles/image-editor/material-dark.css +113 -8
  89. package/styles/image-editor/material.css +113 -8
  90. package/styles/image-editor/material3-dark.css +126 -9
  91. package/styles/image-editor/material3.css +126 -9
  92. package/styles/image-editor/tailwind-dark.css +114 -9
  93. package/styles/image-editor/tailwind.css +114 -9
  94. package/styles/material-dark.css +113 -8
  95. package/styles/material.css +113 -8
  96. package/styles/material3-dark.css +126 -9
  97. package/styles/material3.css +126 -9
  98. package/styles/tailwind-dark.css +114 -9
  99. package/styles/tailwind.css +114 -9
@@ -102,6 +102,23 @@ var SelectionSettings = /** @class */ (function (_super) {
102
102
  return SelectionSettings;
103
103
  }(ChildProperty));
104
104
  export { SelectionSettings };
105
+ /**
106
+ * Predefine the font families that populate in font family dropdown list from the toolbar.
107
+ */
108
+ var FontFamily = /** @class */ (function (_super) {
109
+ __extends(FontFamily, _super);
110
+ function FontFamily() {
111
+ return _super !== null && _super.apply(this, arguments) || this;
112
+ }
113
+ __decorate([
114
+ Property('Arial')
115
+ ], FontFamily.prototype, "default", void 0);
116
+ __decorate([
117
+ Property(null)
118
+ ], FontFamily.prototype, "items", void 0);
119
+ return FontFamily;
120
+ }(ChildProperty));
121
+ export { FontFamily };
105
122
  /**
106
123
  * The Image Editor is a graphical user interface for editing images.
107
124
  *
@@ -130,7 +147,7 @@ var ImageEditor = /** @class */ (function (_super) {
130
147
  _this.isImageLoaded = false;
131
148
  /** @hidden */
132
149
  _this.activeObj = { activePoint: { startX: 0, startY: 0, endX: 0, endY: 0, width: 0, height: 0 },
133
- flipObjColl: [], triangle: [], triangleRatio: [], rotatedAngle: 0 };
150
+ flipObjColl: [], triangle: [], triangleRatio: [], rotatedAngle: 0, opacity: 1 };
134
151
  // current object's ui interaction properties
135
152
  /** @hidden */
136
153
  _this.currObjType = { shape: '', isDragging: false, isActiveObj: false, isText: false, isInitialText: false, isLine: false, isInitialLine: false,
@@ -157,14 +174,16 @@ var ImageEditor = /** @class */ (function (_super) {
157
174
  /** @hidden */
158
175
  _this.cropObj = { cropZoom: 0, defaultZoom: 0, totalPannedPoint: { x: 0, y: 0 }, totalPannedClientPoint: { x: 0, y: 0 },
159
176
  totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {}, rotateFlipColl: [],
160
- degree: 0, currFlipState: '', destPoints: { startX: 0, startY: 0, width: 0, height: 0 },
177
+ degree: 0, currFlipState: '', straighten: 0, destPoints: { startX: 0, startY: 0, width: 0, height: 0 },
161
178
  srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '', isBrightAdjust: false,
162
- zoomFactor: 0, previousZoomValue: 0, aspectWidth: null, aspectHeight: null, frame: 'none' };
179
+ zoomFactor: 0, previousZoomValue: 0, aspectWidth: null, aspectHeight: null, frame: 'none', straightenZoom: 0,
180
+ adjustmentLevel: { brightness: 0, contrast: 0, hue: 0, opacity: 100, saturation: 0, blur: 0,
181
+ exposure: 0, transparency: 100, sharpen: false, bw: false }, currentFilter: '' };
163
182
  // Stored transformations performed after cropping
164
183
  /** @hidden */
165
184
  _this.afterCropActions = [];
166
185
  /** @hidden */
167
- _this.transform = { degree: 0, currFlipState: '', zoomFactor: 0, cropZoomFactor: null, defaultZoomFactor: 0 };
186
+ _this.transform = { degree: 0, currFlipState: '', zoomFactor: 0, cropZoomFactor: null, defaultZoomFactor: 0, straighten: 0 };
168
187
  /** @hidden */
169
188
  _this.panPoint = { currentPannedPoint: { x: 0, y: 0 }, totalPannedPoint: { x: 0, y: 0 }, totalPannedInternalPoint: { x: 0, y: 0 },
170
189
  totalPannedClientPoint: { x: 0, y: 0 } };
@@ -215,17 +234,25 @@ var ImageEditor = /** @class */ (function (_super) {
215
234
  _this.borderRadius = 0;
216
235
  /** @hidden */
217
236
  _this.lineCount = 0;
218
- if (!isBlazor()) {
219
- ImageEditor_1.Inject(Crop, Draw, Selection, Transform, Export, ToolbarModule);
220
- ImageEditor_1.Inject(UndoRedo);
221
- ImageEditor_1.Inject(Filter);
222
- ImageEditor_1.Inject(Shape);
223
- ImageEditor_1.Inject(FreehandDrawing);
224
- if (element) {
225
- _this.appendTo(element);
226
- }
227
- }
228
- else {
237
+ /** @hidden */
238
+ _this.prevStraightenedDegree = 0;
239
+ /** @hidden */
240
+ _this.tempStraighten = 0;
241
+ /** @hidden */
242
+ _this.isStraightening = false;
243
+ /** @hidden */
244
+ _this.isFinetuning = false;
245
+ /** @hidden */
246
+ _this.isZoomBtnClick = false;
247
+ /** @hidden */
248
+ _this.isFinetuneBtnClick = false;
249
+ /** @hidden */
250
+ _this.isFilterCanvasClick = false;
251
+ /** @hidden */
252
+ _this.isFrameBtnClick = false;
253
+ /** @hidden */
254
+ _this.isChangesSaved = false;
255
+ if (isBlazor()) {
229
256
  new Crop(_this);
230
257
  new Draw(_this);
231
258
  new Filter(_this);
@@ -236,6 +263,16 @@ var ImageEditor = /** @class */ (function (_super) {
236
263
  new UndoRedo(_this);
237
264
  new Export(_this);
238
265
  }
266
+ else {
267
+ ImageEditor_1.Inject(Crop, Draw, Selection, Transform, Export, ToolbarModule);
268
+ ImageEditor_1.Inject(UndoRedo);
269
+ ImageEditor_1.Inject(Filter);
270
+ ImageEditor_1.Inject(Shape);
271
+ ImageEditor_1.Inject(FreehandDrawing);
272
+ if (element) {
273
+ _this.appendTo(element);
274
+ }
275
+ }
239
276
  return _this;
240
277
  }
241
278
  ImageEditor_1 = ImageEditor;
@@ -502,14 +539,14 @@ var ImageEditor = /** @class */ (function (_super) {
502
539
  if (!this.element.getAttribute('class')) {
503
540
  this.element.removeAttribute('class');
504
541
  }
505
- if (!isBlazor()) {
542
+ if (isBlazor()) {
543
+ this.element.classList.remove('e-image-editor');
544
+ }
545
+ else {
506
546
  this.notify('toolbar', { prop: 'destroySubComponents', onPropertyChange: false });
507
547
  this.notify('destroyed', null);
508
548
  _super.prototype.destroy.call(this);
509
549
  }
510
- else {
511
- this.element.classList.remove('e-image-editor');
512
- }
513
550
  this.unwireEvent();
514
551
  this.element.innerHTML = '';
515
552
  };
@@ -812,7 +849,8 @@ var ImageEditor = /** @class */ (function (_super) {
812
849
  };
813
850
  ImageEditor.prototype.keyUpEventHandler = function (e) {
814
851
  // eslint-disable-next-line
815
- if (this.textArea.style.display === 'block' && e.target.id === this.element.id + '_textArea') {
852
+ if ((this.textArea.style.display === 'block' || this.textArea.style.display === 'inline-block')
853
+ && e.target.id === this.element.id + '_textArea') {
816
854
  this.notify('selection', { prop: 'textKeyDown', value: { e: e } });
817
855
  }
818
856
  };
@@ -900,6 +938,7 @@ var ImageEditor = /** @class */ (function (_super) {
900
938
  */
901
939
  ImageEditor.prototype.flip = function (direction) {
902
940
  this.notify('transform', { prop: 'flip', value: { direction: direction } });
941
+ this.notify('draw', { prop: 'redrawDownScale' });
903
942
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
904
943
  };
905
944
  /**
@@ -927,6 +966,9 @@ var ImageEditor = /** @class */ (function (_super) {
927
966
  * @returns {void}.
928
967
  */
929
968
  ImageEditor.prototype.open = function (data) {
969
+ if (isNullOrUndefined(data)) {
970
+ return;
971
+ }
930
972
  document.getElementById(this.element.id + '_dropArea').style.display = 'none';
931
973
  this.notify('draw', { prop: 'open', value: { data: data } });
932
974
  };
@@ -955,7 +997,7 @@ var ImageEditor = /** @class */ (function (_super) {
955
997
  }
956
998
  }
957
999
  var isImageLoaded = this.isImageLoaded;
958
- this.currObjType.isUndoAction = this.isUndoRedo = this.togglePan = this.togglePen = this.isImageLoaded = false;
1000
+ this.currObjType.isUndoAction = this.isUndoRedo = this.togglePan = this.togglePen = this.isImageLoaded = this.isFinetuning = false;
959
1001
  this.isCircleCrop = this.isCropTab = false;
960
1002
  this.objColl = [];
961
1003
  this.transform.degree = 0;
@@ -991,34 +1033,62 @@ var ImageEditor = /** @class */ (function (_super) {
991
1033
  isUndoAction: false, isFiltered: false, isSave: false, isResize: false };
992
1034
  this.cropObj = { cropZoom: 0, defaultZoom: 0, totalPannedPoint: { x: 0, y: 0 }, totalPannedClientPoint: { x: 0, y: 0 },
993
1035
  totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {},
994
- rotateFlipColl: [], degree: 0, currFlipState: '', zoomFactor: 0, previousZoomValue: 0,
1036
+ rotateFlipColl: [], degree: 0, currFlipState: '', straighten: 0, zoomFactor: 0, previousZoomValue: 0,
995
1037
  destPoints: { startX: 0, startY: 0, width: 0, height: 0 }, frame: 'none',
996
1038
  srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '', isBrightAdjust: false,
997
- aspectWidth: null, aspectHeight: null };
1039
+ aspectWidth: null, aspectHeight: null, straightenZoom: 0,
1040
+ adjustmentLevel: { brightness: 0, contrast: 0, hue: 0, opacity: 100, saturation: 0, blur: 0,
1041
+ exposure: 0, transparency: 100, sharpen: false, bw: false }, currentFilter: '' };
998
1042
  this.afterCropActions = [];
999
1043
  this.currentFilter = '';
1000
1044
  this.tempFrameZoomLevel = null;
1001
1045
  this.cxtTbarHeight = null;
1046
+ this.straightenPoint = null;
1047
+ this.transform.straighten = 0;
1048
+ this.cancelCropSelection = null;
1002
1049
  this.aspectWidth = this.aspectHeight = null;
1050
+ this.isResize = false;
1003
1051
  var obj_1 = { initialZoomValue: false };
1004
1052
  this.notify('draw', { prop: 'getInitialZoomValue', onPropertyChange: false, value: { obj: obj_1 } });
1005
1053
  if (obj_1['initialZoomValue']) {
1006
1054
  this.setProperties({ zoomSettings: { zoomFactor: obj_1['initialZoomValue'] } }, true);
1007
1055
  }
1008
- if (document.getElementById(this.element.id + '_quickAccessToolbarArea')) {
1009
- document.getElementById(this.element.id + '_quickAccessToolbarArea').style.display = 'none';
1056
+ var qtArea = document.getElementById(this.element.id + '_quickAccessToolbarArea');
1057
+ if (qtArea) {
1058
+ qtArea.style.display = 'none';
1010
1059
  }
1011
1060
  this.notifyResetForAllModules();
1012
1061
  this.notify('filter', { prop: 'update-finetunes' });
1062
+ if (!isBlazor()) {
1063
+ if (this.toolbarTemplate) {
1064
+ this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').clientHeight;
1065
+ }
1066
+ else if (this.element.querySelector('#' + this.element.id + '_toolbar')) {
1067
+ this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbar').clientHeight;
1068
+ }
1069
+ this.notify('toolbar', { prop: 'setToolbarHeight', value: { height: this.toolbarHeight } });
1070
+ }
1071
+ this.isImageLoaded = isImageLoaded;
1072
+ this.straightenBaseImageCanvas();
1013
1073
  this.isImageLoaded = false;
1014
1074
  this.notify('draw', { prop: 'update-canvas', onPropertyChange: false });
1015
1075
  this.isImageLoaded = isImageLoaded;
1076
+ this.prevStraightenedDegree = 0;
1016
1077
  if (!isBlazor()) {
1017
- if (this.element.querySelector('.e-contextual-toolbar-wrapper')) {
1018
- this.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
1078
+ var ctWrapper = this.element.querySelector('.e-contextual-toolbar-wrapper');
1079
+ if (ctWrapper) {
1080
+ ctWrapper.classList.add('e-hide');
1019
1081
  }
1020
1082
  this.notify('toolbar', { prop: 'refresh-dropdown-btn', value: { isDisabled: false } });
1021
1083
  this.notify('toolbar', { prop: 'enable-disable-btns' });
1084
+ var straightenObj = { bool: this.isStraightening };
1085
+ if (Browser.isDevice && straightenObj['bool']) {
1086
+ this.notify('crop', { prop: 'resizeWrapper' });
1087
+ }
1088
+ }
1089
+ else {
1090
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1091
+ this.activeObj.textSettings.fontFamily = this.defaultFontFamily;
1022
1092
  }
1023
1093
  }
1024
1094
  };
@@ -1039,6 +1109,7 @@ var ImageEditor = /** @class */ (function (_super) {
1039
1109
  ImageEditor.prototype.rotate = function (degree) {
1040
1110
  var obj = { isRotate: false };
1041
1111
  this.notify('transform', { prop: 'rotate', value: { degree: degree, obj: obj } });
1112
+ this.notify('draw', { prop: 'redrawDownScale' });
1042
1113
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
1043
1114
  return obj['isRotate'];
1044
1115
  };
@@ -1074,6 +1145,7 @@ var ImageEditor = /** @class */ (function (_super) {
1074
1145
  *
1075
1146
  */
1076
1147
  ImageEditor.prototype.select = function (type, startX, startY, width, height) {
1148
+ this.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: 'crop-' + type } });
1077
1149
  this.notify('draw', { prop: 'select', onPropertyChange: false,
1078
1150
  value: { type: type, startX: startX, startY: startY, width: width, height: height } });
1079
1151
  this.notify('draw', { prop: 'select', onPropertyChange: false,
@@ -1133,6 +1205,7 @@ var ImageEditor = /** @class */ (function (_super) {
1133
1205
  ImageEditor.prototype.zoom = function (zoomFactor, zoomPoint) {
1134
1206
  this.notify('transform', { prop: 'zoom', onPropertyChange: false,
1135
1207
  value: { zoomFactor: zoomFactor, zoomPoint: zoomPoint } });
1208
+ this.notify('draw', { prop: 'redrawDownScale' });
1136
1209
  };
1137
1210
  /**
1138
1211
  * Draw ellipse on an image.
@@ -1157,6 +1230,7 @@ var ImageEditor = /** @class */ (function (_super) {
1157
1230
  isEllipse = true;
1158
1231
  this.notify('shape', { prop: 'drawEllipse', onPropertyChange: false, value: { x: x, y: y, radiusX: radiusX, radiusY: radiusY,
1159
1232
  strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree } });
1233
+ this.notify('draw', { prop: 'redrawDownScale' });
1160
1234
  }
1161
1235
  return isEllipse;
1162
1236
  };
@@ -1178,6 +1252,7 @@ var ImageEditor = /** @class */ (function (_super) {
1178
1252
  isLine = true;
1179
1253
  this.notify('shape', { prop: 'drawLine', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
1180
1254
  endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor } });
1255
+ this.notify('draw', { prop: 'redrawDownScale' });
1181
1256
  }
1182
1257
  return isLine;
1183
1258
  };
@@ -1201,6 +1276,7 @@ var ImageEditor = /** @class */ (function (_super) {
1201
1276
  isArrow = true;
1202
1277
  this.notify('shape', { prop: 'drawArrow', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
1203
1278
  endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, arrowStart: arrowStart, arrowEnd: arrowEnd } });
1279
+ this.notify('draw', { prop: 'redrawDownScale' });
1204
1280
  }
1205
1281
  return isArrow;
1206
1282
  };
@@ -1212,7 +1288,7 @@ var ImageEditor = /** @class */ (function (_super) {
1212
1288
  * @param {string} strokeColor - Specifies the stroke color of path.
1213
1289
  * @returns {boolean}.
1214
1290
  */
1215
- ImageEditor.prototype.drawPath = function (pointColl, strokeWidth, strokeColor) {
1291
+ ImageEditor.prototype.drawPath = function (pointColl, strokeWidth, strokeColor, opacity) {
1216
1292
  this.isPublicMethod = true;
1217
1293
  var obj = { inRange: false };
1218
1294
  var isPath = false;
@@ -1229,6 +1305,7 @@ var ImageEditor = /** @class */ (function (_super) {
1229
1305
  isPath = true;
1230
1306
  this.notify('shape', { prop: 'drawPath', onPropertyChange: false, value: { pointColl: pointColl,
1231
1307
  strokeWidth: strokeWidth, strokeColor: strokeColor } });
1308
+ this.notify('draw', { prop: 'redrawDownScale' });
1232
1309
  }
1233
1310
  return isPath;
1234
1311
  };
@@ -1252,6 +1329,7 @@ var ImageEditor = /** @class */ (function (_super) {
1252
1329
  isRectangle = true;
1253
1330
  this.notify('shape', { prop: 'drawRectangle', onPropertyChange: false, value: { x: x, y: y, width: width, height: height,
1254
1331
  strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree } });
1332
+ this.notify('draw', { prop: 'redrawDownScale' });
1255
1333
  }
1256
1334
  return isRectangle;
1257
1335
  };
@@ -1278,6 +1356,7 @@ var ImageEditor = /** @class */ (function (_super) {
1278
1356
  isText = true;
1279
1357
  this.notify('shape', { prop: 'drawText', onPropertyChange: false, value: { x: x, y: y, text: text, fontFamily: fontFamily,
1280
1358
  fontSize: fontSize, bold: bold, italic: italic, color: color } });
1359
+ this.notify('draw', { prop: 'redrawDownScale' });
1281
1360
  }
1282
1361
  return isText;
1283
1362
  };
@@ -1292,16 +1371,18 @@ var ImageEditor = /** @class */ (function (_super) {
1292
1371
  * @param {number} height - Specifies the height of the image.
1293
1372
  * @param {boolean} isAspectRatio - Specifies whether to maintain aspect ratio or not.
1294
1373
  * @param {number} degree - Specifies the degree to rotate the image.
1374
+ * @param {number} opacity - Specifies the value for the image.
1295
1375
  * @returns {boolean}.
1296
1376
  *
1297
1377
  */
1298
- ImageEditor.prototype.drawImage = function (data, x, y, width, height, isAspectRatio, degree) {
1378
+ ImageEditor.prototype.drawImage = function (data, x, y, width, height, isAspectRatio, degree, opacity) {
1299
1379
  var isImage = false;
1300
1380
  var isPointsInRange = this.allowShape(x, y);
1301
1381
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
1302
1382
  var length_1 = this.objColl.length;
1303
1383
  this.notify('shape', { prop: 'drawImage', onPropertyChange: false, value: { x: x, y: y, width: width, height: height,
1304
- src: data, degree: degree, isAspectRatio: isAspectRatio } });
1384
+ src: data, degree: degree, isAspectRatio: isAspectRatio, opacity: opacity } });
1385
+ this.notify('draw', { prop: 'redrawDownScale' });
1305
1386
  if (this.objColl.length > length_1) {
1306
1387
  isImage = true;
1307
1388
  }
@@ -1321,6 +1402,7 @@ var ImageEditor = /** @class */ (function (_super) {
1321
1402
  ImageEditor.prototype.selectShape = function (id) {
1322
1403
  var obj = { isSelected: false };
1323
1404
  this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: id, obj: obj } });
1405
+ this.notify('draw', { prop: 'redrawDownScale' });
1324
1406
  return obj['isSelected'];
1325
1407
  };
1326
1408
  /**
@@ -1335,6 +1417,7 @@ var ImageEditor = /** @class */ (function (_super) {
1335
1417
  */
1336
1418
  ImageEditor.prototype.deleteShape = function (id) {
1337
1419
  this.notify('shape', { prop: 'deleteShape', onPropertyChange: false, value: { id: id } });
1420
+ this.notify('draw', { prop: 'redrawDownScale' });
1338
1421
  };
1339
1422
  /**
1340
1423
  * Get particular shapes details based on id of the shape which is drawn on an image editor.
@@ -1349,6 +1432,7 @@ var ImageEditor = /** @class */ (function (_super) {
1349
1432
  var shapeDetails = {};
1350
1433
  this.notify('shape', { prop: 'getShapeSetting', onPropertyChange: false,
1351
1434
  value: { id: id, obj: shapeDetails } });
1435
+ this.notify('draw', { prop: 'redrawDownScale' });
1352
1436
  return shapeDetails;
1353
1437
  };
1354
1438
  /**
@@ -1359,6 +1443,7 @@ var ImageEditor = /** @class */ (function (_super) {
1359
1443
  ImageEditor.prototype.getShapeSettings = function () {
1360
1444
  var obj = { shapeDetailsColl: [] };
1361
1445
  this.notify('shape', { prop: 'getShapeSettings', onPropertyChange: false, value: { obj: obj } });
1446
+ this.notify('draw', { prop: 'redrawDownScale' });
1362
1447
  return obj['shapeDetailsColl'];
1363
1448
  };
1364
1449
  /**
@@ -1384,6 +1469,7 @@ var ImageEditor = /** @class */ (function (_super) {
1384
1469
  ImageEditor.prototype.finetuneImage = function (finetuneOption, value) {
1385
1470
  if (!this.disabled && this.isImageLoaded) {
1386
1471
  this.notify('filter', { prop: 'finetuneImage', value: { value: value, option: finetuneOption } });
1472
+ this.notify('draw', { prop: 'redrawDownScale' });
1387
1473
  }
1388
1474
  };
1389
1475
  /**
@@ -1398,6 +1484,7 @@ var ImageEditor = /** @class */ (function (_super) {
1398
1484
  ImageEditor.prototype.applyImageFilter = function (filterOption) {
1399
1485
  if (!this.disabled && this.isImageLoaded) {
1400
1486
  this.notify('filter', { prop: 'applyImageFilter', value: { option: filterOption.toString() } });
1487
+ this.notify('draw', { prop: 'redrawDownScale' });
1401
1488
  this.canvasFilter = this.lowerContext.filter;
1402
1489
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
1403
1490
  }
@@ -1412,6 +1499,7 @@ var ImageEditor = /** @class */ (function (_super) {
1412
1499
  */
1413
1500
  ImageEditor.prototype.undo = function () {
1414
1501
  this.notify('undo-redo', { prop: 'undo', onPropertyChange: false });
1502
+ this.notify('draw', { prop: 'redrawDownScale' });
1415
1503
  };
1416
1504
  /**
1417
1505
  * Redo the last user action that was undone by the user or `undo` method.
@@ -1422,6 +1510,7 @@ var ImageEditor = /** @class */ (function (_super) {
1422
1510
  */
1423
1511
  ImageEditor.prototype.redo = function () {
1424
1512
  this.notify('undo-redo', { prop: 'redo', onPropertyChange: false });
1513
+ this.notify('draw', { prop: 'redrawDownScale' });
1425
1514
  };
1426
1515
  /**
1427
1516
  * Get the dimension of an image in the image editor such as x, y, width, and height.
@@ -1479,6 +1568,7 @@ var ImageEditor = /** @class */ (function (_super) {
1479
1568
  else {
1480
1569
  this.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
1481
1570
  }
1571
+ this.notify('draw', { prop: 'redrawDownScale' });
1482
1572
  }
1483
1573
  return isResized;
1484
1574
  };
@@ -1547,8 +1637,80 @@ var ImageEditor = /** @class */ (function (_super) {
1547
1637
  extend(this.frameObj, this.tempFrameObj);
1548
1638
  this.tempFrameZoomLevel = null;
1549
1639
  }
1640
+ this.notify('draw', { prop: 'redrawDownScale' });
1550
1641
  return isFrame;
1551
1642
  };
1643
+ /**
1644
+ * Straightens an image by rotating it clockwise or counterclockwise.
1645
+ *
1646
+ * @param {number} degree - The degree value specifying the amount of rotation for straightening the image.
1647
+ * Positive values indicate clockwise rotation, while negative values indicate counterclockwise rotation.
1648
+ *
1649
+ * @remarks
1650
+ * The degree value should be within the range of -45 to +45 degrees for accurate straightening.
1651
+ *
1652
+ * @returns {boolean} - A boolean value indicating the success of the straightening operation.
1653
+ */
1654
+ ImageEditor.prototype.straightenImage = function (degree) {
1655
+ var isStraightened = false;
1656
+ if (degree >= -45 && degree <= 45) {
1657
+ isStraightened = true;
1658
+ this.notify('transform', { prop: 'straightenImage', value: { degree: degree } });
1659
+ this.notify('draw', { prop: 'redrawDownScale' });
1660
+ }
1661
+ return isStraightened;
1662
+ };
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
+ * @returns {boolean}.
1670
+ *
1671
+ */
1672
+ ImageEditor.prototype.updateShape = function (setting) {
1673
+ var obj = { isSelected: false };
1674
+ this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: setting.id, obj: obj } });
1675
+ if (obj['isSelected']) {
1676
+ this.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
1677
+ value: { shapeSettings: setting } });
1678
+ var activeObj = extend({}, this.activeObj, {}, true);
1679
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: null } });
1680
+ this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
1681
+ this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: activeObj } });
1682
+ this.okBtn();
1683
+ this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
1684
+ this.notify('draw', { prop: 'redrawDownScale' });
1685
+ }
1686
+ return obj['isSelected'];
1687
+ };
1688
+ /**
1689
+ * Duplicates a shape based on the given shape ID in the ImageEditor.
1690
+ * Use 'getShapeSettings' method to get the shape and then pass a shapeId from the returned shape to clone a shape.
1691
+ *
1692
+ * @param {string} shapeId - Specifies the shape id to clone a shape on an image.
1693
+ * @returns {boolean}.
1694
+ *
1695
+ */
1696
+ ImageEditor.prototype.cloneShape = function (shapeId) {
1697
+ var obj = { isSelected: false };
1698
+ if (shapeId.split('_')[0] === 'shape') {
1699
+ this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: shapeId, obj: obj } });
1700
+ if (obj['isSelected']) {
1701
+ if (isBlazor()) {
1702
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1703
+ this.duplicateShape(false, true);
1704
+ }
1705
+ else {
1706
+ this.notify('toolbar', { prop: 'duplicateShape', onPropertyChange: false, value: { isPreventUndoRedo: false } });
1707
+ }
1708
+ this.okBtn();
1709
+ this.notify('draw', { prop: 'redrawDownScale' });
1710
+ }
1711
+ }
1712
+ return obj['isSelected'];
1713
+ };
1552
1714
  // Toolbar related codes
1553
1715
  ImageEditor.prototype.toolbarTemplateFn = function () {
1554
1716
  var template;
@@ -1668,11 +1830,11 @@ var ImageEditor = /** @class */ (function (_super) {
1668
1830
  this.isUndoRedo = true;
1669
1831
  if (this.transform.cropZoomFactor && this.transform.cropZoomFactor > 0) {
1670
1832
  this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
1671
- value: { zoomFactor: -this.transform.cropZoomFactor, zoomPoint: null, isResize: null } });
1833
+ value: { zoomFactor: -this.transform.cropZoomFactor, zoomPoint: null, isResize: true } });
1672
1834
  }
1673
1835
  else {
1674
1836
  this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
1675
- value: { zoomFactor: Math.abs(this.transform.cropZoomFactor), zoomPoint: null, isResize: null } });
1837
+ value: { zoomFactor: Math.abs(this.transform.cropZoomFactor), zoomPoint: null, isResize: true } });
1676
1838
  }
1677
1839
  this.isUndoRedo = isUndoRedo;
1678
1840
  this.panPoint.totalPannedPoint = { x: 0, y: 0 };
@@ -1691,23 +1853,7 @@ var ImageEditor = /** @class */ (function (_super) {
1691
1853
  */
1692
1854
  ImageEditor.prototype.updateCropTransformItems = function () {
1693
1855
  this.prevCurrSelectionPoint = extend({}, this.currSelectionPoint, {}, true);
1694
- var object = { currObj: {} };
1695
- this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
1696
- var currentObj = object['currObj'];
1697
- currentObj.objColl = extend([], this.objColl, [], true);
1698
- currentObj.pointColl = extend([], this.pointColl, [], true);
1699
- currentObj.afterCropActions = extend([], this.afterCropActions, [], true);
1700
- var selPointCollObj = { selPointColl: null };
1701
- this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
1702
- value: { obj: selPointCollObj } });
1703
- currentObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
1704
- this.cancelCropSelection = { operation: 'cropTransform', previousObj: currentObj, currentObj: currentObj,
1705
- previousObjColl: currentObj.objColl, currentObjColl: currentObj.objColl,
1706
- previousPointColl: currentObj.pointColl, currentPointColl: currentObj.pointColl,
1707
- previousSelPointColl: currentObj.selPointColl, currentSelPointColl: currentObj.selPointColl,
1708
- previousCropObj: extend({}, this.cropObj, {}, true),
1709
- currentCropObj: extend({}, this.cropObj, {}, true),
1710
- previousText: null, currentText: null, filter: null, isCircleCrop: this.isCircleCrop };
1856
+ this.notify('draw', { prop: 'updateCropSelection', onPropertyChange: false });
1711
1857
  };
1712
1858
  /**
1713
1859
  * Get the pascal case.
@@ -1762,11 +1908,13 @@ var ImageEditor = /** @class */ (function (_super) {
1762
1908
  * @returns {void}.
1763
1909
  */
1764
1910
  ImageEditor.prototype.okBtn = function (isMouseDown) {
1765
- if (this.element.querySelector('.e-contextual-toolbar-wrapper')) {
1766
- this.element.querySelector('.e-contextual-toolbar-wrapper').classList.remove('e-frame-wrapper');
1911
+ var ctWrapper = this.element.querySelector('.e-contextual-toolbar-wrapper');
1912
+ if (ctWrapper) {
1913
+ ctWrapper.classList.remove('e-frame-wrapper');
1767
1914
  }
1768
1915
  var isCropSelection = false;
1769
1916
  var splitWords;
1917
+ this.isResizeOkBtn = true;
1770
1918
  var aspectIcon = this.element.querySelector('#' + this.element.id + '_aspectratio');
1771
1919
  var nonAspectIcon = this.element.querySelector('#' + this.element.id + '_nonaspectratio');
1772
1920
  var blrAspRatElem = this.element.querySelector('.e-ie-toolbar-aspect-ratio-btn');
@@ -1788,8 +1936,7 @@ var ImageEditor = /** @class */ (function (_super) {
1788
1936
  if (this.togglePen) {
1789
1937
  shapeSettings.type = ShapeType.FreehandDraw;
1790
1938
  }
1791
- var shapeChangedArgs = { action: 'apply', previousShapeSettings: extend({}, shapeSettings, {}, true),
1792
- currentShapeSettings: extend({}, shapeSettings, {}, true) };
1939
+ var shapeChangedArgs = { action: 'apply', currentShapeSettings: extend({}, shapeSettings, {}, true) };
1793
1940
  this.triggerShapeChanged(shapeChangedArgs);
1794
1941
  }
1795
1942
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
@@ -1826,6 +1973,18 @@ var ImageEditor = /** @class */ (function (_super) {
1826
1973
  previousCropObj: obj1['prevCropObj'], previousText: null, currentText: null, previousFilter: null,
1827
1974
  isCircleCrop: null } });
1828
1975
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
1976
+ var obj_3 = this.cancelCropSelection;
1977
+ if ((!isBlazor() && obj_3 && (isNullOrUndefined(nonAspectIcon) || !nonAspectIcon)) || (isBlazor() && obj_3 && blrNAspRatElem && blrNAspRatElem.classList.contains('e-hidden'))) {
1978
+ obj_3.previousObj.aspectWidth = obj_3.currentObj.aspectWidth = this.aspectWidth;
1979
+ obj_3.previousObj.aspectHeight = obj_3.currentObj.aspectHeight = this.aspectHeight;
1980
+ obj_3.previousCropObj = extend({}, this.cropObj, {}, true);
1981
+ obj_3.currentCropObj = extend({}, this.cropObj, {}, true);
1982
+ this.notify('draw', { prop: 'updateCropSelObj' });
1983
+ }
1984
+ this.cancelCropSelection = null;
1985
+ }
1986
+ else if (point && (point.x === 0 || point.y === 0)) {
1987
+ this.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
1829
1988
  }
1830
1989
  else {
1831
1990
  this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
@@ -1842,27 +2001,41 @@ var ImageEditor = /** @class */ (function (_super) {
1842
2001
  this.currentFilter = selElem.children[0].children[0].id.replace('Canvas', '');
1843
2002
  }
1844
2003
  if (isCropSelection) {
1845
- this.crop();
2004
+ if (this.transform.straighten !== 0 && (this.panPoint.totalPannedPoint.x !== 0 || this.panPoint.totalPannedPoint.y !== 0 ||
2005
+ this.panPoint.totalPannedClientPoint.x !== 0 || this.panPoint.totalPannedClientPoint.y !== 0)) {
2006
+ var temp = this.prevStraightenedDegree;
2007
+ this.prevStraightenedDegree = this.transform.straighten;
2008
+ this.setStraighten(this.transform.straighten - 3);
2009
+ this.setStraighten(this.transform.straighten + 3);
2010
+ this.prevStraightenedDegree = temp;
2011
+ }
2012
+ this.isCroppedEvent = this.crop();
1846
2013
  }
1847
2014
  else if (this.togglePen) {
1848
2015
  this.freeHandDraw(false);
1849
2016
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
2017
+ this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
2018
+ this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
1850
2019
  }
1851
- else if (this.textArea.style.display === 'block') {
2020
+ else if (this.textArea.style.display === 'block' || this.textArea.style.display === 'inline-block') {
1852
2021
  this.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
1853
2022
  value: { x: null, y: null, isMouseDown: null } });
2023
+ this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
2024
+ this.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
1854
2025
  if (isNullOrUndefined(isMouseDown)) {
1855
2026
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
1856
2027
  }
2028
+ this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
2029
+ this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
1857
2030
  }
1858
2031
  else if ((!isBlazor() && document.querySelector('#' + this.element.id + '_sliderWrapper')) ||
1859
2032
  (isBlazor() && !this.element.querySelector('.e-ie-contextual-slider').classList.contains('e-hidden')) ||
1860
2033
  this.currObjType.isFiltered) {
1861
2034
  this.initialAdjustmentValue = this.canvasFilter = this.lowerContext.filter;
1862
2035
  this.currObjType.isFiltered = false;
1863
- var obj_3 = { value: null };
1864
- this.notify('draw', { prop: 'getTempAdjustmentValue', value: { obj: obj_3 } });
1865
- if (obj_3['value'] !== this.lowerContext.filter) {
2036
+ var obj_4 = { value: null };
2037
+ this.notify('draw', { prop: 'getTempAdjustmentValue', value: { obj: obj_4 } });
2038
+ if (obj_4['value'] !== this.lowerContext.filter) {
1866
2039
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
1867
2040
  }
1868
2041
  if ((this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) ||
@@ -1873,11 +2046,11 @@ var ImageEditor = /** @class */ (function (_super) {
1873
2046
  else if (obj['bool']) {
1874
2047
  this.notify('freehand-draw', { prop: 'applyFhd', onPropertyChange: false });
1875
2048
  this.notify('selection', { prop: 'setFreehandDrawCustomized', value: { isFreehandDrawCustomized: false } });
1876
- if (!isBlazor()) {
1877
- this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
2049
+ if (isBlazor()) {
2050
+ this.updateToolbar(this.element, 'destroyQuickAccessToolbar');
1878
2051
  }
1879
2052
  else {
1880
- this.updateToolbar(this.element, 'destroyQuickAccessToolbar');
2053
+ this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
1881
2054
  }
1882
2055
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
1883
2056
  }
@@ -1901,9 +2074,8 @@ var ImageEditor = /** @class */ (function (_super) {
1901
2074
  this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
1902
2075
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
1903
2076
  this.tempFrameObj = extend({}, this.frameObj, {}, true);
1904
- this.notify('draw', { prop: 'setTempFrame', onPropertyChange: false, value: { frame: this.frameObj.type } });
1905
2077
  }
1906
- this.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false });
2078
+ this.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: true } });
1907
2079
  }
1908
2080
  if (!isBlazor() && !obj['isCropToolbar']) {
1909
2081
  this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
@@ -1913,9 +2085,12 @@ var ImageEditor = /** @class */ (function (_super) {
1913
2085
  this.updateToolbar(this.element, 'imageLoaded');
1914
2086
  }
1915
2087
  this.notify('draw', { prop: 'setNewPath', value: { bool: false } });
1916
- this.isCropTab = false;
1917
2088
  this.transform.zoomFactor = this.transform.defaultZoomFactor;
1918
2089
  this.notify('selection', { prop: 'setCurrentDrawingShape', onPropertyChange: false, value: { value: '' } });
2090
+ this.isResizeOkBtn = false;
2091
+ this.notify('draw', { prop: 'redrawDownScale' });
2092
+ this.isChangesSaved = false;
2093
+ this.triggerActionComplete();
1919
2094
  };
1920
2095
  /**
1921
2096
  * Set the temporary filter properties.
@@ -1967,12 +2142,13 @@ var ImageEditor = /** @class */ (function (_super) {
1967
2142
  this.pointColl = [];
1968
2143
  this.freehandCounter = 0;
1969
2144
  this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
1970
- if (this.element.querySelector('.e-contextual-toolbar-wrapper')) {
1971
- this.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
2145
+ var ctWrapper = this.element.querySelector('.e-contextual-toolbar-wrapper');
2146
+ if (ctWrapper) {
2147
+ ctWrapper.classList.add('e-hide');
1972
2148
  }
1973
2149
  var data = this.getImageData();
1974
- if (this.element.querySelector('.e-contextual-toolbar-wrapper')) {
1975
- this.element.querySelector('.e-contextual-toolbar-wrapper').classList.remove('e-hide');
2150
+ if (ctWrapper) {
2151
+ ctWrapper.classList.remove('e-hide');
1976
2152
  if (isBlazor()) {
1977
2153
  this.element.querySelector('.e-ie-toolbar-check-btn').classList.remove('e-hidden');
1978
2154
  this.element.querySelector('.e-ie-toolbar-close-btn').classList.remove('e-hidden');
@@ -2006,8 +2182,9 @@ var ImageEditor = /** @class */ (function (_super) {
2006
2182
  var finetuneValueChanging = { finetune: this.getFinetuneOption(type),
2007
2183
  value: value, cancel: false };
2008
2184
  if (isBlazor() && this.events && this.events.finetuneValueChanging.hasDelegate === true) {
2185
+ finetuneValueChanging.value = parseInt(finetuneValueChanging.value.toString());
2009
2186
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2010
- this.dotNetRef.invokeMethodAsync('OnFinetuneValueChangeAsync', finetuneValueChanging).then(function (finetuneValueChanging) {
2187
+ this.dotNetRef.invokeMethodAsync('OnFinetuneValueChangeAsync', 'FinetuneValueChanging', finetuneValueChanging, null).then(function (finetuneValueChanging) {
2011
2188
  if (finetuneValueChanging.cancel) {
2012
2189
  return;
2013
2190
  }
@@ -2063,7 +2240,8 @@ var ImageEditor = /** @class */ (function (_super) {
2063
2240
  */
2064
2241
  ImageEditor.prototype.getSelectionType = function (type) {
2065
2242
  var typeToSelectionType = { 'CropCustom': 'Custom', 'CropSquare': 'Square', 'CropCircle': 'Circle',
2066
- 'Crop3:2': '3:2', 'Crop4:3': '4:3', 'Crop5:4': '5:4', 'Crop7:5': '7:5', 'Crop16:9': '16:9' };
2243
+ 'Crop3:2': '3:2', 'Crop4:3': '4:3', 'Crop5:4': '5:4', 'Crop7:5': '7:5', 'Crop16:9': '16:9',
2244
+ 'Crop2:3': '2:3', 'Crop3:4': '3:4', 'Crop4:5': '4:5', 'Crop5:7': '5:7', 'Crop9:16': '9:16' };
2067
2245
  return typeToSelectionType["" + type];
2068
2246
  };
2069
2247
  /** Clears the context.
@@ -2106,10 +2284,12 @@ var ImageEditor = /** @class */ (function (_super) {
2106
2284
  this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: null, fillColor: null,
2107
2285
  strokeWidth: this.activeObj.strokeSettings.strokeWidth } });
2108
2286
  this.objColl.push(this.activeObj);
2109
- this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2110
- value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
2111
- previousPointColl: prevObj.pointColl, previousCropObj: prevCropObj, previousText: null,
2112
- currentText: null, previousFilter: null, isCircleCrop: null } });
2287
+ if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
2288
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2289
+ value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
2290
+ previousPointColl: prevObj.pointColl, previousCropObj: prevCropObj, previousText: null,
2291
+ currentText: null, previousFilter: null, isCircleCrop: null } });
2292
+ }
2113
2293
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
2114
2294
  if (!isBlazor()) {
2115
2295
  if (Browser.isDevice) {
@@ -2127,8 +2307,7 @@ var ImageEditor = /** @class */ (function (_super) {
2127
2307
  }
2128
2308
  }
2129
2309
  }
2130
- var shapeChangedArgs = { action: type, previousShapeSettings: extend({}, shapeSettings, {}, true),
2131
- currentShapeSettings: extend({}, shapeSettings, {}, true) };
2310
+ var shapeChangedArgs = { action: type, currentShapeSettings: extend({}, shapeSettings, {}, true) };
2132
2311
  this.triggerShapeChanged(shapeChangedArgs);
2133
2312
  };
2134
2313
  /**
@@ -2157,18 +2336,20 @@ var ImageEditor = /** @class */ (function (_super) {
2157
2336
  value: { obj: selPointCollObj } });
2158
2337
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
2159
2338
  this.objColl.pop();
2160
- if (this.textArea.style.display === 'block') {
2339
+ if (this.textArea.style.display === 'block' || this.textArea.style.display === 'inline-block') {
2161
2340
  this.notify('shape', { prop: 'updateFontRatio', onPropertyChange: false,
2162
2341
  value: { obj: this.activeObj, isTextArea: true } });
2163
2342
  var temp = this.activeObj.textSettings.fontFamily;
2164
2343
  this.activeObj.textSettings.fontFamily = this.toPascalCase(id);
2165
2344
  this.notify('shape', { prop: 'redraw-text' });
2166
2345
  this.objColl.push(this.activeObj);
2167
- this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2168
- value: { operation: 'textAreaCustomization', previousObj: prevObj, previousObjColl: prevObj.objColl,
2169
- previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2170
- previousCropObj: prevCropObj, previousText: null,
2171
- currentText: null, previousFilter: null, isCircleCrop: null } });
2346
+ if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
2347
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2348
+ value: { operation: 'textAreaCustomization', previousObj: prevObj, previousObjColl: prevObj.objColl,
2349
+ previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2350
+ previousCropObj: prevCropObj, previousText: null,
2351
+ currentText: null, previousFilter: null, isCircleCrop: null } });
2352
+ }
2172
2353
  this.objColl.pop();
2173
2354
  this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
2174
2355
  var width = this.activeObj.activePoint.width +
@@ -2187,15 +2368,16 @@ var ImageEditor = /** @class */ (function (_super) {
2187
2368
  value: { textSettings: null, fontFamily: fontFamily, fontSize: null } });
2188
2369
  this.notify('shape', { prop: 'redraw-text' });
2189
2370
  this.objColl.push(this.activeObj);
2190
- this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2191
- value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: objColl,
2192
- previousPointColl: extend([], this.pointColl, [], true),
2193
- previousSelPointColl: prevObj.selPointColl, previousCropObj: prevCropObj, previousText: null,
2194
- currentText: null, previousFilter: null, isCircleCrop: null } });
2371
+ if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
2372
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2373
+ value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: objColl,
2374
+ previousPointColl: extend([], this.pointColl, [], true),
2375
+ previousSelPointColl: prevObj.selPointColl, previousCropObj: prevCropObj, previousText: null,
2376
+ currentText: null, previousFilter: null, isCircleCrop: null } });
2377
+ }
2195
2378
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
2196
2379
  }
2197
- var shapeChangedArgs = { action: 'font-family', previousShapeSettings: extend({}, shapeSettings, {}, true),
2198
- currentShapeSettings: extend({}, shapeSettings, {}, true) };
2380
+ var shapeChangedArgs = { action: 'font-family', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2199
2381
  shapeChangedArgs.currentShapeSettings.fontFamily = this.textArea.style.fontFamily;
2200
2382
  this.triggerShapeChanged(shapeChangedArgs);
2201
2383
  };
@@ -2225,17 +2407,19 @@ var ImageEditor = /** @class */ (function (_super) {
2225
2407
  value: { obj: selPointCollObj } });
2226
2408
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
2227
2409
  this.objColl.pop();
2228
- if (this.textArea.style.display === 'block') {
2410
+ if (this.textArea.style.display === 'block' || this.textArea.style.display === 'inline-block') {
2229
2411
  this.notify('shape', { prop: 'updateFontRatio', onPropertyChange: false,
2230
2412
  value: { obj: this.activeObj, isTextArea: true } });
2231
2413
  var temp = this.activeObj.textSettings.fontSize;
2232
2414
  this.activeObj.textSettings.fontSize = parseInt(this.fontSizeColl[(parseInt(itemText, 10) - 1)].text, 10);
2233
2415
  this.objColl.push(this.activeObj);
2234
- this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2235
- value: { operation: 'textAreaCustomization', previousObj: prevObj, previousObjColl: prevObj.objColl,
2236
- previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2237
- previousCropObj: prevCropObj, previousText: null,
2238
- currentText: null, previousFilter: null, isCircleCrop: null } });
2416
+ if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
2417
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2418
+ value: { operation: 'textAreaCustomization', previousObj: prevObj, previousObjColl: prevObj.objColl,
2419
+ previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2420
+ previousCropObj: prevCropObj, previousText: null,
2421
+ currentText: null, previousFilter: null, isCircleCrop: null } });
2422
+ }
2239
2423
  this.objColl.pop();
2240
2424
  var textStyle = '';
2241
2425
  if (this.textArea.style.fontWeight === 'bold') {
@@ -2286,15 +2470,16 @@ var ImageEditor = /** @class */ (function (_super) {
2286
2470
  isMouseMove: null, x: null, y: null } });
2287
2471
  this.notify('shape', { prop: 'redraw-text' });
2288
2472
  this.objColl.push(this.activeObj);
2289
- this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2290
- value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
2291
- previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2292
- previousCropObj: prevCropObj, previousText: null,
2293
- currentText: null, previousFilter: null, isCircleCrop: null } });
2473
+ if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
2474
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2475
+ value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
2476
+ previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2477
+ previousCropObj: prevCropObj, previousText: null,
2478
+ currentText: null, previousFilter: null, isCircleCrop: null } });
2479
+ }
2294
2480
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
2295
2481
  }
2296
- var shapeChangedArgs = { action: 'font-size', previousShapeSettings: extend({}, shapeSettings, {}, true),
2297
- currentShapeSettings: extend({}, shapeSettings, {}, true) };
2482
+ var shapeChangedArgs = { action: 'font-size', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2298
2483
  shapeChangedArgs.currentShapeSettings.fontSize = this.activeObj.textSettings.fontSize;
2299
2484
  this.triggerShapeChanged(shapeChangedArgs);
2300
2485
  };
@@ -2329,38 +2514,43 @@ var ImageEditor = /** @class */ (function (_super) {
2329
2514
  strokeColor: this.activeObj.strokeSettings.strokeColor, fillColor: null, strokeWidth: null } });
2330
2515
  if (!this.togglePen) {
2331
2516
  this.objColl.push(this.activeObj);
2332
- this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2333
- value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
2334
- previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2335
- previousCropObj: prevCropObj, previousText: null,
2336
- currentText: null, previousFilter: null, isCircleCrop: null } });
2517
+ if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
2518
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2519
+ value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
2520
+ previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2521
+ previousCropObj: prevCropObj, previousText: null,
2522
+ currentText: null, previousFilter: null, isCircleCrop: null } });
2523
+ }
2337
2524
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
2338
2525
  }
2339
2526
  }
2340
- else if (this.textArea.style.display === 'block') {
2527
+ else if (this.textArea.style.display === 'block' || this.textArea.style.display === 'inline-block') {
2341
2528
  this.textArea.style.color = value;
2342
2529
  var temp = this.activeObj.strokeSettings.strokeColor;
2343
2530
  this.activeObj.strokeSettings.strokeColor = value;
2344
2531
  this.objColl.push(this.activeObj);
2345
- this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2346
- value: { operation: 'textAreaCustomization', previousObj: prevObj, previousObjColl: prevObj.objColl,
2347
- previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2348
- previousCropObj: prevCropObj, previousText: null,
2349
- currentText: null, previousFilter: null, isCircleCrop: null } });
2532
+ if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
2533
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2534
+ value: { operation: 'textAreaCustomization', previousObj: prevObj, previousObjColl: prevObj.objColl,
2535
+ previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2536
+ previousCropObj: prevCropObj, previousText: null,
2537
+ currentText: null, previousFilter: null, isCircleCrop: null } });
2538
+ }
2350
2539
  this.objColl.pop();
2351
2540
  this.activeObj.strokeSettings.strokeColor = temp;
2352
2541
  }
2353
2542
  else if (!this.togglePen) {
2354
2543
  this.objColl.push(this.activeObj);
2355
- this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2356
- value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
2357
- previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2358
- previousCropObj: prevCropObj, previousText: null,
2359
- currentText: null, previousFilter: null, isCircleCrop: null } });
2544
+ if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
2545
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2546
+ value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
2547
+ previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2548
+ previousCropObj: prevCropObj, previousText: null,
2549
+ currentText: null, previousFilter: null, isCircleCrop: null } });
2550
+ }
2360
2551
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
2361
2552
  }
2362
- var shapeChangedArgs = { action: 'font-color', previousShapeSettings: extend({}, shapeSettings, {}, true),
2363
- currentShapeSettings: extend({}, shapeSettings, {}, true) };
2553
+ var shapeChangedArgs = { action: 'font-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2364
2554
  shapeChangedArgs.currentShapeSettings.fillColor = value;
2365
2555
  this.triggerShapeChanged(shapeChangedArgs);
2366
2556
  };
@@ -2395,14 +2585,19 @@ var ImageEditor = /** @class */ (function (_super) {
2395
2585
  var obj = { bool: false };
2396
2586
  this.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: obj } });
2397
2587
  if (obj['bool']) {
2398
- var obj_4 = { penStrokeWidth: null };
2399
- this.notify('freehand-draw', { prop: 'getPenStrokeWidth', onPropertyChange: false, value: { obj: obj_4 } });
2588
+ var obj_5 = { penStrokeWidth: null };
2589
+ this.notify('freehand-draw', { prop: 'getPenStrokeWidth', onPropertyChange: false, value: { obj: obj_5 } });
2400
2590
  this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
2591
+ this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
2401
2592
  this.notify('freehand-draw', { prop: 'hoverFhd', onPropertyChange: false,
2402
- value: { strokeColor: null, strokeWidth: obj_4['penStrokeWidth'] } });
2593
+ value: { strokeColor: null, strokeWidth: obj_5['penStrokeWidth'] } });
2403
2594
  var indexObj = { freehandSelectedIndex: null };
2404
2595
  this.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
2405
- this.pointColl[indexObj['freehandSelectedIndex']].strokeWidth = obj_4['penStrokeWidth'];
2596
+ this.pointColl[indexObj['freehandSelectedIndex']].strokeWidth = obj_5['penStrokeWidth'];
2597
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null } });
2598
+ this.notify('draw', { prop: 'redrawDownScale' });
2599
+ this.notify('freehand-draw', { prop: 'hoverFhd', onPropertyChange: false,
2600
+ value: { strokeColor: null, strokeWidth: obj_5['penStrokeWidth'] } });
2406
2601
  this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2407
2602
  value: { operation: 'freehanddrawCustomized', previousObj: prevObj, previousObjColl: prevObj.objColl,
2408
2603
  previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
@@ -2410,8 +2605,7 @@ var ImageEditor = /** @class */ (function (_super) {
2410
2605
  currentText: null, previousFilter: null, isCircleCrop: null } });
2411
2606
  }
2412
2607
  shapeSettings.type = ShapeType.FreehandDraw;
2413
- var shapeChangedArgs = { action: 'stroke-width', previousShapeSettings: extend({}, shapeSettings, {}, true),
2414
- currentShapeSettings: extend({}, shapeSettings, {}, true) };
2608
+ var shapeChangedArgs = { action: 'stroke-width', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2415
2609
  shapeChangedArgs.currentShapeSettings.strokeWidth = this.activeObj.strokeSettings.strokeWidth;
2416
2610
  this.triggerShapeChanged(shapeChangedArgs);
2417
2611
  };
@@ -2443,13 +2637,32 @@ var ImageEditor = /** @class */ (function (_super) {
2443
2637
  this.pointColl = temp;
2444
2638
  this.notify('selection', { prop: 'setFreehandDrawCustomized', value: { isFreehandDrawCustomized: true } });
2445
2639
  this.activeObj.strokeSettings.strokeColor = value;
2640
+ var indexObj = { freehandSelectedIndex: null };
2641
+ this.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
2642
+ if (indexObj['freehandSelectedIndex'] !== null && indexObj['freehandSelectedIndex'] !== undefined) {
2643
+ this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
2644
+ // Temporary delete the selected freehand drawing from the collection
2645
+ var count = 0;
2646
+ var temp_1 = extend({}, this.pointColl, {}, true);
2647
+ for (var i = 0; i < this.freehandCounter; i++) {
2648
+ if (parseInt(temp_1[i].id.split('_')[1], 10) - 1 !== indexObj['freehandSelectedIndex']) {
2649
+ this.pointColl[count] = temp_1[i];
2650
+ count++;
2651
+ }
2652
+ }
2653
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null } });
2654
+ this.notify('draw', { prop: 'redrawDownScale' });
2655
+ this.pointColl = temp_1;
2656
+ this.notify('freehand-draw', { prop: 'hoverFhd', onPropertyChange: false,
2657
+ value: { strokeColor: null, strokeWidth: null } });
2658
+ }
2446
2659
  var obj = { bool: false };
2447
2660
  this.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: obj } });
2448
2661
  if (obj['bool']) {
2449
- var indexObj = { freehandSelectedIndex: null };
2450
- this.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
2662
+ var indexObj_1 = { freehandSelectedIndex: null };
2663
+ this.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj_1 } });
2451
2664
  this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
2452
- this.pointColl[indexObj['freehandSelectedIndex']].strokeColor = value;
2665
+ this.pointColl[indexObj_1['freehandSelectedIndex']].strokeColor = value;
2453
2666
  this.notify('freehand-draw', { prop: 'hoverFhd', onPropertyChange: false,
2454
2667
  value: { strokeColor: value } });
2455
2668
  this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
@@ -2462,8 +2675,7 @@ var ImageEditor = /** @class */ (function (_super) {
2462
2675
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.activeObj } });
2463
2676
  }
2464
2677
  shapeSettings.type = ShapeType.FreehandDraw;
2465
- var shapeChangedArgs = { action: 'stroke-color', previousShapeSettings: extend({}, shapeSettings, {}, true),
2466
- currentShapeSettings: extend({}, shapeSettings, {}, true) };
2678
+ var shapeChangedArgs = { action: 'stroke-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2467
2679
  shapeChangedArgs.currentShapeSettings.strokeColor = value;
2468
2680
  this.triggerShapeChanged(shapeChangedArgs);
2469
2681
  };
@@ -2494,18 +2706,22 @@ var ImageEditor = /** @class */ (function (_super) {
2494
2706
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
2495
2707
  this.objColl.pop();
2496
2708
  this.activeObj.strokeSettings.strokeWidth = parseInt(id, 10);
2709
+ if (this.activeObj.shape === 'rectangle' || this.activeObj.shape === 'ellipse') {
2710
+ this.activeObj.strokeSettings.strokeWidth = parseInt(id, 10) - 1;
2711
+ }
2497
2712
  this.activeObj.strokeSettings.strokeWidth *= 2;
2498
2713
  this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: null, fillColor: null,
2499
2714
  strokeWidth: this.activeObj.strokeSettings.strokeWidth } });
2500
2715
  this.objColl.push(this.activeObj);
2501
- this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2502
- value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
2503
- previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2504
- previousCropObj: prevCropObj, previousText: null,
2505
- currentText: null, previousFilter: null, isCircleCrop: null } });
2716
+ if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
2717
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2718
+ value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
2719
+ previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2720
+ previousCropObj: prevCropObj, previousText: null,
2721
+ currentText: null, previousFilter: null, isCircleCrop: null } });
2722
+ }
2506
2723
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
2507
- var shapeChangedArgs = { action: 'stroke-width', previousShapeSettings: extend({}, shapeSettings, {}, true),
2508
- currentShapeSettings: extend({}, shapeSettings, {}, true) };
2724
+ var shapeChangedArgs = { action: 'stroke-width', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2509
2725
  shapeChangedArgs.currentShapeSettings.strokeWidth = this.activeObj.strokeSettings.strokeWidth;
2510
2726
  this.triggerShapeChanged(shapeChangedArgs);
2511
2727
  }
@@ -2547,11 +2763,13 @@ var ImageEditor = /** @class */ (function (_super) {
2547
2763
  this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: this.activeObj.strokeSettings.strokeColor, fillColor: null, strokeWidth: null } });
2548
2764
  if (!this.togglePen) {
2549
2765
  this.objColl.push(this.activeObj);
2550
- this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2551
- value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
2552
- previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2553
- previousCropObj: prevCropObj, previousText: null,
2554
- currentText: null, previousFilter: null, isCircleCrop: null } });
2766
+ if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
2767
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2768
+ value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
2769
+ previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2770
+ previousCropObj: prevCropObj, previousText: null,
2771
+ currentText: null, previousFilter: null, isCircleCrop: null } });
2772
+ }
2555
2773
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
2556
2774
  }
2557
2775
  }
@@ -2560,8 +2778,7 @@ var ImageEditor = /** @class */ (function (_super) {
2560
2778
  this.activeObj.strokeSettings.strokeColor = value;
2561
2779
  this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: this.activeObj.strokeSettings.strokeColor, fillColor: null, strokeWidth: null } });
2562
2780
  }
2563
- var shapeChangedArgs = { action: 'stroke-color', previousShapeSettings: extend({}, shapeSettings, {}, true),
2564
- currentShapeSettings: extend({}, shapeSettings, {}, true) };
2781
+ var shapeChangedArgs = { action: 'stroke-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2565
2782
  shapeChangedArgs.currentShapeSettings.strokeColor = value;
2566
2783
  this.triggerShapeChanged(shapeChangedArgs);
2567
2784
  };
@@ -2594,15 +2811,15 @@ var ImageEditor = /** @class */ (function (_super) {
2594
2811
  value: { strokeSettings: null, strokeColor: null, fillColor: this.activeObj.strokeSettings.fillColor,
2595
2812
  strokeWidth: null } });
2596
2813
  this.objColl.push(this.activeObj);
2597
- this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2598
- value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
2599
- previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2600
- previousCropObj: prevCropObj, previousText: null,
2601
- currentText: null, previousFilter: null, isCircleCrop: null } });
2814
+ if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
2815
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2816
+ value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
2817
+ previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2818
+ previousCropObj: prevCropObj, previousText: null,
2819
+ currentText: null, previousFilter: null, isCircleCrop: null } });
2820
+ }
2602
2821
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
2603
- var shapeChangedArgs = { action: 'fill-color', previousShapeSettings: extend({}, shapeSettings, {}, true),
2604
- currentShapeSettings: extend({}, shapeSettings, {}, true) };
2605
- shapeChangedArgs.currentShapeSettings.fillColor = value;
2822
+ var shapeChangedArgs = { action: 'fill-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2606
2823
  this.triggerShapeChanged(shapeChangedArgs);
2607
2824
  };
2608
2825
  /**
@@ -2617,6 +2834,9 @@ var ImageEditor = /** @class */ (function (_super) {
2617
2834
  var prevCropObj;
2618
2835
  var prevObj;
2619
2836
  if (isNullOrUndefined(isPreventURC)) {
2837
+ if (isNullOrUndefined(this.activeObj.imageRatio)) {
2838
+ this.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
2839
+ }
2620
2840
  this.notify('shape', { prop: 'pushActItemIntoObj' });
2621
2841
  prevCropObj = extend({}, this.cropObj, {}, true);
2622
2842
  var object = { currObj: {} };
@@ -2635,8 +2855,10 @@ var ImageEditor = /** @class */ (function (_super) {
2635
2855
  this.notify('toolbar', { prop: 'refreshSlider' });
2636
2856
  }
2637
2857
  ctx.clearRect(0, 0, this.activeObj.imageCanvas.width, this.activeObj.imageCanvas.height);
2858
+ var activePoint = this.duplicateImage();
2638
2859
  this.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
2639
2860
  value: { ctx: this.activeObj.imageCanvas.getContext('2d'), isImgAnnotation: true, isHFlip: true, isVFlip: null } });
2861
+ this.activeObj.activePoint = activePoint;
2640
2862
  this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
2641
2863
  if (isNullOrUndefined(isPreventURC)) {
2642
2864
  this.objColl.push(this.activeObj);
@@ -2660,6 +2882,9 @@ var ImageEditor = /** @class */ (function (_super) {
2660
2882
  var prevCropObj;
2661
2883
  var prevObj;
2662
2884
  if (isNullOrUndefined(isPreventURC)) {
2885
+ if (isNullOrUndefined(this.activeObj.imageRatio)) {
2886
+ this.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
2887
+ }
2663
2888
  this.notify('shape', { prop: 'pushActItemIntoObj' });
2664
2889
  prevCropObj = extend({}, this.cropObj, {}, true);
2665
2890
  var object = { currObj: {} };
@@ -2678,8 +2903,10 @@ var ImageEditor = /** @class */ (function (_super) {
2678
2903
  this.notify('toolbar', { prop: 'refreshSlider' });
2679
2904
  }
2680
2905
  ctx.clearRect(0, 0, this.activeObj.imageCanvas.width, this.activeObj.imageCanvas.height);
2906
+ var activePoint = this.duplicateImage();
2681
2907
  this.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
2682
2908
  value: { ctx: this.activeObj.imageCanvas.getContext('2d'), isImgAnnotation: true, isHFlip: null, isVFlip: true } });
2909
+ this.activeObj.activePoint = activePoint;
2683
2910
  this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
2684
2911
  if (isNullOrUndefined(isPreventURC)) {
2685
2912
  this.objColl.push(this.activeObj);
@@ -2695,10 +2922,29 @@ var ImageEditor = /** @class */ (function (_super) {
2695
2922
  * Apply rotate image.
2696
2923
  *
2697
2924
  * @param { string } rotate - Specifies the direction of rotation.
2925
+ * @param { boolean } isPreventURC - Specifies to update undo redo collection.
2698
2926
  * @hidden
2699
2927
  * @returns {void}.
2700
2928
  */
2701
2929
  ImageEditor.prototype.rotateImage = function (rotate) {
2930
+ var prevCropObj;
2931
+ var prevObj;
2932
+ if (isNullOrUndefined(this.activeObj.imageRatio)) {
2933
+ this.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
2934
+ }
2935
+ this.notify('shape', { prop: 'pushActItemIntoObj' });
2936
+ prevCropObj = extend({}, this.cropObj, {}, true);
2937
+ var object = { currObj: {} };
2938
+ this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
2939
+ prevObj = object['currObj'];
2940
+ prevObj.objColl = extend([], this.objColl, [], true);
2941
+ prevObj.pointColl = extend([], this.pointColl, [], true);
2942
+ prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
2943
+ var selPointCollObj = { selPointColl: null };
2944
+ this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
2945
+ value: { obj: selPointCollObj } });
2946
+ prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
2947
+ this.objColl.pop();
2702
2948
  if (!isBlazor()) {
2703
2949
  this.notify('toolbar', { prop: 'refreshSlider' });
2704
2950
  }
@@ -2711,14 +2957,21 @@ var ImageEditor = /** @class */ (function (_super) {
2711
2957
  this.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: this.activeObj } });
2712
2958
  this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
2713
2959
  this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
2714
- if (!isBlazor()) {
2715
- this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
2716
- this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
2717
- }
2718
- else {
2960
+ this.objColl.push(this.activeObj);
2961
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2962
+ value: { operation: 'imageRotate', previousObj: prevObj, previousObjColl: prevObj.objColl,
2963
+ previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2964
+ previousCropObj: prevCropObj, previousText: null,
2965
+ currentText: null, previousFilter: null, isCircleCrop: null } });
2966
+ this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
2967
+ if (isBlazor()) {
2719
2968
  this.updateToolbar(this.element, 'destroyQuickAccessToolbar');
2720
2969
  this.updateToolbar(this.element, 'quickAccessToolbar', 'image');
2721
2970
  }
2971
+ else {
2972
+ this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
2973
+ this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
2974
+ }
2722
2975
  };
2723
2976
  /**
2724
2977
  * Get pascalToSplitWords from string.
@@ -2745,15 +2998,29 @@ var ImageEditor = /** @class */ (function (_super) {
2745
2998
  * @returns {number}.
2746
2999
  */
2747
3000
  ImageEditor.prototype.getCurrAdjustmentValue = function (type) {
2748
- var obj = { adjustmentLevel: null };
2749
- this.notify('filter', { prop: 'getAdjustmentLevel', onPropertyChange: false,
2750
- value: { obj: obj } });
2751
- var typeToAdjustmentLevel = { 'brightness': obj['adjustmentLevel'].brightness,
2752
- 'contrast': obj['adjustmentLevel'].contrast, 'hue': obj['adjustmentLevel'].hue,
2753
- 'saturation': obj['adjustmentLevel'].saturation, 'opacity': obj['adjustmentLevel'].opacity,
2754
- 'blur': obj['adjustmentLevel'].blur, 'exposure': obj['adjustmentLevel'].exposure,
2755
- 'transparency': obj['adjustmentLevel'].transparency };
2756
- return typeToAdjustmentLevel["" + type];
3001
+ var value = 100;
3002
+ var indexObj = { freehandSelectedIndex: null };
3003
+ this.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
3004
+ if (type === 'transparency' && this.togglePen) {
3005
+ var obj = { penOpacity: 1 };
3006
+ this.notify('freehand-draw', { prop: 'getPenOpacity', onPropertyChange: false, value: { obj: obj } });
3007
+ value = obj['penOpacity'] * 100;
3008
+ }
3009
+ else if (type === 'transparency' && indexObj['freehandSelectedIndex'] !== null && indexObj['freehandSelectedIndex'] !== undefined) {
3010
+ value = this.pointColl[indexObj['freehandSelectedIndex']].opacity * 100;
3011
+ }
3012
+ else {
3013
+ var obj = { adjustmentLevel: null };
3014
+ this.notify('filter', { prop: 'getAdjustmentLevel', onPropertyChange: false,
3015
+ value: { obj: obj } });
3016
+ var typeToAdjustmentLevel = { 'brightness': obj['adjustmentLevel'].brightness,
3017
+ 'contrast': obj['adjustmentLevel'].contrast, 'hue': obj['adjustmentLevel'].hue,
3018
+ 'saturation': obj['adjustmentLevel'].saturation, 'opacity': obj['adjustmentLevel'].opacity,
3019
+ 'blur': obj['adjustmentLevel'].blur, 'exposure': obj['adjustmentLevel'].exposure,
3020
+ 'transparency': obj['adjustmentLevel'].transparency, 'straighten': this.transform.straighten };
3021
+ value = typeToAdjustmentLevel["" + type];
3022
+ }
3023
+ return value;
2757
3024
  };
2758
3025
  /**
2759
3026
  * Apply transformSelect.
@@ -2765,14 +3032,80 @@ var ImageEditor = /** @class */ (function (_super) {
2765
3032
  ImageEditor.prototype.transformSelect = function (type) {
2766
3033
  this.isCropToolbar = true;
2767
3034
  this.allowDownScale = false;
3035
+ var straighten = this.transform.straighten;
3036
+ var straightenObj = extend({}, this.activeObj, {}, true);
3037
+ var zoomFactor = this.transform.zoomFactor;
3038
+ this.prevEventSelectionPoint = extend({}, this.activeObj, {}, true);
3039
+ var object = { currObj: {} };
3040
+ this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
3041
+ this.prevEventObjPoint = object['currObj'];
3042
+ this.prevEventObjPoint.objColl = extend([], this.objColl, [], true);
3043
+ this.prevEventObjPoint.pointColl = extend([], this.pointColl, [], true);
3044
+ this.prevEventObjPoint.afterCropActions = extend([], this.afterCropActions, [], true);
3045
+ var selPointCollObj = { selPointColl: null };
3046
+ this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
3047
+ value: { obj: selPointCollObj } });
3048
+ this.prevEventObjPoint.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
3049
+ if (this.transform.straighten !== 0) {
3050
+ this.transform.straighten = 0;
3051
+ this.straightenBaseImageCanvas();
3052
+ for (var i = 0, len = this.objColl.length; i < len; i++) {
3053
+ var shape = this.objColl[i].shape;
3054
+ if (shape !== 'line' && shape !== 'arrow' && shape !== 'path') {
3055
+ this.objColl[i].rotatedAngle -= (straighten * (Math.PI / 180));
3056
+ this.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: this.objColl[i] } });
3057
+ }
3058
+ }
3059
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
3060
+ this.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
3061
+ this.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
3062
+ }
2768
3063
  this.setInitialZoomState();
2769
3064
  var activeObj = extend({}, this.activeObj, {}, true);
3065
+ this.notify('crop', { prop: 'setTransformCrop', onPropertyChange: false, value: { bool: true } });
2770
3066
  this.cropSelectedState();
3067
+ this.notify('crop', { prop: 'setTransformCrop', onPropertyChange: false, value: { bool: false } });
2771
3068
  this.notify('draw', { prop: 'resetCurrentSelectionPoint' });
2772
3069
  this.updateImageTransformColl(type);
2773
3070
  this.notify('transform', { prop: 'performTransformation', value: { text: type } });
3071
+ this.isCropTab = true;
2774
3072
  this.notify('draw', { prop: 'moveToSelectionRange', value: { type: type, activeObj: activeObj } });
3073
+ if (this.isStraightening && (type === 'horizontalflip' || type === 'verticalflip')) {
3074
+ this.notify('draw', { prop: 'resetStraightenDestPoints' });
3075
+ this.notify('draw', { prop: 'setDestForStraighten' });
3076
+ }
3077
+ if (straighten !== 0) {
3078
+ this.transform.straighten = straighten;
3079
+ this.straightenBaseImageCanvas();
3080
+ for (var i = 0, len = this.objColl.length; i < len; i++) {
3081
+ var shape = this.objColl[i].shape;
3082
+ if (shape !== 'line' && shape !== 'arrow' && shape !== 'path') {
3083
+ this.objColl[i].rotatedAngle += (straighten * (Math.PI / 180));
3084
+ this.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: this.objColl[i] } });
3085
+ }
3086
+ }
3087
+ this.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
3088
+ this.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
3089
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
3090
+ this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: straightenObj } });
3091
+ this.notify('draw', { prop: 'setStraightenActObj', value: { activeObj: null } });
3092
+ this.notify('draw', { prop: 'setStraightenInitZoom', value: { zoomFactor: zoomFactor } });
3093
+ if ((this.isStraightening && (type === 'horizontalflip' || type === 'verticalflip')) &&
3094
+ isNullOrUndefined(this.transform.zoomFactor) || this.transform.zoomFactor === 0) {
3095
+ if (this.transform.degree === 0) {
3096
+ this.transform.zoomFactor += 0.025;
3097
+ }
3098
+ else if (this.transform.zoomFactor === 0) {
3099
+ this.transform.zoomFactor = null;
3100
+ }
3101
+ }
3102
+ this.notify('draw', { prop: 'zoomToSel', value: { activeObj: straightenObj, isToolbar: false } });
3103
+ }
2775
3104
  this.isCropToolbar = false;
3105
+ var stValPan = this.element.querySelector('.e-ie-straighten-value-span');
3106
+ if (stValPan) {
3107
+ stValPan.innerHTML = this.transform.straighten.toString() + '&#176';
3108
+ }
2776
3109
  };
2777
3110
  /**
2778
3111
  * Returns default filter.
@@ -2785,6 +3118,144 @@ var ImageEditor = /** @class */ (function (_super) {
2785
3118
  'saturate(' + 100 + '%) ' + 'opacity(' + 1 + ') ' + 'blur(' + 0 + 'px) ' + 'sepia(0%) ' +
2786
3119
  'grayscale(0%) ' + 'invert(0%)';
2787
3120
  };
3121
+ /**
3122
+ * Performs Straightening action.
3123
+ *
3124
+ * @hidden
3125
+ * @returns {void}.
3126
+ */
3127
+ ImageEditor.prototype.setStraighten = function (value, isMethod) {
3128
+ var straightenEventArgs = { cancel: false, previousDegree: this.transform.straighten, currentDegree: value };
3129
+ if (isBlazor()) {
3130
+ this.prevStraightenEvent = this.transform.straighten;
3131
+ }
3132
+ else {
3133
+ this.trigger('rotating', straightenEventArgs);
3134
+ }
3135
+ if (!straightenEventArgs.cancel) {
3136
+ this.performStraighten(straightenEventArgs);
3137
+ }
3138
+ };
3139
+ ImageEditor.prototype.duplicateImage = function () {
3140
+ var activePoint = extend({}, this.activeObj.activePoint, {}, true);
3141
+ var dimObj = { width: 0, height: 0 };
3142
+ this.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
3143
+ value: { width: this.activeObj.imageElement.width, height: this.activeObj.imageElement.height, obj: dimObj, isImgShape: null } });
3144
+ this.activeObj.activePoint.width = dimObj['width'];
3145
+ this.activeObj.activePoint.height = dimObj['height'];
3146
+ return activePoint;
3147
+ };
3148
+ ImageEditor.prototype.performStraighten = function (straightenEventArgs) {
3149
+ var value = straightenEventArgs.currentDegree;
3150
+ var stValPan = this.element.querySelector('.e-ie-straighten-value-span');
3151
+ if (stValPan) {
3152
+ stValPan.innerHTML = value.toString() + '&#176';
3153
+ }
3154
+ var prevValue = this.transform.straighten;
3155
+ var obj = extend({}, this.activeObj, null, true);
3156
+ this.notify('freehand-draw', { prop: 'setCenterSelPoints' });
3157
+ this.transform.straighten = value;
3158
+ this.straightenPoint = { x: this.activeObj.activePoint.startX + (this.activeObj.activePoint.width / 2),
3159
+ y: this.activeObj.activePoint.startY + (this.activeObj.activePoint.height / 2) };
3160
+ this.straightenBaseImageCanvas();
3161
+ for (var i = 0, len = this.objColl.length; i < len; i++) {
3162
+ var shape = this.objColl[i].shape;
3163
+ if (shape !== 'line' && shape !== 'arrow' && shape !== 'path') {
3164
+ this.objColl[i].rotatedAngle += ((this.transform.straighten - this.prevStraightenedDegree) * (Math.PI / 180));
3165
+ this.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: this.objColl[i] } });
3166
+ }
3167
+ }
3168
+ if (this.transform.degree % 90 === 0 && this.transform.degree % 180 !== 0) {
3169
+ if (this.transform.straighten === 0) {
3170
+ this.transform.straighten = 360;
3171
+ }
3172
+ this.notify('draw', { prop: 'performPointZoom', onPropertyChange: false,
3173
+ value: { x: this.activeObj.activePoint.startX + (this.activeObj.activePoint.width / 2),
3174
+ y: this.activeObj.activePoint.startY + (this.activeObj.activePoint.height / 2), type: 'zoomIn', isResize: true } });
3175
+ this.notify('draw', { prop: 'performPointZoom', onPropertyChange: false,
3176
+ value: { x: this.activeObj.activePoint.startX + (this.activeObj.activePoint.width / 2),
3177
+ y: this.activeObj.activePoint.startY + (this.activeObj.activePoint.height / 2), type: 'zoomOut', isResize: true } });
3178
+ if (this.transform.straighten === 360) {
3179
+ this.transform.straighten = 0;
3180
+ }
3181
+ }
3182
+ else {
3183
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: true, isPreventClearRect: null, isFrame: null, isStraighten: true } });
3184
+ }
3185
+ this.notify('draw', { prop: 'drawObject', onPropertyChange: false,
3186
+ value: { canvas: 'duplicate', obj: obj } });
3187
+ this.notify('draw', { prop: 'zoomToSel', value: { activeObj: obj, isToolbar: true } });
3188
+ this.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
3189
+ this.prevStraightenedDegree = this.transform.straighten;
3190
+ };
3191
+ /**
3192
+ * Straightens base image.
3193
+ *
3194
+ * @hidden
3195
+ * @returns {void}.
3196
+ */
3197
+ ImageEditor.prototype.straightenBaseImageCanvas = function () {
3198
+ if (this.isImageLoaded) {
3199
+ var flipState = this.getStraightenFlipState();
3200
+ var straighten = flipState === 'horizontal' || flipState === 'vertical' ?
3201
+ -this.transform.straighten : this.transform.straighten;
3202
+ var ctx = this.baseImgCanvas.getContext('2d');
3203
+ if (ctx.canvas.width !== this.lowerContext.canvas.width &&
3204
+ ctx.canvas.height !== this.lowerContext.canvas.height) {
3205
+ var obj_6 = { width: 0, height: 0 };
3206
+ this.notify('crop', { prop: 'calcRatio', onPropertyChange: false,
3207
+ value: { obj: obj_6, dimension: { width: ctx.canvas.width, height: ctx.canvas.height } } });
3208
+ }
3209
+ var dimension = void 0;
3210
+ dimension = this.getRotatedCanvasDim(this.baseImg.width, this.baseImg.height, this.transform.straighten);
3211
+ this.img.srcWidth = ctx.canvas.width = dimension.width;
3212
+ this.img.srcHeight = ctx.canvas.height = dimension.height;
3213
+ var x = ctx.canvas.width / 2;
3214
+ var y = ctx.canvas.height / 2;
3215
+ ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
3216
+ ctx.translate(x, y);
3217
+ ctx.rotate(straighten * Math.PI / 180);
3218
+ ctx.drawImage(this.baseImg, -this.baseImg.width / 2, -this.baseImg.height / 2, this.baseImg.width, this.baseImg.height);
3219
+ ctx.setTransform(1, 0, 0, 1, 0, 0);
3220
+ var obj = { width: 0, height: 0 };
3221
+ this.notify('crop', { prop: 'calcRatio', onPropertyChange: false, value: { obj: obj, dimension: { width: ctx.canvas.width, height: ctx.canvas.height } } });
3222
+ }
3223
+ };
3224
+ /**
3225
+ * Returns rotated canvas dimension.
3226
+ *
3227
+ * @hidden
3228
+ * @returns {void}.
3229
+ */
3230
+ ImageEditor.prototype.getRotatedCanvasDim = function (width, height, angle) {
3231
+ var angleRad = angle * Math.PI / 180;
3232
+ var cosAngle = Math.cos(angleRad);
3233
+ var sinAngle = Math.sin(angleRad);
3234
+ var minX = Math.min(0, width * cosAngle, height * Math.cos(Math.PI / 2 - angleRad), width * cosAngle + height * Math.cos(Math.PI / 2 - angleRad));
3235
+ var maxX = Math.max(0, width * cosAngle, height * Math.cos(Math.PI / 2 - angleRad), width * cosAngle + height * Math.cos(Math.PI / 2 - angleRad));
3236
+ var minY = Math.min(0, width * sinAngle, height * Math.sin(Math.PI / 2 - angleRad), width * sinAngle + height * Math.sin(Math.PI / 2 - angleRad));
3237
+ var maxY = Math.max(0, width * sinAngle, height * Math.sin(Math.PI / 2 - angleRad), width * sinAngle + height * Math.sin(Math.PI / 2 - angleRad));
3238
+ return { width: Math.ceil(maxX - minX), height: Math.ceil(maxY - minY) };
3239
+ };
3240
+ ;
3241
+ ImageEditor.prototype.getStraightenFlipState = function () {
3242
+ var flipState = '';
3243
+ if (this.rotateFlipColl.length > 0) {
3244
+ for (var i = 0, len = this.rotateFlipColl.length; i < len; i++) {
3245
+ var curFlip = this.rotateFlipColl[i];
3246
+ if (curFlip === 'horizontal') {
3247
+ flipState += 'horizontal';
3248
+ }
3249
+ else if (curFlip === 'vertical') {
3250
+ flipState += 'vertical';
3251
+ }
3252
+ if (flipState === 'horizontalvertical' || flipState === 'verticalhorizontal') {
3253
+ flipState = '';
3254
+ }
3255
+ }
3256
+ }
3257
+ return flipState;
3258
+ };
2788
3259
  // Blazor codes
2789
3260
  /**
2790
3261
  * To Initialize the component rendering
@@ -2812,7 +3283,7 @@ var ImageEditor = /** @class */ (function (_super) {
2812
3283
  }
2813
3284
  var canvasWrapper = this.element.querySelector('.e-canvas-wrapper');
2814
3285
  if (this.element.querySelector('#' + this.element.id + '_toolbarArea')) {
2815
- this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').clientHeight;
3286
+ this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').scrollHeight;
2816
3287
  }
2817
3288
  else {
2818
3289
  this.toolbarHeight = 0;
@@ -2823,7 +3294,7 @@ var ImageEditor = /** @class */ (function (_super) {
2823
3294
  this.upperCanvas = this.element.querySelector('.e-upper-canvas');
2824
3295
  this.lowerCanvas.id = this.element.id + '_lowerCanvas';
2825
3296
  this.upperCanvas.id = this.element.id + '_upperCanvas';
2826
- this.textArea = this.element.querySelector('.e-textbox');
3297
+ this.textArea = this.element.querySelector('.e-textarea');
2827
3298
  this.inMemoryCanvas = this.createElement('canvas', {
2828
3299
  id: this.element.id + '_inMemoryCanvas', attrs: { name: 'canvasImage' }
2829
3300
  });
@@ -2865,7 +3336,8 @@ var ImageEditor = /** @class */ (function (_super) {
2865
3336
  this.initializeThemeColl();
2866
3337
  };
2867
3338
  ImageEditor.prototype.initializeZoomSettings = function () {
2868
- if (isNullOrUndefined(this.zoomSettings.zoomTrigger)) {
3339
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3340
+ if (isNullOrUndefined(this.zoomSettings.zoomTrigger) || this.zoomSettings.zoomTrigger === 0) {
2869
3341
  this.zoomSettings.zoomTrigger = (ZoomTrigger.MouseWheel | ZoomTrigger.Pinch | ZoomTrigger.Toolbar | ZoomTrigger.Commands);
2870
3342
  }
2871
3343
  if (isNullOrUndefined(this.selectionSettings.strokeColor)) {
@@ -2917,10 +3389,35 @@ var ImageEditor = /** @class */ (function (_super) {
2917
3389
  */
2918
3390
  ImageEditor.prototype.triggerShapeChanged = function (shapeChangedArgs) {
2919
3391
  if (isBlazor() && this.events && this.events.shapeChanged.hasDelegate === true) {
2920
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2921
- this.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'ShapeChanged', shapeChangedArgs);
3392
+ var args = { action: shapeChangedArgs.action, shapeSettings: shapeChangedArgs.currentShapeSettings };
3393
+ this.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'ShapeChanged', null, args);
3394
+ }
3395
+ else {
3396
+ this.trigger('shapeChange', shapeChangedArgs);
2922
3397
  }
2923
3398
  };
3399
+ ImageEditor.prototype.triggerActionComplete = function () {
3400
+ var frameChangedArgs = this.curFrameObjEvent;
3401
+ var finetuneValueChanged = this.curFinetuneObjEvent;
3402
+ var imageFiltered = this.curFilterObjEvent;
3403
+ if (isBlazor()) {
3404
+ if (this.isFrameBtnClick && this.events && this.events.frameChanged.hasDelegate === true) {
3405
+ var frameChangeArgs = { frameSettings: frameChangedArgs.currentFrameSetting };
3406
+ this.dotNetRef.invokeMethodAsync('OnFrameChangingAsync', 'FrameChanged', null, frameChangeArgs);
3407
+ }
3408
+ if (this.isFinetuneBtnClick && this.events && this.events.finetuneValueChanged.hasDelegate === true) {
3409
+ var finetuneValueChange = { finetune: this.toPascalCase(finetuneValueChanged.finetune),
3410
+ value: parseInt(finetuneValueChanged.value.toString()) };
3411
+ this.dotNetRef.invokeMethodAsync('OnFinetuneValueChangeAsync', 'FinetuneValueChanged', null, finetuneValueChange);
3412
+ }
3413
+ if (this.isFilterCanvasClick && this.events && this.events.imageFiltered.hasDelegate === true) {
3414
+ var imageFilter = { filter: this.toPascalCase(imageFiltered.filter) };
3415
+ this.dotNetRef.invokeMethodAsync('OnImageFilterEventAsync', 'ImageFiltered', null, imageFilter);
3416
+ }
3417
+ }
3418
+ else { }
3419
+ this.isFilterCanvasClick = this.isFinetuneBtnClick = this.isFrameBtnClick = false;
3420
+ };
2924
3421
  var ImageEditor_1;
2925
3422
  __decorate([
2926
3423
  Property('')
@@ -2970,6 +3467,9 @@ var ImageEditor = /** @class */ (function (_super) {
2970
3467
  __decorate([
2971
3468
  Complex({}, SelectionSettings)
2972
3469
  ], ImageEditor.prototype, "selectionSettings", void 0);
3470
+ __decorate([
3471
+ Complex({}, FontFamily)
3472
+ ], ImageEditor.prototype, "fontFamily", void 0);
2973
3473
  __decorate([
2974
3474
  Event()
2975
3475
  ], ImageEditor.prototype, "beforeSave", void 0);
@@ -3024,6 +3524,9 @@ var ImageEditor = /** @class */ (function (_super) {
3024
3524
  __decorate([
3025
3525
  Event()
3026
3526
  ], ImageEditor.prototype, "click", void 0);
3527
+ __decorate([
3528
+ Event()
3529
+ ], ImageEditor.prototype, "shapeChange", void 0);
3027
3530
  __decorate([
3028
3531
  Event()
3029
3532
  ], ImageEditor.prototype, "quickAccessToolbarOpen", void 0);