@syncfusion/ej2-image-editor 22.1.37 → 22.1.39

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 (58) 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 +342 -273
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +344 -274
  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 +10 -10
  12. package/src/image-editor/action/crop.d.ts +2 -0
  13. package/src/image-editor/action/crop.js +92 -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 +24 -1
  17. package/src/image-editor/action/selection.js +17 -7
  18. package/src/image-editor/action/shape.d.ts +2 -0
  19. package/src/image-editor/action/shape.js +54 -22
  20. package/src/image-editor/action/transform.js +10 -0
  21. package/src/image-editor/base/image-editor.js +7 -5
  22. package/src/image-editor/base/interface.d.ts +6 -2
  23. package/src/image-editor/renderer/toolbar.js +4 -5
  24. package/styles/bootstrap-dark.css +20 -8
  25. package/styles/bootstrap.css +20 -8
  26. package/styles/bootstrap4.css +20 -8
  27. package/styles/bootstrap5-dark.css +20 -8
  28. package/styles/bootstrap5.css +20 -8
  29. package/styles/fabric-dark.css +20 -8
  30. package/styles/fabric.css +20 -8
  31. package/styles/fluent-dark.css +20 -8
  32. package/styles/fluent.css +20 -8
  33. package/styles/highcontrast-light.css +20 -8
  34. package/styles/highcontrast.css +20 -8
  35. package/styles/image-editor/_layout.scss +20 -2
  36. package/styles/image-editor/bootstrap-dark.css +20 -8
  37. package/styles/image-editor/bootstrap.css +20 -8
  38. package/styles/image-editor/bootstrap4.css +20 -8
  39. package/styles/image-editor/bootstrap5-dark.css +20 -8
  40. package/styles/image-editor/bootstrap5.css +20 -8
  41. package/styles/image-editor/fabric-dark.css +20 -8
  42. package/styles/image-editor/fabric.css +20 -8
  43. package/styles/image-editor/fluent-dark.css +20 -8
  44. package/styles/image-editor/fluent.css +20 -8
  45. package/styles/image-editor/highcontrast-light.css +20 -8
  46. package/styles/image-editor/highcontrast.css +20 -8
  47. package/styles/image-editor/material-dark.css +20 -8
  48. package/styles/image-editor/material.css +20 -8
  49. package/styles/image-editor/material3-dark.css +20 -8
  50. package/styles/image-editor/material3.css +20 -8
  51. package/styles/image-editor/tailwind-dark.css +20 -8
  52. package/styles/image-editor/tailwind.css +20 -8
  53. package/styles/material-dark.css +20 -8
  54. package/styles/material.css +20 -8
  55. package/styles/material3-dark.css +20 -8
  56. package/styles/material3.css +20 -8
  57. package/styles/tailwind-dark.css +20 -8
  58. 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,28 @@ 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 obj = extend({}, parent.currSelectionPoint, null, true);
