@syncfusion/ej2-image-editor 25.2.4 → 26.1.35

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 (128) hide show
  1. package/.eslintrc.json +3 -2
  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 +2679 -830
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +2762 -873
  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 -12
  12. package/src/image-editor/action/crop.d.ts +0 -1
  13. package/src/image-editor/action/crop.js +35 -77
  14. package/src/image-editor/action/draw.d.ts +3 -0
  15. package/src/image-editor/action/draw.js +190 -81
  16. package/src/image-editor/action/export.d.ts +3 -0
  17. package/src/image-editor/action/export.js +99 -41
  18. package/src/image-editor/action/filter.d.ts +0 -1
  19. package/src/image-editor/action/filter.js +4 -24
  20. package/src/image-editor/action/freehand-draw.js +30 -8
  21. package/src/image-editor/action/selection.d.ts +10 -0
  22. package/src/image-editor/action/selection.js +444 -99
  23. package/src/image-editor/action/shape.d.ts +11 -1
  24. package/src/image-editor/action/shape.js +520 -127
  25. package/src/image-editor/action/transform.d.ts +0 -1
  26. package/src/image-editor/action/transform.js +53 -69
  27. package/src/image-editor/action/undo-redo.d.ts +2 -0
  28. package/src/image-editor/action/undo-redo.js +114 -29
  29. package/src/image-editor/base/enum.d.ts +5 -1
  30. package/src/image-editor/base/enum.js +4 -0
  31. package/src/image-editor/base/image-editor-model.d.ts +8 -6
  32. package/src/image-editor/base/image-editor.d.ts +116 -7
  33. package/src/image-editor/base/image-editor.js +378 -52
  34. package/src/image-editor/base/interface.d.ts +17 -0
  35. package/src/image-editor/base/interface.js +0 -1
  36. package/src/image-editor/renderer/toolbar.d.ts +14 -1
  37. package/src/image-editor/renderer/toolbar.js +831 -191
  38. package/styles/bootstrap-dark.css +279 -97
  39. package/styles/bootstrap-dark.scss +13 -1
  40. package/styles/bootstrap.css +282 -98
  41. package/styles/bootstrap.scss +13 -1
  42. package/styles/bootstrap4.css +280 -97
  43. package/styles/bootstrap4.scss +13 -1
  44. package/styles/bootstrap5-dark.css +280 -101
  45. package/styles/bootstrap5-dark.scss +13 -1
  46. package/styles/bootstrap5.css +280 -101
  47. package/styles/bootstrap5.scss +13 -1
  48. package/styles/fabric-dark.css +281 -97
  49. package/styles/fabric-dark.scss +13 -1
  50. package/styles/fabric.css +284 -97
  51. package/styles/fabric.scss +13 -1
  52. package/styles/fluent-dark.css +287 -101
  53. package/styles/fluent-dark.scss +13 -1
  54. package/styles/fluent.css +287 -101
  55. package/styles/fluent.scss +13 -1
  56. package/styles/fluent2.css +1851 -0
  57. package/styles/fluent2.scss +13 -0
  58. package/styles/highcontrast-light.css +279 -97
  59. package/styles/highcontrast-light.scss +13 -1
  60. package/styles/highcontrast.css +284 -97
  61. package/styles/highcontrast.scss +13 -1
  62. package/styles/image-editor/_bds-definition.scss +5 -0
  63. package/styles/image-editor/_bootstrap-dark-definition.scss +5 -0
  64. package/styles/image-editor/_bootstrap-definition.scss +5 -0
  65. package/styles/image-editor/_bootstrap4-definition.scss +5 -0
  66. package/styles/image-editor/_bootstrap5-definition.scss +5 -0
  67. package/styles/image-editor/_bootstrap5.3-definition.scss +26 -0
  68. package/styles/image-editor/_fabric-dark-definition.scss +5 -0
  69. package/styles/image-editor/_fabric-definition.scss +5 -0
  70. package/styles/image-editor/_fluent-definition.scss +5 -0
  71. package/styles/image-editor/_fluent2-definition.scss +26 -0
  72. package/styles/image-editor/_fusionnew-definition.scss +5 -0
  73. package/styles/image-editor/_highcontrast-definition.scss +5 -0
  74. package/styles/image-editor/_highcontrast-light-definition.scss +5 -0
  75. package/styles/image-editor/_layout.scss +352 -13
  76. package/styles/image-editor/_material-dark-definition.scss +5 -0
  77. package/styles/image-editor/_material-definition.scss +5 -0
  78. package/styles/image-editor/_material3-definition.scss +5 -0
  79. package/styles/image-editor/_tailwind-definition.scss +5 -0
  80. package/styles/image-editor/bootstrap-dark.css +279 -97
  81. package/styles/image-editor/bootstrap.css +282 -98
  82. package/styles/image-editor/bootstrap4.css +280 -97
  83. package/styles/image-editor/bootstrap5-dark.css +280 -101
  84. package/styles/image-editor/bootstrap5.css +280 -101
  85. package/styles/image-editor/fabric-dark.css +281 -97
  86. package/styles/image-editor/fabric.css +284 -97
  87. package/styles/image-editor/fluent-dark.css +287 -101
  88. package/styles/image-editor/fluent.css +287 -101
  89. package/styles/image-editor/fluent2.css +1851 -0
  90. package/styles/image-editor/fluent2.scss +13 -0
  91. package/styles/image-editor/highcontrast-light.css +279 -97
  92. package/styles/image-editor/highcontrast.css +284 -97
  93. package/styles/image-editor/icons/_bds.scss +1 -162
  94. package/styles/image-editor/icons/_bootstrap-dark.scss +1 -162
  95. package/styles/image-editor/icons/_bootstrap.scss +1 -162
  96. package/styles/image-editor/icons/_bootstrap4.scss +1 -162
  97. package/styles/image-editor/icons/_bootstrap5.3.scss +250 -0
  98. package/styles/image-editor/icons/_bootstrap5.scss +1 -168
  99. package/styles/image-editor/icons/_fabric-dark.scss +1 -162
  100. package/styles/image-editor/icons/_fabric.scss +1 -162
  101. package/styles/image-editor/icons/_fluent.scss +1 -168
  102. package/styles/image-editor/icons/_fluent2.scss +256 -0
  103. package/styles/image-editor/icons/_fusionnew.scss +1 -138
  104. package/styles/image-editor/icons/_highcontrast-light.scss +1 -162
  105. package/styles/image-editor/icons/_highcontrast.scss +1 -162
  106. package/styles/image-editor/icons/_material-dark.scss +2 -163
  107. package/styles/image-editor/icons/_material.scss +1 -162
  108. package/styles/image-editor/icons/_material3.scss +2 -169
  109. package/styles/image-editor/icons/_tailwind.scss +1 -162
  110. package/styles/image-editor/material-dark.css +299 -100
  111. package/styles/image-editor/material.css +302 -100
  112. package/styles/image-editor/material3-dark.css +314 -103
  113. package/styles/image-editor/material3.css +314 -103
  114. package/styles/image-editor/tailwind-dark.css +284 -97
  115. package/styles/image-editor/tailwind.css +284 -97
  116. package/styles/material-dark.css +299 -100
  117. package/styles/material-dark.scss +13 -1
  118. package/styles/material.css +302 -100
  119. package/styles/material.scss +13 -1
  120. package/styles/material3-dark.css +314 -103
  121. package/styles/material3-dark.scss +13 -1
  122. package/styles/material3.css +314 -103
  123. package/styles/material3.scss +13 -1
  124. package/styles/tailwind-dark.css +284 -97
  125. package/styles/tailwind-dark.scss +13 -1
  126. package/styles/tailwind.css +284 -97
  127. package/styles/tailwind.scss +13 -1
  128. package/CHANGELOG.md +0 -289
