@syncfusion/ej2-image-editor 26.2.14 → 27.1.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +3202 -732
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +3281 -797
  7. package/dist/es6/ej2-image-editor.es5.js.map +1 -1
  8. package/dist/global/ej2-image-editor.min.js +2 -2
  9. package/dist/global/ej2-image-editor.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/package.json +14 -13
  12. package/src/image-editor/action/crop.d.ts +0 -1
  13. package/src/image-editor/action/crop.js +8 -19
  14. package/src/image-editor/action/draw.d.ts +4 -0
  15. package/src/image-editor/action/draw.js +377 -45
  16. package/src/image-editor/action/export.js +21 -13
  17. package/src/image-editor/action/filter.d.ts +13 -0
  18. package/src/image-editor/action/filter.js +272 -1
  19. package/src/image-editor/action/freehand-draw.d.ts +1 -0
  20. package/src/image-editor/action/freehand-draw.js +44 -23
  21. package/src/image-editor/action/selection.d.ts +6 -0
  22. package/src/image-editor/action/selection.js +382 -97
  23. package/src/image-editor/action/shape.d.ts +5 -0
  24. package/src/image-editor/action/shape.js +287 -141
  25. package/src/image-editor/action/transform.js +56 -82
  26. package/src/image-editor/action/undo-redo.d.ts +2 -0
  27. package/src/image-editor/action/undo-redo.js +100 -1
  28. package/src/image-editor/base/enum.d.ts +11 -0
  29. package/src/image-editor/base/enum.js +12 -0
  30. package/src/image-editor/base/image-editor-model.d.ts +13 -1
  31. package/src/image-editor/base/image-editor.d.ts +142 -20
  32. package/src/image-editor/base/image-editor.js +811 -149
  33. package/src/image-editor/base/interface.d.ts +140 -1
  34. package/src/image-editor/renderer/toolbar.d.ts +8 -0
  35. package/src/image-editor/renderer/toolbar.js +873 -191
  36. package/styles/bootstrap-dark-lite.css +746 -0
  37. package/styles/bootstrap-dark-lite.scss +13 -0
  38. package/styles/bootstrap-dark.css +150 -105
  39. package/styles/bootstrap-dark.scss +1 -0
  40. package/styles/bootstrap-lite.css +747 -0
  41. package/styles/bootstrap-lite.scss +13 -0
  42. package/styles/bootstrap.css +151 -106
  43. package/styles/bootstrap.scss +1 -0
  44. package/styles/bootstrap4-lite.css +747 -0
  45. package/styles/bootstrap4-lite.scss +13 -0
  46. package/styles/bootstrap4.css +150 -105
  47. package/styles/bootstrap4.scss +1 -0
  48. package/styles/bootstrap5-dark-lite.css +757 -0
  49. package/styles/bootstrap5-dark-lite.scss +13 -0
  50. package/styles/bootstrap5-dark.css +152 -113
  51. package/styles/bootstrap5-dark.scss +1 -0
  52. package/styles/bootstrap5-lite.css +757 -0
  53. package/styles/bootstrap5-lite.scss +13 -0
  54. package/styles/bootstrap5.3-lite.css +760 -0
  55. package/styles/bootstrap5.3-lite.scss +13 -0
  56. package/styles/bootstrap5.3.css +867 -0
  57. package/styles/bootstrap5.3.scss +14 -0
  58. package/styles/bootstrap5.css +152 -113
  59. package/styles/bootstrap5.scss +1 -0
  60. package/styles/fabric-dark-lite.css +749 -0
  61. package/styles/fabric-dark-lite.scss +13 -0
  62. package/styles/fabric-dark.css +150 -105
  63. package/styles/fabric-dark.scss +1 -0
  64. package/styles/fabric-lite.css +751 -0
  65. package/styles/fabric-lite.scss +13 -0
  66. package/styles/fabric.css +151 -106
  67. package/styles/fabric.scss +1 -0
  68. package/styles/fluent-dark-lite.css +758 -0
  69. package/styles/fluent-dark-lite.scss +13 -0
  70. package/styles/fluent-dark.css +150 -111
  71. package/styles/fluent-dark.scss +1 -0
  72. package/styles/fluent-lite.css +758 -0
  73. package/styles/fluent-lite.scss +13 -0
  74. package/styles/fluent.css +150 -111
  75. package/styles/fluent.scss +1 -0
  76. package/styles/fluent2-lite.css +791 -0
  77. package/styles/fluent2-lite.scss +13 -0
  78. package/styles/fluent2.css +173 -117
  79. package/styles/fluent2.scss +1 -0
  80. package/styles/highcontrast-light-lite.css +748 -0
  81. package/styles/highcontrast-light-lite.scss +13 -0
  82. package/styles/highcontrast-light.css +149 -104
  83. package/styles/highcontrast-light.scss +1 -0
  84. package/styles/highcontrast-lite.css +753 -0
  85. package/styles/highcontrast-lite.scss +13 -0
  86. package/styles/highcontrast.css +150 -104
  87. package/styles/highcontrast.scss +1 -0
  88. package/styles/image-editor/_bds-definition.scss +3 -1
  89. package/styles/image-editor/_bigger.scss +216 -0
  90. package/styles/image-editor/_bootstrap-dark-definition.scss +3 -1
  91. package/styles/image-editor/_bootstrap-definition.scss +3 -1
  92. package/styles/image-editor/_bootstrap4-definition.scss +3 -1
  93. package/styles/image-editor/_bootstrap5-definition.scss +3 -1
  94. package/styles/image-editor/_bootstrap5.3-definition.scss +3 -1
  95. package/styles/image-editor/_fabric-dark-definition.scss +3 -1
  96. package/styles/image-editor/_fabric-definition.scss +3 -1
  97. package/styles/image-editor/_fluent-definition.scss +3 -1
  98. package/styles/image-editor/_fluent2-definition.scss +4 -2
  99. package/styles/image-editor/_fusionnew-definition.scss +3 -1
  100. package/styles/image-editor/_highcontrast-definition.scss +3 -1
  101. package/styles/image-editor/_highcontrast-light-definition.scss +3 -1
  102. package/styles/image-editor/_layout.scss +75 -212
  103. package/styles/image-editor/_material-dark-definition.scss +3 -1
  104. package/styles/image-editor/_material-definition.scss +3 -1
  105. package/styles/image-editor/_material3-definition.scss +5 -3
  106. package/styles/image-editor/_tailwind-definition.scss +5 -3
  107. package/styles/image-editor/_theme.scss +48 -11
  108. package/styles/image-editor/bootstrap-dark.css +150 -105
  109. package/styles/image-editor/bootstrap-dark.scss +1 -0
  110. package/styles/image-editor/bootstrap.css +151 -106
  111. package/styles/image-editor/bootstrap.scss +1 -0
  112. package/styles/image-editor/bootstrap4.css +150 -105
  113. package/styles/image-editor/bootstrap4.scss +1 -0
  114. package/styles/image-editor/bootstrap5-dark.css +152 -113
  115. package/styles/image-editor/bootstrap5-dark.scss +1 -0
  116. package/styles/image-editor/bootstrap5.3.css +867 -0
  117. package/styles/image-editor/bootstrap5.3.scss +14 -0
  118. package/styles/image-editor/bootstrap5.css +152 -113
  119. package/styles/image-editor/bootstrap5.scss +1 -0
  120. package/styles/image-editor/fabric-dark.css +150 -105
  121. package/styles/image-editor/fabric-dark.scss +1 -0
  122. package/styles/image-editor/fabric.css +151 -106
  123. package/styles/image-editor/fabric.scss +1 -0
  124. package/styles/image-editor/fluent-dark.css +150 -111
  125. package/styles/image-editor/fluent-dark.scss +1 -0
  126. package/styles/image-editor/fluent.css +150 -111
  127. package/styles/image-editor/fluent.scss +1 -0
  128. package/styles/image-editor/fluent2.css +173 -117
  129. package/styles/image-editor/fluent2.scss +1 -0
  130. package/styles/image-editor/highcontrast-light.css +149 -104
  131. package/styles/image-editor/highcontrast-light.scss +1 -0
  132. package/styles/image-editor/highcontrast.css +150 -104
  133. package/styles/image-editor/highcontrast.scss +1 -0
  134. package/styles/image-editor/icons/_bds.scss +10 -1
  135. package/styles/image-editor/icons/_bootstrap-dark.scss +10 -1
  136. package/styles/image-editor/icons/_bootstrap.scss +10 -1
  137. package/styles/image-editor/icons/_bootstrap4.scss +10 -1
  138. package/styles/image-editor/icons/_bootstrap5.3.scss +10 -1
  139. package/styles/image-editor/icons/_bootstrap5.scss +10 -1
  140. package/styles/image-editor/icons/_fabric-dark.scss +10 -1
  141. package/styles/image-editor/icons/_fabric.scss +10 -1
  142. package/styles/image-editor/icons/_fluent.scss +10 -1
  143. package/styles/image-editor/icons/_fluent2.scss +10 -1
  144. package/styles/image-editor/icons/_fusionnew.scss +10 -1
  145. package/styles/image-editor/icons/_highcontrast-light.scss +10 -1
  146. package/styles/image-editor/icons/_highcontrast.scss +10 -1
  147. package/styles/image-editor/icons/_material-dark.scss +10 -1
  148. package/styles/image-editor/icons/_material.scss +10 -1
  149. package/styles/image-editor/icons/_material3.scss +10 -1
  150. package/styles/image-editor/icons/_tailwind.scss +10 -1
  151. package/styles/image-editor/material-dark.css +153 -108
  152. package/styles/image-editor/material-dark.scss +1 -0
  153. package/styles/image-editor/material.css +159 -114
  154. package/styles/image-editor/material.scss +1 -0
  155. package/styles/image-editor/material3-dark.css +171 -123
  156. package/styles/image-editor/material3-dark.scss +1 -0
  157. package/styles/image-editor/material3.css +171 -123
  158. package/styles/image-editor/material3.scss +1 -0
  159. package/styles/image-editor/tailwind-dark.css +154 -116
  160. package/styles/image-editor/tailwind-dark.scss +1 -0
  161. package/styles/image-editor/tailwind.css +154 -116
  162. package/styles/image-editor/tailwind.scss +1 -0
  163. package/styles/material-dark-lite.css +767 -0
  164. package/styles/material-dark-lite.scss +13 -0
  165. package/styles/material-dark.css +153 -108
  166. package/styles/material-dark.scss +1 -0
  167. package/styles/material-lite.css +769 -0
  168. package/styles/material-lite.scss +13 -0
  169. package/styles/material.css +159 -114
  170. package/styles/material.scss +1 -0
  171. package/styles/material3-dark-lite.css +799 -0
  172. package/styles/material3-dark-lite.scss +13 -0
  173. package/styles/material3-dark.css +171 -123
  174. package/styles/material3-dark.scss +1 -0
  175. package/styles/material3-lite.css +801 -0
  176. package/styles/material3-lite.scss +13 -0
  177. package/styles/material3.css +171 -123
  178. package/styles/material3.scss +1 -0
  179. package/styles/tailwind-dark-lite.css +751 -0
  180. package/styles/tailwind-dark-lite.scss +13 -0
  181. package/styles/tailwind-dark.css +154 -116
  182. package/styles/tailwind-dark.scss +1 -0
  183. package/styles/tailwind-lite.css +751 -0
  184. package/styles/tailwind-lite.scss +13 -0
  185. package/styles/tailwind.css +154 -116
  186. package/styles/tailwind.scss +1 -0