540
+ parent.currSelectionPoint = null;
541
+ var panX = parent.transform.degree === 0 ?
542
+ isReverse ? -parent.cropObj.totalPannedPoint.x : parent.cropObj.totalPannedPoint.x :
543
+ isReverse ? -parent.cropObj.totalPannedClientPoint.x : parent.cropObj.totalPannedClientPoint.x;
544
+ var panY = parent.transform.degree === 0 ?
545
+ isReverse ? -parent.cropObj.totalPannedPoint.y : parent.cropObj.totalPannedPoint.y :
546
+ isReverse ? -parent.cropObj.totalPannedClientPoint.y : parent.cropObj.totalPannedClientPoint.y;
547
+ if (parent.transform.degree === 0) {
548
+ parent.img.destLeft += panX;
549
+ parent.img.destTop += panY;
550
+ parent.notify('transform', { prop: 'drawPannImage', value: { point: { x: panX, y: panY } } });
551
+ }
552
+ else {
553
+ parent.panPoint.currentPannedPoint = { x: panX, y: panY };
554
+ parent.notify('transform', { prop: 'drawPannedImage', value: { xDiff: panX, yDiff: panY } });
555
+ parent.panPoint.currentPannedPoint = { x: 0, y: 0 };
556
+ }
557
+ parent.currSelectionPoint = obj;
558
+ };
563
559
  Crop.prototype.cropCircle = function (context, isSave, isFlip) {
564
560
  var parent = this.parent;
565
561
  if (isFlip && parent.transform.currFlipState !== '') {
@@ -568,9 +564,9 @@ var Crop = /** @__PURE__ @class */ (function () {
568
564
  }
569
565
  context.globalCompositeOperation = 'destination-in';
570
566
  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;
567
+ var centerX = isNullOrUndefined(isSave) ? parent.img.destLeft + (parent.img.destWidth / 2) : context.canvas.width / 2;
568
+ var centerY = isNullOrUndefined(isSave) ? parent.img.destTop + (parent.img.destHeight / 2) : context.canvas.height / 2;
569
+ var radius = isSave ? context.canvas.width / 2 : parent.img.destWidth / 2;
574
570
  context.arc(centerX, centerY, radius, 0, Math.PI * 2);
575
571
  context.closePath();
576
572
  context.fill();
@@ -749,7 +745,6 @@ var Crop = /** @__PURE__ @class */ (function () {
749
745
  }
750
746
  this.cropImg();
751
747
  parent.transform.zoomFactor = 0;
752
- parent.zoomSettings.zoomFactor = 1;
753
748
  parent.setProperties({ zoomSettings: { zoomFactor: 1 } }, true);
754
749
  parent.notify('transform', { prop: 'setPreviousZoomValue', onPropertyChange: false,
755
750
  value: { previousZoomValue: parent.zoomSettings.zoomFactor } });
@@ -775,17 +770,17 @@ var Crop = /** @__PURE__ @class */ (function () {
775
770
  }
776
771
  }
777
772
  };
778
- Crop.prototype.calcRatio = function (obj) {
773
+ Crop.prototype.calcRatio = function (obj, dimension) {
779
774
  var parent = this.parent;
780
775
  var widthRatio;
781
776
  var heightRatio;
782
777
  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;
778
+ widthRatio = (dimension ? dimension.width : parent.baseImg.width) / parent.img.destWidth;
779
+ heightRatio = (dimension ? dimension.height : parent.baseImg.height) / parent.img.destHeight;
785
780
  }
786
781
  else {
787
- widthRatio = parent.baseImg.height / parent.img.destWidth;
788
- heightRatio = parent.baseImg.width / parent.img.destHeight;
782
+ widthRatio = (dimension ? dimension.height : parent.baseImg.height) / parent.img.destWidth;
783
+ heightRatio = (dimension ? dimension.width : parent.baseImg.width) / parent.img.destHeight;
789
784
  }
790
785
  if (obj) {
791
786
  obj['width'] = widthRatio;
@@ -1118,6 +1113,10 @@ var Draw = /** @__PURE__ @class */ (function () {
1118
1113
  parent.activeObj = extend({}, obj, {}, true);
1119
1114
  }
1120
1115
  this.updateActiveObject();
1116
+ if (isNullOrUndefined(parent.activeObj.activePoint.startX) &&
1117
+ isNullOrUndefined(parent.activeObj.activePoint.startY)) {
1118
+ return;
1119
+ }
1121
1120
  if (parent.currObjType.isText) {
1122
1121
  var obj_2 = { keyHistory: '' };
1123
1122
  parent.notify('shape', { prop: 'getKeyHistory', onPropertyChange: false, value: { obj: obj_2 } });
@@ -1788,12 +1787,14 @@ var Draw = /** @__PURE__ @class */ (function () {
1788
1787
  if (degree < 0) {
1789
1788
  degree = 360 + degree;
1790
1789
  }
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;
1790
+ if (parent.activeObj.flipObjColl) {
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;
1797
+ }
1797
1798
  }
1798
1799
  }
1799
1800
  switch (degree) {
@@ -2372,17 +2373,18 @@ var Draw = /** @__PURE__ @class */ (function () {
2372
2373
  parent.activeObj.textSettings.fontFamily;
2373
2374
  if (parent.activeObj.flipObjColl.length === 4) {
2374
2375
  parent.activeObj.flipObjColl = [];
2376
+ parent.activeObj.shapeFlip = '';
2375
2377
  }
2376
2378
  for (var j = 0, len = parent.activeObj.flipObjColl.length; j < len; j++) {
2377
2379
  if (parent.activeObj.flipObjColl[j].toLowerCase() === 'horizontal') {
2378
2380
  canvasDraw.translate(canvasDraw.canvas.width, 0);
2379
2381
  canvasDraw.scale(-1, 1);
2380
- this.updateActPoint('horizontal', canvasDraw);
2382
+ actPoint = this.updateActPoint('horizontal', canvasDraw);
2381
2383
  }
2382
2384
  else if (parent.activeObj.flipObjColl[j].toLowerCase() === 'vertical') {
2383
2385
  canvasDraw.translate(0, canvasDraw.canvas.height);
2384
2386
  canvasDraw.scale(1, -1);
2385
- this.updateActPoint('vertical', canvasDraw);
2387
+ actPoint = this.updateActPoint('vertical', canvasDraw);
2386
2388
  }
2387
2389
  }
2388
2390
  if (parent.activeObj.shapeDegree !== parent.transform.degree) {
@@ -2395,12 +2397,12 @@ var Draw = /** @__PURE__ @class */ (function () {
2395
2397
  if (parent.activeObj.flipObjColl[k].toLowerCase() === 'horizontal') {
2396
2398
  canvasDraw.translate(canvasDraw.canvas.width, 0);
2397
2399
  canvasDraw.scale(-1, 1);
2398
- this.updateActPoint('horizontal', canvasDraw);
2400
+ actPoint = this.updateActPoint('horizontal', canvasDraw);
2399
2401
  }
2400
2402
  else if (parent.activeObj.flipObjColl[k].toLowerCase() === 'vertical') {
2401
2403
  canvasDraw.translate(0, canvasDraw.canvas.height);
2402
2404
  canvasDraw.scale(1, -1);
2403
- this.updateActPoint('vertical', canvasDraw);
2405
+ actPoint = this.updateActPoint('vertical', canvasDraw);
2404
2406
  }
2405
2407
  }
2406
2408
  }
@@ -2436,6 +2438,7 @@ var Draw = /** @__PURE__ @class */ (function () {
2436
2438
  this.updateActiveObject(actPoint, parent.activeObj);
2437
2439
  }
2438
2440
  }
2441
+ return actPoint;
2439
2442
  };
2440
2443
  Draw.prototype.rotateText = function (canvasDraw) {
2441
2444
  var parent = this.parent;
@@ -2449,6 +2452,9 @@ var Draw = /** @__PURE__ @class */ (function () {
2449
2452
  else {
2450
2453
  degree = parent.transform.degree - parent.activeObj.shapeDegree;
2451
2454
  }
2455
+ if (degree === -450) {
2456
+ degree = -90;
2457
+ }
2452
2458
  if (degree < 0) {
2453
2459
  degree = 360 + degree;
2454
2460
  }
@@ -3774,11 +3780,8 @@ var Draw = /** @__PURE__ @class */ (function () {
3774
3780
  }
3775
3781
  }
3776
3782
  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;
3783
+ if (parent.element.querySelector('#' + parent.element.id + '_toolbarArea')) {
3784
+ parent.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
3782
3785
  }
3783
3786
  }
3784
3787
  parent.reset();
@@ -3821,8 +3824,8 @@ var Draw = /** @__PURE__ @class */ (function () {
3821
3824
  parent.clearContext(this.lowerContext);
3822
3825
  parent.clearContext(this.upperContext);
3823
3826
  parent.clearContext(inMemoryContext);
3824
- parent.inMemoryCanvas.width = parent.baseImg.width = this.openURL.width;
3825
- parent.inMemoryCanvas.height = parent.baseImg.height = this.openURL.height;
3827
+ parent.inMemoryCanvas.width = this.openURL.width;
3828
+ parent.inMemoryCanvas.height = this.openURL.height;
3826
3829
  inMemoryContext.putImageData(this.openURL, 0, 0);
3827
3830
  parent.baseImg.src = parent.inMemoryCanvas.toDataURL();
3828
3831
  }
@@ -3978,75 +3981,84 @@ var Draw = /** @__PURE__ @class */ (function () {
3978
3981
  Draw.prototype.moveToSelectionRange = function (type, activeObj) {
3979
3982
  var parent = this.parent;
3980
3983
  if (parent.activeObj.shape) {
3981
- if (type === 'rotateleft' || type === 'rotateright') {
3984
+ var isRotated = false;
3985
+ for (var i = 0; i < parent.rotateFlipColl.length; i++) {
3986
+ if (parent.rotateFlipColl[i] === 90 || parent.rotateFlipColl[i] === -90) {
3987
+ isRotated = true;
3988
+ break;
3989
+ }
3990
+ }
3991
+ if (isRotated) {
3982
3992
  var zoomFactor = parent.transform.zoomFactor;
3983
3993
  parent.objColl.push(parent.activeObj);
3984
3994
  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 } });
3995
+ if (type === 'rotateleft' || type === 'rotateright') {
3996
+ if (parent.transform.degree % 90 === 0 && parent.transform.degree % 180 !== 0) {
3997
+ if (parent.objColl[parent.objColl.length - 1].activePoint.width < activeObj.activePoint.height) {
3998
+ for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
3999
+ if (parent.objColl[parent.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
4000
+ this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
4001
+ this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
4002
+ if (!isNullOrUndefined(zoomFactor)) {
4003
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4004
+ value: { zoomFactor: -0.1, zoomPoint: null } });
4005
+ }
4006
+ break;
3994
4007
  }
3995
- break;
4008
+ zoomFactor += 0.1;
4009
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4010
+ value: { zoomFactor: zoomFactor, zoomPoint: null } });
3996
4011
  }
3997
- zoomFactor += 0.1;
3998
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3999
- value: { zoomFactor: zoomFactor, zoomPoint: null } });
4000
4012
  }
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 } });
4013
+ else {
4014
+ for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
4015
+ if (parent.objColl[parent.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
4016
+ this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
4017
+ this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
4018
+ if (!isNullOrUndefined(zoomFactor)) {
4019
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4020
+ value: { zoomFactor: 0.1, zoomPoint: null } });
4021
+ }
4022
+ break;
4010
4023
  }
4011
- break;
4024
+ zoomFactor -= .1;
4025
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4026
+ value: { zoomFactor: zoomFactor, zoomPoint: null } });
4012
4027
  }
4013
- zoomFactor -= .1;
4014
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4015
- value: { zoomFactor: zoomFactor, zoomPoint: null } });
4016
4028
  }
4017
4029
  }
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 } });
4030
+ else {
4031
+ if (parent.objColl[parent.objColl.length - 1].activePoint.height < activeObj.activePoint.width) {
4032
+ for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
4033
+ if (parent.objColl[parent.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
4034
+ this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
4035
+ this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
4036
+ if (!isNullOrUndefined(zoomFactor)) {
4037
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4038
+ value: { zoomFactor: -0.1, zoomPoint: null } });
4039
+ }
4040
+ break;
4028
4041
  }
4029
- break;
4042
+ zoomFactor += 0.1;
4043
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4044
+ value: { zoomFactor: zoomFactor, zoomPoint: null } });
4030
4045
  }