@@ -29,12 +29,11 @@ var Export = /** @class */ (function () {
29
29
  case 'exportToCanvas':
30
30
  this.exportToCanvas(args.value['object']);
31
31
  break;
32
- case 'drawAnnotation':
33
- this.drawAnnotation(args.value['context'], args.value['ratio']);
34
- break;
35
32
  case 'updateSaveContext':
36
33
  this.updateSaveContext(args.value['context']);
37
34
  break;
35
+ case 'setImageQuality':
36
+ this.imageQuality = args.value['value'];
38
37
  }
39
38
  };
40
39
  Export.prototype.getModuleName = function () {
@@ -138,14 +137,14 @@ var Export = /** @class */ (function () {
138
137
  showSpinner(parent.element);
139
138
  parent.element.style.opacity = '0.5';
140
139
  var tempCanvas = this.exportToCanvas();
141
- var imagetype = (type === 'jpeg') ? 'image/jpeg' : 'image/png';
140
+ var imagetype = type !== 'jpeg' ? 'image/png' : 'image/jpeg';
142
141
  // eslint-disable-next-line @typescript-eslint/tslint/config
143
142
  tempCanvas.toBlob(function (blob) {
144
143
  var blobUrl = URL.createObjectURL(blob);
145
144
  proxy.downloadImg(blobUrl, fileName + '.' + type);
146
145
  hideSpinner(parent.element);
147
146
  parent.element.style.opacity = '1';
148
- }, imagetype);
147
+ }, imagetype, this.imageQuality ? this.imageQuality : null);
149
148
  };
