@syncfusion/ej2-image-editor 22.1.36 → 22.1.38

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 (60) hide show
  1. package/CHANGELOG.md +16 -0
  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 +351 -278
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +353 -279
  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 +11 -11
  12. package/src/image-editor/action/crop.d.ts +2 -0
  13. package/src/image-editor/action/crop.js +89 -97
  14. package/src/image-editor/action/draw.js +88 -71
  15. package/src/image-editor/action/export.js +49 -66
  16. package/src/image-editor/action/freehand-draw.js +25 -1
  17. package/src/image-editor/action/selection.d.ts +1 -0
  18. package/src/image-editor/action/selection.js +26 -7
  19. package/src/image-editor/action/shape.d.ts +2 -0
  20. package/src/image-editor/action/shape.js +51 -22
  21. package/src/image-editor/action/transform.js +10 -0
  22. package/src/image-editor/action/undo-redo.js +4 -2
  23. package/src/image-editor/base/image-editor.js +8 -8
  24. package/src/image-editor/base/interface.d.ts +6 -2
  25. package/src/image-editor/renderer/toolbar.js +4 -5
  26. package/styles/bootstrap-dark.css +20 -8
  27. package/styles/bootstrap.css +20 -8
  28. package/styles/bootstrap4.css +20 -8
  29. package/styles/bootstrap5-dark.css +20 -8
  30. package/styles/bootstrap5.css +20 -8
  31. package/styles/fabric-dark.css +20 -8
  32. package/styles/fabric.css +20 -8
  33. package/styles/fluent-dark.css +20 -8
  34. package/styles/fluent.css +20 -8
  35. package/styles/highcontrast-light.css +20 -8
  36. package/styles/highcontrast.css +20 -8
  37. package/styles/image-editor/_layout.scss +20 -2
  38. package/styles/image-editor/bootstrap-dark.css +20 -8
  39. package/styles/image-editor/bootstrap.css +20 -8
  40. package/styles/image-editor/bootstrap4.css +20 -8
  41. package/styles/image-editor/bootstrap5-dark.css +20 -8
  42. package/styles/image-editor/bootstrap5.css +20 -8
  43. package/styles/image-editor/fabric-dark.css +20 -8
  44. package/styles/image-editor/fabric.css +20 -8
  45. package/styles/image-editor/fluent-dark.css +20 -8
  46. package/styles/image-editor/fluent.css +20 -8
  47. package/styles/image-editor/highcontrast-light.css +20 -8
  48. package/styles/image-editor/highcontrast.css +20 -8
  49. package/styles/image-editor/material-dark.css +20 -8
  50. package/styles/image-editor/material.css +20 -8
  51. package/styles/image-editor/material3-dark.css +20 -8
  52. package/styles/image-editor/material3.css +20 -8
  53. package/styles/image-editor/tailwind-dark.css +20 -8
  54. package/styles/image-editor/tailwind.css +20 -8
  55. package/styles/material-dark.css +20 -8
  56. package/styles/material.css +20 -8
  57. package/styles/material3-dark.css +20 -8
  58. package/styles/material3.css +20 -8
  59. package/styles/tailwind-dark.css +20 -8
  60. package/styles/tailwind.css +20 -8