4031
- zoomFactor += 0.1;
4032
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4033
- value: { zoomFactor: zoomFactor, zoomPoint: null } });
4034
4046
  }
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 } });
4047
+ else {
4048
+ for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
4049
+ if (parent.objColl[parent.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
4050
+ this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
4051
+ this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
4052
+ if (!isNullOrUndefined(zoomFactor)) {
4053
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4054
+ value: { zoomFactor: 0.1, zoomPoint: null } });
4055
+ }
4056
+ break;
4044
4057
  }
4045
- break;
4058
+ zoomFactor -= .1;
4059
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4060
+ value: { zoomFactor: zoomFactor, zoomPoint: null } });
4046
4061
  }
4047
- zoomFactor -= .1;
4048
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4049
- value: { zoomFactor: zoomFactor, zoomPoint: null } });
4050
4062
  }
4051
4063
  }
4052
4064
  }
@@ -4256,8 +4268,19 @@ var Export = /** @__PURE__ @class */ (function () {
4256
4268
  };
4257
4269
  Export.prototype.exportToCanvas = function (object) {
4258
4270
  var parent = this.parent;
4271
+ var width;
4272
+ var height;
4273
+ if (parent.currSelectionPoint) {
4274
+ width = parent.img.srcWidth;
4275
+ height = parent.img.srcHeight;
4276
+ }
4277
+ else {
4278
+ width = parent.baseImg.width;
4279
+ height = parent.baseImg.height;
4280
+ }
4259
4281
  var obj = { width: 0, height: 0 };
4260
- parent.notify('crop', { prop: 'calcRatio', onPropertyChange: false, value: { obj: obj } });
4282
+ parent.notify('crop', { prop: 'calcRatio', onPropertyChange: false,
4283
+ value: { obj: obj, dimension: { width: width, height: height } } });
4261
4284
  var ratio = obj;
4262
4285
  var tempContextFilter = this.lowerContext.filter;
4263
4286
  // Manipulating blur value
@@ -4268,42 +4291,30 @@ var Export = /** @__PURE__ @class */ (function () {
4268
4291
  splitWords[5] = 'blur(' + value + 'px)';
4269
4292
  this.lowerContext.filter = splitWords.join(' ');
4270
4293
  }
4271
- var maxDimension;
4272
4294
  var tempCanvas = parent.createElement('canvas', {
4273
4295
  id: parent.element.id + '_tempCanvas', attrs: { name: 'canvasImage' }
4274
4296
  });
4275
4297
  var tempContext = tempCanvas.getContext('2d');
4276
4298
  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
- }
4299
+ tempCanvas.width = width;
4300
+ tempCanvas.height = height;
4301
+ var dimObj = { width: 0, height: 0 };
4302
+ parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
4303
+ value: { width: width, height: height, obj: dimObj } });
4304
+ var maxDimension = dimObj;
4305
+ tempCanvas.style.maxWidth = maxDimension.width + 'px';
4306
+ tempCanvas.style.maxHeight = maxDimension.height + 'px';
4307
+ tempContext.filter = this.lowerContext.filter;
4308
+ var temp = this.lowerContext.filter;
4309
+ parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
4310
+ tempContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, 0, 0, width, height);
4311
+ this.lowerContext.filter = temp;
4301
4312
  if (parent.transform.degree !== 0 || parent.transform.currFlipState !== '') {
4302
4313
  this.updateSaveContext(tempContext);
4303
4314
  this.exportTransformedImage(tempContext);
4304
4315
  }
