@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
@@ -1096,7 +1096,7 @@ class Draw {
1096
1096
  this.updateCanvas();
1097
1097
  break;
1098
1098
  case 'performCancel':
1099
- this.performCancel(args.value['isContextualToolbar']);
1099
+ this.performCancel(args.value['isContextualToolbar'], args.value['isUndoRedo']);
1100
1100
  break;
1101
1101
  case 'updateFlipPan':
1102
1102
  this.updateFlipPan(args.value['tempSelectionObj']);
@@ -1547,7 +1547,7 @@ class Draw {
1547
1547
  let width;
1548
1548
  let height;
1549
1549
  const canvasWidth = parent.lowerCanvas.clientWidth;
1550
- const canvasHeight = parent.lowerCanvas.clientHeight;
1550
+ const canvasHeight = parent.lowerCanvas.clientHeight + 1;
1551
1551
  const { destLeft, destTop, destWidth, destHeight } = parent.img;
1552
1552
  if (parent.transform.zoomFactor > 0 && this.currSelPoint) {
1553
1553
  const activeObj = extend({}, parent.activeObj, {}, true);
@@ -1588,13 +1588,11 @@ class Draw {
1588
1588
  if (destTop < 0) {
1589
1589
  height += destTop;
1590
1590
  }
1591
- if (parent.currObjType.shape.toLowerCase() !== 'crop-square' && parent.currObjType.shape.toLowerCase() !== 'crop-circle') {
1592
- if (destLeft + destWidth > parent.lowerCanvas.width) {
1593
- width -= (destLeft + destWidth - parent.lowerCanvas.width);
1594
- }
1595
- if (destTop + destHeight > parent.lowerCanvas.height) {
1596
- height -= (destTop + destHeight - parent.lowerCanvas.height);
1597
- }
1591
+ if (destLeft + destWidth > parent.lowerCanvas.width) {
1592
+ width -= (destLeft + destWidth - parent.lowerCanvas.width);
1593
+ }
1594
+ if (destTop + destHeight > parent.lowerCanvas.height) {
1595
+ height -= (destTop + destHeight - parent.lowerCanvas.height);
1598
1596
  }
1599
1597
  }
1600
1598
  switch (parent.currObjType.shape.toLowerCase()) {
@@ -3216,7 +3214,7 @@ class Draw {
3216
3214
  parent.img.destHeight = maxDimension.width;
3217
3215
  }
3218
3216
  parent.img.destLeft = (parent.lowerCanvas.clientWidth - maxDimension.height) / 2;
3219
- parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.width + 1) / 2;
3217
+ parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.width) / 2;
3220
3218
  parent.img.destWidth = maxDimension.height;
3221
3219
  parent.img.destHeight = maxDimension.width;
3222
3220
  }
@@ -3232,7 +3230,12 @@ class Draw {
3232
3230
  parent.img.destHeight = maxDimension.height;
3233
3231
  }
3234
3232
  parent.img.destLeft = (parent.lowerCanvas.clientWidth - maxDimension.width) / 2;
3235
- parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height + 1) / 2;
3233
+ if (degree === 0) {
3234
+ parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height + 1) / 2;
3235
+ }
3236
+ else {
3237
+ parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height) / 2;
3238
+ }
3236
3239
  parent.img.destWidth = maxDimension.width;
3237
3240
  parent.img.destHeight = maxDimension.height;
3238
3241
  }
@@ -3422,6 +3425,7 @@ class Draw {
3422
3425
  hideSpinner(parent.element);
3423
3426
  parent.element.style.opacity = '1';
3424
3427
  proxy.updateBaseImgCanvas();
3428
+ const fileOpened = { fileName: this.fileName, fileType: this.fileType, isValidImage: true };
3425
3429
  proxy.updateCanvas();
3426
3430
  if (parent.currObjType.isUndoZoom) {
3427
3431
  parent.currObjType.isUndoZoom = false;
@@ -3451,6 +3455,14 @@ class Draw {
3451
3455
  - parent.toolbarHeight * 2) - 1 + 'px';
3452
3456
  }
3453
3457
  }