@@ -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,103 @@ 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
+ strokeSettings.strokeColor = strokeColor ? strokeColor : strokeSettings.strokeColor;
408
+ strokeSettings.fillColor = fillColor ? fillColor : strokeSettings.fillColor;
409
+ strokeSettings.radius = radius ? radius : strokeSettings.radius;
410
+ var tempWidth = parent.img.destWidth > 100 ? 100 : parent.img.destWidth / 2;
411
+ var tempHeight = parent.img.destHeight > 100 ? 100 : parent.img.destHeight / 2;
412
+ parent.activeObj.activePoint.width = tempWidth;
413
+ parent.activeObj.activePoint.height = tempHeight;
414
+ if (type === 'line' || type === 'arrow') {
415
+ parent.activeObj.lineDraw = 'horizontal';
416
+ parent.activeObj.activePoint.height = 0;
435
417
  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 } });
418
+ parent.activeObj.activePoint.width += 50;
419
+ parent.activeObj.start = this.getArrowType(arrowStart);
420
+ parent.activeObj.end = this.getArrowType(arrowEnd);
452
421
  }
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 } });
422
+ }
423
+ else if (type === 'rectangle') {
424
+ parent.activeObj.activePoint.width += parent.activeObj.activePoint.width / 2;
425
+ }
426
+ else if (type === 'redact') {
427
+ if (redactType) {
428
+ parent.activeObj.redactType = redactType.toLowerCase();
429
+ if (redactType === RedactType.Blur) {
430
+ if (value) {
431
+ parent.activeObj.redactBlur = value;
432
+ }
433
+ }
434
+ else {
435
+ if (value) {
436
+ parent.activeObj.redactPixelate = value;
437
+ }
438
+ }
439
+ parent.activeObj.redactImage = parent.createElement('canvas');
440
+ }
441
+ }
442
+ this.setDimension(width, height);
443
+ if (start) {
444
+ parent.activeObj.activePoint.startX = start.x;
445
+ parent.activeObj.activePoint.startY = start.y;
446
+ parent.activeObj.activePoint.endX = parent.activeObj.activePoint.startX +
447
+ parent.activeObj.activePoint.width;
448
+ parent.activeObj.activePoint.endY = parent.activeObj.activePoint.startY +
449
+ parent.activeObj.activePoint.height;
450
+ }
451
+ else {
452
+ this.setCenterPoints();
453
+ }
454
+ this.setPointCollForLineAndArrow();
455
+ if (type === 'arrow') {
456
+ parent.activeObj.triangleDirection = 'right';
457
+ }
458
+ parent.currObjType.isDragging = parent.currObjType.isCustomCrop = false;
459
+ this.initShapeProps();
460
+ var obj = { shapeSettingsObj: {} };
461
+ parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
462
+ var shapeSettings = obj['shapeSettingsObj'];
463
+ var shapeChangingArgs = { cancel: false, action: 'insert', previousShapeSettings: shapeSettings,
464
+ currentShapeSettings: shapeSettings };
465
+ parent.trigger('shapeChanging', shapeChangingArgs);
466
+ parent.editCompleteArgs = shapeChangingArgs;
467
+ this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings, shapeChangingArgs.allowShapeOverflow);
468
+ this.setDimension(width, height);
469
+ parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
470
+ if (degree) {
471
+ parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
472
+ parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
473
+ }
474
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
475
+ parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
476
+ parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
477
+ if (type === 'redact') {
478
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'redact',
479
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
480
+ }
481
+ else {
456
482
  parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
457
483
  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
484
  }