150
149
  Export.prototype.exportToCanvas = function (object) {
151
150
  var parent = this.parent;
@@ -243,8 +242,8 @@ var Export = /** @class */ (function () {
243
242
  parent.freehandCounter = parent.pointColl.length;
244
243
  parent.transform.straighten = 0;
245
244
  this.lowerContext.filter = 'none';
246
- parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
247
- parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
245
+ parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
246
+ value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: null } });
248
247
  this.lowerContext.filter = prevObj.filter;
249
248
  parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
250
249
  if (parent.isCircleCrop || (parent.currSelectionPoint && parent.currSelectionPoint.shape === 'crop-circle')) {
@@ -255,56 +254,115 @@ var Export = /** @class */ (function () {
255
254
  return tempCanvas;
256
255
  };
257
256
  Export.prototype.drawAnnotation = function (tempContext, ratio) {
257
+ var parent = this.parent;
258
+ var tempObjColl = extend([], parent.objColl, [], true);
259
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
260
+ var tempPointColl = extend([], parent.pointColl, [], true);
261
+ for (var i = 0; i < parent.shapeColl.length; i++) {
262
+ if (parent.shapeColl[i].order) {
263
+ if (parent.shapeColl[i].currIndex && parent.shapeColl[i].currIndex.indexOf('shape') > -1) {
264
+ parent.objColl = [];
265
+ parent.objColl.push(extend({}, parent.shapeColl[i], {}, true));
266
+ this.drawShape(tempContext, ratio);
267
+ }
268
+ else if (parent.shapeColl[i].id && parent.shapeColl[i].id.indexOf('pen') > -1) {
269
+ parent.pointColl = [];
270
+ parent.freehandCounter = 0;
271
+ parent.pointColl.push(extend({}, parent.shapeColl[i], {}, true));
272
+ parent.freehandCounter = parent.pointColl.length;
273
+ this.drawPen(tempContext, ratio);
274
+ }
275
+ }
276
+ }
277
+ parent.objColl = tempObjColl;
278
+ parent.pointColl = tempPointColl;
279
+ parent.freehandCounter = parent.pointColl.length;
280
+ };
281
+ Export.prototype.drawShape = function (tempContext, ratio) {
258
282
  var parent = this.parent;
259
283
  if (parent.objColl.length > 0) {
260
284
  var temp = tempContext.filter;
261
285
  tempContext.filter = 'none';
286
+ var indexObj = { index: null };
287
+ parent.notify('shape', { prop: 'getSmallestIndex', onPropertyChange: false, value: { obj: indexObj } });
288
+ var index = indexObj['index'];
289
+ var objColl = extend([], parent.objColl, [], true);
262
290
  var tempObjColl = extend([], parent.objColl, [], true);
263
- for (var i = 0, len = parent.objColl.length; i < len; i++) {
264
- var currObj = parent.objColl[i];
265
- var activePoint = currObj.activePoint;
266
- // Subtracting destination left and top points
267
- activePoint.startX -= parent.img.destLeft;
268
- activePoint.startY -= parent.img.destTop;
269
- activePoint.endX -= parent.img.destLeft;
270
- activePoint.endY -= parent.img.destTop;
271
- activePoint.width = activePoint.endX - activePoint.startX;
272
- activePoint.height = activePoint.endY - activePoint.startY;
273
- // Manipulating points
274
- activePoint.startX *= ratio.width;
275
- activePoint.startY *= ratio.height;
276
- activePoint.endX *= ratio.width;
277
- activePoint.endY *= ratio.height;
278
- activePoint.width = activePoint.endX - activePoint.startX;
279
- activePoint.height = activePoint.endY - activePoint.startY;
280
- currObj.strokeSettings.strokeWidth *= ((ratio.width + ratio.height) / 2);
281
- if (currObj.shape === 'text') {
282
- currObj.textSettings.fontSize *= ((ratio.width + ratio.height) / 2);
283
- }
284
- else if (currObj.shape === 'path') {
285
- for (var l = 0; l < currObj.pointColl.length; l++) {
286
- currObj.pointColl[l].x =
287
- (currObj.pointColl[l].x - parent.img.destLeft) * ratio.width;
288
- currObj.pointColl[l].y =
289
- (currObj.pointColl[l].y - parent.img.destTop) * ratio.height;
291
+ while (objColl.length > 0) {
292
+ var found = false;
293
+ for (var i = 0; i < objColl.length; i++) {
294
+ var currentObj = objColl[i];
295
+ if (isNullOrUndefined(currentObj.order)) {
296
+ objColl.splice(i, 1);
297
+ i--;
298
+ continue;
299
+ }
300
+ if (currentObj.order === index) {
301
+ var temp_1 = tempContext.filter;
302
+ tempContext.filter = 'none';
303
+ var currObj = objColl[i];
304
+ var activePoint = currObj.activePoint;
305
+ // Subtracting destination left and top points
306
+ activePoint.startX -= parent.img.destLeft;
307
+ activePoint.startY -= parent.img.destTop;
308
+ activePoint.endX -= parent.img.destLeft;
309
+ activePoint.endY -= parent.img.destTop;
310
+ activePoint.width = activePoint.endX - activePoint.startX;
311
+ activePoint.height = activePoint.endY - activePoint.startY;
312
+ // Manipulating points
313
+ activePoint.startX *= ratio.width;
314
+ activePoint.startY *= ratio.height;
315
+ activePoint.endX *= ratio.width;
316
+ activePoint.endY *= ratio.height;
317
+ activePoint.width = activePoint.endX - activePoint.startX;
318
+ activePoint.height = activePoint.endY - activePoint.startY;
319
+ currObj.strokeSettings.strokeWidth *= ((ratio.width + ratio.height) / 2);
320
+ if (currObj.shape === 'text') {
321
+ currObj.textSettings.fontSize *= ((ratio.width + ratio.height) / 2);
322
+ }
323
+ else if (currObj.shape === 'path') {
324
+ for (var l = 0; l < currObj.pointColl.length; l++) {
325
+ currObj.pointColl[l].x =
326
+ (currObj.pointColl[l].x - parent.img.destLeft) * ratio.width;
327
+ currObj.pointColl[l].y =
328
+ (currObj.pointColl[l].y - parent.img.destTop) * ratio.height;
329
+ }
330
+ }
331
+ else if (currObj.shape === 'image') {
332
+ parent.activeObj = extend({}, objColl[i], {}, true);
333
+ parent.notify('selection', { prop: 'upgradeImageQuality', onPropertyChange: false });
334
+ objColl[i] = extend({}, parent.activeObj, {}, true);
335
+ }
336
+ parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'saveContext', obj: objColl[i], isCropRatio: null,
337
+ points: null, isPreventDrag: true, saveContext: tempContext, isPreventSelection: null } });
338
+ tempContext.filter = temp_1;
339
+ parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
340
+ index++;
341
+ var indexBool = { bool: false };
342
+ parent.notify('shape', { prop: 'isIndexInObjColl', onPropertyChange: false, value: { obj: indexBool, index: index } });
343
+ if (!indexBool['bool']) {
344
+ index++;
345
+ }
346
+ objColl.splice(i, 1);
347
+ found = true;
348
+ break; // Exit the loop to start from the beginning
290
349
  }
291
350
  }
292
- else if (currObj.shape === 'image') {
293
- parent.activeObj = extend({}, parent.objColl[i], {}, true);
294
- parent.notify('selection', { prop: 'upgradeImageQuality', onPropertyChange: false });
295
- parent.objColl[i] = extend({}, parent.activeObj, {}, true);
351
+ if (!found) {
352
+ break; // If no matching order was found, exit the loop
296
353
  }
297
- parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'saveContext', obj: parent.objColl[i], isCropRatio: null,
298
- points: null, isPreventDrag: true, saveContext: tempContext, isPreventSelection: null } });
299
354
  }
300
355
  tempContext.filter = temp;
301
356
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
302
357
  parent.objColl = tempObjColl;
303
358
  }
359
+ };
360
+ Export.prototype.drawPen = function (tempContext, ratio) {
361
+ var parent = this.parent;
304
362
  if (parent.freehandCounter > 0) {
305
363
  var widthObj = { penStrokeWidth: null };
306
364
  parent.notify('freehand-draw', { prop: 'getPenStrokeWidth', onPropertyChange: false, value: { obj: widthObj } });
307
- // eslint-disable-next-line
365
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
308
366
  var tempPointColl = extend({}, parent.pointColl, {}, true);
309
367
  for (var n = 0; n < parent.freehandCounter; n++) {
310
368
  parent.points = extend([], parent.pointColl[n].points, []);
@@ -29,7 +29,6 @@ export declare class Filter {
29
29
  private setAdjustment;
30
30
  private setFilterValue;
31
31
  private setSaturationFilterValue;
32
- private updateFilter;
33
32
  private finetuneImage;
34
33
  private setCurrAdjValue;
35
34
  private getCurrentObj;
@@ -43,9 +43,6 @@ var Filter = /** @class */ (function () {
43
43
  case 'set-adjustment':
44
44
  this.setAdjustment(args.value['operation']);
45
45
  break;
46
- case 'update-filter':
47
- this.updateFilter(args.value['operation'], args.value['filter']);
48
- break;
49
46
  case 'initFilter':
50
47
  this.initFilter();
51
48
  break;
@@ -162,9 +159,8 @@ var Filter = /** @class */ (function () {
162
159
  parent.isUndoRedo = true;
163
160
  var temp = this.lowerContext.filter;
164
161
  this.lowerContext.filter = 'none';
165
- parent.notify('shape', { prop: 'iterateObjColl', onPropertyChange: false });
166
- parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
167
- value: { context: this.lowerContext, points: null } });
162
+ parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
163
+ value: { ctx: this.lowerContext, shape: 'iterate', pen: 'iterate', isPreventApply: null } });
168
164
  this.lowerContext.filter = temp;
169
165
  parent.isUndoRedo = false;
170
166
  }
@@ -360,9 +356,8 @@ var Filter = /** @class */ (function () {
360
356
  this.lowerContext.filter = 'brightness(' + 1 + ') ' + 'contrast(' + 100 + '%) ' + 'hue-rotate(' + 0 + 'deg) ' +
361
357
  'saturate(' + 100 + '%) ' + 'opacity(' + 1 + ') ' + 'blur(' + 0 + 'px) ' + 'sepia(0%) ' + 'grayscale(0%) ' + 'invert(0%)';
362
358
  this.bevelFilter = tempFilter;
363
- parent.notify('shape', { prop: 'iterateObjColl', onPropertyChange: false });
364
- parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
365
- value: { context: this.lowerContext, points: null } });
359
+ parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
360
+ value: { ctx: this.lowerContext, shape: 'iterate', pen: 'iterate', isPreventApply: null } });
366
361
  this.lowerContext.filter = tempFilter;
367
362
  parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
368
363
  if ((parent.currSelectionPoint && parent.currSelectionPoint.shape === 'crop-circle') || parent.isCircleCrop) {
@@ -537,21 +532,6 @@ var Filter = /** @class */ (function () {
537
532
  Filter.prototype.setSaturationFilterValue = function (value) {
538
533
  return Math.round((value === 1) ? 0 : (value - 1) * 100);
539
534
  };
540
- Filter.prototype.updateFilter = function (type, previousFilter) {
541
- var parent = this.parent;
542
- var validTypes = ['default', 'chrome', 'cold', 'warm', 'grayscale', 'blackandwhite', 'sepia', 'invert', 'sharpen'];
543
- if (validTypes.indexOf(type) !== -1) {
544
- var selEle = parent.element.querySelector('.e-contextual-toolbar-wrapper .e-toolbar-item.e-selected');
545
- if (selEle) {
546
- selEle.classList.remove('e-selected');
547
- }
548
- var filterCanvas = document.getElementById(parent.element.id + '_' + type + 'Canvas');
549
- if (filterCanvas) {
550
- filterCanvas.parentElement.classList.add('e-selected');
551
- }
552
- this.parent.currentFilter = previousFilter ? previousFilter : parent.element.id + '_' + type;
553
- }
554
- };
555
535
  Filter.prototype.finetuneImage = function (finetuneOption, value) {
556
536
  var parent = this.parent;
557
537
  if (!parent.disabled && parent.isImageLoaded) {
@@ -285,7 +285,8 @@ var FreehandDrawing = /** @class */ (function () {
285
285
  EventHandler.add(canvas, 'mousemove touchmove', this.freehandMoveHandler, this);
286
286
  var shapeSettings = { id: 'pen_' + (this.currFHDIdx + 1), type: ShapeType.FreehandDraw,
287
287
  startX: this.freehandDownPoint.x, startY: this.freehandDownPoint.y,
288
- strokeColor: parent.activeObj.strokeSettings.strokeColor, strokeWidth: this.penStrokeWidth, points: null };
288
+ strokeColor: parent.activeObj.strokeSettings.strokeColor, strokeWidth: this.penStrokeWidth,
289
+ points: null, index: parent.objColl.length + parent.freehandCounter + 1 };
289
290
  var shapeChangingArgs = { cancel: false, action: 'draw-start', previousShapeSettings: shapeSettings,
290
291
  currentShapeSettings: shapeSettings };
291
292
  this.triggerShapeChanging(shapeChangingArgs);
@@ -319,8 +320,10 @@ var FreehandDrawing = /** @class */ (function () {
319
320
  parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false, value: { obj: selPointCollObj } });
320
321
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
321
322
  var fhCnt = parent.freehandCounter;
323
+ var order = parent.objColl.length + parent.freehandCounter + 1;
322
324
  parent.pointColl[fhCnt] = { points: extend([], parent.points), strokeColor: parent.activeObj.strokeSettings.strokeColor,
323
- strokeWidth: this.penStrokeWidth, flipState: parent.transform.currFlipState, id: 'pen_' + (this.currFHDIdx + 1) };
325
+ strokeWidth: this.penStrokeWidth, flipState: parent.transform.currFlipState,
326
+ id: 'pen_' + (this.currFHDIdx + 1), order: order };
324
327
  parent.points = [];
325
328
  this.dummyPoints = [];
326
329
  this.selPointColl[fhCnt] = { points: extend([], this.selPoints) };
@@ -336,7 +339,7 @@ var FreehandDrawing = /** @class */ (function () {
336
339
  var shapeSettings = { id: 'pen_' + (this.currFHDIdx + 1), type: ShapeType.FreehandDraw,
337
340
  startX: this.freehandDownPoint.x, startY: this.freehandDownPoint.y,
338
341
  strokeColor: parent.activeObj.strokeSettings.strokeColor, strokeWidth: this.penStrokeWidth,
339
- points: parent.pointColl[this.currFHDIdx].points };
342
+ points: parent.pointColl[this.currFHDIdx].points, index: order };
340
343
  var shapeChangingArgs = { cancel: false, action: 'draw-end', previousShapeSettings: shapeSettings,
341
344
  currentShapeSettings: shapeSettings };
342
345
  this.triggerShapeChanging(shapeChangingArgs);
@@ -538,7 +541,9 @@ var FreehandDrawing = /** @class */ (function () {
538
541
  context.filter = 'none';
539
542
  if (points) {
540
543
  parent.pointColl[parent.freehandCounter] = { points: points, strokeColor: parent.activeObj.strokeSettings.strokeColor,
541
- strokeWidth: this.penStrokeWidth, flipState: parent.transform.currFlipState };
544
+ strokeWidth: this.penStrokeWidth, flipState: parent.transform.currFlipState,
545
+ id: 'pen_' + (parent.freehandCounter + 1), order: parent.objColl.length + parent.freehandCounter + 1 };
546
+ this.selPointColl[parent.freehandCounter] = extend({}, parent.pointColl[parent.freehandCounter], {}, true);
542
547
  parent.freehandCounter++;
543
548
  }
544
549
  if (parent.freehandCounter > 0) {
@@ -664,6 +669,7 @@ var FreehandDrawing = /** @class */ (function () {
664
669
  };
665
670
  FreehandDrawing.prototype.selectFhd = function (index) {
666
671
  var parent = this.parent;
672
+ var tempFHDStyles = extend({}, this.tempFHDStyles, {}, true);
667
673
  parent.notify('selection', { prop: 'setFreehandDrawEditing', onPropertyChange: false, value: { bool: true } });
668
674
  if (index || index === 0) {
669
675
  if (this.isFHDIdx(index)) {
@@ -690,13 +696,17 @@ var FreehandDrawing = /** @class */ (function () {
690
696
  if (obj['bool']) {
691
697
  var shapeSettings = { id: 'pen_' + (this.fhdSelIdx + 1), type: ShapeType.FreehandDraw,
692
698
  startX: point.points[0].x, startY: point.points[0].y, strokeColor: point.strokeColor,
693
- strokeWidth: point.strokeWidth, points: point.points, opacity: point.opacity };
699
+ strokeWidth: point.strokeWidth, points: point.points, opacity: point.opacity,
700
+ index: point.order };
694
701
  var shapeChangingArgs = { cancel: false, action: 'select', previousShapeSettings: shapeSettings,
695
702
  currentShapeSettings: shapeSettings };
696
703
  this.triggerShapeChanging(shapeChangingArgs);
697
704
  }
698
705
  else {
699
- parent.okBtn();
706
+ parent.okBtn(null, true);
707
+ }
708
+ if (parent.isUndoRedoStack) {
709
+ this.tempFHDStyles = tempFHDStyles;
700
710
  }
701
711
  };
702
712
  FreehandDrawing.prototype.deleteFhd = function (index, isId) {
@@ -991,8 +1001,8 @@ var FreehandDrawing = /** @class */ (function () {
991
1001
  parent.img.destTop = destPoints.startY;
992
1002
  parent.img.destWidth = destPoints.width;
993
1003
  parent.img.destHeight = destPoints.height;
994
- parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: isPreventApply } });
995
- parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: isPreventApply } });
1004
+ parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
1005
+ value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: isPreventApply } });
996
1006
  };
997
1007
  FreehandDrawing.prototype.panFHDColl = function (xDiff, yDiff, panRegion) {
998
1008
  var parent = this.parent;
@@ -1077,10 +1087,12 @@ var FreehandDrawing = /** @class */ (function () {
1077
1087
  }
1078
1088
  else {
1079
1089
  parent.upperCanvas.style.cursor = parent.cursor = 'default';
1090
+ var strokeWidth = this.penStrokeWidth;
1080
1091
  parent.notify('shape', { prop: 'apply', onPropertyChange: false, value: { shape: null, obj: null, canvas: null } });
1081
1092
  parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
1082
1093
  parent.notify('toolbar', { prop: 'setCurrentToolbar', value: { type: 'main' } });
1083
1094
  parent.notify('selection', { prop: 'setFreehandDrawCustomized', value: { isFreehandDrawCustomized: false } });
1095
+ this.penStrokeWidth = strokeWidth;
1084
1096
  }
1085
1097
  };
1086
1098
  FreehandDrawing.prototype.isFHDIdx = function (index, obj) {
@@ -1119,6 +1131,16 @@ var FreehandDrawing = /** @class */ (function () {
1119
1131
  var parent = this.parent;
1120
1132
  var point = parent.pointColl[this.fhdSelIdx];
1121
1133
  parent.trigger('shapeChanging', shapeChangingArgs);
1134
+ if (shapeChangingArgs.currentShapeSettings.id.indexOf('pen_') === -1 &&
1135
+ (shapeChangingArgs.action === 'draw-end' || shapeChangingArgs.action === 'select')) {
1136
+ var id = 'pen_' + shapeChangingArgs.currentShapeSettings.id;
1137
+ if (this.fhdSelIdx) {
1138
+ parent.pointColl[this.fhdSelIdx].id = id;
1139
+ }
1140
+ else {
1141
+ parent.pointColl[parent.freehandCounter - 1].id = id;
1142
+ }
1143
+ }
1122
1144
  this.penStrokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
1123
1145
  if (parent.activeObj.strokeSettings.strokeColor !== shapeChangingArgs.currentShapeSettings.strokeColor) {
1124
1146
  parent.activeObj.strokeSettings.strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
@@ -45,6 +45,9 @@ export declare class Selection {
45
45
  private isSliding;
46
46
  private mouseDown;
47
47
  private isSliderActive;
48
+ private arrowShape;
49
+ private isPreventShaping;
50
+ private isGrabbing;
48
51
  constructor(parent: ImageEditor);
49
52
  destroy(): void;
50
53
  private addEventListener;
@@ -57,6 +60,8 @@ export declare class Selection {
57
60
  private selMouseUpEvent;
58
61
  private getMouseCursor;
59
62
  private setCursor;
63
+ private getHighestOrder;
64
+ private setCursorForActObj;
60
65
  private setCursorForPath;
61
66
  private setCursorForLineArrow;
62
67
  private setCursorForRotatedObject;
@@ -77,6 +82,11 @@ export declare class Selection {
77
82
  private getScaleRatio;
78
83
  private findImageRatio;
79
84
  private revertResizing;
85
+ private performSEResize;
86
+ private performNWResize;
87
+ private isCustomSelection;
88
+ private revertCustomSelection;
89
+ private revertPoints;
80
90
  private updateNWPoints;
81
91
  private updateNPoints;
82
92
  private updateNEPoints;