4305
4316
  if (parent.objColl.length > 0) {
4306
- var temp = tempContext.filter;
4317
+ var temp_1 = tempContext.filter;
4307
4318
  tempContext.filter = 'none';
4308
4319
  var tempObjColl = extend([], parent.objColl, [], true);
4309
4320
  for (var i = 0, len = parent.objColl.length; i < len; i++) {
@@ -4316,22 +4327,20 @@ var Export = /** @__PURE__ @class */ (function () {
4316
4327
  activePoint.width = activePoint.endX - activePoint.startX;
4317
4328
  activePoint.height = activePoint.endY - activePoint.startY;
4318
4329
  // 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
- }
4330
+ activePoint.startX *= ratio.width;
4331
+ activePoint.startY *= ratio.height;
4332
+ activePoint.endX *= ratio.width;
4333
+ activePoint.endY *= ratio.height;
4334
+ activePoint.width = activePoint.endX - activePoint.startX;
4335
+ activePoint.height = activePoint.endY - activePoint.startY;
4336
+ parent.objColl[i].strokeSettings.strokeWidth *= ((ratio.width + ratio.height) / 2);
4337
+ if (parent.objColl[i].shape === 'text') {
4338
+ parent.objColl[i].textSettings.fontSize *= ((ratio.width + ratio.height) / 2);
4330
4339
  }
4331
4340
  parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'saveContext', obj: parent.objColl[i], isCropRatio: null,
4332
4341
  points: null, isPreventDrag: true, saveContext: tempContext, isPreventSelection: null } });
4333
4342
  }
4334
- tempContext.filter = temp;
4343
+ tempContext.filter = temp_1;
4335
4344
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
4336
4345
  parent.objColl = tempObjColl;
4337
4346
  }
@@ -4342,18 +4351,10 @@ var Export = /** @__PURE__ @class */ (function () {
4342
4351
  parent.points = extend([], parent.pointColl[n].points, []);
4343
4352
  parent.notify('freehand-draw', { prop: 'setPointCounter', onPropertyChange: false, value: { value: 0 } });
4344
4353
  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
- }
4354
+ parent.pointColl[n].strokeWidth *= ((ratio.width + ratio.height) / 2);
4355
+ for (var l = 0; l < len; l++) {
4356
+ parent.points[l].x = (parent.points[l].x - parent.img.destLeft) * ratio.width;
4357
+ parent.points[l].y = (parent.points[l].y - parent.img.destTop) * ratio.height;
4357
4358
  }
4358
4359
  }
4359
4360
  parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
@@ -4365,6 +4366,7 @@ var Export = /** @__PURE__ @class */ (function () {
4365
4366
  value: { context: tempContext, isSave: true, isFlip: null } });
4366
4367
  }
4367
4368
  this.lowerContext.filter = tempContextFilter;
4369
+ parent.canvasFilter = tempContextFilter;
4368
4370
  if (object) {
4369
4371
  object['canvas'] = tempCanvas;
4370
4372
  }
@@ -4399,17 +4401,10 @@ var Export = /** @__PURE__ @class */ (function () {
4399
4401
  };
4400
4402
  Export.prototype.exportRotate = function (tempContext, degree) {
4401
4403
  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
- }
4404
+ this.setMaxDim(parent.transform.degree, tempContext.canvas);
4405
+ tempContext.translate(tempContext.canvas.width / 2, tempContext.canvas.height / 2);
4406
+ tempContext.rotate(Math.PI / 180 * degree);
4407
+ tempContext.drawImage(parent.inMemoryCanvas, -tempContext.canvas.height / 2, -tempContext.canvas.width / 2, tempContext.canvas.height, tempContext.canvas.width);
4413
4408
  this.updateSaveContext(tempContext);
4414
4409
  };