@@ -46,7 +46,7 @@ var Crop = /** @__PURE__ @class */ (function () {
46
46
  this.crop(args.value['obj']);
47
47
  break;
48
48
  case 'calcRatio':
49
- this.calcRatio(args.value['obj']);
49
+ this.calcRatio(args.value['obj'], args.value['dimension']);
50
50
  break;
51
51
  case 'isObjInImage':
52
52
  this.isObjInImage(args.value['obj'], args.value['object']);
@@ -192,112 +192,74 @@ var Crop = /** @__PURE__ @class */ (function () {
192
192
  Crop.prototype.rotateCrop = function () {
193
193
  var parent = this.parent;
194
194
  var shape = parent.activeObj.shape || '';
195
- var tempDegree = parent.transform.degree;
196
195
  parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
197
196
  parent.currSelectionPoint = extend({}, parent.activeObj, {}, true);
198
197
  parent.objColl.push(parent.activeObj);
199
198
  parent.activeObj = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
200
- this.lowerContext.setTransform(1, 0, 0, 1, 0, 0);
201
- parent.notify('draw', { prop: 'setClientTransDim', onPropertyChange: false,
202
- value: { isPreventDimension: null } });
203
- this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
204
- parent.transform.degree = 0;
205
- var temp = this.lowerContext.filter;
206
- parent.notify('finetune', { prop: 'updateBrightFilter', onPropertyChange: false });
207
- this.lowerContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, parent.img.destLeft, parent.img.destTop, parent.img.destWidth, parent.img.destHeight);
208
- this.lowerContext.filter = temp;
209
- var length = 0;
210
- if (tempDegree === 90 || tempDegree === -270) {
211
- length = 3;
212
- }
213
- else if (tempDegree === 180 || tempDegree === -180) {
214
- length = 2;
215
- }
216
- else if (tempDegree === 270 || tempDegree === -90) {
217
- length = 1;
218
- }
219
- for (var i = 0; i < length; i++) {
220
- parent.notify('shape', { prop: 'rotateObjColl', onPropertyChange: false });
221
- parent.notify('freehand-draw', { prop: 'rotateFhdColl', onPropertyChange: false });
222
- }
223
199
  var activeObj = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
224
- if (parent.transform.currFlipState !== '') {
225
- for (var i = 0, len = parent.objColl.length; i < len; i++) {
226
- parent.objColl[i].shapeFlip = '';
227
- }
228
- for (var i = 0; i < parent.freehandCounter; i++) {
229
- parent.pointColl[i].shapeFlip = '';
230
- }
231
- parent.transform.degree = tempDegree;
232
- var flipState = this.getCurrCropState('initial');
233
- parent.transform.degree = 0;
234
- parent.notify('shape', { prop: 'redrawObj', onPropertyChange: false, value: { degree: flipState } });
235
- parent.notify('freehand-draw', { prop: 'flipFHDColl', onPropertyChange: false,
236
- value: { value: flipState } });
237
- }
238
- parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
239
- parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
200
+ var tempCurrSelObj = extend({}, parent.currSelectionPoint, {}, true);
201
+ var preventSelObj = { bool: null };
202
+ parent.notify('transform', { prop: 'getPreventSelect', onPropertyChange: false, value: { obj: preventSelObj } });
203
+ parent.notify('transform', { prop: 'setPreventSelect', onPropertyChange: false, value: { bool: true } });
204
+ var coll = extend([], parent.rotateFlipColl, [], true);
205
+ this.panToSelRangle(true);
206
+ this.revertTransform('initial', coll);
240
207
  activeObj = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
241
208
  this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
242
209
  parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: activeObj } });
243
210
  parent.objColl.pop();
244
211
  parent.transform.degree = 0;
245
212
  this.cropImg(true);
246
- parent.notify('transform', { prop: 'setReverseRotate', onPropertyChange: false, value: { bool: true } });
247
- this.lowerContext.setTransform(1, 0, 0, 1, 0, 0);
248
- parent.transform.degree = tempDegree;
249
- parent.notify('draw', { prop: 'setDestPoints', onPropertyChange: false });
250
- parent.notify('draw', { prop: 'currTransState', onPropertyChange: false,
251
- value: { type: 'initial', isPreventDestination: null, context: null, isPreventCircleCrop: null } });
252
- parent.notify('finetune', { prop: 'updateBrightFilter', onPropertyChange: false });
253
- this.lowerContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, parent.img.destLeft, parent.img.destTop, parent.img.destWidth, parent.img.destHeight);
254
- this.lowerContext.filter = temp;
255
- parent.notify('draw', { prop: 'currTransState', onPropertyChange: false,
256
- value: { type: 'reverse', isPreventDestination: null, context: null, isPreventCircleCrop: null } });
257
- length = 0;
258
- if (tempDegree === 90 || tempDegree === -270) {
259
- length = 1;
260
- }
261
- else if (tempDegree === 180 || tempDegree === -180) {
262
- length = 2;
263
- }
264
- else if (tempDegree === 270 || tempDegree === -90) {
265
- length = 3;
213
+ this.revertTransform('reverse', coll);
214
+ parent.currSelectionPoint = tempCurrSelObj;
215
+ parent.notify('transform', { prop: 'setPreventSelect', onPropertyChange: false, value: { bool: preventSelObj['bool'] } });
216
+ parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
217
+ parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
218
+ if (shape === 'crop-circle') {
219
+ this.cropCircle(this.lowerContext);
266
220
  }
267
- for (var i = 0; i < length; i++) {
268
- parent.notify('shape', { prop: 'rotateObjColl', onPropertyChange: false });
269
- parent.notify('freehand-draw', { prop: 'rotateFhdColl', onPropertyChange: false });
221
+ this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
222
+ parent.notify('draw', { prop: 'resetPanPoints', onPropertyChange: false });
223
+ };
224
+ Crop.prototype.revertTransform = function (type, coll) {
225
+ var parent = this.parent;
226
+ var obj = { isRotate: false };
227
+ if (type === 'initial') {
228
+ for (var i = coll.length - 1; i >= 0; i--) {
229
+ switch (coll[i]) {
230
+ case 90:
231
+ parent.notify('transform', { prop: 'rotate', value: { degree: -90, obj: obj } });
232
+ break;
233
+ case -90:
234
+ parent.notify('transform', { prop: 'rotate', value: { degree: 90, obj: obj } });
235
+ break;
236
+ default:
237
+ parent.notify('transform', { prop: 'flipImage', value: { direction: parent.toPascalCase(coll[i]) } });
238
+ break;
239
+ }
240
+ }
270
241
  }
271
- if (this.getCurrFlipState() !== '') {
242
+ else {
272
243
  for (var i = 0, len = parent.objColl.length; i < len; i++) {
273
244
  parent.objColl[i].shapeFlip = '';
274
245
  }
275
246
  for (var i = 0; i < parent.freehandCounter; i++) {
276
247
  parent.pointColl[i].shapeFlip = '';
277
248
  }
278
- var flipState = this.getCurrCropState('reverse');
279
- parent.notify('shape', { prop: 'redrawObj', onPropertyChange: false, value: { degree: flipState } });
280
- parent.notify('freehand-draw', { prop: 'flipFHDColl', onPropertyChange: false,
281
- value: { value: flipState } });
282
- }
283
- parent.notify('transform', { prop: 'setReverseRotate', onPropertyChange: false, value: { bool: false } });
284
- this.lowerContext.filter = 'none';
285
- for (var i = 0, len = parent.objColl.length; i < len; i++) {
286
- if (this.isObjInImage(parent.objColl[i])) {
287
- parent.notify('shape', { prop: 'apply', onPropertyChange: false,
288
- value: { shape: parent.objColl[i].shape, obj: parent.objColl[i], canvas: null } });
289
- parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
249
+ for (var i = 0, len = coll.length; i < len; i++) {
250
+ switch (coll[i]) {
251
+ case 90:
252
+ parent.notify('transform', { prop: 'rotate', value: { degree: 90, obj: obj } });
253
+ break;
254
+ case -90:
255
+ parent.notify('transform', { prop: 'rotate', value: { degree: -90, obj: obj } });
256
+ break;
257
+ default:
258
+ parent.notify('transform', { prop: 'flipImage', value: { direction: parent.toPascalCase(coll[i]) } });
259
+ break;
260
+ }
290
261
  }
291
262
  }
292
- parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
293
- this.lowerContext.filter = temp;
294
- parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
295
- parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
296
- if (shape === 'crop-circle') {
297
- this.cropCircle(this.lowerContext);
298
- }
299
- this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
300
- parent.notify('draw', { prop: 'resetPanPoints', onPropertyChange: false });
301
263
  };
302
264
  Crop.prototype.flipCrop = function () {
303
265
  var parent = this.parent;
@@ -498,6 +460,15 @@ var Crop = /** @__PURE__ @class */ (function () {
498
460
  this.lowerContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, parent.img.destLeft, parent.img.destTop, parent.img.destWidth, parent.img.destHeight);
499
461
  parent.notify('draw', { prop: 'currTransState', onPropertyChange: false,
500
462
  value: { type: 'reverse', isPreventDestination: null, context: null, isPreventCircleCrop: true } });
463
+ var cropObjColl = extend([], parent.objColl, null, true);
464
+ var cropPointColl = extend([], parent.pointColl, null, true);
465
+ parent.objColl = [];
466
+ parent.pointColl = [];
467
+ parent.freehandCounter = 0;
468
+ this.panToSelRangle();
469
+ parent.objColl = cropObjColl;
470
+ parent.pointColl = cropPointColl;
471
+ parent.freehandCounter = parent.pointColl.length;
501
472
  if (parent.cropObj.activeObj.shape) {
502
473
  var destPoints = { startX: parent.img.destLeft, startY: parent.img.destTop, width: parent.img.destWidth,
503
474
  height: parent.img.destHeight };
@@ -514,8 +485,8 @@ var Crop = /** @__PURE__ @class */ (function () {
514
485
  parent.img.destWidth = destPoints.width;
515
486
  parent.img.destHeight = destPoints.height;
516
487
  parent.notify('freehand-draw', { prop: 'updateFHDColl', onPropertyChange: false });
517
- var cropObjColl = extend([], parent.objColl, null, true);
518
- var cropPointColl = extend([], parent.pointColl, null, true);
488
+ cropObjColl = extend([], parent.objColl, null, true);
489
+ cropPointColl = extend([], parent.pointColl, null, true);
519
490
  parent.objColl = [];
520
491
  parent.pointColl = [];
521
492
  parent.freehandCounter = 0;
@@ -526,9 +497,12 @@ var Crop = /** @__PURE__ @class */ (function () {
526
497
  parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
527
498
  value: { obj: { selPointColl: [] } } });
528
499
  parent.cropObj.filter = this.lowerContext.filter;
500
+ var actObj = extend({}, parent.currSelectionPoint, null, true);
529
501
  parent.notify('draw', { prop: 'setCurrentObj', onPropertyChange: false, value: { obj: null } });
502
+ parent.activeObj = extend({}, actObj, null, true);
530
503
  var activeObj = extend({}, parent.activeObj, null, true);
531
504
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
505
+ this.panToSelRangle();
532
506
  parent.objColl = cropObjColl;
533
507
  parent.pointColl = cropPointColl;
534
508
  parent.freehandCounter = parent.pointColl.length;
@@ -560,6 +534,25 @@ var Crop = /** @__PURE__ @class */ (function () {
560
534
  parent.currSelectionPoint = null;
561
535
  }
562
536
  };
537
+ Crop.prototype.panToSelRangle = function (isReverse) {
538
+ var parent = this.parent;
539
+ var panX = parent.transform.degree === 0 ?
540
+ isReverse ? -parent.cropObj.totalPannedPoint.x : parent.cropObj.totalPannedPoint.x :
541
+ isReverse ? -parent.cropObj.totalPannedClientPoint.x : parent.cropObj.totalPannedClientPoint.x;
542
+ var panY = parent.transform.degree === 0 ?
543
+ isReverse ? -parent.cropObj.totalPannedPoint.y : parent.cropObj.totalPannedPoint.y :
544
+ isReverse ? -parent.cropObj.totalPannedClientPoint.y : parent.cropObj.totalPannedClientPoint.y;
545
+ if (parent.transform.degree === 0) {
546
+ parent.img.destLeft += panX;
547
+ parent.img.destTop += panY;
548
+ parent.notify('transform', { prop: 'drawPannImage', value: { point: { x: panX, y: panY } } });
549
+ }
550
+ else {
551
+ parent.panPoint.currentPannedPoint = { x: panX, y: panY };
552
+ parent.notify('transform', { prop: 'drawPannedImage', value: { xDiff: panX, yDiff: panY } });
553
+ parent.panPoint.currentPannedPoint = { x: 0, y: 0 };
554
+ }
555
+ };
563
556
  Crop.prototype.cropCircle = function (context, isSave, isFlip) {
564
557
  var parent = this.parent;
565
558
  if (isFlip && parent.transform.currFlipState !== '') {
@@ -568,9 +561,9 @@ var Crop = /** @__PURE__ @class */ (function () {
568
561
  }
569
562
  context.globalCompositeOperation = 'destination-in';
570
563
  context.beginPath();
571
- var centerX = isNullOrUndefined(isSave) ? parent.img.destLeft + (parent.img.destWidth / 2) : parent.img.destWidth / 2;
572
- var centerY = isNullOrUndefined(isSave) ? parent.img.destTop + (parent.img.destHeight / 2) : parent.img.destHeight / 2;
573
- var radius = parent.img.destWidth / 2;
564
+ var centerX = isNullOrUndefined(isSave) ? parent.img.destLeft + (parent.img.destWidth / 2) : context.canvas.width / 2;
565
+ var centerY = isNullOrUndefined(isSave) ? parent.img.destTop + (parent.img.destHeight / 2) : context.canvas.height / 2;
566
+ var radius = isSave ? context.canvas.width / 2 : parent.img.destWidth / 2;
574
567
  context.arc(centerX, centerY, radius, 0, Math.PI * 2);
575
568
  context.closePath();
576
569
  context.fill();
@@ -749,7 +742,6 @@ var Crop = /** @__PURE__ @class */ (function () {
749
742
  }
750
743
  this.cropImg();
751
744
  parent.transform.zoomFactor = 0;
752
- parent.zoomSettings.zoomFactor = 1;
753
745
  parent.setProperties({ zoomSettings: { zoomFactor: 1 } }, true);
754
746
  parent.notify('transform', { prop: 'setPreviousZoomValue', onPropertyChange: false,
755
747
  value: { previousZoomValue: parent.zoomSettings.zoomFactor } });
@@ -775,17 +767,17 @@ var Crop = /** @__PURE__ @class */ (function () {
775
767
  }
776
768
  }
777
769
  };
778
- Crop.prototype.calcRatio = function (obj) {
770
+ Crop.prototype.calcRatio = function (obj, dimension) {
779
771
  var parent = this.parent;
780
772
  var widthRatio;
781
773
  var heightRatio;
782
774
  if (parent.transform.degree === 0 || parent.transform.degree % 180 === 0) {
783
- widthRatio = parent.baseImg.width / parent.img.destWidth;
784
- heightRatio = parent.baseImg.height / parent.img.destHeight;
775
+ widthRatio = (dimension ? dimension.width : parent.baseImg.width) / parent.img.destWidth;
776
+ heightRatio = (dimension ? dimension.height : parent.baseImg.height) / parent.img.destHeight;
785
777
  }
786
778
  else {
787
- widthRatio = parent.baseImg.height / parent.img.destWidth;
788
- heightRatio = parent.baseImg.width / parent.img.destHeight;
779
+ widthRatio = (dimension ? dimension.height : parent.baseImg.height) / parent.img.destWidth;
780
+ heightRatio = (dimension ? dimension.width : parent.baseImg.width) / parent.img.destHeight;
789
781
  }
790
782
  if (obj) {
791
783
  obj['width'] = widthRatio;
@@ -1118,6 +1110,10 @@ var Draw = /** @__PURE__ @class */ (function () {
1118
1110
  parent.activeObj = extend({}, obj, {}, true);
1119
1111
  }
1120
1112
  this.updateActiveObject();
1113
+ if (isNullOrUndefined(parent.activeObj.activePoint.startX) &&
1114
+ isNullOrUndefined(parent.activeObj.activePoint.startY)) {
1115
+ return;
1116
+ }
1121
1117
  if (parent.currObjType.isText) {
1122
1118
  var obj_2 = { keyHistory: '' };
1123
1119
  parent.notify('shape', { prop: 'getKeyHistory', onPropertyChange: false, value: { obj: obj_2 } });
@@ -1788,12 +1784,14 @@ var Draw = /** @__PURE__ @class */ (function () {
1788
1784
  if (degree < 0) {
1789
1785
  degree = 360 + degree;
1790
1786
  }
1791
- for (var i = 0, len = parent.activeObj.flipObjColl.length; i < len; i++) {
1792
- if (parent.activeObj.flipObjColl[i].toLowerCase() === 'horizontal') {
1793
- isHorizontalflip = true;
1794
- }
1795
- else if (parent.activeObj.flipObjColl[i].toLowerCase() === 'vertical') {
1796
- isVerticalflip = true;
1787
+ if (parent.activeObj.flipObjColl) {
1788
+ for (var i = 0, len = parent.activeObj.flipObjColl.length; i < len; i++) {
1789
+ if (parent.activeObj.flipObjColl[i].toLowerCase() === 'horizontal') {
1790
+ isHorizontalflip = true;
1791
+ }
1792
+ else if (parent.activeObj.flipObjColl[i].toLowerCase() === 'vertical') {
1793
+ isVerticalflip = true;
1794
+ }
1797
1795
  }
1798
1796
  }
1799
1797
  switch (degree) {
@@ -2372,17 +2370,18 @@ var Draw = /** @__PURE__ @class */ (function () {
2372
2370
  parent.activeObj.textSettings.fontFamily;
2373
2371
  if (parent.activeObj.flipObjColl.length === 4) {
2374
2372
  parent.activeObj.flipObjColl = [];
2373
+ parent.activeObj.shapeFlip = '';
2375
2374
  }
2376
2375
  for (var j = 0, len = parent.activeObj.flipObjColl.length; j < len; j++) {
2377
2376
  if (parent.activeObj.flipObjColl[j].toLowerCase() === 'horizontal') {
2378
2377
  canvasDraw.translate(canvasDraw.canvas.width, 0);
2379
2378
  canvasDraw.scale(-1, 1);
2380
- this.updateActPoint('horizontal', canvasDraw);
2379
+ actPoint = this.updateActPoint('horizontal', canvasDraw);
2381
2380
  }
2382
2381
  else if (parent.activeObj.flipObjColl[j].toLowerCase() === 'vertical') {
2383
2382
  canvasDraw.translate(0, canvasDraw.canvas.height);
2384
2383
  canvasDraw.scale(1, -1);
2385
- this.updateActPoint('vertical', canvasDraw);
2384
+ actPoint = this.updateActPoint('vertical', canvasDraw);
2386
2385
  }
2387
2386
  }
2388
2387
  if (parent.activeObj.shapeDegree !== parent.transform.degree) {
@@ -2395,12 +2394,12 @@ var Draw = /** @__PURE__ @class */ (function () {
2395
2394
  if (parent.activeObj.flipObjColl[k].toLowerCase() === 'horizontal') {
2396
2395
  canvasDraw.translate(canvasDraw.canvas.width, 0);
2397
2396
  canvasDraw.scale(-1, 1);
2398
- this.updateActPoint('horizontal', canvasDraw);
2397
+ actPoint = this.updateActPoint('horizontal', canvasDraw);
2399
2398
  }
2400
2399
  else if (parent.activeObj.flipObjColl[k].toLowerCase() === 'vertical') {
2401
2400
  canvasDraw.translate(0, canvasDraw.canvas.height);
2402
2401
  canvasDraw.scale(1, -1);
2403
- this.updateActPoint('vertical', canvasDraw);
2402
+ actPoint = this.updateActPoint('vertical', canvasDraw);
2404
2403
  }
2405
2404
  }
2406
2405
  }
@@ -2436,6 +2435,7 @@ var Draw = /** @__PURE__ @class */ (function () {
2436
2435
  this.updateActiveObject(actPoint, parent.activeObj);
2437
2436
  }
2438
2437
  }
2438
+ return actPoint;
2439
2439
  };
2440
2440
  Draw.prototype.rotateText = function (canvasDraw) {
2441
2441
  var parent = this.parent;
@@ -2449,6 +2449,9 @@ var Draw = /** @__PURE__ @class */ (function () {
2449
2449
  else {
2450
2450
  degree = parent.transform.degree - parent.activeObj.shapeDegree;
2451
2451
  }
2452
+ if (degree === -450) {
2453
+ degree = -90;
2454
+ }
2452
2455
  if (degree < 0) {
2453
2456
  degree = 360 + degree;
2454
2457
  }
@@ -3774,11 +3777,8 @@ var Draw = /** @__PURE__ @class */ (function () {
3774
3777
  }
3775
3778
  }
3776
3779
  else {
3777
- if (parent.element.querySelector('#' + parent.element.id + '_toolbar')) {
3778
- parent.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbar').clientHeight;
3779
- }
3780
- else {
3781
- parent.toolbarHeight = 0;
3780
+ if (parent.element.querySelector('#' + parent.element.id + '_toolbarArea')) {
3781
+ parent.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
3782
3782
  }
3783
3783
  }
3784
3784
  parent.reset();
@@ -3821,8 +3821,8 @@ var Draw = /** @__PURE__ @class */ (function () {
3821
3821
  parent.clearContext(this.lowerContext);
3822
3822
  parent.clearContext(this.upperContext);
3823
3823
  parent.clearContext(inMemoryContext);
3824
- parent.inMemoryCanvas.width = parent.baseImg.width = this.openURL.width;
3825
- parent.inMemoryCanvas.height = parent.baseImg.height = this.openURL.height;
3824
+ parent.inMemoryCanvas.width = this.openURL.width;
3825
+ parent.inMemoryCanvas.height = this.openURL.height;
3826
3826
  inMemoryContext.putImageData(this.openURL, 0, 0);
3827
3827
  parent.baseImg.src = parent.inMemoryCanvas.toDataURL();
3828
3828
  }
@@ -3978,75 +3978,84 @@ var Draw = /** @__PURE__ @class */ (function () {
3978
3978
  Draw.prototype.moveToSelectionRange = function (type, activeObj) {
3979
3979
  var parent = this.parent;
3980
3980
  if (parent.activeObj.shape) {
3981
- if (type === 'rotateleft' || type === 'rotateright') {
3981
+ var isRotated = false;
3982
+ for (var i = 0; i < parent.rotateFlipColl.length; i++) {
3983
+ if (parent.rotateFlipColl[i] === 90 || parent.rotateFlipColl[i] === -90) {
3984
+ isRotated = true;
3985
+ break;
3986
+ }
3987
+ }
3988
+ if (isRotated) {
3982
3989
  var zoomFactor = parent.transform.zoomFactor;
3983
3990
  parent.objColl.push(parent.activeObj);
3984
3991
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
3985
- if (parent.transform.degree % 90 === 0 && parent.transform.degree % 180 !== 0) {
3986
- if (parent.objColl[parent.objColl.length - 1].activePoint.width < activeObj.activePoint.height) {
3987
- for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
3988
- if (parent.objColl[parent.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
3989
- this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
3990
- this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
3991
- if (!isNullOrUndefined(zoomFactor)) {
3992
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3993
- value: { zoomFactor: -0.1, zoomPoint: null } });
3992
+ if (type === 'rotateleft' || type === 'rotateright') {
3993
+ if (parent.transform.degree % 90 === 0 && parent.transform.degree % 180 !== 0) {
3994
+ if (parent.objColl[parent.objColl.length - 1].activePoint.width < activeObj.activePoint.height) {
3995
+ for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
3996
+ if (parent.objColl[parent.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
3997
+ this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
3998
+ this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
3999
+ if (!isNullOrUndefined(zoomFactor)) {
4000
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4001
+ value: { zoomFactor: -0.1, zoomPoint: null } });
4002
+ }
4003
+ break;
3994
4004
  }
3995
- break;
4005
+ zoomFactor += 0.1;
4006
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4007
+ value: { zoomFactor: zoomFactor, zoomPoint: null } });
3996
4008
  }
3997
- zoomFactor += 0.1;
3998
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3999
- value: { zoomFactor: zoomFactor, zoomPoint: null } });
4000
4009
  }
4001
- }
4002
- else {
4003
- for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
4004
- if (parent.objColl[parent.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
4005
- this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
4006
- this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
4007
- if (!isNullOrUndefined(zoomFactor)) {
4008
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4009
- value: { zoomFactor: 0.1, zoomPoint: null } });
4010
+ else {
4011
+ for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
4012
+ if (parent.objColl[parent.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
4013
+ this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
4014
+ this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
4015
+ if (!isNullOrUndefined(zoomFactor)) {
4016
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4017
+ value: { zoomFactor: 0.1, zoomPoint: null } });
4018
+ }
4019
+ break;
4010
4020
  }
4011
- break;
4021
+ zoomFactor -= .1;
4022
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4023
+ value: { zoomFactor: zoomFactor, zoomPoint: null } });
4012
4024
  }
4013
- zoomFactor -= .1;
4014
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4015
- value: { zoomFactor: zoomFactor, zoomPoint: null } });
4016
4025
  }
4017
4026
  }
4018
- }
4019
- else {
4020
- if (parent.objColl[parent.objColl.length - 1].activePoint.height < activeObj.activePoint.width) {
4021
- for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
4022
- if (parent.objColl[parent.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
4023
- this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
4024
- this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
4025
- if (!isNullOrUndefined(zoomFactor)) {
4026
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4027
- value: { zoomFactor: -0.1, zoomPoint: null } });
4027
+ else {
4028
+ if (parent.objColl[parent.objColl.length - 1].activePoint.height < activeObj.activePoint.width) {
4029
+ for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
4030
+ if (parent.objColl[parent.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
4031
+ this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
4032
+ this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
4033
+ if (!isNullOrUndefined(zoomFactor)) {
4034
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4035
+ value: { zoomFactor: -0.1, zoomPoint: null } });
4036
+ }
4037
+ break;
4028
4038
  }
4029
- break;
4039
+ zoomFactor += 0.1;
4040
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4041
+ value: { zoomFactor: zoomFactor, zoomPoint: null } });
4030
4042
  }
4031
- zoomFactor += 0.1;
4032
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4033
- value: { zoomFactor: zoomFactor, zoomPoint: null } });
4034
4043
  }
4035
- }
4036
- else {
4037
- for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
4038
- if (parent.objColl[parent.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
4039
- this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
4040
- this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
4041
- if (!isNullOrUndefined(zoomFactor)) {
4042
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4043
- value: { zoomFactor: 0.1, zoomPoint: null } });
4044
+ else {
4045
+ for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
4046
+ if (parent.objColl[parent.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
4047
+ this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
4048
+ this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
4049
+ if (!isNullOrUndefined(zoomFactor)) {
4050
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4051
+ value: { zoomFactor: 0.1, zoomPoint: null } });
4052
+ }
4053
+ break;
4044
4054
  }
4045
- break;
4055
+ zoomFactor -= .1;
4056
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4057
+ value: { zoomFactor: zoomFactor, zoomPoint: null } });
4046
4058
  }
4047
- zoomFactor -= .1;
4048
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4049
- value: { zoomFactor: zoomFactor, zoomPoint: null } });
4050
4059
  }
4051
4060
  }
4052
4061
  }
@@ -4256,8 +4265,19 @@ var Export = /** @__PURE__ @class */ (function () {
4256
4265
  };
4257
4266
  Export.prototype.exportToCanvas = function (object) {
4258
4267
  var parent = this.parent;
4268
+ var width;
4269
+ var height;
4270
+ if (parent.currSelectionPoint) {
4271
+ width = parent.img.srcWidth;
4272
+ height = parent.img.srcHeight;
4273
+ }
4274
+ else {
4275
+ width = parent.baseImg.width;
4276
+ height = parent.baseImg.height;
4277
+ }
4259
4278
  var obj = { width: 0, height: 0 };
4260
- parent.notify('crop', { prop: 'calcRatio', onPropertyChange: false, value: { obj: obj } });
4279
+ parent.notify('crop', { prop: 'calcRatio', onPropertyChange: false,
4280
+ value: { obj: obj, dimension: { width: width, height: height } } });
4261
4281
  var ratio = obj;
4262
4282
  var tempContextFilter = this.lowerContext.filter;
4263
4283
  // Manipulating blur value
@@ -4268,42 +4288,30 @@ var Export = /** @__PURE__ @class */ (function () {
4268
4288
  splitWords[5] = 'blur(' + value + 'px)';
4269
4289
  this.lowerContext.filter = splitWords.join(' ');
4270
4290
  }
4271
- var maxDimension;
4272
4291
  var tempCanvas = parent.createElement('canvas', {
4273
4292
  id: parent.element.id + '_tempCanvas', attrs: { name: 'canvasImage' }
4274
4293
  });
4275
4294
  var tempContext = tempCanvas.getContext('2d');
4276
4295
  tempContext.filter = this.lowerContext.filter;
4277
- if (parent.currSelectionPoint) {
4278
- tempCanvas.width = parent.img.destWidth;
4279
- tempCanvas.height = parent.img.destHeight;
4280
- tempContext.filter = this.lowerContext.filter;
4281
- var temp = this.lowerContext.filter;
4282
- parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
4283
- tempContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, 0, 0, parent.img.destWidth, parent.img.destHeight);
4284
- this.lowerContext.filter = temp;
4285
- }
4286
- else {
4287
- tempCanvas.width = parent.baseImg.width;
4288
- tempCanvas.height = parent.baseImg.height;
4289
- var obj_2 = { width: 0, height: 0 };
4290
- parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
4291
- value: { width: parent.baseImg.width, height: parent.baseImg.height, obj: obj_2 } });
4292
- maxDimension = obj_2;
4293
- tempCanvas.style.maxWidth = maxDimension.width + 'px';
4294
- tempCanvas.style.maxHeight = maxDimension.height + 'px';
4295
- tempContext.filter = this.lowerContext.filter;
4296
- var temp = this.lowerContext.filter;
4297
- parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
4298
- tempContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, 0, 0, parent.baseImg.width, parent.baseImg.height);
4299
- this.lowerContext.filter = temp;
4300
- }
4296
+ tempCanvas.width = width;
4297
+ tempCanvas.height = height;
4298
+ var dimObj = { width: 0, height: 0 };
4299
+ parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
4300
+ value: { width: width, height: height, obj: dimObj } });
4301
+ var maxDimension = dimObj;
4302
+ tempCanvas.style.maxWidth = maxDimension.width + 'px';
4303
+ tempCanvas.style.maxHeight = maxDimension.height + 'px';
4304
+ tempContext.filter = this.lowerContext.filter;
4305
+ var temp = this.lowerContext.filter;
4306
+ parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
4307
+ tempContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, 0, 0, width, height);
4308
+ this.lowerContext.filter = temp;
4301
4309
  if (parent.transform.degree !== 0 || parent.transform.currFlipState !== '') {
4302
4310
  this.updateSaveContext(tempContext);
4303
4311
  this.exportTransformedImage(tempContext);
4304
4312
  }
4305
4313
  if (parent.objColl.length > 0) {
4306
- var temp = tempContext.filter;
4314
+ var temp_1 = tempContext.filter;
4307
4315
  tempContext.filter = 'none';
4308
4316
  var tempObjColl = extend([], parent.objColl, [], true);
4309
4317
  for (var i = 0, len = parent.objColl.length; i < len; i++) {
@@ -4316,22 +4324,20 @@ var Export = /** @__PURE__ @class */ (function () {
4316
4324
  activePoint.width = activePoint.endX - activePoint.startX;
4317
4325
  activePoint.height = activePoint.endY - activePoint.startY;
4318
4326
  // Manipulating points
4319
- if (isNullOrUndefined(parent.currSelectionPoint)) {
4320
- activePoint.startX *= ratio.width;
4321
- activePoint.startY *= ratio.height;
4322
- activePoint.endX *= ratio.width;
4323
- activePoint.endY *= ratio.height;
4324
- activePoint.width = activePoint.endX - activePoint.startX;
4325
- activePoint.height = activePoint.endY - activePoint.startY;
4326
- parent.objColl[i].strokeSettings.strokeWidth *= ((ratio.width + ratio.height) / 2);
4327
- if (parent.objColl[i].shape === 'text') {
4328
- parent.objColl[i].textSettings.fontSize *= ((ratio.width + ratio.height) / 2);
4329
- }
4327
+ activePoint.startX *= ratio.width;
4328
+ activePoint.startY *= ratio.height;
4329
+ activePoint.endX *= ratio.width;
4330
+ activePoint.endY *= ratio.height;
4331
+ activePoint.width = activePoint.endX - activePoint.startX;
4332
+ activePoint.height = activePoint.endY - activePoint.startY;
4333
+ parent.objColl[i].strokeSettings.strokeWidth *= ((ratio.width + ratio.height) / 2);
4334
+ if (parent.objColl[i].shape === 'text') {
4335
+ parent.objColl[i].textSettings.fontSize *= ((ratio.width + ratio.height) / 2);
4330
4336
  }
4331
4337
  parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'saveContext', obj: parent.objColl[i], isCropRatio: null,
4332
4338
  points: null, isPreventDrag: true, saveContext: tempContext, isPreventSelection: null } });
4333
4339
  }
4334
- tempContext.filter = temp;
4340
+ tempContext.filter = temp_1;
4335
4341
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
4336
4342
  parent.objColl = tempObjColl;
4337
4343
  }
@@ -4342,18 +4348,10 @@ var Export = /** @__PURE__ @class */ (function () {
4342
4348
  parent.points = extend([], parent.pointColl[n].points, []);
4343
4349
  parent.notify('freehand-draw', { prop: 'setPointCounter', onPropertyChange: false, value: { value: 0 } });
4344
4350
  var len = parent.points.length;
4345
- if (parent.currSelectionPoint) {
4346
- for (var l = 0; l < len; l++) {
4347
- parent.points[l].x -= parent.img.destLeft;
4348
- parent.points[l].y -= parent.img.destTop;
4349
- }
4350
- }
4351
- else {
4352
- parent.pointColl[n].strokeWidth *= ((ratio.width + ratio.height) / 2);
4353
- for (var l = 0; l < len; l++) {
4354
- parent.points[l].x = (parent.points[l].x - parent.img.destLeft) * ratio.width;
4355
- parent.points[l].y = (parent.points[l].y - parent.img.destTop) * ratio.height;
4356
- }
4351
+ parent.pointColl[n].strokeWidth *= ((ratio.width + ratio.height) / 2);
4352
+ for (var l = 0; l < len; l++) {
4353
+ parent.points[l].x = (parent.points[l].x - parent.img.destLeft) * ratio.width;
4354
+ parent.points[l].y = (parent.points[l].y - parent.img.destTop) * ratio.height;
4357
4355
  }
4358
4356
  }
4359
4357
  parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
@@ -4365,6 +4363,7 @@ var Export = /** @__PURE__ @class */ (function () {
4365
4363
  value: { context: tempContext, isSave: true, isFlip: null } });
4366
4364
  }
4367
4365
  this.lowerContext.filter = tempContextFilter;
4366
+ parent.canvasFilter = tempContextFilter;
4368
4367
  if (object) {
4369
4368
  object['canvas'] = tempCanvas;
4370
4369
  }
@@ -4399,17 +4398,10 @@ var Export = /** @__PURE__ @class */ (function () {
4399
4398
  };
4400
4399
  Export.prototype.exportRotate = function (tempContext, degree) {
4401
4400
  var parent = this.parent;
4402
- if (isNullOrUndefined(parent.currSelectionPoint)) {
4403
- this.setMaxDim(parent.transform.degree, tempContext.canvas);
4404
- tempContext.translate(tempContext.canvas.width / 2, tempContext.canvas.height / 2);
4405
- tempContext.rotate(Math.PI / 180 * degree);
4406
- tempContext.drawImage(parent.inMemoryCanvas, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, -tempContext.canvas.height / 2, -tempContext.canvas.width / 2, tempContext.canvas.height, tempContext.canvas.width);
4407
- }
4408
- else {
4409
- tempContext.translate(tempContext.canvas.width / 2, tempContext.canvas.height / 2);
4410
- tempContext.rotate(Math.PI / 180 * degree);
4411
- tempContext.drawImage(parent.inMemoryCanvas, -tempContext.canvas.height / 2, -tempContext.canvas.width / 2, tempContext.canvas.height, tempContext.canvas.width);
4412
- }
4401
+ this.setMaxDim(parent.transform.degree, tempContext.canvas);
4402
+ tempContext.translate(tempContext.canvas.width / 2, tempContext.canvas.height / 2);
4403
+ tempContext.rotate(Math.PI / 180 * degree);
4404
+ tempContext.drawImage(parent.inMemoryCanvas, -tempContext.canvas.height / 2, -tempContext.canvas.width / 2, tempContext.canvas.height, tempContext.canvas.width);
4413
4405
  this.updateSaveContext(tempContext);
4414
4406
  };
4415
4407
  Export.prototype.exportFlip = function (tempContext, flipHorizontal, flipVertical) {
@@ -4436,12 +4428,12 @@ var Export = /** @__PURE__ @class */ (function () {
4436
4428
  var newWidth;
4437
4429
  var newHeight;
4438
4430
  if (degree % 90 === 0 && degree % 180 !== 0) {
4439
- newWidth = this.parent.baseImg.height;
4440
- newHeight = this.parent.baseImg.width;
4431
+ newWidth = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.height : this.parent.img.srcHeight;
4432
+ newHeight = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.width : this.parent.img.srcWidth;
4441
4433
  }
4442
4434
  else if (degree % 180 === 0 || degree === 0) {
4443
- newWidth = this.parent.baseImg.width;
4444
- newHeight = this.parent.baseImg.height;
4435
+ newWidth = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.width : this.parent.img.srcWidth;
4436
+ newHeight = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.height : this.parent.img.srcHeight;
4445
4437
  }
4446
4438
  tempCanvas.width = newWidth;
4447
4439
  tempCanvas.height = newHeight;
@@ -5757,6 +5749,7 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
5757
5749
  }
5758
5750
  };
5759
5751
  FreehandDrawing.prototype.selectFhd = function (index) {
5752
+ var _this = this;
5760
5753
  var parent = this.parent;
5761
5754
  parent.notify('selection', { prop: 'setFreehandDrawEditing', onPropertyChange: false, value: { bool: true } });
5762
5755
  if (index || index === 0) {
@@ -5781,7 +5774,29 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
5781
5774
  var obj = { bool: false };
5782
5775
  parent.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: obj } });
5783
5776
  if (obj['bool']) {
5784
- if (!isBlazor()) {
5777
+ var shapeSettings = { id: 'pen_' + (this.fhdSelIdx + 1), type: ShapeType.FreehandDraw,
5778
+ startX: parent.pointColl[this.fhdSelIdx].points[0].x, startY: parent.pointColl[this.fhdSelIdx].points[0].y,
5779
+ strokeColor: parent.pointColl[this.fhdSelIdx].strokeColor, strokeWidth: parent.pointColl[this.fhdSelIdx].strokeWidth,
5780
+ points: parent.pointColl[this.fhdSelIdx].points };
5781
+ var shapeChangingArgs = { action: 'select', previousShapeSettings: shapeSettings,
5782
+ currentShapeSettings: shapeSettings };
5783
+ if (isBlazor() && parent.events && parent.events.shapeChanging.hasDelegate === true) {
5784
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
5785
+ parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs).then(function (shapeChangingArgs) {
5786
+ parent.pointColl[_this.fhdSelIdx].strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
5787
+ parent.pointColl[_this.fhdSelIdx].strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
5788
+ parent.pointColl[_this.fhdSelIdx].points = shapeChangingArgs.currentShapeSettings.points;
5789
+ _this.freehandRedraw(_this.upperContext);
5790
+ parent.updateToolbar(parent.element, 'imageLoaded');
5791
+ parent.updateToolbar(parent.element, 'pen');
5792
+ });
5793
+ }
5794
+ else {
5795
+ parent.trigger('shapeChanging', shapeChangingArgs);
5796
+ parent.pointColl[this.fhdSelIdx].strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
5797
+ parent.pointColl[this.fhdSelIdx].strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
5798
+ parent.pointColl[this.fhdSelIdx].points = shapeChangingArgs.currentShapeSettings.points;
5799
+ this.freehandRedraw(this.upperContext);
5785
5800
  parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
5786
5801
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
5787
5802
  }
@@ -6403,6 +6418,12 @@ var Selection = /** @__PURE__ @class */ (function () {
6403
6418
  case 'reset':
6404
6419
  this.reset();
6405
6420
  break;
6421
+ case 'unWireEvent':
6422
+ this.unwireEvent();
6423
+ break;
6424
+ case 'updPtCollForShpRot':
6425
+ this.updPtCollForShpRot(args.value['obj']);
6426
+ break;
6406
6427
  }
6407
6428
  };
6408
6429
  Selection.prototype.getModuleName = function () {
@@ -9264,6 +9285,9 @@ var Selection = /** @__PURE__ @class */ (function () {
9264
9285
  if (!this.isFhdEditing) {
9265
9286
  this.applyCurrActObj(x, y);
9266
9287
  parent.currObjType.isResize = false;
9288
+ if (!isBlazor()) {
9289
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
9290
+ }
9267
9291
  }
9268
9292
  }
9269
9293
  if (parent.activeObj) {
@@ -9746,6 +9770,12 @@ var Selection = /** @__PURE__ @class */ (function () {
9746
9770
  EventHandler.add(this.parent.upperCanvas, 'touchend', this.mouseUpEventHandler, this);
9747
9771
  EventHandler.add(this.parent.upperCanvas, 'touchmove', this.mouseMoveEventHandler, this);
9748
9772
  };
9773
+ Selection.prototype.unwireEvent = function () {
9774
+ EventHandler.remove(this.parent.lowerCanvas, 'touchend', this.mouseUpEventHandler);
9775
+ EventHandler.remove(this.parent.lowerCanvas, 'touchmove', this.mouseMoveEventHandler);
9776
+ EventHandler.remove(this.parent.upperCanvas, 'touchend', this.mouseUpEventHandler);
9777
+ EventHandler.remove(this.parent.upperCanvas, 'touchmove', this.mouseMoveEventHandler);
9778
+ };
9749
9779
  Selection.prototype.keyDownEventHandler = function (e) {
9750
9780
  var _this = this;
9751
9781
  var parent = this.parent;
@@ -10581,8 +10611,10 @@ var Selection = /** @__PURE__ @class */ (function () {
10581
10611
  fillColor: parent.activeObj.strokeSettings ? parent.activeObj.strokeSettings.fillColor : null,
10582
10612
  radius: parent.activeObj.shape === 'ellipse' ? parent.activeObj.activePoint.width / 2 : null,
10583
10613
  length: parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' ? parent.activeObj.activePoint.width : null,
10584
- text: parent.activeObj.shape === 'text' ? (parent.activeObj.keyHistory ? parent.activeObj.keyHistory : null) : null,
10614
+ text: parent.activeObj.shape === 'text' ? (parent.activeObj.keyHistory ? parent.activeObj.keyHistory :
10615
+ (parent.activeObj.textSettings.text ? parent.activeObj.textSettings.text : null)) : null,
10585
10616
  fontSize: parent.activeObj.shape === 'text' ? (parent.activeObj.textSettings ? parent.activeObj.textSettings.fontSize : null) : null,
10617
+ fontFamily: parent.activeObj.shape === 'text' ? (parent.activeObj.textSettings ? parent.activeObj.textSettings.fontFamily : null) : null,
10586
10618
  fontStyle: parent.activeObj.shape === 'text' ? fontStyle : null,
10587
10619
  color: parent.activeObj.shape === 'text' ? (parent.activeObj.strokeSettings ? parent.activeObj.strokeSettings.strokeColor : null) : null
10588
10620
  };
@@ -10626,12 +10658,14 @@ var Selection = /** @__PURE__ @class */ (function () {
10626
10658
  if (degree < 0) {
10627
10659
  degree = 360 + degree;
10628
10660
  }
10629
- for (var i = 0; i < obj.flipObjColl.length; i++) {
10630
- if (obj.flipObjColl[i].toLowerCase() === 'horizontal') {
10631
- isHorizontalflip = true;
10632
- }
10633
- else if (obj.flipObjColl[i].toLowerCase() === 'vertical') {
10634
- isVerticalflip = true;
10661
+ if (obj.flipObjColl) {
10662
+ for (var i = 0; i < obj.flipObjColl.length; i++) {
10663
+ if (obj.flipObjColl[i].toLowerCase() === 'horizontal') {
10664
+ isHorizontalflip = true;
10665
+ }
10666
+ else if (obj.flipObjColl[i].toLowerCase() === 'vertical') {
10667
+ isVerticalflip = true;
10668
+ }
10635
10669
  }
10636
10670
  }
10637
10671
  if (degree === 0 || degree === 360) {
@@ -10720,7 +10754,7 @@ var Shape = /** @__PURE__ @class */ (function () {
10720
10754
  this.drawPath(args.value['pointColl'], args.value['strokeWidth'], args.value['strokeColor']);
10721
10755
  break;
10722
10756
  case 'drawRectangle':
10723
- this.drawRectangle(args.value['x'], args.value['y'], args.value['width'], args.value['height'], args.value['strokeWidt'], args.value['strokeColor'], args.value['fillColor']);
10757
+ this.drawRectangle(args.value['x'], args.value['y'], args.value['width'], args.value['height'], args.value['strokeWidth'], args.value['strokeColor'], args.value['fillColor']);
10724
10758
  break;
10725
10759
  case 'drawText':
10726
10760
  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']);
@@ -10911,10 +10945,10 @@ var Shape = /** @__PURE__ @class */ (function () {
10911
10945
  { text: 'Enter Text', fontFamily: 'Arial', fontSize: null, fontRatio: null, bold: false, italic: false, underline: false };
10912
10946
  this.strokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null };
10913
10947
  };
10914
- Shape.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor) {
10948
+ Shape.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree) {
10915
10949
  this.initializeShape('ellipse');
10916
10950
  var start = x && y ? { x: x, y: y } : null;
10917
- this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY);
10951
+ this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY, null, null, null, degree);
10918
10952
  };
10919
10953
  Shape.prototype.drawLine = function (startX, startY, endX, endY, strokeWidth, strokeColor) {
10920
10954
  this.initializeShape('line');
@@ -10945,10 +10979,10 @@ var Shape = /** @__PURE__ @class */ (function () {
10945
10979
  var height = endY - startY;
10946
10980
  this.drawShape('arrow', strokeWidth, strokeColor, null, start, width, height, null, arrowStart, arrowEnd);
10947
10981
  };
10948
- Shape.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor) {
10982
+ Shape.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor, degree) {
10949
10983
  this.initializeShape('rectangle');
10950
10984
  var start = x && y ? { x: x, y: y } : null;
10951
- this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height);
10985
+ this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height, null, null, null, degree);
10952
10986
  };
10953
10987
  Shape.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color) {
10954
10988
  this.drawShapeText(text, fontFamily, fontSize, bold, italic, color, x, y);
@@ -10987,7 +11021,7 @@ var Shape = /** @__PURE__ @class */ (function () {
10987
11021
  }
10988
11022
  return arrowType;
10989
11023
  };
10990
- Shape.prototype.drawShape = function (type, strokeWidth, strokeColor, fillColor, start, width, height, pointColl, arrowStart, arrowEnd) {
11024
+ Shape.prototype.drawShape = function (type, strokeWidth, strokeColor, fillColor, start, width, height, pointColl, arrowStart, arrowEnd, degree) {
10991
11025
  var _this = this;
10992
11026
  var parent = this.parent;
10993
11027
  if (!parent.disabled && parent.isImageLoaded) {
@@ -11056,10 +11090,7 @@ var Shape = /** @__PURE__ @class */ (function () {
11056
11090
  parent.activeObj.triangleDirection = 'right';
11057
11091
  }
11058
11092
  parent.currObjType.isDragging = parent.currObjType.isCustomCrop = false;
11059
- parent.activeObj.shapeDegree = parent.transform.degree;
11060
- parent.activeObj.shapeFlip = parent.transform.currFlipState;
11061
- parent.activeObj.textFlip = parent.transform.currFlipState;
11062
- parent.activeObj.flipObjColl = [];
11093
+ this.initShapeProps();
11063
11094
  var obj = { shapeSettingsObj: {} };
11064
11095
  parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
11065
11096
  var shapeSettings = obj['shapeSettingsObj'];
@@ -11071,6 +11102,10 @@ var Shape = /** @__PURE__ @class */ (function () {
11071
11102
  _this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
11072
11103
  _this.setDimension(width, height);
11073
11104
  parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
11105
+ if (degree) {
11106
+ parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
11107
+ parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
11108
+ }
11074
11109
  parent.updateToolbar(parent.element, 'quickAccessToolbar', 'shape');
11075
11110
  parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
11076
11111
  parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl_1 } });
@@ -11085,6 +11120,10 @@ var Shape = /** @__PURE__ @class */ (function () {
11085
11120
  this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
11086
11121
  this.setDimension(width, height);
11087
11122
  parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
11123
+ if (degree) {
11124
+ parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
11125
+ parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
11126
+ }
11088
11127
  if (!isBlazor()) {
11089
11128
  parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
11090
11129
  }
@@ -11105,6 +11144,13 @@ var Shape = /** @__PURE__ @class */ (function () {
11105
11144
  }
11106
11145
  }
11107
11146
  };
11147
+ Shape.prototype.initShapeProps = function () {
11148
+ var parent = this.parent;
11149
+ parent.activeObj.shapeDegree = parent.transform.degree;
11150
+ parent.activeObj.shapeFlip = parent.transform.currFlipState;
11151
+ parent.activeObj.textFlip = parent.transform.currFlipState;
11152
+ parent.activeObj.flipObjColl = [];
11153
+ };
11108
11154
  Shape.prototype.setPointCollForLineAndArrow = function () {
11109
11155
  var parent = this.parent;
11110
11156
  if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow') {
@@ -11119,6 +11165,19 @@ var Shape = /** @__PURE__ @class */ (function () {
11119
11165
  }
11120
11166
  }
11121
11167
  };
11168
+ Shape.prototype.prevObjColl = function () {
11169
+ var parent = this.parent;
11170
+ var object = { currObj: {} };
11171
+ parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
11172
+ this.prevObj = object['currObj'];
11173
+ this.prevObj.objColl = extend([], parent.objColl, [], true);
11174
+ this.prevObj.pointColl = extend([], parent.pointColl, [], true);
11175
+ this.prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
11176
+ var selPointCollObj = { selPointColl: null };
11177
+ parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
11178
+ value: { obj: selPointCollObj } });
11179
+ this.prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
11180
+ };
11122
11181
  Shape.prototype.drawShapeText = function (text, fontFamily, fontSize, bold, italic, strokeColor, x, y) {
11123
11182
  var _this = this;
11124
11183
  var parent = this.parent;
@@ -11131,16 +11190,7 @@ var Shape = /** @__PURE__ @class */ (function () {
11131
11190
  parent.notify('draw', { prop: 'setImageEdited', onPropertyChange: false });
11132
11191
  parent.togglePen = false;
11133
11192
  this.redrawActObj();
11134
- var object = { currObj: {} };
11135
- parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
11136
- this.prevObj = object['currObj'];
11137
- this.prevObj.objColl = extend([], parent.objColl, [], true);
11138
- this.prevObj.pointColl = extend([], parent.pointColl, [], true);
11139
- this.prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
11140
- var selPointCollObj = { selPointColl: null };
11141
- parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
11142
- value: { obj: selPointCollObj } });
11143
- this.prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
11193
+ this.prevObjColl();
11144
11194
  this.refreshActiveObj();
11145
11195
  parent.activeObj.shape = parent.currObjType.shape = 'text';
11146
11196
  parent.currObjType.isCustomCrop = false;
@@ -11379,9 +11429,12 @@ var Shape = /** @__PURE__ @class */ (function () {
11379
11429
  parent.activeObj.activePoint.width = shapeSettings.length;
11380
11430
  break;
11381
11431
  case 'text':
11382
- parent.activeObj.keyHistory = shapeSettings.text;
11432
+ parent.activeObj.keyHistory = parent.activeObj.textSettings.text = shapeSettings.text;
11383
11433
  parent.activeObj.textSettings.fontSize = shapeSettings.fontSize;
11384
11434
  parent.activeObj.strokeSettings.strokeColor = shapeSettings.color;
11435
+ parent.activeObj.textSettings.fontFamily = shapeSettings.fontFamily;
11436
+ break;
11437
+ case 'rectangle':
11385
11438
  break;
11386
11439
  }
11387
11440
  if (parent.activeObj.shape === 'text' && parent.activeObj.textSettings) {
@@ -12247,6 +12300,7 @@ var Shape = /** @__PURE__ @class */ (function () {
12247
12300
  if (actObj.flipObjColl.length === 4) {
12248
12301
  actObj.flipObjColl = [];
12249
12302
  flip = '';
12303
+ actObj.shapeFlip = '';
12250
12304
  }
12251
12305
  if (flip === '' && actObj.flipObjColl.length > 1) {
12252
12306
  flip = actObj.flipObjColl[actObj.flipObjColl.length - 1];
@@ -12898,6 +12952,10 @@ var Shape = /** @__PURE__ @class */ (function () {
12898
12952
  shapeDetails.fontStyle.push('italic');
12899
12953
  }
12900
12954
  break;
12955
+ case 'path':
12956
+ shapeDetails.strokeColor = obj.strokeSettings.strokeColor;
12957
+ shapeDetails.strokeWidth = obj.strokeSettings.strokeWidth;
12958
+ break;
12901
12959
  }
12902
12960
  return shapeDetails;
12903
12961
  };
@@ -13168,7 +13226,12 @@ var Shape = /** @__PURE__ @class */ (function () {
13168
13226
  this.lowerContext.filter = object['canvasFilter'];
13169
13227
  this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
13170
13228
  parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
13171
- parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
13229
+ if (!isBlazor()) {
13230
+ parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
13231
+ }
13232
+ else {
13233
+ parent.updateToolbar(parent.element, 'imageLoaded');
13234
+ }
13172
13235
  }
13173
13236
  };
13174
13237
  Shape.prototype.getMaxText = function (isTextBox, text, obj) {
@@ -13568,6 +13631,12 @@ var Transform = /** @__PURE__ @class */ (function () {
13568
13631
  this.cropDimension.width = args.value['width'];
13569
13632
  this.cropDimension.height = args.value['height'];
13570
13633
  break;
13634
+ case 'getPreventSelect':
13635
+ args.value['obj']['bool'] = this.isPreventSelect;
13636
+ break;
13637
+ case 'setPreventSelect':
13638
+ this.isPreventSelect = args.value['bool'];
13639
+ break;
13571
13640
  case 'reset':
13572
13641
  this.reset();
13573
13642
  break;
@@ -14692,6 +14761,9 @@ var Transform = /** @__PURE__ @class */ (function () {
14692
14761
  parent.notify('shape', { prop: 'alignRotateFlipColl', onPropertyChange: false,
14693
14762
  value: { collection: parent.objColl[i].flipObjColl, isRotateFlipCollection: null, obj: flipObjColl } });
14694
14763
  parent.objColl[i].flipObjColl = flipObjColl['collection'];
14764
+ if (parent.objColl[i].flipObjColl.length === 0) {
14765
+ parent.objColl[i].shapeFlip = '';
14766
+ }
14695
14767
  }
14696
14768
  }
14697
14769
  if (tempZoomFactor !== 0) {
@@ -15057,6 +15129,7 @@ var Transform = /** @__PURE__ @class */ (function () {
15057
15129
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
15058
15130
  this.lowerContext.filter = tempFilter;
15059
15131
  parent.initialAdjustmentValue = tempFilter;
15132
+ parent.canvasFilter = this.lowerContext.filter;
15060
15133
  if (parent.isImageLoaded) {
15061
15134
  showSpinner(parent.element);
15062
15135
  parent.element.style.opacity = '0.5';
@@ -15536,7 +15609,9 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
15536
15609
  this.undoRedoStep--;
15537
15610
  if (!isBlazor()) {
15538
15611
  parent.notify('toolbar', { prop: 'enable-disable-btns' });
15539
- parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
15612
+ if (parent.element.querySelector('.e-contextual-toolbar-wrapper')) {
15613
+ parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
15614
+ }
15540
15615
  }
15541
15616
  else {
15542
15617
  parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
@@ -15639,7 +15714,7 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
15639
15714
  parent.cropObj = extend({}, obj.currentCropObj, {}, true);
15640
15715
  parent.afterCropActions = obj.currentObj.afterCropActions;
15641
15716
  this.lowerContext.filter = obj.currentObj.filter;
15642
- if (!isBlazor()) {
15717
+ if (!isBlazor() && parent.element.querySelector('.e-contextual-toolbar-wrapper')) {
15643
15718
  parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
15644
15719
  }
15645
15720
  parent.canvasFilter = this.lowerContext.filter;
@@ -16512,7 +16587,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
16512
16587
  this.inMemoryContext = this.inMemoryCanvas.getContext('2d');
16513
16588
  this.lowerContext.filter = this.getDefaultFilter();
16514
16589
  this.notify('filter', { prop: 'setAdjustmentValue', onPropertyChange: false, value: { adjustmentValue: this.lowerContext.filter } });
16515
- this.notify('toolbar', { prop: 'setCanvasFilter', onPropertyChange: false, value: { filter: this.lowerContext.filter } });
16590
+ this.canvasFilter = this.lowerContext.filter;
16516
16591
  this.notify('toolbar', { prop: 'setInitialAdjustmentValue', onPropertyChange: false, value: { value: this.lowerContext.filter } });
16517
16592
  if (this.cssClass) {
16518
16593
  addClass([this.element], this.cssClass.replace(/\s+/g, ' ').trim().split(' '));
@@ -16577,6 +16652,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
16577
16652
  screen.orientation.removeEventListener('change', this.screenOrientation.bind(this));
16578
16653
  }
16579
16654
  this.notify('shape', { prop: 'unWireEvent', onPropertyChange: false });
16655
+ this.notify('selection', { prop: 'unWireEvent', onPropertyChange: false });
16580
16656
  };
16581
16657
  ImageEditor.prototype.createCanvas = function () {
16582
16658
  this.element.style.boxSizing = 'border-box';
@@ -17513,8 +17589,10 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
17513
17589
  this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
17514
17590
  var data = this.getImageData();
17515
17591
  if (!isBlazor()) {
17516
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
17517
- isApplyBtn: true, isCropping: false } });
17592
+ if (!Browser.isDevice) {
17593
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
17594
+ isApplyBtn: true, isCropping: false } });
17595
+ }
17518
17596
  this.element.querySelector('#' + this.element.id + '_contextualToolbarArea').classList.remove('e-hide');
17519
17597
  }
17520
17598
  this.objColl = objColl;
@@ -18129,8 +18207,8 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
18129
18207
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
18130
18208
  this.element = element;
18131
18209
  var canvasWrapper = this.element.querySelector('.e-canvas-wrapper');
18132
- if (this.element.querySelector('#' + this.element.id + '_toolbar')) {
18133
- this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbar').clientHeight;
18210
+ if (this.element.querySelector('#' + this.element.id + '_toolbarArea')) {
18211
+ this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').clientHeight;
18134
18212
  }
18135
18213
  else {
18136
18214
  this.toolbarHeight = 0;
@@ -18147,9 +18225,6 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
18147
18225
  });
18148
18226
  this.upperCanvas.width = this.lowerCanvas.width = this.inMemoryCanvas.width = this.element.offsetWidth;
18149
18227
  this.upperCanvas.height = this.lowerCanvas.height = this.inMemoryCanvas.height = (this.element.offsetHeight - this.toolbarHeight);
18150
- this.baseImg = this.createElement('img', {
18151
- id: this.element.id + '_orgImg', attrs: { name: 'Image', crossorigin: 'anonymous' }
18152
- });
18153
18228
  this.lowerContext = this.lowerCanvas.getContext('2d');
18154
18229
  this.baseImg = this.createElement('img', {
18155
18230
  id: this.element.id + '_orgImg', attrs: { name: 'Image', crossorigin: 'anonymous' }
@@ -18733,9 +18808,6 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
18733
18808
  case 'getCanvasFilter':
18734
18809
  args.value['obj']['canvasFilter'] = parent.canvasFilter;
18735
18810
  break;
18736
- case 'setCanvasFilter':
18737
- parent.canvasFilter = args.value['filter'];
18738
- break;
18739
18811
  case 'getDefToolbarItems':
18740
18812
  args.value['obj']['defToolbarItems'] = this.defToolbarItems;
18741
18813
  break;
@@ -20141,7 +20213,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
20141
20213
  if (!parent.isImageLoaded || parent.isCropToolbar) {
20142
20214
  return;
20143
20215
  }
20144
- var args = { toolbarType: type };
20216
+ var item = type === 'shapes' && parent.activeObj.shape ? parent.activeObj.shape : type;
20217
+ var args = { toolbarType: item };
20145
20218
  if (type !== 'filter' && type !== 'color') {
20146
20219
  if (document.getElementById(parent.element.id + '_toolbar') && this.defToolbarItems.length > 0) {
20147
20220
  getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
@@ -21357,7 +21430,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
21357
21430
  var parent = this.parent;
21358
21431
  if (document.querySelector('#' + parent.element.id + '_sliderWrapper') ||
21359
21432
  parent.currObjType.isFiltered) {
21360
- parent.initialAdjustmentValue = parent.canvasFilter = this.lowerContext.filter;
21433
+ parent.initialAdjustmentValue = this.lowerContext.filter;
21434
+ parent.canvasFilter = this.lowerContext.filter;
21361
21435
  parent.currObjType.isFiltered = false;
21362
21436
  }
21363
21437
  };