485
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
486
+ if (parent.isPublicMethod && !isSelected) {
487
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
488
+ }
489
+ parent.isPublicMethod = false;
464
490
  }
465
491
  }
466
492
  };
@@ -501,7 +527,7 @@ var Shape = /** @class */ (function () {
501
527
  value: { obj: selPointCollObj } });
502
528
  this.prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
503
529
  };
504
- Shape.prototype.drawShapeText = function (text, fontFamily, fontSize, bold, italic, strokeColor, x, y, isSelected, degree) {
530
+ Shape.prototype.drawShapeText = function (text, fontFamily, fontSize, bold, italic, strokeColor, x, y, isSelected, degree, fillColor, outlineColor, outlineWidth) {
505
531
  var parent = this.parent;
506
532
  if (!parent.disabled && parent.isImageLoaded) {
507
533
  if (parent.currObjType.shape === 'freehanddraw') {
@@ -516,7 +542,7 @@ var Shape = /** @class */ (function () {
516
542
  this.refreshActiveObj();
517
543
  parent.activeObj.shape = parent.currObjType.shape = 'text';
518
544
  parent.currObjType.isCustomCrop = false;
519
- this.initializeTextShape(text, fontFamily, fontSize, bold, italic, strokeColor);
545
+ this.initializeTextShape(text, fontFamily, fontSize, bold, italic, strokeColor, fillColor, outlineColor, outlineWidth);
520
546
  parent.currObjType.isText = parent.currObjType.isInitialText = true;
521
547
  if (isNullOrUndefined(parent.activeObj.textSettings.fontSize)) {
522
548
  parent.getFontSizes();
@@ -535,7 +561,7 @@ var Shape = /** @class */ (function () {
535
561
  parent.activeObj.order = this.getNewOrder();
536
562
  var width = this.upperContext.measureText(parent.activeObj.textSettings.text).width +
537
563
  parent.activeObj.textSettings.fontSize * 0.5;
538
- var height = parent.activeObj.textSettings.fontSize + parent.activeObj.textSettings.fontSize * 0.25;
564
+ var height = parent.activeObj.textSettings.fontSize;
539
565
  if (!isNullOrUndefined(x) && !isNullOrUndefined(y)) {
540
566
  parent.activeObj.activePoint.startX = x;
541
567
  parent.activeObj.activePoint.startY = y;
@@ -551,6 +577,7 @@ var Shape = /** @class */ (function () {
551
577
  var shapeChangingArgs = { cancel: false, action: 'insert', previousShapeSettings: shapeSettings,
552
578
  currentShapeSettings: shapeSettings };
553
579
  parent.trigger('shapeChanging', shapeChangingArgs);
580
+ parent.editCompleteArgs = shapeChangingArgs;
554
581
  this.drawShapeTextEvent(shapeChangingArgs);
555
582
  if (degree) {
556
583
  parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
@@ -579,7 +606,7 @@ var Shape = /** @class */ (function () {
579
606
  };
580
607
  Shape.prototype.drawShapeImageEvent = function (shapeChangingArgs, isSelect) {
581
608
  var parent = this.parent;
582
- this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
609
+ this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings, shapeChangingArgs.allowShapeOverflow);
583
610
  parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
584
611
  parent.objColl.push(parent.activeObj);
585
612
  var prevCropObj = extend({}, parent.cropObj, {}, true);
@@ -602,7 +629,7 @@ var Shape = /** @class */ (function () {
602
629
  };
603
630
  Shape.prototype.drawShapeTextEvent = function (shapeChangingArgs) {
604
631
  var parent = this.parent;
605
- this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
632
+ this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings, shapeChangingArgs.allowShapeOverflow);
606
633
  this.addLetter(parent.activeObj.textSettings.text);
607
634
  parent.activeObj.textFlip = parent.transform.currFlipState;
608
635
  this.updateFontRatio(parent.activeObj);
@@ -620,22 +647,19 @@ var Shape = /** @class */ (function () {
620
647
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
621
648
  parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
622
649
  };
623
- Shape.prototype.initializeTextShape = function (text, fontFamily, fontSize, bold, italic, strokeColor) {
650
+ Shape.prototype.initializeTextShape = function (text, fontFamily, fontSize, bold, italic, strokeColor, fillColor, outlineColor, outlineWidth) {
624
651
  var parent = this.parent;
625
652
  this.keyHistory = '';
626
653
  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
654
  parent.activeObj.strokeSettings.strokeColor = strokeColor || parent.activeObj.strokeSettings.strokeColor;
655
+ parent.activeObj.strokeSettings.fillColor = fillColor || parent.activeObj.strokeSettings.fillColor;
634
656
  parent.activeObj.textSettings.text = text || parent.activeObj.textSettings.text;
635
657
  parent.activeObj.textSettings.fontFamily = fontFamily || parent.activeObj.textSettings.fontFamily;
636
658
  parent.activeObj.textSettings.fontSize = fontSize || parent.activeObj.textSettings.fontSize;
637
659
  parent.activeObj.textSettings.bold = bold || parent.activeObj.textSettings.bold;
638
660
  parent.activeObj.textSettings.italic = italic || parent.activeObj.textSettings.italic;
661
+ parent.activeObj.strokeSettings.outlineColor = outlineColor || parent.activeObj.strokeSettings.outlineColor;
662
+ parent.activeObj.strokeSettings.outlineWidth = outlineWidth || parent.activeObj.strokeSettings.outlineWidth;
639
663
  };
640
664
  Shape.prototype.drawImage = function (x, y, width, height, src, degree, isAspectRatio, opacity, isSelected) {
641
665
  this.initializeShape('image');
@@ -743,7 +767,7 @@ var Shape = /** @class */ (function () {
743
767
  parent.activeObj.activePoint.endX = parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width;
744
768
  parent.activeObj.activePoint.endY = parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height;
745
769
  };
746
- Shape.prototype.updateShapeChangeEventArgs = function (shapeSettings) {
770
+ Shape.prototype.updateShapeChangeEventArgs = function (shapeSettings, allowShapeOverflow) {
747
771
  var parent = this.parent;
748
772
  var shapeId;
749
773
  if (shapeSettings.id && shapeSettings.id.indexOf('shape_') === -1 &&
@@ -777,6 +801,7 @@ var Shape = /** @class */ (function () {
777
801
  parent.activeObj.strokeSettings.strokeWidth = shapeSettings.strokeWidth;
778
802
  parent.activeObj.opacity = shapeSettings.opacity;
779
803
  parent.activeObj.order = shapeSettings.index;
804
+ parent.activeObj.preventShapeDragOut = !allowShapeOverflow;
780
805
  if (isNullOrUndefined(shapeSettings.degree)) {
781
806
  shapeSettings.degree = 0;
782
807
  }
@@ -835,9 +860,6 @@ var Shape = /** @class */ (function () {
835
860
  case 'italic':
836
861
  parent.activeObj.textSettings.italic = true;
837
862
  break;
838
- case 'underline':
839
- parent.activeObj.textSettings.underline = true;
840
- break;
841
863
  }
842
864
  }
843
865
  }
@@ -856,7 +878,7 @@ var Shape = /** @class */ (function () {
856
878
  this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
857
879
  this.updateFontStyles();
858
880
  var width = this.upperContext.measureText(this.keyHistory).width + fontSize * 0.5;
859
- var height = fontSize + fontSize * 0.25;
881
+ var height = fontSize;
860
882
  this.upperContext.fillText(this.keyHistory, parent.activeObj.activePoint.startX, parent.activeObj.activePoint.startY + fontSize);
861
883
  this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
862
884
  parent.currObjType.isText = true;
@@ -879,7 +901,10 @@ var Shape = /** @class */ (function () {
879
901
  var text = (parent.textArea.style.display === 'block' || parent.textArea.style.display === 'inline-block') ?
880
902
  this.getMaxText(true) : this.getMaxText();
881
903
  var width = this.upperContext.measureText(text).width + fontSize * 0.5;
882
- var height = rows.length * (fontSize + fontSize * 0.25);
904
+ var height = rows.length * fontSize;
905
+ if (rows.length > 1) {
906
+ height += (fontSize * 0.50);
907
+ }
883
908
  parent.notify('selection', { prop: 'setTextSelection', onPropertyChange: false,
884
909
  value: { width: width, height: height } });
885
910
  parent.notify('draw', { prop: 'updateActiveObject', onPropertyChange: false, value: { actPoint: parent.activeObj.activePoint, obj: parent.activeObj,
@@ -911,10 +936,11 @@ var Shape = /** @class */ (function () {
911
936
  parent.textArea.value = '';
912
937
  this.updateFontStyles();
913
938
  var width = this.upperContext.measureText(parent.activeObj.keyHistory).width + fontSize * 0.5;
914
- var height = fontSize + fontSize * 0.25;
939
+ var height = fontSize;
915
940
  var rows = parent.activeObj.keyHistory.split('\n');
916
941
  if (rows.length > 1) {
917
942
  height *= rows.length;
943
+ height += (fontSize * 0.1 * rows.length);
918
944
  var widthColl = [];
919
945
  for (var i = 0, len = rows.length; i < len; i++) {
920
946
  widthColl.push(this.upperContext.measureText(rows[i]).width + fontSize * 0.5);
@@ -978,6 +1004,14 @@ var Shape = /** @class */ (function () {
978
1004
  }
979
1005
  if (currentObj.order === index) {
980
1006
  this.apply(currentObj.shape, currentObj);
1007
+ if (currentObj.shape === 'redact' && JSON.stringify(currentObj.activePoint) === JSON.stringify(parent.activeObj.activePoint) &&
1008
+ currentObj.redactImage !== parent.activeObj.redactImage) {
1009
+ currentObj.redactImage = parent.activeObj.redactImage;
1010
+ if (parent.objColl[i] && JSON.stringify(parent.objColl[i].activePoint) ===
1011
+ JSON.stringify(currentObj.activePoint)) {
1012
+ parent.objColl[i].redactImage = parent.activeObj.redactImage;
1013
+ }
1014
+ }
981
1015
  this.refreshActiveObj();
982
1016
  index++;
983
1017
  if (!this.isIndexInObjColl(index)) {
@@ -1146,12 +1180,14 @@ var Shape = /** @class */ (function () {
1146
1180
  var selPointCollObj = { selPointColl: null };
1147
1181
  parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false, value: { obj: selPointCollObj } });
1148
1182
  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;
1183
+ if (selPointCollObj['selPointColl'][i] && selPointCollObj['selPointColl'][i].points) {
1184
+ var len = selPointCollObj['selPointColl'][i].points.length;
1185
+ var point = void 0;
1186
+ for (var l = 0; l < len; l++) {
1187
+ point = this.straightenPoints(selPointCollObj['selPointColl'][i].points[l].x, selPointCollObj['selPointColl'][i].points[l].y);
1188
+ selPointCollObj['selPointColl'][i].points[l].x = point.x;
1189
+ selPointCollObj['selPointColl'][i].points[l].y = point.y;
1190
+ }
1155
1191
  }
1156
1192
  }
1157
1193
  var straightenObj = { straightenPoint: null };
@@ -1592,17 +1628,26 @@ var Shape = /** @class */ (function () {
1592
1628
  var dupElem = parent.element.querySelector('#' + parent.element.id + '_duplicate');
1593
1629
  var removeElem = parent.element.querySelector('#' + parent.element.id + '_remove');
1594
1630
  var editTextElem = parent.element.querySelector('#' + parent.element.id + '_editText');
1631
+ var shadowColor = actObj.strokeSettings.outlineColor;
1632
+ var outlineWidth = actObj.strokeSettings.outlineWidth;
1633
+ var shadows = [];
1595
1634
  if (zOrderElem) {
1596
- zOrderElem.classList.add('e-disabled');
1635
+ zOrderElem.classList.add('e-overlay');
1597
1636
  }
1598
1637
  if (dupElem) {
1599
- dupElem.classList.add('e-disabled');
1638
+ dupElem.classList.add('e-overlay');
1600
1639
  }
1601
1640
  if (removeElem) {
1602
- removeElem.classList.add('e-disabled');
1641
+ removeElem.classList.add('e-overlay');
1603
1642
  }
1604
1643
  if (editTextElem) {
1605
- editTextElem.classList.add('e-disabled');
1644
+ editTextElem.classList.add('e-overlay');
1645
+ }
1646
+ if (actObj.strokeSettings.fillColor !== '') {
1647
+ parent.textArea.style.backgroundColor = actObj.strokeSettings.fillColor;
1648
+ }
1649
+ else {
1650
+ parent.textArea.style.backgroundColor = 'transparent';
1606
1651
  }
1607
1652
  parent.textArea.style.display = 'block';
1608
1653
  parent.textArea.style.left = x + 'px';
@@ -1610,6 +1655,22 @@ var Shape = /** @class */ (function () {
1610
1655
  parent.textArea.style.fontFamily = actObj.textSettings.fontFamily;
1611
1656
  parent.textArea.style.fontSize = actObj.textSettings.fontSize + 'px';
1612
1657
  parent.textArea.style.color = actObj.strokeSettings.strokeColor;
1658
+ var fontSize = actObj.textSettings.fontSize;
1659
+ var baseWidth = Math.max(1, outlineWidth / 2);
1660
+ var adjustedOutlineWidth = baseWidth * (Math.floor((fontSize - 1) / 16) * 0.5 + 0.5);
1661
+ if (/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$|^[a-zA-Z]+$/.test(actObj.strokeSettings.outlineColor)) {
1662
+ for (var x_1 = -adjustedOutlineWidth; x_1 <= adjustedOutlineWidth; x_1++) {
1663
+ for (var y_1 = -adjustedOutlineWidth; y_1 <= adjustedOutlineWidth; y_1++) {
1664
+ if (x_1 !== 0 || y_1 !== 0) {
1665
+ shadows.push(x_1 / 2 + "px " + y_1 / 2 + "px 0 " + shadowColor);
1666
+ }
1667
+ }
1668
+ }
1669
+ parent.textArea.style.textShadow = shadows.join(', ');
1670
+ }
1671
+ else {
1672
+ parent.textArea.style.textShadow = null;
1673
+ }
1613
1674
  parent.textArea.style.fontWeight = actObj.textSettings.bold ? 'bold' : 'normal';
1614
1675
  parent.textArea.style.fontStyle = actObj.textSettings.italic ? 'italic' : 'normal';
1615
1676
  parent.textArea.style.border = '2px solid ' + parent.themeColl[parent.theme]['primaryColor'];
@@ -1618,15 +1679,14 @@ var Shape = /** @class */ (function () {
1618
1679
  parent.textArea.style.width = 'auto';
1619
1680
  parent.textArea.style.height = 'auto';
1620
1681
  parent.textArea.focus();
1621
- var zoomFactor = parent.transform.zoomFactor;
1622
1682
  var _a = actObj.activePoint, width = _a.width, height = _a.height;
1623
1683
  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';
1684
+ parent.textArea.style.width = height + (height * 0.25) + 'px';
1685
+ parent.textArea.style.height = width + (width * 0.25) + 'px';
1626
1686
  }
1627
1687
  else {
1628
- parent.textArea.style.width = (zoomFactor === 0 ? width : width) + 'px';
1629
- parent.textArea.style.height = (zoomFactor === 0 ? height : height) + 'px';
1688
+ parent.textArea.style.width = width + (width * 0.25) + 'px';
1689
+ parent.textArea.style.height = height + (height * 0.25) + 'px';
1630
1690
  }
1631
1691
  this.setTextBoxWidth();
1632
1692
  var obj = { flipColl: null };
@@ -1902,11 +1962,22 @@ var Shape = /** @class */ (function () {
1902
1962
  parent.notify('selection', { prop: 'mouseUpEventHandler', value: { e: e } });
1903
1963
  this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
1904
1964
  parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
1965
+ if (parent.objColl.length > 0) {
1966
+ var obj1 = parent.activeObj.activePoint;
1967
+ var obj2 = parent.objColl[parent.objColl.length - 1].activePoint;
1968
+ if (Math.floor(obj1.startX) === Math.floor(obj2.startX) &&
1969
+ Math.floor(obj1.startY) === Math.floor(obj2.startY) &&
1970
+ Math.floor(obj1.endX) === Math.floor(obj2.endX) &&
1971
+ Math.floor(obj1.endY) === Math.floor(obj2.endY)) {
1972
+ this.refreshActiveObj();
1973
+ }
1974
+ }
1905
1975
  }
1906
1976
  parent.notify('draw', { prop: 'setNewPath', value: { bool: true } });
1907
1977
  if (parent.objColl[parent.objColl.length - 1]) {
1908
1978
  var shape = parent.drawingShape;
1909
1979
  parent.notify('selection', { prop: 'setCurrentDrawingShape', value: { value: '' } });
1980
+ parent.noRedact = true;
1910
1981
  parent.selectShape(parent.objColl[parent.objColl.length - 1].currIndex);
1911
1982
  parent.notify('selection', { prop: 'setCurrentDrawingShape', value: { value: 'path' } });
1912
1983
  parent.drawingShape = shape;
@@ -1925,12 +1996,16 @@ var Shape = /** @class */ (function () {
1925
1996
  };
1926
1997
  Shape.prototype.findTextTarget = function (e) {
1927
1998
  var parent = this.parent;
1999
+ if (!e) {
2000
+ return;
2001
+ }
1928
2002
  if (parent.activeObj.shape !== 'text') {
1929
2003
  if (parent.activeObj.shape === 'path') {
1930
2004
  this.stopPathDrawing(e, null);
1931
2005
  return;
1932
2006
  }
1933
2007
  else if (e.type === 'dblclick') {
2008
+ parent.notify('selection', { prop: 'setPanDown', onPropertyChange: false, value: { panDown: null } });
1934
2009
  var activeObj = extend({}, parent.activeObj, {}, true);
1935
2010
  var objColl = extend([], parent.objColl, [], true);
1936
2011
  var obj = { bool: null };
@@ -2143,7 +2218,7 @@ var Shape = /** @class */ (function () {
2143
2218
  var filesData = e.target.files[0];
2144
2219
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2145
2220
  var fileData = filesData;
2146
- var fileExtension = fileData.name && fileData.name.split('.')[1].toLowerCase();
2221
+ var fileExtension = fileData.name && fileData.name.split('.').pop().toLowerCase();
2147
2222
  if (fileExtension && ['jpg', 'jpeg', 'png', 'svg'].indexOf(fileExtension) === -1) {
2148
2223
  this.refreshActiveObj();
2149
2224
  return;
@@ -2225,6 +2300,7 @@ var Shape = /** @class */ (function () {
2225
2300
  var shapeChangingArgs = { cancel: false, action: 'insert', previousShapeSettings: shapeSettings,
2226
2301
  currentShapeSettings: shapeSettings };
2227
2302
  parent.trigger('shapeChanging', shapeChangingArgs);
2303
+ parent.editCompleteArgs = shapeChangingArgs;
2228
2304
  isSelect = isSelect ? isSelect : isSelected;
2229
2305
  this.drawShapeImageEvent(shapeChangingArgs, isSelect);
2230
2306
  if (parent.isPublicMethod && !isSelected) {
@@ -2516,6 +2592,7 @@ var Shape = /** @class */ (function () {
2516
2592
  var shapeChangedArgs = { action: 'font-style', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2517
2593
  shapeChangedArgs.currentShapeSettings.fontStyle = [item];
2518
2594
  parent.trigger('shapeChange', shapeChangedArgs);
2595
+ parent.editCompleteArgs = shapeChangedArgs;
2519
2596
  };
2520
2597
  Shape.prototype.updateFontStyle = function (item, objColl, fontWeight, fontStyle) {
2521
2598
  var parent = this.parent;
@@ -2595,7 +2672,7 @@ var Shape = /** @class */ (function () {
2595
2672
  var text = this.getMaxText(isTextArea);
2596
2673
  var width = this.upperContext.measureText(text).width +
2597
2674
  parent.activeObj.textSettings.fontSize * 0.5;
2598
- var height = (parent.activeObj.textSettings.fontSize + parent.activeObj.textSettings.fontSize * 0.25);
2675
+ var height = parent.activeObj.textSettings.fontSize;
2599
2676
  var degree = this.getRotDegOfShape(obj);
2600
2677
  if (isNullOrUndefined(isTextArea)) {
2601
2678
  if (degree === 0 || Math.abs(degree) === 180) {
@@ -2696,6 +2773,9 @@ var Shape = /** @class */ (function () {
2696
2773
  parent.activeObj.textSettings = this.textSettings;
2697
2774
  parent.activeObj.rotatedAngle = 0;
2698
2775
  parent.activeObj.opacity = 1;
2776
+ parent.activeObj.redactType = this.redactType;
2777
+ parent.activeObj.redactBlur = parent.tempRedactBlur;
2778
+ parent.activeObj.redactPixelate = parent.tempRedactPixel;
2699
2779
  };
2700
2780
  Shape.prototype.applyActObj = function (isMouseDown) {
2701
2781
  var parent = this.parent;
@@ -2884,6 +2964,25 @@ var Shape = /** @class */ (function () {
2884
2964
  parent.activeObj.textSettings.italic = tempItalic;
2885
2965
  return width;
2886
2966
  };
2967
+ Shape.prototype.getRedactObjDetails = function (obj) {
2968
+ var parent = this.parent;
2969
+ var redactDetails = {};
2970
+ redactDetails.id = obj.currIndex;
2971
+ redactDetails.type = parent.toPascalCase(obj.redactType);
2972
+ redactDetails.startX = obj.activePoint.startX;
2973
+ redactDetails.startY = obj.activePoint.startY;
2974
+ redactDetails.width = obj.activePoint.width;
2975
+ redactDetails.height = obj.activePoint.height;
2976
+ switch (obj.redactType) {
2977
+ case 'blur':
2978
+ redactDetails.blurIntensity = obj.redactBlur;
2979
+ break;
2980
+ case 'pixelate':
2981
+ redactDetails.pixelSize = obj.redactPixelate;
2982
+ break;
2983
+ }
2984
+ return redactDetails;
2985
+ };
2887
2986
  Shape.prototype.getObjDetails = function (obj) {
2888
2987
  var parent = this.parent;
2889
2988
  var shapeDetails = {};
@@ -3012,6 +3111,23 @@ var Shape = /** @class */ (function () {
3012
3111
  }
3013
3112
  obj['shapeDetailsColl'] = shapeDetailsColl;
3014
3113
  };
3114
+ Shape.prototype.getRedactSettings = function (obj) {
3115
+ var parent = this.parent;
3116
+ var RedactDetailsColl = [];
3117
+ if (!parent.disabled && parent.isImageLoaded) {
3118
+ if (parent.textArea.style.display !== 'none') {
3119
+ parent.okBtn(null, true);
3120
+ }
3121
+ else {
3122
+ this.applyActObj(true);
3123
+ }
3124
+ for (var i = 0, len = parent.objColl.length; i < len; i++) {
3125
+ var redactDetails = this.getRedactObjDetails(parent.objColl[i]);
3126
+ RedactDetailsColl.push(redactDetails);
3127
+ }
3128
+ }
3129
+ obj['shapeDetailsColl'] = RedactDetailsColl;
3130
+ };
3015
3131
  Shape.prototype.isPointsInRange = function (x, y, obj) {
3016
3132
  var inRange = false;
3017
3133
  var parent = this.parent;
@@ -3158,6 +3274,10 @@ var Shape = /** @class */ (function () {
3158
3274
  parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
3159
3275
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
3160
3276
  }
3277
+ else if (parent.activeObj.shape === 'redact') {
3278
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'redact',
3279
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
3280
+ }
3161
3281
  else {
3162
3282
  parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
3163
3283
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
@@ -3554,11 +3674,20 @@ var Shape = /** @class */ (function () {
3554
3674
  break;
3555
3675
  }
3556
3676
  };
3677
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3678
+ Shape.prototype.reorderRedact = function (tempObjColl) {
3679
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3680
+ var nonRedact = tempObjColl.filter(function (item) { return item.shape !== 'redact'; });
3681
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3682
+ var redact = tempObjColl.filter(function (item) { return item.shape === 'redact'; });
3683
+ return redact.concat(nonRedact);
3684
+ };
3557
3685
  Shape.prototype.updateShapeColl = function () {
3558
3686
  var parent = this.parent;
3559
3687
  var isOrdered = false;
3560
3688
  var tempOrder = 1;
3561
3689
  var tempObjColl = extend([], parent.objColl, [], true);
3690
+ tempObjColl = this.reorderRedact(tempObjColl);
3562
3691
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3563
3692
  var tempPointColl = extend([], parent.pointColl, [], true);
3564
3693
  if (parent.shapeColl.length > 0 &&
@@ -3660,9 +3789,16 @@ var Shape = /** @class */ (function () {
3660
3789
  var tempObjColl = extend([], parent.objColl, [], true);
3661
3790
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3662
3791
  var tempPointColl = extend([], parent.pointColl, [], true);
3792
+ var tempSelPointCollObj = { selPointColl: null };
3793
+ parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
3794
+ value: { obj: tempSelPointCollObj } });
3795
+ var selPointCollObj = { selPointColl: null };
3796
+ parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
3797
+ value: { obj: selPointCollObj } });
3663
3798
  this.updateShapeColl();
3664
3799
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3665
3800
  var tempShapeColl = extend([], parent.shapeColl, [], true);
3801
+ tempShapeColl = this.reorderRedact(tempShapeColl);
3666
3802
  var isPrevented = false;
3667
3803
  if (!this.preventFrameAnnotation) {
3668
3804
  this.preventFrameAnnotation = isPrevented = true;
@@ -3703,7 +3839,10 @@ var Shape = /** @class */ (function () {
3703
3839
  else if (tempShapeColl[i].id && tempShapeColl[i].id.indexOf('pen') > -1) {
3704
3840
  parent.pointColl = [];
3705
3841
  parent.freehandCounter = 0;
3842
+ parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false, value: { obj: { selPointColl: [] } } });
3706
3843
  parent.pointColl.push(extend({}, tempShapeColl[i], {}, true));
3844
+ parent.notify('freehand-draw', { prop: 'pushSelPointColl', onPropertyChange: false,
3845
+ value: { obj: { selPointColl: selPointCollObj['selPointColl'][i] } } });
3707
3846
  parent.freehandCounter = parent.pointColl.length;
3708
3847
  if (pen === 'iterate') {
3709
3848
  parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
@@ -3724,6 +3863,12 @@ var Shape = /** @class */ (function () {
3724
3863
  break;
3725
3864
  }
3726
3865
  }
3866
+ for (var i_5 = 0, len = tempSelPointCollObj['selPointColl'].length; i_5 < len; i_5++) {
3867
+ if (tempSelPointCollObj['selPointColl'][i_5].id === selPointCollObj['selPointColl'][i_5].id) {
3868
+ tempSelPointCollObj['selPointColl'][i_5] = extend({}, selPointCollObj['selPointColl'][i_5], {}, true);
3869
+ break;
3870
+ }
3871
+ }
3727
3872
  }
3728
3873
  }
3729
3874
  }
@@ -3740,6 +3885,7 @@ var Shape = /** @class */ (function () {
3740
3885
  parent.objColl = tempObjColl;
3741
3886
  parent.pointColl = tempPointColl;
3742
3887
  parent.freehandCounter = parent.pointColl.length;
3888
+ parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false, value: { obj: { selPointColl: tempSelPointCollObj['selPointColl'] } } });
3743
3889
  if (isPrevented && this.preventFrameAnnotation) {
3744
3890
  parent.notify('draw', { prop: 'applyFrame', value: { ctx: this.lowerContext, frame: parent.frameObj.type, preventImg: true } });
3745
3891
  this.preventFrameAnnotation = false;