4415
4410
  Export.prototype.exportFlip = function (tempContext, flipHorizontal, flipVertical) {
@@ -4436,12 +4431,12 @@ var Export = /** @__PURE__ @class */ (function () {
4436
4431
  var newWidth;
4437
4432
  var newHeight;
4438
4433
  if (degree % 90 === 0 && degree % 180 !== 0) {
4439
- newWidth = this.parent.baseImg.height;
4440
- newHeight = this.parent.baseImg.width;
4434
+ newWidth = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.height : this.parent.img.srcHeight;
4435
+ newHeight = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.width : this.parent.img.srcWidth;
4441
4436
  }
4442
4437
  else if (degree % 180 === 0 || degree === 0) {
4443
- newWidth = this.parent.baseImg.width;
4444
- newHeight = this.parent.baseImg.height;
4438
+ newWidth = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.width : this.parent.img.srcWidth;
4439
+ newHeight = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.height : this.parent.img.srcHeight;
4445
4440
  }
4446
4441
  tempCanvas.width = newWidth;
4447
4442
  tempCanvas.height = newHeight;
@@ -5757,6 +5752,7 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
5757
5752
  }
5758
5753
  };
5759
5754
  FreehandDrawing.prototype.selectFhd = function (index) {
5755
+ var _this = this;
5760
5756
  var parent = this.parent;
5761
5757
  parent.notify('selection', { prop: 'setFreehandDrawEditing', onPropertyChange: false, value: { bool: true } });
5762
5758
  if (index || index === 0) {
@@ -5781,7 +5777,28 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
5781
5777
  var obj = { bool: false };
5782
5778
  parent.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: obj } });