3458
+ if (parent.isImageLoaded && parent.element.style.opacity !== '0.5') {
3459
+ if (isBlazor() && parent.events && parent.events.fileOpened.hasDelegate === true) {
3460
+ parent.dotNetRef.invokeMethodAsync('FileOpenEventAsync', 'FileOpened', fileOpened);
3461
+ }
3462
+ else {
3463
+ parent.trigger('fileOpened', fileOpened);
3464
+ }
3465
+ }
3454
3466
  };
3455
3467
  parent.baseImg.onerror = () => {
3456
3468
  hideSpinner(parent.element);
@@ -3476,7 +3488,6 @@ class Draw {
3476
3488
  }
3477
3489
  updateCanvas() {
3478
3490
  const parent = this.parent;
3479
- const fileOpened = { fileName: this.fileName, fileType: this.fileType, isValidImage: true };
3480
3491
  parent.img.srcWidth = parent.baseImgCanvas.width;
3481
3492
  parent.img.srcHeight = parent.baseImgCanvas.height;
3482
3493
  const obj = { width: 0, height: 0 };
@@ -3512,14 +3523,6 @@ class Draw {
3512
3523
  if (parent.disabled) {
3513
3524
  parent.element.setAttribute('class', 'e-disabled');
3514
3525
  }
3515
- if (parent.isImageLoaded && parent.element.style.opacity !== '0.5') {
3516
- if (isBlazor() && parent.events && parent.events.fileOpened.hasDelegate === true) {
3517
- parent.dotNetRef.invokeMethodAsync('FileOpenEventAsync', 'FileOpened', fileOpened);
3518
- }
3519
- else {
3520
- parent.trigger('fileOpened', fileOpened);
3521
- }
3522
- }
3523
3526
  if (parent.zoomSettings.zoomFactor !== 1 || parent.zoomSettings.zoomPoint) {
3524
3527
  parent.zoom(parent.zoomSettings.zoomFactor, parent.zoomSettings.zoomPoint);
3525
3528
  }
@@ -3546,14 +3549,14 @@ class Draw {
3546
3549
  parent.cancelCropSelection = null;
3547
3550
  }
3548
3551
  }
3549
- performCancel(isContextualToolbar) {
3552
+ performCancel(isContextualToolbar, isUndoRedo) {
3550
3553
  const parent = this.parent;
3551
3554
  const straightenObj = { bool: parent.isStraightening };
3552
3555
  isContextualToolbar = isContextualToolbar ? isContextualToolbar : false;
3553
3556
  const obj = { bool: false };
3554
3557
  parent.allowDownScale = true;
3555
3558
  parent.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: obj } });
3556
- if (JSON.stringify(parent.frameObj) !== JSON.stringify(parent.tempFrameObj)) {
3559
+ if (isNullOrUndefined(isUndoRedo) && JSON.stringify(parent.frameObj) !== JSON.stringify(parent.tempFrameObj)) {
3557
3560
  extend(parent.frameObj, parent.tempFrameObj);
3558
3561
  this.renderImage(null, null, true);
3559
3562
  }
@@ -4316,16 +4319,16 @@ class Draw {
4316
4319
  setClientTransDim(isPreventDimension) {
4317
4320
  const parent = this.parent;
4318
4321
  if (parent.transform.degree % 90 === 0 && parent.transform.degree % 180 !== 0) {
4319
- parent.img.destLeft = (parent.lowerCanvas.width - parent.img.destHeight) / 2;
4320
- parent.img.destTop = (parent.lowerCanvas.height - parent.img.destWidth) / 2;
4322
+ parent.img.destLeft = (parent.lowerCanvas.clientWidth - parent.img.destHeight) / 2;
4323
+ parent.img.destTop = (parent.lowerCanvas.clientHeight - parent.img.destWidth + 1) / 2;
4321
4324
  const temp = parent.img.destWidth;
4322
4325
  parent.img.destWidth = parent.img.destHeight;
4323
4326
  parent.img.destHeight = temp;
4324
4327
  }
4325
4328
  else {
4326
4329
  if (isNullOrUndefined(isPreventDimension)) {
4327
- parent.img.destLeft = (parent.lowerCanvas.width - parent.img.destWidth) / 2;
4328
- parent.img.destTop = (parent.lowerCanvas.height - parent.img.destHeight) / 2;
4330
+ parent.img.destLeft = (parent.lowerCanvas.clientWidth - parent.img.destWidth) / 2;
4331
+ parent.img.destTop = (parent.lowerCanvas.clientHeight - parent.img.destHeight + 1) / 2;
4329
4332
  }
4330
4333
  }
4331
4334
  }
@@ -12613,7 +12616,15 @@ class Selection {
12613
12616
  this.getCurrentFlipState();
12614
12617
  }
12615
12618
  else {
12619
+ const totalPannedInternalPoint = extend({}, parent.panPoint.totalPannedInternalPoint, {}, true);
12620
+ const destPoints = { startX: parent.img.destLeft, startY: parent.img.destTop, width: parent.img.destWidth,
12621
+ height: parent.img.destHeight };
12616
12622
  parent.notify('draw', { prop: 'callUpdateCurrTransState', onPropertyChange: false });
12623
+ parent.panPoint.totalPannedInternalPoint = totalPannedInternalPoint;
12624
+ parent.img.destLeft = destPoints.startX;
12625
+ parent.img.destTop = destPoints.startY;
12626
+ parent.img.destWidth = destPoints.width;
12627
+ parent.img.destHeight = destPoints.height;
12617
12628
  parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
12618
12629
  value: { context: this.lowerContext, points: null } });
12619
12630
  }
@@ -15130,12 +15141,14 @@ class Shape {
15130
15141
  return;
15131
15142
  }
15132
15143
  else if (e.type === 'dblclick') {
15144
+ const activeObj = extend({}, parent.activeObj, {}, true);
15133
15145
  const objColl = extend([], parent.objColl, [], true);
15134
15146
  const obj = { bool: null };
15135
15147
  parent.notify('selection', { prop: 'findTargetObj', onPropertyChange: false,
15136
15148
  value: { x: e.clientX, y: e.clientY, isCrop: false, obj: obj } });
15137
15149
  parent.objColl = objColl;
15138
15150
  if (!obj['bool'] || parent.activeObj.shape !== 'text') {
15151
+ parent.activeObj = extend({}, activeObj, {}, true);
15139
15152
  return;
15140
15153
  }
15141
15154
  }
@@ -17812,11 +17825,11 @@ class Transform {
17812
17825
  if (parent.img.destTop > 0) {
17813
17826
  parent.img.destTop = 0;
17814
17827
  }
17815
- if (parent.img.destLeft + maxDimension.width < parent.lowerCanvas.width) {
17816
- parent.img.destLeft = parent.lowerCanvas.width - parent.img.destWidth;
17828
+ if (parent.img.destLeft + maxDimension.width < parent.lowerCanvas.clientWidth) {
17829
+ parent.img.destLeft = parent.lowerCanvas.clientWidth - parent.img.destWidth;
17817
17830
  }
17818
- if (parent.img.destTop + maxDimension.height < parent.lowerCanvas.height) {
17819
- parent.img.destTop = parent.lowerCanvas.height - parent.img.destHeight;
17831
+ if (parent.img.destTop + maxDimension.height < parent.lowerCanvas.clientHeight) {
17832
+ parent.img.destTop = parent.lowerCanvas.clientHeight - parent.img.destHeight;
17820
17833
  }
17821
17834
  }
17822
17835
  return maxDimension;
@@ -19028,12 +19041,16 @@ class Transform {
19028
19041
  }
19029
19042
  straightenImage(degree) {
19030
19043
  const parent = this.parent;
19044
+ if (parent.toolbar && parent.toolbar.length === 0) {
19045
+ parent.notify('draw', { prop: 'select', onPropertyChange: false,
19046
+ value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
19047
+ }
19031
19048
  if (isBlazor()) {
19032
19049
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
19033
19050
  parent.performCropClick();
19034
19051
  }
19035
19052
  else {
19036
- parent.notify('toolbar', { prop: 'performCropTransformClick' });
19053
+ parent.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: null } });
19037
19054
  }
19038
19055
  parent.setStraighten(degree, true);
19039
19056
  if ((isBlazor() && parent.events && parent.events.straightening.hasDelegate === false) || !isBlazor()) {
@@ -19425,7 +19442,7 @@ class UndoRedo {
19425
19442
  this.tempCurrSelPoint = extend({}, parent.currSelectionPoint, {}, true);
19426
19443
  parent.currSelectionPoint = null;
19427
19444
  }
19428
- parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
19445
+ parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null, isUndoRedo: true } });
19429
19446
  parent.currObjType.isActiveObj = false;
19430
19447
  if (parent.transform.straighten !== 0) {
19431
19448
  parent.notify('draw', { prop: 'setStraightenActObj', value: { activeObj: null } });
@@ -19988,6 +20005,16 @@ class UndoRedo {
19988
20005
  this.parent.notify('draw', { prop: 'getArrowDimension', onPropertyChange: false, value: { obj: arrowObj } });
19989
20006
  const tempArrowObj = extend({}, arrowObj['arrowDimension'], {}, true);
19990
20007
  if (parent.transform.zoomFactor > 0 && (obj.length > 0 || point.length > 0)) {
20008
+ if (obj.length > 0) {
20009
+ for (let i = 0; i < obj.length; i++) {
20010
+ if (obj[i].currIndex) {
20011
+ continue;
20012
+ }
20013
+ else {
20014
+ obj[i].currIndex = 'shape_' + (i + 1);
20015
+ }
20016
+ }
20017
+ }
19991
20018
  parent.objColl = obj;
19992
20019
  parent.pointColl = point;
19993
20020
  const isUndoRedo = parent.isUndoRedo;
@@ -21170,6 +21197,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21170
21197
  *
21171
21198
  */
21172
21199
  select(type, startX, startY, width, height) {
21200
+ this.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: 'crop-' + type } });
21173
21201
  this.notify('draw', { prop: 'select', onPropertyChange: false,
21174
21202
  value: { type: type, startX: startX, startY: startY, width: width, height: height } });
21175
21203
  this.notify('draw', { prop: 'select', onPropertyChange: false,
@@ -23359,7 +23387,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23359
23387
  this.initializeThemeColl();
23360
23388
  }
23361
23389
  initializeZoomSettings() {
23362
- if (isNullOrUndefined(this.zoomSettings.zoomTrigger)) {
23390
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
23391
+ if (isNullOrUndefined(this.zoomSettings.zoomTrigger) || this.zoomSettings.zoomTrigger === 0) {
23363
23392
  this.zoomSettings.zoomTrigger = (ZoomTrigger.MouseWheel | ZoomTrigger.Pinch | ZoomTrigger.Toolbar | ZoomTrigger.Commands);
23364
23393
  }
23365
23394
  if (isNullOrUndefined(this.selectionSettings.strokeColor)) {
@@ -24151,7 +24180,7 @@ class ToolbarModule {
24151
24180
  this.frameToolbarClick();
24152
24181
  break;
24153
24182
  case 'performCropTransformClick':
24154
- this.performCropTransformClick();
24183
+ this.performCropTransformClick(args.value['shape']);
24155
24184
  break;
24156
24185
  case 'duplicateShape':
24157
24186
  this.duplicateShape(args.value['isPreventUndoRedo'], true);
@@ -24343,6 +24372,9 @@ class ToolbarModule {
24343
24372
  else {
24344
24373
  this.defToolbarItems = [...leftItem, ...mainItem, ...rightItem, ...zoomItem];
24345
24374
  }
24375
+ const args = { toolbarType: 'main', toolbarItems: this.defToolbarItems };
24376
+ parent.trigger('toolbarUpdating', args);
24377
+ this.defToolbarItems = args.toolbarItems;
24346
24378
  const toolbarObj = new Toolbar({
24347
24379
  width: '100%',
24348
24380
  items: this.defToolbarItems,
@@ -24375,7 +24407,10 @@ class ToolbarModule {
24375
24407
  const parent = this.parent;
24376
24408
  const id = parent.element.id;
24377
24409
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)) {
24378
- const items = this.getMainToolbarItem();
24410
+ let items = this.getMainToolbarItem();
24411
+ const args = { toolbarType: 'bottom-toolbar', toolbarItems: items };
24412
+ parent.trigger('toolbarUpdating', args);
24413
+ items = args.toolbarItems;
24379
24414
  const toolbarObj = new Toolbar({ items: items, width: '100%',
24380
24415
  created: () => {
24381
24416
  this.renderAnnotationBtn();
@@ -24799,6 +24834,9 @@ class ToolbarModule {
24799
24834
  else {
24800
24835
  this.defToolbarItems = [...leftItem, ...zoomItem, ...mainItem, ...rightItem];
24801
24836
  }
24837
+ const args = { toolbarType: 'resize', toolbarItems: this.defToolbarItems };
24838
+ parent.trigger('toolbarUpdating', args);
24839
+ this.defToolbarItems = args.toolbarItems;
24802
24840
  const toolbar = new Toolbar({
24803
24841
  width: '100%',
24804
24842
  items: this.defToolbarItems,
@@ -25099,7 +25137,7 @@ class ToolbarModule {
25099
25137
  }
25100
25138
  }
25101
25139
  }
25102
- renderCropBtn() {
25140
+ renderCropBtn(shapeString) {
25103
25141
  const parent = this.parent;
25104
25142
  const items = [];
25105
25143
  let isCustomized = false;
@@ -25135,7 +25173,11 @@ class ToolbarModule {
25135
25173
  }
25136
25174
  let iconCss;
25137
25175
  let shape;
25138
- if (parent.activeObj.shape) {
25176
+ if (shapeString) {
25177
+ iconCss = this.getCurrentShapeIcon(shapeString);
25178
+ shape = shapeString;
25179
+ }
25180
+ else if (parent.activeObj.shape) {
25139
25181
  iconCss = this.getCurrentShapeIcon(parent.activeObj.shape);
25140
25182
  shape = parent.activeObj.shape;
25141
25183
  }
@@ -25345,7 +25387,7 @@ class ToolbarModule {
25345
25387
  }
25346
25388
  return toolbarItems;
25347
25389
  }
25348
- initCropTransformToolbar() {
25390
+ initCropTransformToolbar(shape) {
25349
25391
  const parent = this.parent;
25350
25392
  const id = parent.element.id;
25351
25393
  const leftItem = this.getLeftToolbarItem();
@@ -25358,12 +25400,15 @@ class ToolbarModule {
25358
25400
  else {
25359
25401
  this.defToolbarItems = [...leftItem, ...zoomItem, ...mainItem, ...rightItem];
25360
25402
  }
25403
+ const args = { toolbarType: 'crop-transform', toolbarItems: this.defToolbarItems };
25404
+ parent.trigger('toolbarUpdating', args);
25405
+ this.defToolbarItems = args.toolbarItems;
25361
25406
  const toolbar = new Toolbar({
25362
25407
  width: '100%',
25363
25408
  items: this.defToolbarItems,
25364
25409
  clicked: this.defToolbarClicked.bind(this),
25365
25410
  created: () => {
25366
- this.renderCropBtn();
25411
+ this.renderCropBtn(shape);
25367
25412
  this.renderStraightenSlider();
25368
25413
  this.wireZoomBtnEvents();
25369
25414
  if (!Browser.isDevice) {
@@ -25405,8 +25450,6 @@ class ToolbarModule {
25405
25450
  && slider && slider.parentElement.scrollHeight > this.toolbarHeight) {
25406
25451
  this.toolbarHeight = parent.toolbarHeight = slider.parentElement.scrollHeight;
25407
25452
  }
25408
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
25409
- toolbar.refreshOverflow();
25410
25453
  this.enableDisableTbrBtn();
25411
25454
  parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
25412
25455
  }
@@ -25465,6 +25508,10 @@ class ToolbarModule {
25465
25508
  else {
25466
25509
  this.defToolbarItems = [...leftItem, ...zoomItem, ...mainItem, ...rightItem];
25467
25510
  }
25511
+ const args = { toolbarType: parent.activeObj.shape ? parent.activeObj.shape : 'shapes',
25512
+ toolbarItems: this.defToolbarItems };
25513
+ parent.trigger('toolbarUpdating', args);
25514
+ this.defToolbarItems = args.toolbarItems;
25468
25515
  const toolbar = new Toolbar({
25469
25516
  width: '100%',
25470
25517
  items: this.defToolbarItems,
@@ -25869,6 +25916,9 @@ class ToolbarModule {
25869
25916
  else {
25870
25917
  this.defToolbarItems = [...leftItem, ...zoomItem, ...mainItem, ...rightItem];
25871
25918
  }
25919
+ const args = { toolbarType: 'text', toolbarItems: this.defToolbarItems };
25920
+ parent.trigger('toolbarUpdating', args);
25921
+ this.defToolbarItems = args.toolbarItems;
25872
25922
  const toolbar = new Toolbar({
25873
25923
  width: '100%',
25874
25924
  items: this.defToolbarItems,
@@ -25992,8 +26042,10 @@ class ToolbarModule {
25992
26042
  else {
25993
26043
  fontFamily = parent.activeObj.textSettings.fontFamily;
25994
26044
  }
25995
- args.element.querySelector('[id *= ' + '"' + fontFamily.toLowerCase()
25996
- + '"' + ']').classList.add('e-selected-btn');
26045
+ const elem = args.element.querySelector('[id *= ' + '"' + fontFamily.toLowerCase() + '"' + ']');
26046
+ if (elem) {
26047
+ elem.classList.add('e-selected-btn');
26048
+ }
25997
26049
  },
25998
26050
  select: (args) => {
25999
26051
  spanElem.textContent = args.item.text;
@@ -26031,14 +26083,13 @@ class ToolbarModule {
26031
26083
  fontSizeBtn.appendTo('#' + id + '_fontSizeBtn');
26032
26084
  }
26033
26085
  }
26034
- refreshToolbar(type, isApplyBtn, isCropping, isZooming, cType) {
26086
+ refreshToolbar(type, isApplyBtn, isCropping, isZooming, cType, shape) {
26035
26087
  const parent = this.parent;
26036
26088
  const id = parent.element.id;
26037
26089
  if (!parent.isImageLoaded || parent.isCropToolbar) {
26038
26090
  return;
26039
26091
  }
26040
- const item = type === 'shapes' && parent.activeObj.shape ? parent.activeObj.shape : type;
26041
- const args = { toolbarType: item };
26092
+ const args = {};
26042
26093
  let aspectIcon;
26043
26094
  let nonAspectIcon;
26044
26095
  if (type !== 'filter' && type !== 'color') {
@@ -26104,7 +26155,6 @@ class ToolbarModule {
26104
26155
  else {
26105
26156
  args.toolbarItems = ['fillColor', 'strokeColor', 'strokeWidth', 'duplicate', 'remove'];
26106
26157
  }
26107
- parent.trigger('toolbarUpdating', args);
26108
26158
  this.initShapesToolbarItem(args.toolbarItems);
26109
26159
  break;
26110
26160
  case 'text':
@@ -26112,7 +26162,6 @@ class ToolbarModule {
26112
26162
  this.initMainToolbar(false, true, true);
26113
26163
  }
26114
26164
  args.toolbarItems = ['fontFamily', 'fontSize', 'fontColor', 'bold', 'italic', 'duplicate', 'remove', 'text'];
26115
- parent.trigger('toolbarUpdating', args);
26116
26165
  this.initTextToolbarItem(args.toolbarItems);
26117
26166
  break;
26118
26167
  case 'pen':
@@ -26120,7 +26169,6 @@ class ToolbarModule {
26120
26169
  this.initMainToolbar(false, true, true);
26121
26170
  }
26122
26171
  args.toolbarItems = ['strokeColor', 'strokeWidth', 'remove', 'transparency'];
26123
- parent.trigger('toolbarUpdating', args);
26124
26172
  this.initPenToolbarItem(args.toolbarItems);
26125
26173
  break;
26126
26174
  case 'adjustment':
@@ -26162,7 +26210,7 @@ class ToolbarModule {
26162
26210
  this.initMainToolbar(false, true, true);
26163
26211
  }
26164
26212
  parent.updateCropTransformItems();
26165
- this.initCropTransformToolbar();
26213
+ this.initCropTransformToolbar(shape);
26166
26214
  if (Browser.isDevice) {
26167
26215
  this.updateContextualToolbar('color', 'straighten', true);
26168
26216
  }
@@ -26189,7 +26237,7 @@ class ToolbarModule {
26189
26237
  this.currToolbar = type;
26190
26238
  this.refreshDropDownBtn(isCropping);
26191
26239
  }
26192
- performCropTransformClick() {
26240
+ performCropTransformClick(shape) {
26193
26241
  const parent = this.parent;
26194
26242
  parent.notify('draw', { prop: 'setTempStraightenZoomDeg' });
26195
26243
  parent.tempStraighten = parent.transform.straighten;
@@ -26197,7 +26245,7 @@ class ToolbarModule {
26197
26245
  parent.okBtn();
26198
26246
  }
26199
26247
  parent.isStraightening = true;
26200
- this.refreshToolbar('croptransform');
26248
+ this.refreshToolbar('croptransform', null, null, null, null, shape);
26201
26249
  parent.notify('draw', { prop: 'setDestForStraighten' });
26202
26250
  parent.notify('draw', { prop: 'setTempDestForStraighten' });
26203
26251
  }
@@ -26389,6 +26437,9 @@ class ToolbarModule {
26389
26437
  else {
26390
26438
  this.defToolbarItems = [...leftItem, ...zoomItem, ...mainItem, ...rightItem];
26391
26439
  }
26440
+ const args = { toolbarType: 'pen', toolbarItems: this.defToolbarItems };
26441
+ parent.trigger('toolbarUpdating', args);
26442
+ this.defToolbarItems = args.toolbarItems;
26392
26443
  const toolbar = new Toolbar({
26393
26444
  width: '100%',
26394
26445
  items: this.defToolbarItems,
@@ -26555,6 +26606,9 @@ class ToolbarModule {
26555
26606
  else {
26556
26607
  this.defToolbarItems = [...leftItem, ...zoomItem, ...mainItem, ...rightItem];
26557
26608
  }
26609
+ const args = { toolbarType: 'finetune', toolbarItems: this.defToolbarItems };
26610
+ parent.trigger('toolbarUpdating', args);
26611
+ this.defToolbarItems = args.toolbarItems;
26558
26612
  const toolbar = new Toolbar({
26559
26613
  width: '100%',
26560
26614
  items: this.defToolbarItems,
@@ -26604,7 +26658,10 @@ class ToolbarModule {
26604
26658
  id: id + '_customizeWrapper',
26605
26659
  styles: 'position: absolute'
26606
26660
  }));
26607
- const mainItem = this.getFrameToolbarItem();
26661
+ let mainItem = this.getFrameToolbarItem();
26662
+ const args = { toolbarType: 'frame', toolbarItems: mainItem };
26663
+ parent.trigger('toolbarUpdating', args);
26664
+ mainItem = args.toolbarItems;
26608
26665
  const toolbar = new Toolbar({
26609
26666
  width: '100%',
26610
26667
  items: mainItem,
@@ -27228,7 +27285,10 @@ class ToolbarModule {
27228
27285
  initFilterToolbarItem() {
27229
27286
  const parent = this.parent;
27230
27287
  const id = parent.element.id;
27231
- const mainItem = this.getFilterToolbarItem();
27288
+ let mainItem = this.getFilterToolbarItem();
27289
+ const args = { toolbarType: 'filter', toolbarItems: mainItem };
27290
+ parent.trigger('toolbarUpdating', args);
27291
+ mainItem = args.toolbarItems;
27232
27292
  if (document.querySelector('#' + id + '_contextualToolbar').classList.contains('e-control')) {
27233
27293
  getComponent(document.getElementById(id + '_contextualToolbar'), 'toolbar').destroy();
27234
27294
  }
@@ -27422,6 +27482,9 @@ class ToolbarModule {
27422
27482
  qtArea.style.top = point.startY - (height + (height / 1.5)) + 'px';
27423
27483
  }
27424
27484
  }
27485
+ if (parseFloat(qtArea.style.top) < 0) {
27486
+ qtArea.style.top = '0px';
27487
+ }
27425
27488
  }
27426
27489
  }
27427
27490
  refreshDropDownBtn(isDisabled) {