@syncfusion/ej2-image-editor 26.2.14 → 27.1.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/README.md +1 -1
  2. package/dist/ej2-image-editor.umd.min.js +2 -2
  3. package/dist/ej2-image-editor.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-image-editor.es2015.js +3267 -731
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +3345 -795
  7. package/dist/es6/ej2-image-editor.es5.js.map +1 -1
  8. package/dist/global/ej2-image-editor.min.js +2 -2
  9. package/dist/global/ej2-image-editor.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/package.json +13 -13
  12. package/src/image-editor/action/crop.d.ts +0 -1
  13. package/src/image-editor/action/crop.js +8 -19
  14. package/src/image-editor/action/draw.d.ts +4 -0
  15. package/src/image-editor/action/draw.js +401 -47
  16. package/src/image-editor/action/export.js +21 -13
  17. package/src/image-editor/action/filter.d.ts +13 -0
  18. package/src/image-editor/action/filter.js +272 -1
  19. package/src/image-editor/action/freehand-draw.d.ts +1 -0
  20. package/src/image-editor/action/freehand-draw.js +44 -23
  21. package/src/image-editor/action/selection.d.ts +9 -0
  22. package/src/image-editor/action/selection.js +420 -98
  23. package/src/image-editor/action/shape.d.ts +5 -0
  24. package/src/image-editor/action/shape.js +291 -141
  25. package/src/image-editor/action/transform.js +56 -82
  26. package/src/image-editor/action/undo-redo.d.ts +2 -0
  27. package/src/image-editor/action/undo-redo.js +100 -1
  28. package/src/image-editor/base/enum.d.ts +11 -0
  29. package/src/image-editor/base/enum.js +12 -0
  30. package/src/image-editor/base/image-editor-model.d.ts +13 -1
  31. package/src/image-editor/base/image-editor.d.ts +142 -20
  32. package/src/image-editor/base/image-editor.js +814 -150
  33. package/src/image-editor/base/interface.d.ts +140 -1
  34. package/src/image-editor/renderer/toolbar.d.ts +8 -0
  35. package/src/image-editor/renderer/toolbar.js +876 -193
  36. package/styles/bootstrap-dark-lite.css +746 -0
  37. package/styles/bootstrap-dark-lite.scss +13 -0
  38. package/styles/bootstrap-dark.css +150 -105
  39. package/styles/bootstrap-dark.scss +1 -0
  40. package/styles/bootstrap-lite.css +747 -0
  41. package/styles/bootstrap-lite.scss +13 -0
  42. package/styles/bootstrap.css +151 -106
  43. package/styles/bootstrap.scss +1 -0
  44. package/styles/bootstrap4-lite.css +747 -0
  45. package/styles/bootstrap4-lite.scss +13 -0
  46. package/styles/bootstrap4.css +150 -105
  47. package/styles/bootstrap4.scss +1 -0
  48. package/styles/bootstrap5-dark-lite.css +757 -0
  49. package/styles/bootstrap5-dark-lite.scss +13 -0
  50. package/styles/bootstrap5-dark.css +152 -113
  51. package/styles/bootstrap5-dark.scss +1 -0
  52. package/styles/bootstrap5-lite.css +757 -0
  53. package/styles/bootstrap5-lite.scss +13 -0
  54. package/styles/bootstrap5.3-lite.css +760 -0
  55. package/styles/bootstrap5.3-lite.scss +13 -0
  56. package/styles/bootstrap5.3.css +867 -0
  57. package/styles/bootstrap5.3.scss +14 -0
  58. package/styles/bootstrap5.css +152 -113
  59. package/styles/bootstrap5.scss +1 -0
  60. package/styles/fabric-dark-lite.css +749 -0
  61. package/styles/fabric-dark-lite.scss +13 -0
  62. package/styles/fabric-dark.css +150 -105
  63. package/styles/fabric-dark.scss +1 -0
  64. package/styles/fabric-lite.css +751 -0
  65. package/styles/fabric-lite.scss +13 -0
  66. package/styles/fabric.css +151 -106
  67. package/styles/fabric.scss +1 -0
  68. package/styles/fluent-dark-lite.css +758 -0
  69. package/styles/fluent-dark-lite.scss +13 -0
  70. package/styles/fluent-dark.css +150 -111
  71. package/styles/fluent-dark.scss +1 -0
  72. package/styles/fluent-lite.css +758 -0
  73. package/styles/fluent-lite.scss +13 -0
  74. package/styles/fluent.css +150 -111
  75. package/styles/fluent.scss +1 -0
  76. package/styles/fluent2-lite.css +791 -0
  77. package/styles/fluent2-lite.scss +13 -0
  78. package/styles/fluent2.css +173 -117
  79. package/styles/fluent2.scss +1 -0
  80. package/styles/highcontrast-light-lite.css +748 -0
  81. package/styles/highcontrast-light-lite.scss +13 -0
  82. package/styles/highcontrast-light.css +149 -104
  83. package/styles/highcontrast-light.scss +1 -0
  84. package/styles/highcontrast-lite.css +753 -0
  85. package/styles/highcontrast-lite.scss +13 -0
  86. package/styles/highcontrast.css +150 -104
  87. package/styles/highcontrast.scss +1 -0
  88. package/styles/image-editor/_bds-definition.scss +3 -1
  89. package/styles/image-editor/_bigger.scss +216 -0
  90. package/styles/image-editor/_bootstrap-dark-definition.scss +3 -1
  91. package/styles/image-editor/_bootstrap-definition.scss +3 -1
  92. package/styles/image-editor/_bootstrap4-definition.scss +3 -1
  93. package/styles/image-editor/_bootstrap5-definition.scss +3 -1
  94. package/styles/image-editor/_bootstrap5.3-definition.scss +3 -1
  95. package/styles/image-editor/_fabric-dark-definition.scss +3 -1
  96. package/styles/image-editor/_fabric-definition.scss +3 -1
  97. package/styles/image-editor/_fluent-definition.scss +3 -1
  98. package/styles/image-editor/_fluent2-definition.scss +4 -2
  99. package/styles/image-editor/_fusionnew-definition.scss +3 -1
  100. package/styles/image-editor/_highcontrast-definition.scss +3 -1
  101. package/styles/image-editor/_highcontrast-light-definition.scss +3 -1
  102. package/styles/image-editor/_layout.scss +75 -212
  103. package/styles/image-editor/_material-dark-definition.scss +3 -1
  104. package/styles/image-editor/_material-definition.scss +3 -1
  105. package/styles/image-editor/_material3-definition.scss +5 -3
  106. package/styles/image-editor/_tailwind-definition.scss +5 -3
  107. package/styles/image-editor/_theme.scss +48 -11
  108. package/styles/image-editor/bootstrap-dark.css +150 -105
  109. package/styles/image-editor/bootstrap-dark.scss +1 -0
  110. package/styles/image-editor/bootstrap.css +151 -106
  111. package/styles/image-editor/bootstrap.scss +1 -0
  112. package/styles/image-editor/bootstrap4.css +150 -105
  113. package/styles/image-editor/bootstrap4.scss +1 -0
  114. package/styles/image-editor/bootstrap5-dark.css +152 -113
  115. package/styles/image-editor/bootstrap5-dark.scss +1 -0
  116. package/styles/image-editor/bootstrap5.3.css +867 -0
  117. package/styles/image-editor/bootstrap5.3.scss +14 -0
  118. package/styles/image-editor/bootstrap5.css +152 -113
  119. package/styles/image-editor/bootstrap5.scss +1 -0
  120. package/styles/image-editor/fabric-dark.css +150 -105
  121. package/styles/image-editor/fabric-dark.scss +1 -0
  122. package/styles/image-editor/fabric.css +151 -106
  123. package/styles/image-editor/fabric.scss +1 -0
  124. package/styles/image-editor/fluent-dark.css +150 -111
  125. package/styles/image-editor/fluent-dark.scss +1 -0
  126. package/styles/image-editor/fluent.css +150 -111
  127. package/styles/image-editor/fluent.scss +1 -0
  128. package/styles/image-editor/fluent2.css +173 -117
  129. package/styles/image-editor/fluent2.scss +1 -0
  130. package/styles/image-editor/highcontrast-light.css +149 -104
  131. package/styles/image-editor/highcontrast-light.scss +1 -0
  132. package/styles/image-editor/highcontrast.css +150 -104
  133. package/styles/image-editor/highcontrast.scss +1 -0
  134. package/styles/image-editor/icons/_bds.scss +10 -1
  135. package/styles/image-editor/icons/_bootstrap-dark.scss +10 -1
  136. package/styles/image-editor/icons/_bootstrap.scss +10 -1
  137. package/styles/image-editor/icons/_bootstrap4.scss +10 -1
  138. package/styles/image-editor/icons/_bootstrap5.3.scss +10 -1
  139. package/styles/image-editor/icons/_bootstrap5.scss +10 -1
  140. package/styles/image-editor/icons/_fabric-dark.scss +10 -1
  141. package/styles/image-editor/icons/_fabric.scss +10 -1
  142. package/styles/image-editor/icons/_fluent.scss +10 -1
  143. package/styles/image-editor/icons/_fluent2.scss +10 -1
  144. package/styles/image-editor/icons/_fusionnew.scss +10 -1
  145. package/styles/image-editor/icons/_highcontrast-light.scss +10 -1
  146. package/styles/image-editor/icons/_highcontrast.scss +10 -1
  147. package/styles/image-editor/icons/_material-dark.scss +10 -1
  148. package/styles/image-editor/icons/_material.scss +10 -1
  149. package/styles/image-editor/icons/_material3.scss +10 -1
  150. package/styles/image-editor/icons/_tailwind.scss +10 -1
  151. package/styles/image-editor/material-dark.css +153 -108
  152. package/styles/image-editor/material-dark.scss +1 -0
  153. package/styles/image-editor/material.css +159 -114
  154. package/styles/image-editor/material.scss +1 -0
  155. package/styles/image-editor/material3-dark.css +171 -123
  156. package/styles/image-editor/material3-dark.scss +1 -0
  157. package/styles/image-editor/material3.css +171 -123
  158. package/styles/image-editor/material3.scss +1 -0
  159. package/styles/image-editor/tailwind-dark.css +154 -116
  160. package/styles/image-editor/tailwind-dark.scss +1 -0
  161. package/styles/image-editor/tailwind.css +154 -116
  162. package/styles/image-editor/tailwind.scss +1 -0
  163. package/styles/material-dark-lite.css +767 -0
  164. package/styles/material-dark-lite.scss +13 -0
  165. package/styles/material-dark.css +153 -108
  166. package/styles/material-dark.scss +1 -0
  167. package/styles/material-lite.css +769 -0
  168. package/styles/material-lite.scss +13 -0
  169. package/styles/material.css +159 -114
  170. package/styles/material.scss +1 -0
  171. package/styles/material3-dark-lite.css +799 -0
  172. package/styles/material3-dark-lite.scss +13 -0
  173. package/styles/material3-dark.css +171 -123
  174. package/styles/material3-dark.scss +1 -0
  175. package/styles/material3-lite.css +801 -0
  176. package/styles/material3-lite.scss +13 -0
  177. package/styles/material3.css +171 -123
  178. package/styles/material3.scss +1 -0
  179. package/styles/tailwind-dark-lite.css +751 -0
  180. package/styles/tailwind-dark-lite.scss +13 -0
  181. package/styles/tailwind-dark.css +154 -116
  182. package/styles/tailwind-dark.scss +1 -0
  183. package/styles/tailwind-lite.css +751 -0
  184. package/styles/tailwind-lite.scss +13 -0
  185. package/styles/tailwind.css +154 -116
  186. package/styles/tailwind.scss +1 -0