5783
5779
  if (obj['bool']) {
5784
- if (!isBlazor()) {
5780
+ var shapeSettings = { id: 'pen_' + (this.fhdSelIdx + 1), type: ShapeType.FreehandDraw,
5781
+ startX: parent.pointColl[this.fhdSelIdx].points[0].x, startY: parent.pointColl[this.fhdSelIdx].points[0].y,
5782
+ strokeColor: parent.pointColl[this.fhdSelIdx].strokeColor, strokeWidth: parent.pointColl[this.fhdSelIdx].strokeWidth,
5783
+ points: parent.pointColl[this.fhdSelIdx].points };
5784
+ var shapeChangingArgs = { action: 'select', previousShapeSettings: shapeSettings,
5785
+ currentShapeSettings: shapeSettings };
5786
+ if (isBlazor() && parent.events && parent.events.shapeChanging.hasDelegate === true) {
5787
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
5788
+ parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs).then(function (shapeChangingArgs) {
5789
+ parent.activeObj.strokeSettings.strokeColor = parent.pointColl[_this.fhdSelIdx].strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
5790
+ parent.activeObj.strokeSettings.strokeWidth = parent.pointColl[_this.fhdSelIdx].strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
5791
+ parent.pointColl[_this.fhdSelIdx].points = shapeChangingArgs.currentShapeSettings.points;
5792
+ _this.freehandRedraw(_this.upperContext);
5793
+ parent.updateToolbar(parent.element, 'colorToolbar');
5794
+ });
5795
+ }
5796
+ else {
5797
+ parent.trigger('shapeChanging', shapeChangingArgs);
5798
+ parent.activeObj.strokeSettings.strokeColor = parent.pointColl[this.fhdSelIdx].strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
5799
+ parent.activeObj.strokeSettings.strokeWidth = parent.pointColl[this.fhdSelIdx].strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
5800
+ parent.pointColl[this.fhdSelIdx].points = shapeChangingArgs.currentShapeSettings.points;
5801
+ this.freehandRedraw(this.upperContext);
5785
5802
  parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
5786
5803
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
5787
5804
  }
@@ -6406,6 +6423,9 @@ var Selection = /** @__PURE__ @class */ (function () {
6406
6423
  case 'unWireEvent':
6407
6424
  this.unwireEvent();
6408
6425
  break;
6426
+ case 'updPtCollForShpRot':
6427
+ this.updPtCollForShpRot(args.value['obj']);
6428
+ break;
6409
6429
  }
6410
6430
  };
6411
6431
  Selection.prototype.getModuleName = function () {
@@ -9267,6 +9287,9 @@ var Selection = /** @__PURE__ @class */ (function () {
9267
9287
  if (!this.isFhdEditing) {
9268
9288
  this.applyCurrActObj(x, y);
9269
9289
  parent.currObjType.isResize = false;
9290
+ if (!isBlazor()) {
9291
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
9292
+ }
9270
9293
  }
9271
9294
  }
9272
9295
  if (parent.activeObj) {
@@ -10590,8 +10613,10 @@ var Selection = /** @__PURE__ @class */ (function () {
10590
10613
  fillColor: parent.activeObj.strokeSettings ? parent.activeObj.strokeSettings.fillColor : null,
10591
10614
  radius: parent.activeObj.shape === 'ellipse' ? parent.activeObj.activePoint.width / 2 : null,
10592
10615
  length: parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' ? parent.activeObj.activePoint.width : null,
10593
- text: parent.activeObj.shape === 'text' ? (parent.activeObj.keyHistory ? parent.activeObj.keyHistory : null) : null,
10616
+ text: parent.activeObj.shape === 'text' ? (parent.activeObj.keyHistory ? parent.activeObj.keyHistory :
10617
+ (parent.activeObj.textSettings.text ? parent.activeObj.textSettings.text : null)) : null,
10594
10618
  fontSize: parent.activeObj.shape === 'text' ? (parent.activeObj.textSettings ? parent.activeObj.textSettings.fontSize : null) : null,
10619
+ fontFamily: parent.activeObj.shape === 'text' ? (parent.activeObj.textSettings ? parent.activeObj.textSettings.fontFamily : null) : null,
10595
10620
  fontStyle: parent.activeObj.shape === 'text' ? fontStyle : null,
10596
10621
  color: parent.activeObj.shape === 'text' ? (parent.activeObj.strokeSettings ? parent.activeObj.strokeSettings.strokeColor : null) : null
10597
10622
  };
@@ -10635,12 +10660,14 @@ var Selection = /** @__PURE__ @class */ (function () {
10635
10660
  if (degree < 0) {
10636
10661
  degree = 360 + degree;
10637
10662
  }
10638
- for (var i = 0; i < obj.flipObjColl.length; i++) {
10639
- if (obj.flipObjColl[i].toLowerCase() === 'horizontal') {
10640
- isHorizontalflip = true;
10641
- }
10642
- else if (obj.flipObjColl[i].toLowerCase() === 'vertical') {
10643
- isVerticalflip = true;
10663
+ if (obj.flipObjColl) {
10664
+ for (var i = 0; i < obj.flipObjColl.length; i++) {
10665
+ if (obj.flipObjColl[i].toLowerCase() === 'horizontal') {
10666
+ isHorizontalflip = true;
10667
+ }
10668
+ else if (obj.flipObjColl[i].toLowerCase() === 'vertical') {
10669
+ isVerticalflip = true;
10670
+ }
10644
10671
  }
10645
10672
  }
10646
10673
  if (degree === 0 || degree === 360) {
@@ -10729,7 +10756,7 @@ var Shape = /** @__PURE__ @class */ (function () {
10729
10756
  this.drawPath(args.value['pointColl'], args.value['strokeWidth'], args.value['strokeColor']);
10730
10757
  break;
10731
10758
  case 'drawRectangle':
10732
- this.drawRectangle(args.value['x'], args.value['y'], args.value['width'], args.value['height'], args.value['strokeWidt'], args.value['strokeColor'], args.value['fillColor']);
10759
+ this.drawRectangle(args.value['x'], args.value['y'], args.value['width'], args.value['height'], args.value['strokeWidth'], args.value['strokeColor'], args.value['fillColor']);
10733
10760
  break;
10734
10761
  case 'drawText':
10735
10762
  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']);
@@ -10920,10 +10947,10 @@ var Shape = /** @__PURE__ @class */ (function () {
10920
10947
  { text: 'Enter Text', fontFamily: 'Arial', fontSize: null, fontRatio: null, bold: false, italic: false, underline: false };
10921
10948
  this.strokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null };
10922
10949
  };
10923
- Shape.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor) {
10950
+ Shape.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree) {
10924
10951
  this.initializeShape('ellipse');
10925
10952
  var start = x && y ? { x: x, y: y } : null;
10926
- this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY);
10953
+ this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY, null, null, null, degree);
10927
10954
  };
10928
10955
  Shape.prototype.drawLine = function (startX, startY, endX, endY, strokeWidth, strokeColor) {
10929
10956
  this.initializeShape('line');
@@ -10954,10 +10981,10 @@ var Shape = /** @__PURE__ @class */ (function () {
10954
10981
  var height = endY - startY;
10955
10982
  this.drawShape('arrow', strokeWidth, strokeColor, null, start, width, height, null, arrowStart, arrowEnd);
10956
10983
  };
10957
- Shape.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor) {
10984
+ Shape.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor, degree) {
10958
10985
  this.initializeShape('rectangle');
10959
10986
  var start = x && y ? { x: x, y: y } : null;
10960
- this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height);
10987
+ this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height, null, null, null, degree);
10961
10988
  };
10962
10989
  Shape.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color) {
10963
10990
  this.drawShapeText(text, fontFamily, fontSize, bold, italic, color, x, y);
@@ -10996,7 +11023,7 @@ var Shape = /** @__PURE__ @class */ (function () {
10996
11023
  }
10997
11024
  return arrowType;
10998
11025
  };
10999
- Shape.prototype.drawShape = function (type, strokeWidth, strokeColor, fillColor, start, width, height, pointColl, arrowStart, arrowEnd) {
11026
+ Shape.prototype.drawShape = function (type, strokeWidth, strokeColor, fillColor, start, width, height, pointColl, arrowStart, arrowEnd, degree) {
11000
11027
  var _this = this;
11001
11028
  var parent = this.parent;
11002
11029
  if (!parent.disabled && parent.isImageLoaded) {
@@ -11065,10 +11092,7 @@ var Shape = /** @__PURE__ @class */ (function () {
11065
11092
  parent.activeObj.triangleDirection = 'right';
11066
11093
  }
11067
11094
  parent.currObjType.isDragging = parent.currObjType.isCustomCrop = false;
11068
- parent.activeObj.shapeDegree = parent.transform.degree;
11069
- parent.activeObj.shapeFlip = parent.transform.currFlipState;
11070
- parent.activeObj.textFlip = parent.transform.currFlipState;
11071
- parent.activeObj.flipObjColl = [];
11095
+ this.initShapeProps();
11072
11096
  var obj = { shapeSettingsObj: {} };
11073
11097
  parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
11074
11098
  var shapeSettings = obj['shapeSettingsObj'];
@@ -11080,6 +11104,10 @@ var Shape = /** @__PURE__ @class */ (function () {
11080
11104
  _this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
11081
11105
  _this.setDimension(width, height);
11082
11106
  parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
11107
+ if (degree) {
11108
+ parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
11109
+ parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
11110
+ }
11083
11111
  parent.updateToolbar(parent.element, 'quickAccessToolbar', 'shape');
11084
11112
  parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
11085
11113
  parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl_1 } });
@@ -11094,6 +11122,10 @@ var Shape = /** @__PURE__ @class */ (function () {
11094
11122
  this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
11095
11123
  this.setDimension(width, height);
11096
11124
  parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
11125
+ if (degree) {
11126
+ parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
11127
+ parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
11128
+ }
11097
11129
  if (!isBlazor()) {
11098
11130
  parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
11099
11131
  }
@@ -11114,6 +11146,13 @@ var Shape = /** @__PURE__ @class */ (function () {
11114
11146
  }
11115
11147
  }
11116
11148
  };
11149
+ Shape.prototype.initShapeProps = function () {
11150
+ var parent = this.parent;
11151
+ parent.activeObj.shapeDegree = parent.transform.degree;
11152
+ parent.activeObj.shapeFlip = parent.transform.currFlipState;
11153
+ parent.activeObj.textFlip = parent.transform.currFlipState;
11154
+ parent.activeObj.flipObjColl = [];
11155
+ };
11117
11156
  Shape.prototype.setPointCollForLineAndArrow = function () {
11118
11157
  var parent = this.parent;
11119
11158
  if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow') {
@@ -11128,6 +11167,19 @@ var Shape = /** @__PURE__ @class */ (function () {
11128
11167
  }
11129
11168
  }
11130
11169
  };
11170
+ Shape.prototype.prevObjColl = function () {
11171
+ var parent = this.parent;
11172
+ var object = { currObj: {} };
11173
+ parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
11174
+ this.prevObj = object['currObj'];
11175
+ this.prevObj.objColl = extend([], parent.objColl, [], true);
11176
+ this.prevObj.pointColl = extend([], parent.pointColl, [], true);
11177
+ this.prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
11178
+ var selPointCollObj = { selPointColl: null };
11179
+ parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
11180
+ value: { obj: selPointCollObj } });
11181
+ this.prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
11182
+ };
11131
11183
  Shape.prototype.drawShapeText = function (text, fontFamily, fontSize, bold, italic, strokeColor, x, y) {
11132
11184
  var _this = this;
11133
11185
  var parent = this.parent;
@@ -11140,16 +11192,7 @@ var Shape = /** @__PURE__ @class */ (function () {
11140
11192
  parent.notify('draw', { prop: 'setImageEdited', onPropertyChange: false });
11141
11193
  parent.togglePen = false;
11142
11194
  this.redrawActObj();
11143
- var object = { currObj: {} };
11144
- parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
11145
- this.prevObj = object['currObj'];
11146
- this.prevObj.objColl = extend([], parent.objColl, [], true);
11147
- this.prevObj.pointColl = extend([], parent.pointColl, [], true);
11148
- this.prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
11149
- var selPointCollObj = { selPointColl: null };
11150
- parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
11151
- value: { obj: selPointCollObj } });
11152
- this.prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
11195
+ this.prevObjColl();
11153
11196
  this.refreshActiveObj();
11154
11197
  parent.activeObj.shape = parent.currObjType.shape = 'text';
11155
11198
  parent.currObjType.isCustomCrop = false;
@@ -11240,6 +11283,9 @@ var Shape = /** @__PURE__ @class */ (function () {
11240
11283
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11241
11284
  parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
11242
11285
  }
11286
+ else {
11287
+ parent.updateToolbar(parent.element, 'text');
11288
+ }
11243
11289
  };
11244
11290
  Shape.prototype.initializeTextShape = function (text, fontFamily, fontSize, bold, italic, strokeColor) {
11245
11291
  var parent = this.parent;
@@ -11388,9 +11434,12 @@ var Shape = /** @__PURE__ @class */ (function () {
11388
11434
  parent.activeObj.activePoint.width = shapeSettings.length;
11389
11435
  break;
11390
11436
  case 'text':
11391
- parent.activeObj.keyHistory = shapeSettings.text;
11437
+ parent.activeObj.keyHistory = parent.activeObj.textSettings.text = shapeSettings.text;
11392
11438
  parent.activeObj.textSettings.fontSize = shapeSettings.fontSize;
11393
11439
  parent.activeObj.strokeSettings.strokeColor = shapeSettings.color;
11440
+ parent.activeObj.textSettings.fontFamily = shapeSettings.fontFamily;
11441
+ break;
11442
+ case 'rectangle':
11394
11443
  break;
11395
11444
  }
11396
11445
  if (parent.activeObj.shape === 'text' && parent.activeObj.textSettings) {
@@ -12256,6 +12305,7 @@ var Shape = /** @__PURE__ @class */ (function () {
12256
12305
  if (actObj.flipObjColl.length === 4) {
12257
12306
  actObj.flipObjColl = [];
12258
12307
  flip = '';
12308
+ actObj.shapeFlip = '';
12259
12309
  }
12260
12310
  if (flip === '' && actObj.flipObjColl.length > 1) {
12261
12311
  flip = actObj.flipObjColl[actObj.flipObjColl.length - 1];
@@ -12907,6 +12957,10 @@ var Shape = /** @__PURE__ @class */ (function () {
12907
12957
  shapeDetails.fontStyle.push('italic');
12908
12958
  }
12909
12959
  break;
12960
+ case 'path':
12961
+ shapeDetails.strokeColor = obj.strokeSettings.strokeColor;
12962
+ shapeDetails.strokeWidth = obj.strokeSettings.strokeWidth;
12963
+ break;
12910
12964
  }
12911
12965
  return shapeDetails;
12912
12966
  };
@@ -13177,7 +13231,12 @@ var Shape = /** @__PURE__ @class */ (function () {
13177
13231
  this.lowerContext.filter = object['canvasFilter'];
13178
13232
  this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
13179
13233
  parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
13180
- parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
13234
+ if (!isBlazor()) {
13235
+ parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
13236
+ }
13237
+ else {
13238
+ parent.updateToolbar(parent.element, 'imageLoaded');
13239
+ }
13181
13240
  }
13182
13241
  };
13183
13242
  Shape.prototype.getMaxText = function (isTextBox, text, obj) {
@@ -13577,6 +13636,12 @@ var Transform = /** @__PURE__ @class */ (function () {
13577
13636
  this.cropDimension.width = args.value['width'];
13578
13637
  this.cropDimension.height = args.value['height'];
13579
13638
  break;
13639
+ case 'getPreventSelect':
13640
+ args.value['obj']['bool'] = this.isPreventSelect;
13641
+ break;
13642
+ case 'setPreventSelect':
13643
+ this.isPreventSelect = args.value['bool'];
13644
+ break;
13580
13645
  case 'reset':
13581
13646
  this.reset();
13582
13647
  break;
@@ -14701,6 +14766,9 @@ var Transform = /** @__PURE__ @class */ (function () {
14701
14766
  parent.notify('shape', { prop: 'alignRotateFlipColl', onPropertyChange: false,
14702
14767
  value: { collection: parent.objColl[i].flipObjColl, isRotateFlipCollection: null, obj: flipObjColl } });
14703
14768
  parent.objColl[i].flipObjColl = flipObjColl['collection'];
14769
+ if (parent.objColl[i].flipObjColl.length === 0) {
14770
+ parent.objColl[i].shapeFlip = '';
14771
+ }
14704
14772
  }
14705
14773
  }
14706
14774
  if (tempZoomFactor !== 0) {
@@ -15066,6 +15134,7 @@ var Transform = /** @__PURE__ @class */ (function () {
15066
15134
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
15067
15135
  this.lowerContext.filter = tempFilter;
15068
15136
  parent.initialAdjustmentValue = tempFilter;
15137
+ parent.canvasFilter = this.lowerContext.filter;
15069
15138
  if (parent.isImageLoaded) {
15070
15139
  showSpinner(parent.element);
15071
15140
  parent.element.style.opacity = '0.5';
@@ -16523,7 +16592,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
16523
16592
  this.inMemoryContext = this.inMemoryCanvas.getContext('2d');
16524
16593
  this.lowerContext.filter = this.getDefaultFilter();
16525
16594
  this.notify('filter', { prop: 'setAdjustmentValue', onPropertyChange: false, value: { adjustmentValue: this.lowerContext.filter } });
16526
- this.notify('toolbar', { prop: 'setCanvasFilter', onPropertyChange: false, value: { filter: this.lowerContext.filter } });
16595
+ this.canvasFilter = this.lowerContext.filter;
16527
16596
  this.notify('toolbar', { prop: 'setInitialAdjustmentValue', onPropertyChange: false, value: { value: this.lowerContext.filter } });
16528
16597
  if (this.cssClass) {
16529
16598
  addClass([this.element], this.cssClass.replace(/\s+/g, ' ').trim().split(' '));
@@ -17525,8 +17594,10 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
17525
17594
  this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
17526
17595
  var data = this.getImageData();
17527
17596
  if (!isBlazor()) {
17528
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
17529
- isApplyBtn: true, isCropping: false } });
17597
+ if (!Browser.isDevice) {
17598
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
17599
+ isApplyBtn: true, isCropping: false } });
17600
+ }
17530
17601
  this.element.querySelector('#' + this.element.id + '_contextualToolbarArea').classList.remove('e-hide');
17531
17602
  }
17532
17603
  this.objColl = objColl;
@@ -18141,8 +18212,8 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
18141
18212
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
18142
18213
  this.element = element;
18143
18214
  var canvasWrapper = this.element.querySelector('.e-canvas-wrapper');
18144
- if (this.element.querySelector('#' + this.element.id + '_toolbar')) {
18145
- this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbar').clientHeight;
18215
+ if (this.element.querySelector('#' + this.element.id + '_toolbarArea')) {
18216
+ this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').clientHeight;
18146
18217
  }
18147
18218
  else {
18148
18219
  this.toolbarHeight = 0;
@@ -18742,9 +18813,6 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
18742
18813
  case 'getCanvasFilter':
18743
18814
  args.value['obj']['canvasFilter'] = parent.canvasFilter;
18744
18815
  break;
18745
- case 'setCanvasFilter':
18746
- parent.canvasFilter = args.value['filter'];
18747
- break;
18748
18816
  case 'getDefToolbarItems':
18749
18817
  args.value['obj']['defToolbarItems'] = this.defToolbarItems;
18750
18818
  break;
@@ -20150,7 +20218,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
20150
20218
  if (!parent.isImageLoaded || parent.isCropToolbar) {
20151
20219
  return;
20152
20220
  }
20153
- var args = { toolbarType: type };
20221
+ var item = type === 'shapes' && parent.activeObj.shape ? parent.activeObj.shape : type;
20222
+ var args = { toolbarType: item };
20154
20223
  if (type !== 'filter' && type !== 'color') {
20155
20224
  if (document.getElementById(parent.element.id + '_toolbar') && this.defToolbarItems.length > 0) {
20156
20225
  getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
@@ -21366,7 +21435,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
21366
21435
  var parent = this.parent;
21367
21436
  if (document.querySelector('#' + parent.element.id + '_sliderWrapper') ||
21368
21437
  parent.currObjType.isFiltered) {
21369
- parent.initialAdjustmentValue = parent.canvasFilter = this.lowerContext.filter;
21438
+ parent.initialAdjustmentValue = this.lowerContext.filter;
21439
+ parent.canvasFilter = this.lowerContext.filter;
21370
21440
  parent.currObjType.isFiltered = false;
21371
21441
  }
21372
21442
  };