@syncfusion/ej2-image-editor 24.1.41 → 24.1.44

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 (54) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +1 -1
  3. package/dist/ej2-image-editor.umd.min.js +2 -2
  4. package/dist/ej2-image-editor.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-image-editor.es2015.js +117 -54
  6. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  7. package/dist/es6/ej2-image-editor.es5.js +114 -51
  8. package/dist/es6/ej2-image-editor.es5.js.map +1 -1
  9. package/dist/global/ej2-image-editor.min.js +2 -2
  10. package/dist/global/ej2-image-editor.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +8 -8
  13. package/src/image-editor/action/draw.js +29 -26
  14. package/src/image-editor/action/selection.js +8 -0
  15. package/src/image-editor/action/shape.js +2 -0
  16. package/src/image-editor/action/transform.js +9 -5
  17. package/src/image-editor/action/undo-redo.js +11 -1
  18. package/src/image-editor/base/image-editor.js +3 -1
  19. package/src/image-editor/renderer/toolbar.js +52 -18
  20. package/styles/bootstrap-dark.css +9 -2
  21. package/styles/bootstrap.css +9 -2
  22. package/styles/bootstrap4.css +9 -2
  23. package/styles/bootstrap5-dark.css +9 -2
  24. package/styles/bootstrap5.css +9 -2
  25. package/styles/fabric-dark.css +9 -2
  26. package/styles/fabric.css +9 -2
  27. package/styles/fluent-dark.css +9 -2
  28. package/styles/fluent.css +9 -2
  29. package/styles/highcontrast-light.css +9 -2
  30. package/styles/highcontrast.css +9 -2
  31. package/styles/image-editor/_layout.scss +9 -6
  32. package/styles/image-editor/bootstrap-dark.css +9 -2
  33. package/styles/image-editor/bootstrap.css +9 -2
  34. package/styles/image-editor/bootstrap4.css +9 -2
  35. package/styles/image-editor/bootstrap5-dark.css +9 -2
  36. package/styles/image-editor/bootstrap5.css +9 -2
  37. package/styles/image-editor/fabric-dark.css +9 -2
  38. package/styles/image-editor/fabric.css +9 -2
  39. package/styles/image-editor/fluent-dark.css +9 -2
  40. package/styles/image-editor/fluent.css +9 -2
  41. package/styles/image-editor/highcontrast-light.css +9 -2
  42. package/styles/image-editor/highcontrast.css +9 -2
  43. package/styles/image-editor/material-dark.css +9 -2
  44. package/styles/image-editor/material.css +9 -2
  45. package/styles/image-editor/material3-dark.css +7 -2
  46. package/styles/image-editor/material3.css +7 -2
  47. package/styles/image-editor/tailwind-dark.css +9 -2
  48. package/styles/image-editor/tailwind.css +9 -2
  49. package/styles/material-dark.css +9 -2
  50. package/styles/material.css +9 -2
  51. package/styles/material3-dark.css +7 -2
  52. package/styles/material3.css +7 -2
  53. package/styles/tailwind-dark.css +9 -2
  54. package/styles/tailwind.css +9 -2