@@ -1,12 +1,13 @@
1
1
  /* eslint-disable no-constant-condition */
2
2
  import { EventHandler, extend, isNullOrUndefined } from '@syncfusion/ej2-base';
3
- import { ShapeType } from '../index';
3
+ import { ShapeType, RedactType } from '../index';
4
4
  var Shape = /** @class */ (function () {
5
5
  function Shape(parent) {
6
6
  this.textSettings = { text: 'Enter Text', fontFamily: '', fontSize: null, fontRatio: null, bold: false, italic: false, underline: false };
7
- this.strokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null };
7
+ this.strokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null, radius: null, outlineColor: '', outlineWidth: null };
8
8
  this.keyHistory = ''; // text history
9
9
  this.preventFrameAnnotation = false;
10
+ this.redactType = 'blur';
10
11
  this.parent = parent;
11
12
  this.addEventListener();
12
13
  }
@@ -42,10 +43,10 @@ var Shape = /** @class */ (function () {
42
43
  this.drawPath(args.value['pointColl'], args.value['strokeWidth'], args.value['strokeColor'], args.value['isSelected']);
43
44
  break;
44
45
  case 'drawRectangle':
45
- this.drawRectangle(args.value['x'], args.value['y'], args.value['width'], args.value['height'], args.value['strokeWidth'], args.value['strokeColor'], args.value['fillColor'], args.value['degree'], args.value['isSelected']);
46
+ this.drawRectangle(args.value['x'], args.value['y'], args.value['width'], args.value['height'], args.value['strokeWidth'], args.value['strokeColor'], args.value['fillColor'], args.value['degree'], args.value['isSelected'], args.value['radius']);
46
47
  break;
47
48
  case 'drawText':
48
- this.drawText(args.value['x'], args.value['y'], args.value['text'], args.value['fontFamily'], args.value['fontSize'], args.value['bold'], args.value['italic'], args.value['color'], args.value['isSelected'], args.value['degree']);
49
+ this.drawText(args.value['x'], args.value['y'], args.value['text'], args.value['fontFamily'], args.value['fontSize'], args.value['bold'], args.value['italic'], args.value['color'], args.value['isSelected'], args.value['degree'], args.value['fillColor'], args.value['outlineColor'], args.value['outlineWidth']);
49
50
  break;
50
51
  case 'redrawActObj':
51
52
  this.redrawActObj(args.value['x'], args.value['y'], args.value['isMouseDown']);
@@ -54,7 +55,7 @@ var Shape = /** @class */ (function () {
54
55
  this.apply(args.value['shape'], args.value['obj'], args.value['canvas']);
55
56
  break;
56
57
  case 'updateShapeChangeEventArgs':
57
- this.updateShapeChangeEventArgs(args.value['shapeSettings']);
58
+ this.updateShapeChangeEventArgs(args.value['shapeSettings'], args.value['allowShapeOverflow']);
58
59
  break;
59
60
  case 'updSelChangeEventArgs':
60
61
  this.updSelChangeEventArgs(args.value['selectionSettings']);
@@ -129,6 +130,9 @@ var Shape = /** @class */ (function () {
129
130
  case 'getShapeSettings':
130
131
  this.getShapeSettings(args.value['obj']);
131
132
  break;
133
+ case 'getRedactSettings':
134
+ this.getRedactSettings(args.value['obj']);
135
+ break;
132
136
  case 'isPointsInRange':
133
137
  this.isPointsInRange(args.value['x'], args.value['y'], args.value['obj']);
134
138
  break;
@@ -160,6 +164,9 @@ var Shape = /** @class */ (function () {
160
164
  else if (args.value['fontSize']) {
161
165
  this.textSettings.fontSize = args.value['fontSize'];
162
166
  }
167
+ else if (args.value['radius']) {
168
+ this.strokeSettings.radius = args.value['radius'];
169
+ }
163
170
  break;
164
171
  case 'setStrokeSettings':
165
172
  if (args.value['strokeSettings']) {
@@ -174,6 +181,15 @@ var Shape = /** @class */ (function () {
174
181
  else if (args.value['strokeWidth']) {
175
182
  this.strokeSettings.strokeWidth = args.value['strokeWidth'];
176
183
  }
184
+ else if (args.value['outlineColor']) {
185
+ this.strokeSettings.outlineColor = args.value['outlineColor'];
186
+ }
187
+ else if (args.value['radius']) {
188
+ this.strokeSettings.radius = args.value['radius'];
189
+ }
190
+ else if (args.value['outlineWidth']) {
191
+ this.strokeSettings.outlineWidth = args.value['outlineWidth'];
192
+ }
177
193
  break;
178
194
  case 'getStrokeSettings':
179
195
  args.value['obj']['strokeSettings'] = this.strokeSettings;
@@ -194,7 +210,7 @@ var Shape = /** @class */ (function () {
194
210
  this.alignTextAreaIntoCanvas();
195
211
  break;
196
212
  case 'initializeTextShape':
197
- this.initializeTextShape(args.value['text'], args.value['fontFamily'], args.value['fontSize'], args.value['bold'], args.value['italic'], args.value['strokeColor']);
213
+ this.initializeTextShape(args.value['text'], args.value['fontFamily'], args.value['fontSize'], args.value['bold'], args.value['italic'], args.value['strokeColor'], args.value['fillColor'], args.value['outlineColor'], args.value['outlineWidth']);
198
214
  break;
199
215
  case 'stopPathDrawing':
200
216
  this.stopPathDrawing(args.value['e'], args.value['isApply']);
@@ -259,6 +275,12 @@ var Shape = /** @class */ (function () {
259
275
  case 'getLowestOrder':
260
276
  args.value['obj']['order'] = this.getLowestOrder();
261
277
  break;
278
+ case 'drawRedact':
279
+ this.drawRedact(args.value['x'], args.value['y'], args.value['width'], args.value['height'], args.value['type'], args.value['value']);
280
+ break;
281
+ case 'setRedactType':
282
+ this.redactType = args.value['redactType'];
283
+ break;
262
284
  }
263
285
  };
264
286
  Shape.prototype.getModuleName = function () {
@@ -284,7 +306,7 @@ var Shape = /** @class */ (function () {
284
306
  Shape.prototype.reset = function () {
285
307
  this.textSettings =
286
308
  { text: 'Enter Text', fontFamily: this.parent.fontFamily.default, fontSize: null, fontRatio: null, bold: false, italic: false, underline: false };
287
- this.strokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null };
309
+ this.strokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null, radius: null, outlineColor: '', outlineWidth: null };
288
310
  this.preventFrameAnnotation = false;
289
311
  };
290
312
  Shape.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree, isSelected) {
@@ -300,20 +322,10 @@ var Shape = /** @class */ (function () {
300
322
  this.drawShape('line', strokeWidth, strokeColor, null, start, width, height, null, null, null, null, null, isSelected);
301
323
  };
302
324
  Shape.prototype.drawPath = function (pointColl, strokeWidth, strokeColor, isSelected) {
303
- var parent = this.parent;
304
325
  this.initializeShape('path');
305
326
  if (pointColl) {
306
327
  this.drawShape('path', strokeWidth, strokeColor, null, null, null, null, pointColl, null, null, null, null, isSelected);
307
328
  }
308
- else {
309
- this.drawShape('line', strokeWidth, strokeColor, null, null, null, null, null, null, null, null, null, isSelected);
310
- var obj = extend({}, parent.objColl[parent.objColl.length - 1], null, true);
311
- obj.shape = 'path';
312
- obj.lineDraw = null;
313
- obj.pointColl = [{ x: obj.activePoint.startX, y: obj.activePoint.startY },
314
- { x: obj.activePoint.endX, y: obj.activePoint.endY }];
315
- parent.objColl[parent.objColl.length - 1] = obj;
316
- }
317
329
  };
318
330
  Shape.prototype.drawArrow = function (startX, startY, endX, endY, strokeWidth, strokeColor, arrowStart, arrowEnd, isSelected) {
319
331
  this.initializeShape('arrow');
@@ -322,23 +334,24 @@ var Shape = /** @class */ (function () {
322
334
  var height = endY - startY;
323
335
  this.drawShape('arrow', strokeWidth, strokeColor, null, start, width, height, null, arrowStart, arrowEnd, null, null, isSelected);
324
336
  };
325
- Shape.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor, degree, isSelected) {
337
+ Shape.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor, degree, isSelected, radius) {
326
338
  this.initializeShape('rectangle');
327
339
  var start = x && y ? { x: x, y: y } : null;
328
- this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height, null, null, null, degree, null, isSelected);
340
+ this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height, null, null, null, degree, null, isSelected, radius);
329
341
  };
330
- Shape.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color, isSelected, degree) {
331
- this.drawShapeText(text, fontFamily, fontSize, bold, italic, color, x, y, isSelected, degree);
342
+ // eslint-disable-next-line @typescript-eslint/tslint/config
343
+ Shape.prototype.drawRedact = function (x, y, width, height, type, value) {
344
+ this.initializeShape('redact');
345
+ var start = x && y ? { x: x, y: y } : null;
346
+ this.drawShape('redact', null, null, null, start, width, height, null, null, null, null, null, null, null, type, value);
347
+ };
348
+ Shape.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color, isSelected, degree, fillColor, outlineColor, outlineWidth) {
349
+ this.drawShapeText(text, fontFamily, fontSize, bold, italic, color, x, y, isSelected, degree, fillColor, outlineColor, outlineWidth);
332
350
  };
333
351
  Shape.prototype.initializeShape = function (type) {
334
352
  var parent = this.parent;
335
353
  this.redrawActObj();
336
354
  parent.activeObj.shape = type;
337
- if (parent.currObjType.shape === 'freehanddraw') {
338
- this.apply();
339
- parent.upperCanvas.style.cursor = parent.cursor = 'default';
340
- parent.currObjType.shape = '';
341
- }
342
355
  parent.currObjType.isCustomCrop = false;
343
356
  };
344
357
  Shape.prototype.updateWidthHeight = function (obj) {
@@ -366,7 +379,7 @@ var Shape = /** @class */ (function () {
366
379
  }
367
380
  return arrowType;
368
381
  };
369
- Shape.prototype.drawShape = function (type, strokeWidth, strokeColor, fillColor, start, width, height, pointColl, arrowStart, arrowEnd, degree, opacity, isSelected) {
382
+ Shape.prototype.drawShape = function (type, strokeWidth, strokeColor, fillColor, start, width, height, pointColl, arrowStart, arrowEnd, degree, opacity, isSelected, radius, redactType, value) {
370
383
  var parent = this.parent;
371
384
  if (!parent.disabled && parent.isImageLoaded) {
372
385
  parent.notify('draw', { prop: 'setImageEdited', onPropertyChange: false });
@@ -377,90 +390,107 @@ var Shape = /** @class */ (function () {
377
390
  parent.upperCanvas.style.display = 'block';
378
391
  this.refreshActiveObj();
379
392
  parent.currObjType.shape = type = type.toLowerCase();
380
- if (type === 'path' && isNullOrUndefined(pointColl)) {
393
+ if (type !== 'freehanddraw' && type !== '') {
381
394
  parent.activeObj.shape = type;
382
- parent.activeObj.pointColl = [];
383
- parent.upperCanvas.style.cursor = parent.cursor = 'crosshair';
384
- parent.notify('selection', { prop: 'setCurrentDrawingShape', onPropertyChange: false, value: { value: 'path' } });
385
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
386
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
387
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
388
- }
389
- else {
390
- if (type !== 'freehanddraw' && type !== '') {
391
- parent.activeObj.shape = type;
392
- var strokeSettings = parent.activeObj.strokeSettings;
393
- this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
394
- if (isNullOrUndefined(strokeSettings)) {
395
- strokeSettings = this.strokeSettings;
396
- }
397
- if (type === 'path' && pointColl) {
398
- parent.activeObj.pointColl = pointColl;
399
- }
400
- if (opacity !== null && opacity !== undefined) {
401
- parent.activeObj.opacity = opacity;
402
- }
403
- strokeSettings.strokeWidth = strokeWidth ? strokeWidth : strokeSettings.strokeWidth;
404
- strokeSettings.strokeColor = strokeColor ? strokeColor : strokeSettings.strokeColor;
405
- strokeSettings.fillColor = fillColor ? fillColor : strokeSettings.fillColor;
406
- var tempWidth = parent.img.destWidth > 100 ? 100 : parent.img.destWidth / 2;
407
- var tempHeight = parent.img.destHeight > 100 ? 100 : parent.img.destHeight / 2;
408
- parent.activeObj.activePoint.width = tempWidth;
409
- parent.activeObj.activePoint.height = tempHeight;
410
- if (type === 'line' || type === 'arrow') {
411
- parent.activeObj.lineDraw = 'horizontal';
412
- parent.activeObj.activePoint.height = 0;
413
- if (type === 'arrow') {
414
- parent.activeObj.activePoint.width += 50;
415
- parent.activeObj.start = this.getArrowType(arrowStart);
416
- parent.activeObj.end = this.getArrowType(arrowEnd);
417
- }
418
- }
419
- else if (type === 'rectangle') {
420
- parent.activeObj.activePoint.width += parent.activeObj.activePoint.width / 2;
421
- }
422
- this.setDimension(width, height);
423
- if (start) {
424
- parent.activeObj.activePoint.startX = start.x;
425
- parent.activeObj.activePoint.startY = start.y;
426
- parent.activeObj.activePoint.endX = parent.activeObj.activePoint.startX +
427
- parent.activeObj.activePoint.width;
428
- parent.activeObj.activePoint.endY = parent.activeObj.activePoint.startY +
429
- parent.activeObj.activePoint.height;
430
- }
431
- else {
432
- this.setCenterPoints();
433
- }
434
- this.setPointCollForLineAndArrow();
395
+ var strokeSettings = parent.activeObj.strokeSettings;
396
+ this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
397
+ if (isNullOrUndefined(strokeSettings)) {
398
+ strokeSettings = this.strokeSettings;
399
+ }
400
+ if (type === 'path' && pointColl) {
401
+ parent.activeObj.pointColl = pointColl;
402
+ }
403
+ if (opacity !== null && opacity !== undefined) {
404
+ parent.activeObj.opacity = opacity;
405
+ }
406
+ strokeSettings.strokeWidth = strokeWidth ? strokeWidth : strokeSettings.strokeWidth;
407
+ var shape = parent.activeObj.shape;
408
+ if ((shape === 'rectangle' || shape === 'ellipse') && strokeWidth === 0) {
409
+ strokeSettings.strokeWidth = 0;
410
+ }
411
+ strokeSettings.strokeColor = strokeColor ? strokeColor : strokeSettings.strokeColor;
412
+ strokeSettings.fillColor = fillColor ? fillColor : strokeSettings.fillColor;
413
+ strokeSettings.radius = radius ? radius : strokeSettings.radius;
414
+ var tempWidth = parent.img.destWidth > 100 ? 100 : parent.img.destWidth / 2;
415
+ var tempHeight = parent.img.destHeight > 100 ? 100 : parent.img.destHeight / 2;
416
+ parent.activeObj.activePoint.width = tempWidth;
417
+ parent.activeObj.activePoint.height = tempHeight;
418
+ if (type === 'line' || type === 'arrow') {
419
+ parent.activeObj.lineDraw = 'horizontal';
420
+ parent.activeObj.activePoint.height = 0;
435
421
  if (type === 'arrow') {
436
- parent.activeObj.triangleDirection = 'right';
437
- }
438
- parent.currObjType.isDragging = parent.currObjType.isCustomCrop = false;
439
- this.initShapeProps();
440
- var obj = { shapeSettingsObj: {} };
441
- parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
442
- var shapeSettings = obj['shapeSettingsObj'];
443
- var shapeChangingArgs = { cancel: false, action: 'insert', previousShapeSettings: shapeSettings,
444
- currentShapeSettings: shapeSettings };
445
- parent.trigger('shapeChanging', shapeChangingArgs);
446
- this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
447
- this.setDimension(width, height);
448
- parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
449
- if (degree) {
450
- parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
451
- parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
422
+ parent.activeObj.activePoint.width += 50;
423
+ parent.activeObj.start = this.getArrowType(arrowStart);
424
+ parent.activeObj.end = this.getArrowType(arrowEnd);
452
425
  }
453
- parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
454
- parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
455
- parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
426
+ }
427
+ else if (type === 'rectangle') {
428
+ parent.activeObj.activePoint.width += parent.activeObj.activePoint.width / 2;
429
+ }
430
+ else if (type === 'redact') {
431
+ if (redactType) {
432
+ parent.activeObj.redactType = redactType.toLowerCase();
433
+ if (redactType === RedactType.Blur) {
434
+ if (value) {
435
+ parent.activeObj.redactBlur = value;
436
+ }
437
+ }
438
+ else {
439
+ if (value) {
440
+ parent.activeObj.redactPixelate = value;
441
+ }
442
+ }
443
+ parent.activeObj.redactImage = parent.createElement('canvas');
444
+ }
445
+ }
446
+ this.setDimension(width, height);
447
+ if (start) {
448
+ parent.activeObj.activePoint.startX = start.x;
449
+ parent.activeObj.activePoint.startY = start.y;
450
+ parent.activeObj.activePoint.endX = parent.activeObj.activePoint.startX +
451
+ parent.activeObj.activePoint.width;
452
+ parent.activeObj.activePoint.endY = parent.activeObj.activePoint.startY +
453
+ parent.activeObj.activePoint.height;
454
+ }
455
+ else {
456
+ this.setCenterPoints();
457
+ }
458
+ this.setPointCollForLineAndArrow();
459
+ if (type === 'arrow') {
460
+ parent.activeObj.triangleDirection = 'right';
461
+ }
462
+ parent.currObjType.isDragging = parent.currObjType.isCustomCrop = false;
463
+ this.initShapeProps();
464
+ var obj = { shapeSettingsObj: {} };
465
+ parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
466
+ var shapeSettings = obj['shapeSettingsObj'];
467
+ var shapeChangingArgs = { cancel: false, action: 'insert', previousShapeSettings: shapeSettings,
468
+ currentShapeSettings: shapeSettings };
469
+ parent.trigger('shapeChanging', shapeChangingArgs);
470
+ parent.editCompleteArgs = shapeChangingArgs;
471
+ this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings, shapeChangingArgs.allowShapeOverflow);
472
+ this.setDimension(width, height);
473
+ parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
474
+ if (degree) {
475
+ parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
476
+ parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
477
+ }
478
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
479
+ parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
480
+ parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
481
+ if (type === 'redact') {
482
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'redact',
483
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
484
+ }
485
+ else {
456
486
  parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
457
487
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
458
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
459
- if (parent.isPublicMethod && !isSelected) {
460
- parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
461
- }
462
- parent.isPublicMethod = false;
463
488
  }
489
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
490
+ if (parent.isPublicMethod && !isSelected) {
491
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
492
+ }
493
+ parent.isPublicMethod = false;
464
494
  }
465
495
  }
466
496
  };
@@ -501,7 +531,7 @@ var Shape = /** @class */ (function () {
501
531
  value: { obj: selPointCollObj } });
502
532
  this.prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
503
533
  };
504
- Shape.prototype.drawShapeText = function (text, fontFamily, fontSize, bold, italic, strokeColor, x, y, isSelected, degree) {
534
+ Shape.prototype.drawShapeText = function (text, fontFamily, fontSize, bold, italic, strokeColor, x, y, isSelected, degree, fillColor, outlineColor, outlineWidth) {
505
535
  var parent = this.parent;
506
536
  if (!parent.disabled && parent.isImageLoaded) {
507
537
  if (parent.currObjType.shape === 'freehanddraw') {
@@ -516,7 +546,7 @@ var Shape = /** @class */ (function () {
516
546
  this.refreshActiveObj();
517
547
  parent.activeObj.shape = parent.currObjType.shape = 'text';
518
548
  parent.currObjType.isCustomCrop = false;
519
- this.initializeTextShape(text, fontFamily, fontSize, bold, italic, strokeColor);
549
+ this.initializeTextShape(text, fontFamily, fontSize, bold, italic, strokeColor, fillColor, outlineColor, outlineWidth);
520
550
  parent.currObjType.isText = parent.currObjType.isInitialText = true;
521
551
  if (isNullOrUndefined(parent.activeObj.textSettings.fontSize)) {
522
552
  parent.getFontSizes();
@@ -535,7 +565,7 @@ var Shape = /** @class */ (function () {
535
565
  parent.activeObj.order = this.getNewOrder();
536
566
  var width = this.upperContext.measureText(parent.activeObj.textSettings.text).width +
537
567
  parent.activeObj.textSettings.fontSize * 0.5;
538
- var height = parent.activeObj.textSettings.fontSize + parent.activeObj.textSettings.fontSize * 0.25;
568
+ var height = parent.activeObj.textSettings.fontSize;
539
569
  if (!isNullOrUndefined(x) && !isNullOrUndefined(y)) {
540
570
  parent.activeObj.activePoint.startX = x;
541
571
  parent.activeObj.activePoint.startY = y;
@@ -551,6 +581,7 @@ var Shape = /** @class */ (function () {
551
581
  var shapeChangingArgs = { cancel: false, action: 'insert', previousShapeSettings: shapeSettings,
552
582
  currentShapeSettings: shapeSettings };
553
583
  parent.trigger('shapeChanging', shapeChangingArgs);
584
+ parent.editCompleteArgs = shapeChangingArgs;
554
585
  this.drawShapeTextEvent(shapeChangingArgs);
555
586
  if (degree) {
556
587
  parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
@@ -579,7 +610,7 @@ var Shape = /** @class */ (function () {
579
610
  };
580
611
  Shape.prototype.drawShapeImageEvent = function (shapeChangingArgs, isSelect) {
581
612
  var parent = this.parent;
582
- this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
613
+ this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings, shapeChangingArgs.allowShapeOverflow);
583
614
  parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
584
615
  parent.objColl.push(parent.activeObj);
585
616
  var prevCropObj = extend({}, parent.cropObj, {}, true);
@@ -602,7 +633,7 @@ var Shape = /** @class */ (function () {
602
633
  };
603
634
  Shape.prototype.drawShapeTextEvent = function (shapeChangingArgs) {
604
635
  var parent = this.parent;
605
- this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
636
+ this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings, shapeChangingArgs.allowShapeOverflow);
606
637
  this.addLetter(parent.activeObj.textSettings.text);
607
638
  parent.activeObj.textFlip = parent.transform.currFlipState;
608
639
  this.updateFontRatio(parent.activeObj);
@@ -620,22 +651,19 @@ var Shape = /** @class */ (function () {
620
651
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
621
652
  parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
622
653
  };
623
- Shape.prototype.initializeTextShape = function (text, fontFamily, fontSize, bold, italic, strokeColor) {
654
+ Shape.prototype.initializeTextShape = function (text, fontFamily, fontSize, bold, italic, strokeColor, fillColor, outlineColor, outlineWidth) {
624
655
  var parent = this.parent;
625
656
  this.keyHistory = '';
626
657
  parent.upperCanvas.style.display = 'block';
627
- if (isNullOrUndefined(parent.activeObj.textSettings)) {
628
- parent.activeObj.textSettings = this.textSettings;
629
- }
630
- if (isNullOrUndefined(parent.activeObj.strokeSettings)) {
631
- parent.activeObj.strokeSettings = this.strokeSettings;
632
- }
633
658
  parent.activeObj.strokeSettings.strokeColor = strokeColor || parent.activeObj.strokeSettings.strokeColor;
659
+ parent.activeObj.strokeSettings.fillColor = fillColor || parent.activeObj.strokeSettings.fillColor;
634
660
  parent.activeObj.textSettings.text = text || parent.activeObj.textSettings.text;
635
661
  parent.activeObj.textSettings.fontFamily = fontFamily || parent.activeObj.textSettings.fontFamily;
636
662
  parent.activeObj.textSettings.fontSize = fontSize || parent.activeObj.textSettings.fontSize;
637
663
  parent.activeObj.textSettings.bold = bold || parent.activeObj.textSettings.bold;
638
664
  parent.activeObj.textSettings.italic = italic || parent.activeObj.textSettings.italic;
665
+ parent.activeObj.strokeSettings.outlineColor = outlineColor || parent.activeObj.strokeSettings.outlineColor;
666
+ parent.activeObj.strokeSettings.outlineWidth = outlineWidth || parent.activeObj.strokeSettings.outlineWidth;
639
667
  };
640
668
  Shape.prototype.drawImage = function (x, y, width, height, src, degree, isAspectRatio, opacity, isSelected) {
641
669
  this.initializeShape('image');
@@ -743,7 +771,7 @@ var Shape = /** @class */ (function () {
743
771
  parent.activeObj.activePoint.endX = parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width;
744
772
  parent.activeObj.activePoint.endY = parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height;
745
773
  };
746
- Shape.prototype.updateShapeChangeEventArgs = function (shapeSettings) {
774
+ Shape.prototype.updateShapeChangeEventArgs = function (shapeSettings, allowShapeOverflow) {
747
775
  var parent = this.parent;
748
776
  var shapeId;
749
777
  if (shapeSettings.id && shapeSettings.id.indexOf('shape_') === -1 &&
@@ -777,6 +805,7 @@ var Shape = /** @class */ (function () {
777
805
  parent.activeObj.strokeSettings.strokeWidth = shapeSettings.strokeWidth;
778
806
  parent.activeObj.opacity = shapeSettings.opacity;
779
807
  parent.activeObj.order = shapeSettings.index;
808
+ parent.activeObj.preventShapeDragOut = !allowShapeOverflow;
780
809
  if (isNullOrUndefined(shapeSettings.degree)) {
781
810
  shapeSettings.degree = 0;
782
811
  }
@@ -835,9 +864,6 @@ var Shape = /** @class */ (function () {
835
864
  case 'italic':
836
865
  parent.activeObj.textSettings.italic = true;
837
866
  break;
838
- case 'underline':
839
- parent.activeObj.textSettings.underline = true;
840
- break;
841
867
  }
842
868
  }
843
869
  }
@@ -856,7 +882,7 @@ var Shape = /** @class */ (function () {
856
882
  this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
857
883
  this.updateFontStyles();
858
884
  var width = this.upperContext.measureText(this.keyHistory).width + fontSize * 0.5;
859
- var height = fontSize + fontSize * 0.25;
885
+ var height = fontSize;
860
886
  this.upperContext.fillText(this.keyHistory, parent.activeObj.activePoint.startX, parent.activeObj.activePoint.startY + fontSize);
861
887
  this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
862
888
  parent.currObjType.isText = true;
@@ -879,7 +905,10 @@ var Shape = /** @class */ (function () {
879
905
  var text = (parent.textArea.style.display === 'block' || parent.textArea.style.display === 'inline-block') ?
880
906
  this.getMaxText(true) : this.getMaxText();
881
907
  var width = this.upperContext.measureText(text).width + fontSize * 0.5;
882
- var height = rows.length * (fontSize + fontSize * 0.25);
908
+ var height = rows.length * fontSize;
909
+ if (rows.length > 1) {
910
+ height += (fontSize * 0.50);
911
+ }
883
912
  parent.notify('selection', { prop: 'setTextSelection', onPropertyChange: false,
884
913
  value: { width: width, height: height } });
885
914
  parent.notify('draw', { prop: 'updateActiveObject', onPropertyChange: false, value: { actPoint: parent.activeObj.activePoint, obj: parent.activeObj,
@@ -911,10 +940,11 @@ var Shape = /** @class */ (function () {
911
940
  parent.textArea.value = '';
912
941
  this.updateFontStyles();
913
942
  var width = this.upperContext.measureText(parent.activeObj.keyHistory).width + fontSize * 0.5;
914
- var height = fontSize + fontSize * 0.25;
943
+ var height = fontSize;
915
944
  var rows = parent.activeObj.keyHistory.split('\n');
916
945
  if (rows.length > 1) {
917
946
  height *= rows.length;
947
+ height += (fontSize * 0.1 * rows.length);
918
948
  var widthColl = [];
919
949
  for (var i = 0, len = rows.length; i < len; i++) {
920
950
  widthColl.push(this.upperContext.measureText(rows[i]).width + fontSize * 0.5);
@@ -978,6 +1008,14 @@ var Shape = /** @class */ (function () {
978
1008
  }
979
1009
  if (currentObj.order === index) {
980
1010
  this.apply(currentObj.shape, currentObj);
1011
+ if (currentObj.shape === 'redact' && JSON.stringify(currentObj.activePoint) === JSON.stringify(parent.activeObj.activePoint) &&
1012
+ currentObj.redactImage !== parent.activeObj.redactImage) {
1013
+ currentObj.redactImage = parent.activeObj.redactImage;
1014
+ if (parent.objColl[i] && JSON.stringify(parent.objColl[i].activePoint) ===
1015
+ JSON.stringify(currentObj.activePoint)) {
1016
+ parent.objColl[i].redactImage = parent.activeObj.redactImage;
1017
+ }
1018
+ }
981
1019
  this.refreshActiveObj();
982
1020
  index++;
983
1021
  if (!this.isIndexInObjColl(index)) {
@@ -1146,12 +1184,14 @@ var Shape = /** @class */ (function () {
1146
1184
  var selPointCollObj = { selPointColl: null };
1147
1185
  parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false, value: { obj: selPointCollObj } });
1148
1186
  for (var i = 0, fLen = parent.freehandCounter; i < fLen; i++) {
1149
- var len = selPointCollObj['selPointColl'][i].points.length;
1150
- var point = void 0;
1151
- for (var l = 0; l < len; l++) {
1152
- point = this.straightenPoints(selPointCollObj['selPointColl'][i].points[l].x, selPointCollObj['selPointColl'][i].points[l].y);
1153
- selPointCollObj['selPointColl'][i].points[l].x = point.x;
1154
- selPointCollObj['selPointColl'][i].points[l].y = point.y;
1187
+ if (selPointCollObj['selPointColl'][i] && selPointCollObj['selPointColl'][i].points) {
1188
+ var len = selPointCollObj['selPointColl'][i].points.length;
1189
+ var point = void 0;
1190
+ for (var l = 0; l < len; l++) {
1191
+ point = this.straightenPoints(selPointCollObj['selPointColl'][i].points[l].x, selPointCollObj['selPointColl'][i].points[l].y);
1192
+ selPointCollObj['selPointColl'][i].points[l].x = point.x;
1193
+ selPointCollObj['selPointColl'][i].points[l].y = point.y;
1194
+ }
1155
1195
  }
1156
1196
  }
1157
1197
  var straightenObj = { straightenPoint: null };
@@ -1592,17 +1632,26 @@ var Shape = /** @class */ (function () {
1592
1632
  var dupElem = parent.element.querySelector('#' + parent.element.id + '_duplicate');
1593
1633
  var removeElem = parent.element.querySelector('#' + parent.element.id + '_remove');
1594
1634
  var editTextElem = parent.element.querySelector('#' + parent.element.id + '_editText');
1635
+ var shadowColor = actObj.strokeSettings.outlineColor;
1636
+ var outlineWidth = actObj.strokeSettings.outlineWidth;
1637
+ var shadows = [];
1595
1638
  if (zOrderElem) {
1596
- zOrderElem.classList.add('e-disabled');
1639
+ zOrderElem.classList.add('e-overlay');
1597
1640
  }
1598
1641
  if (dupElem) {
1599
- dupElem.classList.add('e-disabled');
1642
+ dupElem.classList.add('e-overlay');
1600
1643
  }
1601
1644
  if (removeElem) {
1602
- removeElem.classList.add('e-disabled');
1645
+ removeElem.classList.add('e-overlay');
1603
1646
  }
1604
1647
  if (editTextElem) {
1605
- editTextElem.classList.add('e-disabled');
1648
+ editTextElem.classList.add('e-overlay');
1649
+ }
1650
+ if (actObj.strokeSettings.fillColor !== '') {
1651
+ parent.textArea.style.backgroundColor = actObj.strokeSettings.fillColor;
1652
+ }
1653
+ else {
1654
+ parent.textArea.style.backgroundColor = 'transparent';
1606
1655
  }
1607
1656
  parent.textArea.style.display = 'block';
1608
1657
  parent.textArea.style.left = x + 'px';
@@ -1610,6 +1659,22 @@ var Shape = /** @class */ (function () {
1610
1659
  parent.textArea.style.fontFamily = actObj.textSettings.fontFamily;
1611
1660
  parent.textArea.style.fontSize = actObj.textSettings.fontSize + 'px';
1612
1661
  parent.textArea.style.color = actObj.strokeSettings.strokeColor;
1662
+ var fontSize = actObj.textSettings.fontSize;
1663
+ var baseWidth = Math.max(1, outlineWidth / 2);
1664
+ var adjustedOutlineWidth = baseWidth * (Math.floor((fontSize - 1) / 16) * 0.5 + 0.5);
1665
+ if (/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$|^[a-zA-Z]+$/.test(actObj.strokeSettings.outlineColor)) {
1666
+ for (var x_1 = -adjustedOutlineWidth; x_1 <= adjustedOutlineWidth; x_1++) {
1667
+ for (var y_1 = -adjustedOutlineWidth; y_1 <= adjustedOutlineWidth; y_1++) {
1668
+ if (x_1 !== 0 || y_1 !== 0) {
1669
+ shadows.push(x_1 / 2 + "px " + y_1 / 2 + "px 0 " + shadowColor);
1670
+ }
1671
+ }
1672
+ }
1673
+ parent.textArea.style.textShadow = shadows.join(', ');
1674
+ }
1675
+ else {
1676
+ parent.textArea.style.textShadow = null;
1677
+ }
1613
1678
  parent.textArea.style.fontWeight = actObj.textSettings.bold ? 'bold' : 'normal';
1614
1679
  parent.textArea.style.fontStyle = actObj.textSettings.italic ? 'italic' : 'normal';
1615
1680
  parent.textArea.style.border = '2px solid ' + parent.themeColl[parent.theme]['primaryColor'];
@@ -1618,15 +1683,14 @@ var Shape = /** @class */ (function () {
1618
1683
  parent.textArea.style.width = 'auto';
1619
1684
  parent.textArea.style.height = 'auto';
1620
1685
  parent.textArea.focus();
1621
- var zoomFactor = parent.transform.zoomFactor;
1622
1686
  var _a = actObj.activePoint, width = _a.width, height = _a.height;
1623
1687
  if (degree % 90 === 0 && degree % 180 !== 0 && degree !== 0) {
1624
- parent.textArea.style.width = (zoomFactor === 0 ? height : height) + 'px';
1625
- parent.textArea.style.height = (zoomFactor === 0 ? width : width) + 'px';
1688
+ parent.textArea.style.width = height + (height * 0.25) + 'px';
1689
+ parent.textArea.style.height = width + (width * 0.25) + 'px';
1626
1690
  }
1627
1691
  else {
1628
- parent.textArea.style.width = (zoomFactor === 0 ? width : width) + 'px';
1629
- parent.textArea.style.height = (zoomFactor === 0 ? height : height) + 'px';
1692
+ parent.textArea.style.width = width + (width * 0.25) + 'px';
1693
+ parent.textArea.style.height = height + (height * 0.25) + 'px';
1630
1694
  }
1631
1695
  this.setTextBoxWidth();
1632
1696
  var obj = { flipColl: null };
@@ -1902,11 +1966,22 @@ var Shape = /** @class */ (function () {
1902
1966
  parent.notify('selection', { prop: 'mouseUpEventHandler', value: { e: e } });
1903
1967
  this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
1904
1968
  parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
1969
+ if (parent.objColl.length > 0) {
1970
+ var obj1 = parent.activeObj.activePoint;
1971
+ var obj2 = parent.objColl[parent.objColl.length - 1].activePoint;
1972
+ if (Math.floor(obj1.startX) === Math.floor(obj2.startX) &&
1973
+ Math.floor(obj1.startY) === Math.floor(obj2.startY) &&
1974
+ Math.floor(obj1.endX) === Math.floor(obj2.endX) &&
1975
+ Math.floor(obj1.endY) === Math.floor(obj2.endY)) {
1976
+ this.refreshActiveObj();
1977
+ }
1978
+ }
1905
1979
  }
1906
1980
  parent.notify('draw', { prop: 'setNewPath', value: { bool: true } });
1907
1981
  if (parent.objColl[parent.objColl.length - 1]) {
1908
1982
  var shape = parent.drawingShape;
1909
1983
  parent.notify('selection', { prop: 'setCurrentDrawingShape', value: { value: '' } });
1984
+ parent.noRedact = true;
1910
1985
  parent.selectShape(parent.objColl[parent.objColl.length - 1].currIndex);
1911
1986
  parent.notify('selection', { prop: 'setCurrentDrawingShape', value: { value: 'path' } });
1912
1987
  parent.drawingShape = shape;
@@ -1925,12 +2000,16 @@ var Shape = /** @class */ (function () {
1925
2000
  };
1926
2001
  Shape.prototype.findTextTarget = function (e) {
1927
2002
  var parent = this.parent;
2003
+ if (!e) {
2004
+ return;
2005
+ }
1928
2006
  if (parent.activeObj.shape !== 'text') {
1929
2007
  if (parent.activeObj.shape === 'path') {
1930
2008
  this.stopPathDrawing(e, null);
1931
2009
  return;
1932
2010
  }
1933
2011
  else if (e.type === 'dblclick') {
2012
+ parent.notify('selection', { prop: 'setPanDown', onPropertyChange: false, value: { panDown: null } });
1934
2013
  var activeObj = extend({}, parent.activeObj, {}, true);
1935
2014
  var objColl = extend([], parent.objColl, [], true);
1936
2015
  var obj = { bool: null };
@@ -2143,7 +2222,7 @@ var Shape = /** @class */ (function () {
2143
2222
  var filesData = e.target.files[0];
2144
2223
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2145
2224
  var fileData = filesData;
2146
- var fileExtension = fileData.name && fileData.name.split('.')[1].toLowerCase();
2225
+ var fileExtension = fileData.name && fileData.name.split('.').pop().toLowerCase();
2147
2226
  if (fileExtension && ['jpg', 'jpeg', 'png', 'svg'].indexOf(fileExtension) === -1) {
2148
2227
  this.refreshActiveObj();
2149
2228
  return;
@@ -2225,6 +2304,7 @@ var Shape = /** @class */ (function () {
2225
2304
  var shapeChangingArgs = { cancel: false, action: 'insert', previousShapeSettings: shapeSettings,
2226
2305
  currentShapeSettings: shapeSettings };
2227
2306
  parent.trigger('shapeChanging', shapeChangingArgs);
2307
+ parent.editCompleteArgs = shapeChangingArgs;
2228
2308
  isSelect = isSelect ? isSelect : isSelected;
2229
2309
  this.drawShapeImageEvent(shapeChangingArgs, isSelect);
2230
2310
  if (parent.isPublicMethod && !isSelected) {
@@ -2516,6 +2596,7 @@ var Shape = /** @class */ (function () {
2516
2596
  var shapeChangedArgs = { action: 'font-style', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2517
2597
  shapeChangedArgs.currentShapeSettings.fontStyle = [item];
2518
2598
  parent.trigger('shapeChange', shapeChangedArgs);
2599
+ parent.editCompleteArgs = shapeChangedArgs;
2519
2600
  };
2520
2601
  Shape.prototype.updateFontStyle = function (item, objColl, fontWeight, fontStyle) {
2521
2602
  var parent = this.parent;
@@ -2595,7 +2676,7 @@ var Shape = /** @class */ (function () {
2595
2676
  var text = this.getMaxText(isTextArea);
2596
2677
  var width = this.upperContext.measureText(text).width +
2597
2678
  parent.activeObj.textSettings.fontSize * 0.5;
2598
- var height = (parent.activeObj.textSettings.fontSize + parent.activeObj.textSettings.fontSize * 0.25);
2679
+ var height = parent.activeObj.textSettings.fontSize;
2599
2680
  var degree = this.getRotDegOfShape(obj);
2600
2681
  if (isNullOrUndefined(isTextArea)) {
2601
2682
  if (degree === 0 || Math.abs(degree) === 180) {
@@ -2696,6 +2777,9 @@ var Shape = /** @class */ (function () {
2696
2777
  parent.activeObj.textSettings = this.textSettings;
2697
2778
  parent.activeObj.rotatedAngle = 0;
2698
2779
  parent.activeObj.opacity = 1;
2780
+ parent.activeObj.redactType = this.redactType;
2781
+ parent.activeObj.redactBlur = parent.tempRedactBlur;
2782
+ parent.activeObj.redactPixelate = parent.tempRedactPixel;
2699
2783
  };
2700
2784
  Shape.prototype.applyActObj = function (isMouseDown) {
2701
2785
  var parent = this.parent;
@@ -2884,6 +2968,25 @@ var Shape = /** @class */ (function () {
2884
2968
  parent.activeObj.textSettings.italic = tempItalic;
2885
2969
  return width;
2886
2970
  };
2971
+ Shape.prototype.getRedactObjDetails = function (obj) {
2972
+ var parent = this.parent;
2973
+ var redactDetails = {};
2974
+ redactDetails.id = obj.currIndex;
2975
+ redactDetails.type = parent.toPascalCase(obj.redactType);
2976
+ redactDetails.startX = obj.activePoint.startX;
2977
+ redactDetails.startY = obj.activePoint.startY;
2978
+ redactDetails.width = obj.activePoint.width;
2979
+ redactDetails.height = obj.activePoint.height;
2980
+ switch (obj.redactType) {
2981
+ case 'blur':
2982
+ redactDetails.blurIntensity = obj.redactBlur;
2983
+ break;
2984
+ case 'pixelate':
2985
+ redactDetails.pixelSize = obj.redactPixelate;
2986
+ break;
2987
+ }
2988
+ return redactDetails;
2989
+ };
2887
2990
  Shape.prototype.getObjDetails = function (obj) {
2888
2991
  var parent = this.parent;
2889
2992
  var shapeDetails = {};
@@ -3012,6 +3115,23 @@ var Shape = /** @class */ (function () {
3012
3115
  }
3013
3116
  obj['shapeDetailsColl'] = shapeDetailsColl;
3014
3117
  };
3118
+ Shape.prototype.getRedactSettings = function (obj) {
3119
+ var parent = this.parent;
3120
+ var RedactDetailsColl = [];
3121
+ if (!parent.disabled && parent.isImageLoaded) {
3122
+ if (parent.textArea.style.display !== 'none') {
3123
+ parent.okBtn(null, true);
3124
+ }
3125
+ else {
3126
+ this.applyActObj(true);
3127
+ }
3128
+ for (var i = 0, len = parent.objColl.length; i < len; i++) {
3129
+ var redactDetails = this.getRedactObjDetails(parent.objColl[i]);
3130
+ RedactDetailsColl.push(redactDetails);
3131
+ }
3132
+ }
3133
+ obj['shapeDetailsColl'] = RedactDetailsColl;
3134
+ };
3015
3135
  Shape.prototype.isPointsInRange = function (x, y, obj) {
3016
3136
  var inRange = false;
3017
3137
  var parent = this.parent;
@@ -3158,6 +3278,10 @@ var Shape = /** @class */ (function () {
3158
3278
  parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
3159
3279
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
3160
3280
  }
3281
+ else if (parent.activeObj.shape === 'redact') {
3282
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'redact',
3283
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
3284
+ }
3161
3285
  else {
3162
3286
  parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
3163
3287
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
@@ -3554,11 +3678,20 @@ var Shape = /** @class */ (function () {
3554
3678
  break;
3555
3679
  }
3556
3680
  };
3681
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3682
+ Shape.prototype.reorderRedact = function (tempObjColl) {
3683
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3684
+ var nonRedact = tempObjColl.filter(function (item) { return item.shape !== 'redact'; });
3685
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3686
+ var redact = tempObjColl.filter(function (item) { return item.shape === 'redact'; });
3687
+ return redact.concat(nonRedact);
3688
+ };
3557
3689
  Shape.prototype.updateShapeColl = function () {
3558
3690
  var parent = this.parent;
3559
3691
  var isOrdered = false;
3560
3692
  var tempOrder = 1;
3561
3693
  var tempObjColl = extend([], parent.objColl, [], true);
3694
+ tempObjColl = this.reorderRedact(tempObjColl);
3562
3695
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3563
3696
  var tempPointColl = extend([], parent.pointColl, [], true);
3564
3697
  if (parent.shapeColl.length > 0 &&
@@ -3660,9 +3793,16 @@ var Shape = /** @class */ (function () {
3660
3793
  var tempObjColl = extend([], parent.objColl, [], true);
3661
3794
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3662
3795
  var tempPointColl = extend([], parent.pointColl, [], true);
3796
+ var tempSelPointCollObj = { selPointColl: null };
3797
+ parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
3798
+ value: { obj: tempSelPointCollObj } });
3799
+ var selPointCollObj = { selPointColl: null };
3800
+ parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
3801
+ value: { obj: selPointCollObj } });
3663
3802
  this.updateShapeColl();
3664
3803
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3665
3804
  var tempShapeColl = extend([], parent.shapeColl, [], true);
3805
+ tempShapeColl = this.reorderRedact(tempShapeColl);
3666
3806
  var isPrevented = false;
3667
3807
  if (!this.preventFrameAnnotation) {
3668
3808
  this.preventFrameAnnotation = isPrevented = true;
@@ -3703,7 +3843,10 @@ var Shape = /** @class */ (function () {
3703
3843
  else if (tempShapeColl[i].id && tempShapeColl[i].id.indexOf('pen') > -1) {
3704
3844
  parent.pointColl = [];
3705
3845
  parent.freehandCounter = 0;
3846
+ parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false, value: { obj: { selPointColl: [] } } });
3706
3847
  parent.pointColl.push(extend({}, tempShapeColl[i], {}, true));
3848
+ parent.notify('freehand-draw', { prop: 'pushSelPointColl', onPropertyChange: false,
3849
+ value: { obj: { selPointColl: selPointCollObj['selPointColl'][i] } } });
3707
3850
  parent.freehandCounter = parent.pointColl.length;
3708
3851
  if (pen === 'iterate') {
3709
3852
  parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
@@ -3724,6 +3867,12 @@ var Shape = /** @class */ (function () {
3724
3867
  break;
3725
3868
  }
3726
3869
  }
3870
+ for (var i_5 = 0, len = tempSelPointCollObj['selPointColl'].length; i_5 < len; i_5++) {
3871
+ if (tempSelPointCollObj['selPointColl'][i_5].id === selPointCollObj['selPointColl'][i_5].id) {
3872
+ tempSelPointCollObj['selPointColl'][i_5] = extend({}, selPointCollObj['selPointColl'][i_5], {}, true);
3873
+ break;
3874
+ }
3875
+ }
3727
3876
  }
3728
3877
  }
3729
3878
  }
@@ -3740,6 +3889,7 @@ var Shape = /** @class */ (function () {
3740
3889
  parent.objColl = tempObjColl;
3741
3890
  parent.pointColl = tempPointColl;
3742
3891
  parent.freehandCounter = parent.pointColl.length;
3892
+ parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false, value: { obj: { selPointColl: tempSelPointCollObj['selPointColl'] } } });
3743
3893
  if (isPrevented && this.preventFrameAnnotation) {
3744
3894
  parent.notify('draw', { prop: 'applyFrame', value: { ctx: this.lowerContext, frame: parent.frameObj.type, preventImg: true } });
3745
3895
  this.preventFrameAnnotation = false;