@@ -1099,7 +1099,7 @@ var Draw = /** @__PURE__ @class */ (function () {
1099
1099
  this.updateCanvas();
1100
1100
  break;
1101
1101
  case 'performCancel':
1102
- this.performCancel(args.value['isContextualToolbar']);
1102
+ this.performCancel(args.value['isContextualToolbar'], args.value['isUndoRedo']);
1103
1103
  break;
1104
1104
  case 'updateFlipPan':
1105
1105
  this.updateFlipPan(args.value['tempSelectionObj']);
@@ -1550,7 +1550,7 @@ var Draw = /** @__PURE__ @class */ (function () {
1550
1550
  var width;
1551
1551
  var height;
1552
1552
  var canvasWidth = parent.lowerCanvas.clientWidth;
1553
- var canvasHeight = parent.lowerCanvas.clientHeight;
1553
+ var canvasHeight = parent.lowerCanvas.clientHeight + 1;
1554
1554
  var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop, destWidth = _a.destWidth, destHeight = _a.destHeight;
1555
1555
  if (parent.transform.zoomFactor > 0 && this.currSelPoint) {
1556
1556
  var activeObj = extend({}, parent.activeObj, {}, true);
@@ -1591,13 +1591,11 @@ var Draw = /** @__PURE__ @class */ (function () {
1591
1591
  if (destTop < 0) {
1592
1592
  height += destTop;
1593
1593
  }
1594
- if (parent.currObjType.shape.toLowerCase() !== 'crop-square' && parent.currObjType.shape.toLowerCase() !== 'crop-circle') {
1595
- if (destLeft + destWidth > parent.lowerCanvas.width) {
1596
- width -= (destLeft + destWidth - parent.lowerCanvas.width);
1597
- }
1598
- if (destTop + destHeight > parent.lowerCanvas.height) {
1599
- height -= (destTop + destHeight - parent.lowerCanvas.height);
1600
- }
1594
+ if (destLeft + destWidth > parent.lowerCanvas.width) {
1595
+ width -= (destLeft + destWidth - parent.lowerCanvas.width);
1596
+ }
1597
+ if (destTop + destHeight > parent.lowerCanvas.height) {
1598
+ height -= (destTop + destHeight - parent.lowerCanvas.height);
1601
1599
  }
1602
1600
  }
1603
1601
  switch (parent.currObjType.shape.toLowerCase()) {
@@ -3219,7 +3217,7 @@ var Draw = /** @__PURE__ @class */ (function () {
3219
3217
  parent.img.destHeight = maxDimension.width;
3220
3218
  }
3221
3219
  parent.img.destLeft = (parent.lowerCanvas.clientWidth - maxDimension.height) / 2;
3222
- parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.width + 1) / 2;
3220
+ parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.width) / 2;
3223
3221
  parent.img.destWidth = maxDimension.height;
3224
3222
  parent.img.destHeight = maxDimension.width;
3225
3223
  }
@@ -3235,7 +3233,12 @@ var Draw = /** @__PURE__ @class */ (function () {
3235
3233
  parent.img.destHeight = maxDimension.height;
3236
3234
  }
3237
3235
  parent.img.destLeft = (parent.lowerCanvas.clientWidth - maxDimension.width) / 2;
3238
- parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height + 1) / 2;
3236
+ if (degree === 0) {
3237
+ parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height + 1) / 2;
3238
+ }
3239
+ else {
3240
+ parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height) / 2;
3241
+ }
3239
3242
  parent.img.destWidth = maxDimension.width;
3240
3243
  parent.img.destHeight = maxDimension.height;
3241
3244
  }
@@ -3426,6 +3429,7 @@ var Draw = /** @__PURE__ @class */ (function () {
3426
3429
  hideSpinner(parent.element);
3427
3430
  parent.element.style.opacity = '1';
3428
3431
  proxy.updateBaseImgCanvas();
3432
+ var fileOpened = { fileName: _this.fileName, fileType: _this.fileType, isValidImage: true };
3429
3433
  proxy.updateCanvas();
3430
3434
  if (parent.currObjType.isUndoZoom) {
3431
3435
  parent.currObjType.isUndoZoom = false;
@@ -3455,6 +3459,14 @@ var Draw = /** @__PURE__ @class */ (function () {
3455
3459
  - parent.toolbarHeight * 2) - 1 + 'px';
3456
3460
  }
3457
3461
  }
3462
+ if (parent.isImageLoaded && parent.element.style.opacity !== '0.5') {
3463
+ if (isBlazor() && parent.events && parent.events.fileOpened.hasDelegate === true) {
3464
+ parent.dotNetRef.invokeMethodAsync('FileOpenEventAsync', 'FileOpened', fileOpened);
3465
+ }
3466
+ else {
3467
+ parent.trigger('fileOpened', fileOpened);
3468
+ }
3469
+ }
3458
3470
  };
3459
3471
  parent.baseImg.onerror = function () {
3460
3472
  hideSpinner(parent.element);
@@ -3480,7 +3492,6 @@ var Draw = /** @__PURE__ @class */ (function () {
3480
3492
  };
3481
3493
  Draw.prototype.updateCanvas = function () {
3482
3494
  var parent = this.parent;
3483
- var fileOpened = { fileName: this.fileName, fileType: this.fileType, isValidImage: true };
3484
3495
  parent.img.srcWidth = parent.baseImgCanvas.width;
3485
3496
  parent.img.srcHeight = parent.baseImgCanvas.height;
3486
3497
  var obj = { width: 0, height: 0 };
@@ -3516,14 +3527,6 @@ var Draw = /** @__PURE__ @class */ (function () {
3516
3527
  if (parent.disabled) {
3517
3528
  parent.element.setAttribute('class', 'e-disabled');
3518
3529
  }
3519
- if (parent.isImageLoaded && parent.element.style.opacity !== '0.5') {
3520
- if (isBlazor() && parent.events && parent.events.fileOpened.hasDelegate === true) {
3521
- parent.dotNetRef.invokeMethodAsync('FileOpenEventAsync', 'FileOpened', fileOpened);
3522
- }
3523
- else {
3524
- parent.trigger('fileOpened', fileOpened);
3525
- }
3526
- }
3527
3530
  if (parent.zoomSettings.zoomFactor !== 1 || parent.zoomSettings.zoomPoint) {
3528
3531
  parent.zoom(parent.zoomSettings.zoomFactor, parent.zoomSettings.zoomPoint);
3529
3532
  }
@@ -3550,14 +3553,14 @@ var Draw = /** @__PURE__ @class */ (function () {
3550
3553
  parent.cancelCropSelection = null;
3551
3554
  }
3552
3555
  };
3553
- Draw.prototype.performCancel = function (isContextualToolbar) {
3556
+ Draw.prototype.performCancel = function (isContextualToolbar, isUndoRedo) {
3554
3557
  var parent = this.parent;
3555
3558
  var straightenObj = { bool: parent.isStraightening };
3556
3559
  isContextualToolbar = isContextualToolbar ? isContextualToolbar : false;
3557
3560
  var obj = { bool: false };
3558
3561
  parent.allowDownScale = true;
3559
3562
  parent.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: obj } });
3560
- if (JSON.stringify(parent.frameObj) !== JSON.stringify(parent.tempFrameObj)) {
3563
+ if (isNullOrUndefined(isUndoRedo) && JSON.stringify(parent.frameObj) !== JSON.stringify(parent.tempFrameObj)) {
3561
3564
  extend(parent.frameObj, parent.tempFrameObj);
3562
3565
  this.renderImage(null, null, true);
3563
3566
  }
@@ -4321,16 +4324,16 @@ var Draw = /** @__PURE__ @class */ (function () {
4321
4324
  Draw.prototype.setClientTransDim = function (isPreventDimension) {
4322
4325
  var parent = this.parent;
4323
4326
  if (parent.transform.degree % 90 === 0 && parent.transform.degree % 180 !== 0) {
4324
- parent.img.destLeft = (parent.lowerCanvas.width - parent.img.destHeight) / 2;
4325
- parent.img.destTop = (parent.lowerCanvas.height - parent.img.destWidth) / 2;
4327
+ parent.img.destLeft = (parent.lowerCanvas.clientWidth - parent.img.destHeight) / 2;
4328
+ parent.img.destTop = (parent.lowerCanvas.clientHeight - parent.img.destWidth + 1) / 2;
4326
4329
  var temp = parent.img.destWidth;
4327
4330
  parent.img.destWidth = parent.img.destHeight;
4328
4331
  parent.img.destHeight = temp;
4329
4332
  }
4330
4333
  else {
4331
4334
  if (isNullOrUndefined(isPreventDimension)) {
4332
- parent.img.destLeft = (parent.lowerCanvas.width - parent.img.destWidth) / 2;
4333
- parent.img.destTop = (parent.lowerCanvas.height - parent.img.destHeight) / 2;
4335
+ parent.img.destLeft = (parent.lowerCanvas.clientWidth - parent.img.destWidth) / 2;
4336
+ parent.img.destTop = (parent.lowerCanvas.clientHeight - parent.img.destHeight + 1) / 2;
4334
4337
  }
4335
4338
  }
4336
4339
  };
@@ -12637,7 +12640,15 @@ var Selection = /** @__PURE__ @class */ (function () {
12637
12640
  this.getCurrentFlipState();
12638
12641
  }
12639
12642
  else {
12643
+ var totalPannedInternalPoint = extend({}, parent.panPoint.totalPannedInternalPoint, {}, true);
12644
+ var destPoints = { startX: parent.img.destLeft, startY: parent.img.destTop, width: parent.img.destWidth,
12645
+ height: parent.img.destHeight };
12640
12646
  parent.notify('draw', { prop: 'callUpdateCurrTransState', onPropertyChange: false });
12647
+ parent.panPoint.totalPannedInternalPoint = totalPannedInternalPoint;
12648
+ parent.img.destLeft = destPoints.startX;
12649
+ parent.img.destTop = destPoints.startY;
12650
+ parent.img.destWidth = destPoints.width;
12651
+ parent.img.destHeight = destPoints.height;
12641
12652
  parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
12642
12653
  value: { context: this.lowerContext, points: null } });
12643
12654
  }
@@ -15157,12 +15168,14 @@ var Shape = /** @__PURE__ @class */ (function () {
15157
15168
  return;
15158
15169
  }
15159
15170
  else if (e.type === 'dblclick') {
15171
+ var activeObj = extend({}, parent.activeObj, {}, true);
15160
15172
  var objColl = extend([], parent.objColl, [], true);
15161
15173
  var obj = { bool: null };
15162
15174
  parent.notify('selection', { prop: 'findTargetObj', onPropertyChange: false,
15163
15175
  value: { x: e.clientX, y: e.clientY, isCrop: false, obj: obj } });
15164
15176
  parent.objColl = objColl;
15165
15177
  if (!obj['bool'] || parent.activeObj.shape !== 'text') {
15178
+ parent.activeObj = extend({}, activeObj, {}, true);
15166
15179
  return;
15167
15180
  }
15168
15181
  }
@@ -17846,11 +17859,11 @@ var Transform = /** @__PURE__ @class */ (function () {
17846
17859
  if (parent.img.destTop > 0) {
17847
17860
  parent.img.destTop = 0;
17848
17861
  }
17849
- if (parent.img.destLeft + maxDimension.width < parent.lowerCanvas.width) {
17850
- parent.img.destLeft = parent.lowerCanvas.width - parent.img.destWidth;
17862
+ if (parent.img.destLeft + maxDimension.width < parent.lowerCanvas.clientWidth) {
17863
+ parent.img.destLeft = parent.lowerCanvas.clientWidth - parent.img.destWidth;
17851
17864
  }
17852
- if (parent.img.destTop + maxDimension.height < parent.lowerCanvas.height) {
17853
- parent.img.destTop = parent.lowerCanvas.height - parent.img.destHeight;
17865
+ if (parent.img.destTop + maxDimension.height < parent.lowerCanvas.clientHeight) {
17866
+ parent.img.destTop = parent.lowerCanvas.clientHeight - parent.img.destHeight;
17854
17867
  }
17855
17868
  }
17856
17869
  return maxDimension;
@@ -19065,12 +19078,16 @@ var Transform = /** @__PURE__ @class */ (function () {
19065
19078
  };
19066
19079
  Transform.prototype.straightenImage = function (degree) {
19067
19080
  var parent = this.parent;
19081
+ if (parent.toolbar && parent.toolbar.length === 0) {
19082
+ parent.notify('draw', { prop: 'select', onPropertyChange: false,
19083
+ value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
19084
+ }
19068
19085
  if (isBlazor()) {
19069
19086
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
19070
19087
  parent.performCropClick();
19071
19088
  }
19072
19089
  else {
19073
- parent.notify('toolbar', { prop: 'performCropTransformClick' });
19090
+ parent.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: null } });
19074
19091
  }
19075
19092
  parent.setStraighten(degree, true);
19076
19093
  if ((isBlazor() && parent.events && parent.events.straightening.hasDelegate === false) || !isBlazor()) {
@@ -19463,7 +19480,7 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
19463
19480
  this.tempCurrSelPoint = extend({}, parent.currSelectionPoint, {}, true);
19464
19481
  parent.currSelectionPoint = null;
19465
19482
  }
19466
- parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
19483
+ parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null, isUndoRedo: true } });
19467
19484
  parent.currObjType.isActiveObj = false;
19468
19485
  if (parent.transform.straighten !== 0) {
19469
19486
  parent.notify('draw', { prop: 'setStraightenActObj', value: { activeObj: null } });
@@ -20026,6 +20043,16 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
20026
20043
  this.parent.notify('draw', { prop: 'getArrowDimension', onPropertyChange: false, value: { obj: arrowObj } });
20027
20044
  var tempArrowObj = extend({}, arrowObj['arrowDimension'], {}, true);
20028
20045
  if (parent.transform.zoomFactor > 0 && (obj.length > 0 || point.length > 0)) {
20046
+ if (obj.length > 0) {
20047
+ for (var i = 0; i < obj.length; i++) {
20048
+ if (obj[i].currIndex) {
20049
+ continue;
20050
+ }
20051
+ else {
20052
+ obj[i].currIndex = 'shape_' + (i + 1);
20053
+ }
20054
+ }
20055
+ }
20029
20056
  parent.objColl = obj;
20030
20057
  parent.pointColl = point;
20031
20058
  var isUndoRedo = parent.isUndoRedo;
@@ -21247,6 +21274,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
21247
21274
  *
21248
21275
  */
21249
21276
  ImageEditor.prototype.select = function (type, startX, startY, width, height) {
21277
+ this.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: 'crop-' + type } });
21250
21278
  this.notify('draw', { prop: 'select', onPropertyChange: false,
21251
21279
  value: { type: type, startX: startX, startY: startY, width: width, height: height } });
21252
21280
  this.notify('draw', { prop: 'select', onPropertyChange: false,
@@ -23437,7 +23465,8 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
23437
23465
  this.initializeThemeColl();
23438
23466
  };
23439
23467
  ImageEditor.prototype.initializeZoomSettings = function () {
23440
- if (isNullOrUndefined(this.zoomSettings.zoomTrigger)) {
23468
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
23469
+ if (isNullOrUndefined(this.zoomSettings.zoomTrigger) || this.zoomSettings.zoomTrigger === 0) {
23441
23470
  this.zoomSettings.zoomTrigger = (ZoomTrigger.MouseWheel | ZoomTrigger.Pinch | ZoomTrigger.Toolbar | ZoomTrigger.Commands);
23442
23471
  }
23443
23472
  if (isNullOrUndefined(this.selectionSettings.strokeColor)) {
@@ -24231,7 +24260,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
24231
24260
  this.frameToolbarClick();
24232
24261
  break;
24233
24262
  case 'performCropTransformClick':
24234
- this.performCropTransformClick();
24263
+ this.performCropTransformClick(args.value['shape']);
24235
24264
  break;
24236
24265
  case 'duplicateShape':
24237
24266
  this.duplicateShape(args.value['isPreventUndoRedo'], true);
@@ -24425,6 +24454,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
24425
24454
  else {
24426
24455
  this.defToolbarItems = leftItem.concat(mainItem, rightItem, zoomItem);
24427
24456
  }
24457
+ var args = { toolbarType: 'main', toolbarItems: this.defToolbarItems };
24458
+ parent.trigger('toolbarUpdating', args);
24459
+ this.defToolbarItems = args.toolbarItems;
24428
24460
  var toolbarObj = new Toolbar({
24429
24461
  width: '100%',
24430
24462
  items: this.defToolbarItems,
@@ -24459,6 +24491,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
24459
24491
  var id = parent.element.id;
24460
24492
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)) {
24461
24493
  var items = this.getMainToolbarItem();
24494
+ var args = { toolbarType: 'bottom-toolbar', toolbarItems: items };
24495
+ parent.trigger('toolbarUpdating', args);
24496
+ items = args.toolbarItems;
24462
24497
  var toolbarObj = new Toolbar({ items: items, width: '100%',
24463
24498
  created: function () {
24464
24499
  _this.renderAnnotationBtn();
@@ -24883,6 +24918,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
24883
24918
  else {
24884
24919
  this.defToolbarItems = leftItem.concat(zoomItem, mainItem, rightItem);
24885
24920
  }
24921
+ var args = { toolbarType: 'resize', toolbarItems: this.defToolbarItems };
24922
+ parent.trigger('toolbarUpdating', args);
24923
+ this.defToolbarItems = args.toolbarItems;
24886
24924
  var toolbar = new Toolbar({
24887
24925
  width: '100%',
24888
24926
  items: this.defToolbarItems,
@@ -25184,7 +25222,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25184
25222
  }
25185
25223
  }
25186
25224
  };
25187
- ToolbarModule.prototype.renderCropBtn = function () {
25225
+ ToolbarModule.prototype.renderCropBtn = function (shapeString) {
25188
25226
  var _this = this;
25189
25227
  var parent = this.parent;
25190
25228
  var items = [];
@@ -25221,7 +25259,11 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25221
25259
  }
25222
25260
  var iconCss;
25223
25261
  var shape;
25224
- if (parent.activeObj.shape) {
25262
+ if (shapeString) {
25263
+ iconCss = this.getCurrentShapeIcon(shapeString);
25264
+ shape = shapeString;
25265
+ }
25266
+ else if (parent.activeObj.shape) {
25225
25267
  iconCss = this.getCurrentShapeIcon(parent.activeObj.shape);
25226
25268
  shape = parent.activeObj.shape;
25227
25269
  }
@@ -25431,7 +25473,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25431
25473
  }
25432
25474
  return toolbarItems;
25433
25475
  };
25434
- ToolbarModule.prototype.initCropTransformToolbar = function () {
25476
+ ToolbarModule.prototype.initCropTransformToolbar = function (shape) {
25435
25477
  var _this = this;
25436
25478
  var parent = this.parent;
25437
25479
  var id = parent.element.id;
@@ -25445,12 +25487,15 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25445
25487
  else {
25446
25488
  this.defToolbarItems = leftItem.concat(zoomItem, mainItem, rightItem);
25447
25489
  }
25490
+ var args = { toolbarType: 'crop-transform', toolbarItems: this.defToolbarItems };
25491
+ parent.trigger('toolbarUpdating', args);
25492
+ this.defToolbarItems = args.toolbarItems;
25448
25493
  var toolbar = new Toolbar({
25449
25494
  width: '100%',
25450
25495
  items: this.defToolbarItems,
25451
25496
  clicked: this.defToolbarClicked.bind(this),
25452
25497
  created: function () {
25453
- _this.renderCropBtn();
25498
+ _this.renderCropBtn(shape);
25454
25499
  _this.renderStraightenSlider();
25455
25500
  _this.wireZoomBtnEvents();
25456
25501
  if (!Browser.isDevice) {
@@ -25492,8 +25537,6 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25492
25537
  && slider && slider.parentElement.scrollHeight > this.toolbarHeight) {
25493
25538
  this.toolbarHeight = parent.toolbarHeight = slider.parentElement.scrollHeight;
25494
25539
  }
25495
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
25496
- toolbar.refreshOverflow();
25497
25540
  this.enableDisableTbrBtn();
25498
25541
  parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
25499
25542
  };
@@ -25553,6 +25596,10 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25553
25596
  else {
25554
25597
  this.defToolbarItems = leftItem.concat(zoomItem, mainItem, rightItem);
25555
25598
  }
25599
+ var args = { toolbarType: parent.activeObj.shape ? parent.activeObj.shape : 'shapes',
25600
+ toolbarItems: this.defToolbarItems };
25601
+ parent.trigger('toolbarUpdating', args);
25602
+ this.defToolbarItems = args.toolbarItems;
25556
25603
  var toolbar = new Toolbar({
25557
25604
  width: '100%',
25558
25605
  items: this.defToolbarItems,
@@ -25959,6 +26006,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25959
26006
  else {
25960
26007
  this.defToolbarItems = leftItem.concat(zoomItem, mainItem, rightItem);
25961
26008
  }
26009
+ var args = { toolbarType: 'text', toolbarItems: this.defToolbarItems };
26010
+ parent.trigger('toolbarUpdating', args);
26011
+ this.defToolbarItems = args.toolbarItems;
25962
26012
  var toolbar = new Toolbar({
25963
26013
  width: '100%',
25964
26014
  items: this.defToolbarItems,
@@ -26083,8 +26133,10 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26083
26133
  else {
26084
26134
  fontFamily = parent.activeObj.textSettings.fontFamily;
26085
26135
  }
26086
- args.element.querySelector('[id *= ' + '"' + fontFamily.toLowerCase()
26087
- + '"' + ']').classList.add('e-selected-btn');
26136
+ var elem = args.element.querySelector('[id *= ' + '"' + fontFamily.toLowerCase() + '"' + ']');
26137
+ if (elem) {
26138
+ elem.classList.add('e-selected-btn');
26139
+ }
26088
26140
  },
26089
26141
  select: function (args) {
26090
26142
  spanElem_2.textContent = args.item.text;
@@ -26122,14 +26174,13 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26122
26174
  fontSizeBtn_1.appendTo('#' + id + '_fontSizeBtn');
26123
26175
  }
26124
26176
  };
26125
- ToolbarModule.prototype.refreshToolbar = function (type, isApplyBtn, isCropping, isZooming, cType) {
26177
+ ToolbarModule.prototype.refreshToolbar = function (type, isApplyBtn, isCropping, isZooming, cType, shape) {
26126
26178
  var parent = this.parent;
26127
26179
  var id = parent.element.id;
26128
26180
  if (!parent.isImageLoaded || parent.isCropToolbar) {
26129
26181
  return;
26130
26182
  }
26131
- var item = type === 'shapes' && parent.activeObj.shape ? parent.activeObj.shape : type;
26132
- var args = { toolbarType: item };
26183
+ var args = {};
26133
26184
  var aspectIcon;
26134
26185
  var nonAspectIcon;
26135
26186
  if (type !== 'filter' && type !== 'color') {
@@ -26195,7 +26246,6 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26195
26246
  else {
26196
26247
  args.toolbarItems = ['fillColor', 'strokeColor', 'strokeWidth', 'duplicate', 'remove'];
26197
26248
  }
26198
- parent.trigger('toolbarUpdating', args);
26199
26249
  this.initShapesToolbarItem(args.toolbarItems);
26200
26250
  break;
26201
26251
  case 'text':
@@ -26203,7 +26253,6 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26203
26253
  this.initMainToolbar(false, true, true);
26204
26254
  }
26205
26255
  args.toolbarItems = ['fontFamily', 'fontSize', 'fontColor', 'bold', 'italic', 'duplicate', 'remove', 'text'];
26206
- parent.trigger('toolbarUpdating', args);
26207
26256
  this.initTextToolbarItem(args.toolbarItems);
26208
26257
  break;
26209
26258
  case 'pen':
@@ -26211,7 +26260,6 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26211
26260
  this.initMainToolbar(false, true, true);
26212
26261
  }
26213
26262
  args.toolbarItems = ['strokeColor', 'strokeWidth', 'remove', 'transparency'];
26214
- parent.trigger('toolbarUpdating', args);
26215
26263
  this.initPenToolbarItem(args.toolbarItems);
26216
26264
  break;
26217
26265
  case 'adjustment':
@@ -26253,7 +26301,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26253
26301
  this.initMainToolbar(false, true, true);
26254
26302
  }
26255
26303
  parent.updateCropTransformItems();
26256
- this.initCropTransformToolbar();
26304
+ this.initCropTransformToolbar(shape);
26257
26305
  if (Browser.isDevice) {
26258
26306
  this.updateContextualToolbar('color', 'straighten', true);
26259
26307
  }
@@ -26280,7 +26328,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26280
26328
  this.currToolbar = type;
26281
26329
  this.refreshDropDownBtn(isCropping);
26282
26330
  };
26283
- ToolbarModule.prototype.performCropTransformClick = function () {
26331
+ ToolbarModule.prototype.performCropTransformClick = function (shape) {
26284
26332
  var parent = this.parent;
26285
26333
  parent.notify('draw', { prop: 'setTempStraightenZoomDeg' });
26286
26334
  parent.tempStraighten = parent.transform.straighten;
@@ -26288,7 +26336,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26288
26336
  parent.okBtn();
26289
26337
  }
26290
26338
  parent.isStraightening = true;
26291
- this.refreshToolbar('croptransform');
26339
+ this.refreshToolbar('croptransform', null, null, null, null, shape);
26292
26340
  parent.notify('draw', { prop: 'setDestForStraighten' });
26293
26341
  parent.notify('draw', { prop: 'setTempDestForStraighten' });
26294
26342
  };
@@ -26481,6 +26529,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26481
26529
  else {
26482
26530
  this.defToolbarItems = leftItem.concat(zoomItem, mainItem, rightItem);
26483
26531
  }
26532
+ var args = { toolbarType: 'pen', toolbarItems: this.defToolbarItems };
26533
+ parent.trigger('toolbarUpdating', args);
26534
+ this.defToolbarItems = args.toolbarItems;
26484
26535
  var toolbar = new Toolbar({
26485
26536
  width: '100%',
26486
26537
  items: this.defToolbarItems,
@@ -26649,6 +26700,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26649
26700
  else {
26650
26701
  this.defToolbarItems = leftItem.concat(zoomItem, mainItem, rightItem);
26651
26702
  }
26703
+ var args = { toolbarType: 'finetune', toolbarItems: this.defToolbarItems };
26704
+ parent.trigger('toolbarUpdating', args);
26705
+ this.defToolbarItems = args.toolbarItems;
26652
26706
  var toolbar = new Toolbar({
26653
26707
  width: '100%',
26654
26708
  items: this.defToolbarItems,
@@ -26700,6 +26754,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26700
26754
  styles: 'position: absolute'
26701
26755
  }));
26702
26756
  var mainItem = this.getFrameToolbarItem();
26757
+ var args = { toolbarType: 'frame', toolbarItems: mainItem };
26758
+ parent.trigger('toolbarUpdating', args);
26759
+ mainItem = args.toolbarItems;
26703
26760
  var toolbar = new Toolbar({
26704
26761
  width: '100%',
26705
26762
  items: mainItem,
@@ -27325,6 +27382,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
27325
27382
  var parent = this.parent;
27326
27383
  var id = parent.element.id;
27327
27384
  var mainItem = this.getFilterToolbarItem();
27385
+ var args = { toolbarType: 'filter', toolbarItems: mainItem };
27386
+ parent.trigger('toolbarUpdating', args);
27387
+ mainItem = args.toolbarItems;
27328
27388
  if (document.querySelector('#' + id + '_contextualToolbar').classList.contains('e-control')) {
27329
27389
  getComponent(document.getElementById(id + '_contextualToolbar'), 'toolbar').destroy();
27330
27390
  }
@@ -27518,6 +27578,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
27518
27578
  qtArea.style.top = point.startY - (height + (height / 1.5)) + 'px';
27519
27579
  }
27520
27580
  }
27581
+ if (parseFloat(qtArea.style.top) < 0) {
27582
+ qtArea.style.top = '0px';
27583
+ }
27521
27584
  }
27522
27585
  };
27523
27586
  ToolbarModule.prototype.refreshDropDownBtn = function (isDisabled) {