@syncfusion/ej2-image-editor 24.1.46 → 24.2.4

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 (68) hide show
  1. package/CHANGELOG.md +12 -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 +189 -39
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +189 -39
  7. package/dist/es6/ej2-image-editor.es5.js.map +1 -1
  8. package/dist/global/ej2-image-editor.min.js +2 -2
  9. package/dist/global/ej2-image-editor.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/package.json +11 -11
  12. package/src/image-editor/action/draw.js +3 -0
  13. package/src/image-editor/action/selection.d.ts +1 -0
  14. package/src/image-editor/action/selection.js +11 -2
  15. package/src/image-editor/action/shape.js +6 -6
  16. package/src/image-editor/action/undo-redo.d.ts +1 -0
  17. package/src/image-editor/action/undo-redo.js +43 -6
  18. package/src/image-editor/renderer/toolbar.d.ts +4 -0
  19. package/src/image-editor/renderer/toolbar.js +126 -25
  20. package/styles/bootstrap-dark.css +12 -0
  21. package/styles/bootstrap.css +12 -0
  22. package/styles/bootstrap4.css +12 -0
  23. package/styles/bootstrap5-dark.css +12 -0
  24. package/styles/bootstrap5.css +12 -0
  25. package/styles/fabric-dark.css +12 -0
  26. package/styles/fabric.css +12 -0
  27. package/styles/fluent-dark.css +12 -0
  28. package/styles/fluent.css +12 -0
  29. package/styles/highcontrast-light.css +12 -0
  30. package/styles/highcontrast.css +12 -0
  31. package/styles/image-editor/_bootstrap-dark-definition.scss +1 -0
  32. package/styles/image-editor/_bootstrap-definition.scss +1 -0
  33. package/styles/image-editor/_bootstrap4-definition.scss +1 -0
  34. package/styles/image-editor/_bootstrap5-definition.scss +1 -0
  35. package/styles/image-editor/_fabric-dark-definition.scss +1 -0
  36. package/styles/image-editor/_fabric-definition.scss +1 -0
  37. package/styles/image-editor/_fluent-definition.scss +1 -0
  38. package/styles/image-editor/_fusionnew-definition.scss +1 -0
  39. package/styles/image-editor/_highcontrast-definition.scss +1 -0
  40. package/styles/image-editor/_highcontrast-light-definition.scss +1 -0
  41. package/styles/image-editor/_layout.scss +32 -2
  42. package/styles/image-editor/_material-dark-definition.scss +1 -0
  43. package/styles/image-editor/_material-definition.scss +1 -0
  44. package/styles/image-editor/_material3-definition.scss +3 -2
  45. package/styles/image-editor/_tailwind-definition.scss +1 -0
  46. package/styles/image-editor/bootstrap-dark.css +12 -0
  47. package/styles/image-editor/bootstrap.css +12 -0
  48. package/styles/image-editor/bootstrap4.css +12 -0
  49. package/styles/image-editor/bootstrap5-dark.css +12 -0
  50. package/styles/image-editor/bootstrap5.css +12 -0
  51. package/styles/image-editor/fabric-dark.css +12 -0
  52. package/styles/image-editor/fabric.css +12 -0
  53. package/styles/image-editor/fluent-dark.css +12 -0
  54. package/styles/image-editor/fluent.css +12 -0
  55. package/styles/image-editor/highcontrast-light.css +12 -0
  56. package/styles/image-editor/highcontrast.css +12 -0
  57. package/styles/image-editor/material-dark.css +12 -0
  58. package/styles/image-editor/material.css +12 -0
  59. package/styles/image-editor/material3-dark.css +25 -4
  60. package/styles/image-editor/material3.css +25 -4
  61. package/styles/image-editor/tailwind-dark.css +15 -2
  62. package/styles/image-editor/tailwind.css +15 -2
  63. package/styles/material-dark.css +12 -0
  64. package/styles/material.css +12 -0
  65. package/styles/material3-dark.css +25 -4
  66. package/styles/material3.css +25 -4
  67. package/styles/tailwind-dark.css +15 -2
  68. package/styles/tailwind.css +15 -2
@@ -4889,6 +4889,9 @@ class Draw {
4889
4889
  if (lastDotIndex !== -1) {
4890
4890
  return url.slice(lastDotIndex + 1).toLowerCase();
4891
4891
  }
4892
+ else if (url.indexOf('base64') !== -1) {
4893
+ return url.slice(url.indexOf('/') + 1, url.indexOf(';')).toLowerCase();
4894
+ }
4892
4895
  return null;
4893
4896
  }
4894
4897
  fileSelect(inputElement, args) {
@@ -8299,6 +8302,7 @@ class Selection {
8299
8302
  this.isImageClarity = true;
8300
8303
  this.isPinching = false;
8301
8304
  this.isSliding = false;
8305
+ this.mouseDown = '';
8302
8306
  this.parent = parent;
8303
8307
  this.addEventListener();
8304
8308
  }
@@ -8587,6 +8591,7 @@ class Selection {
8587
8591
  this.currentDrawingShape = '';
8588
8592
  this.initialPrevObj = {};
8589
8593
  this.resizedElement = '';
8594
+ this.mouseDown = '';
8590
8595
  }
8591
8596
  performTabAction() {
8592
8597
  const parent = this.parent;
@@ -11002,6 +11007,8 @@ class Selection {
11002
11007
  }
11003
11008
  mouseDownEventHandler(e) {
11004
11009
  const parent = this.parent;
11010
+ this.mouseDown = e.currentTarget === parent.lowerCanvas || e.currentTarget === parent.upperCanvas ?
11011
+ 'canvas' : '';
11005
11012
  if (e.type === 'touchstart') {
11006
11013
  this.isTouch = true;
11007
11014
  }
@@ -11439,6 +11446,10 @@ class Selection {
11439
11446
  && !parent.element.querySelector('#' + id + '_headWrapper').parentElement.classList.contains('e-hide')))) {
11440
11447
  return;
11441
11448
  }
11449
+ else if (e.currentTarget === document && this.mouseDown === '') {
11450
+ e.stopImmediatePropagation();
11451
+ return;
11452
+ }
11442
11453
  if (e.type === 'touchstart') {
11443
11454
  this.isTouch = false;
11444
11455
  }
@@ -11560,13 +11571,13 @@ class Selection {
11560
11571
  if (this.currentDrawingShape === 'text') {
11561
11572
  const prevCropObj = extend({}, parent.cropObj, {}, true);
11562
11573
  parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
11563
- value: { operation: 'shapeTransform', previousObj: this.initialPrevObj, previousObjColl: this.initialPrevObj.objColl,
11574
+ value: { operation: 'shapeInsert', previousObj: this.initialPrevObj, previousObjColl: this.initialPrevObj.objColl,
11564
11575
  previousPointColl: this.initialPrevObj.pointColl, previousSelPointColl: this.initialPrevObj.selPointColl,
11565
11576
  previousCropObj: prevCropObj, previousText: null,
11566
11577
  currentText: null, previousFilter: null, isCircleCrop: null } });
11567
11578
  }
11568
11579
  else {
11569
- parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: this.initialPrevObj.objColl } });
11580
+ parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: this.initialPrevObj.objColl, operation: 'shapeInsert' } });
11570
11581
  }
11571
11582
  this.isShapeInserted = true;
11572
11583
  this.currentDrawingShape = '';
@@ -11698,6 +11709,7 @@ class Selection {
11698
11709
  parent.currObjType.shape = '';
11699
11710
  }
11700
11711
  this.dragElement = '';
11712
+ this.mouseDown = '';
11701
11713
  parent.currObjType.isInitialLine = parent.currObjType.isDragging = false;
11702
11714
  this.selMouseUpEvent();
11703
11715
  }
@@ -13725,7 +13737,7 @@ class Shape {
13725
13737
  parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
13726
13738
  parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
13727
13739
  if (parent.isPublicMethod) {
13728
- parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
13740
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
13729
13741
  }
13730
13742
  parent.isPublicMethod = false;
13731
13743
  });
@@ -13751,7 +13763,7 @@ class Shape {
13751
13763
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
13752
13764
  parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
13753
13765
  if (parent.isPublicMethod) {
13754
- parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
13766
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
13755
13767
  }
13756
13768
  parent.isPublicMethod = false;
13757
13769
  }
@@ -13848,7 +13860,7 @@ class Shape {
13848
13860
  parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs, null).then((shapeChangingArgs) => {
13849
13861
  this.drawShapeTextEvent(shapeChangingArgs);
13850
13862
  if (parent.isPublicMethod) {
13851
- parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
13863
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
13852
13864
  }
13853
13865
  parent.isPublicMethod = false;
13854
13866
  });
@@ -13857,7 +13869,7 @@ class Shape {
13857
13869
  parent.trigger('shapeChanging', shapeChangingArgs);
13858
13870
  this.drawShapeTextEvent(shapeChangingArgs);
13859
13871
  if (parent.isPublicMethod) {
13860
- parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
13872
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
13861
13873
  }
13862
13874
  parent.isPublicMethod = false;
13863
13875
  }
@@ -13870,7 +13882,7 @@ class Shape {
13870
13882
  parent.objColl.push(parent.activeObj);
13871
13883
  const prevCropObj = extend({}, parent.cropObj, {}, true);
13872
13884
  parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
13873
- value: { operation: 'shapeTransform', previousObj: this.prevObj, previousObjColl: this.prevObj.objColl,
13885
+ value: { operation: 'shapeInsert', previousObj: this.prevObj, previousObjColl: this.prevObj.objColl,
13874
13886
  previousPointColl: this.prevObj.pointColl, previousSelPointColl: this.prevObj.selPointColl, previousCropObj: prevCropObj,
13875
13887
  previousText: null, currentText: null, previousFilter: null, isCircleCrop: null } });
13876
13888
  parent.notify('selection', { prop: 'redrawShape', onPropertyChange: false,
@@ -13901,7 +13913,7 @@ class Shape {
13901
13913
  parent.objColl.push(parent.activeObj);
13902
13914
  const prevCropObj = extend({}, parent.cropObj, {}, true);
13903
13915
  parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
13904
- value: { operation: 'shapeTransform', previousObj: this.prevObj, previousObjColl: this.prevObj.objColl,
13916
+ value: { operation: 'shapeInsert', previousObj: this.prevObj, previousObjColl: this.prevObj.objColl,
13905
13917
  previousPointColl: this.prevObj.pointColl, previousSelPointColl: this.prevObj.selPointColl,
13906
13918
  previousCropObj: prevCropObj, previousText: null, currentText: null, previousFilter: null, isCircleCrop: null } });
13907
13919
  parent.notify('selection', { prop: 'redrawShape', onPropertyChange: false,
@@ -19141,10 +19153,10 @@ class UndoRedo {
19141
19153
  this.redo();
19142
19154
  break;
19143
19155
  case 'updateUrObj':
19144
- this.updateUrObj(args.value['objColl']);
19156
+ this.updateUrObj(args.value['objColl'], args.value['operation']);
19145
19157
  break;
19146
19158
  case 'updateUndoRedo':
19147
- this.updateUndoRedo();
19159
+ this.updateUndoRedo(args.value ? args.value['operation'] : null);
19148
19160
  break;
19149
19161
  case 'getAppliedUndoRedoColl':
19150
19162
  args.value['obj']['appliedUndoRedoColl'] = this.appliedUndoRedoColl;
@@ -19351,6 +19363,7 @@ class UndoRedo {
19351
19363
  undo() {
19352
19364
  const parent = this.parent;
19353
19365
  this.cancelCropSelection();
19366
+ parent.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: false } });
19354
19367
  if (!parent.disabled && parent.isImageLoaded) {
19355
19368
  if (this.undoRedoStep > 0) {
19356
19369
  this.refreshToolbarActions();
@@ -19411,6 +19424,7 @@ class UndoRedo {
19411
19424
  case 'invert':
19412
19425
  case 'sharpen':
19413
19426
  case 'imageRotate':
19427
+ case 'shapeInsert':
19414
19428
  this.shapeTransform(obj.previousObjColl);
19415
19429
  break;
19416
19430
  case 'freehanddraw':
@@ -19488,6 +19502,7 @@ class UndoRedo {
19488
19502
  redo() {
19489
19503
  const parent = this.parent;
19490
19504
  this.cancelCropSelection();
19505
+ parent.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: false } });
19491
19506
  if (!parent.disabled && parent.isImageLoaded) {
19492
19507
  if (this.undoRedoStep < this.appliedUndoRedoColl.length) {
19493
19508
  this.refreshToolbarActions();
@@ -19544,6 +19559,7 @@ class UndoRedo {
19544
19559
  case 'invert':
19545
19560
  case 'sharpen':
19546
19561
  case 'imageRotate':
19562
+ case 'shapeInsert':
19547
19563
  this.shapeTransform(obj.currentObjColl);
19548
19564
  break;
19549
19565
  case 'freehanddraw':
@@ -19881,6 +19897,37 @@ class UndoRedo {
19881
19897
  }
19882
19898
  parent.notify('filter', { prop: 'setAdjustmentValue', onPropertyChange: false, value: { adjustmentValue: this.lowerContext.filter } });
19883
19899
  parent.currObjType.isCustomCrop = false;
19900
+ if (isBlazor() && parent.events && parent.events.historyChanged.hasDelegate === true) {
19901
+ let imageAction = this.getImageAction(operation);
19902
+ const args = { length: this.undoRedoColl.length, index: this.undoRedoStep, actionTrigger: isUndo ? 'Undo' : 'Redo', imageAction: imageAction };
19903
+ parent.dotNetRef.invokeMethodAsync('OnHistoryChangedAsync', args);
19904
+ }
19905
+ }
19906
+ getImageAction(operation) {
19907
+ if (['brightness', 'contrast', 'saturation', 'opacity', 'blur', 'hue'].indexOf(operation) !== -1) {
19908
+ return 'FinetuneApplied';
19909
+ }
19910
+ else if (['chrome', 'cold', 'warm', 'grayscale', 'blackandwhite', 'sepia', 'invert'].indexOf(operation) !== -1) {
19911
+ return 'FilterApplied';
19912
+ }
19913
+ else if (operation === 'frame') {
19914
+ return 'FrameApplied';
19915
+ }
19916
+ else if (operation === 'resize') {
19917
+ return 'ImageResized';
19918
+ }
19919
+ else if (['deleteFreehandDrawing', 'deleteObj'].indexOf(operation) !== -1) {
19920
+ return 'ShapeDeleted';
19921
+ }
19922
+ else if (operation === 'crop') {
19923
+ return 'Cropped';
19924
+ }
19925
+ else if (['shapeInsert', 'freehanddraw', 'freehand-draw'].indexOf(operation) !== -1) {
19926
+ return 'ShapeInserted';
19927
+ }
19928
+ else {
19929
+ return 'ShapeCustomized';
19930
+ }
19884
19931
  }
19885
19932
  updateUrc(operation, previousObj, previousObjColl, previousPointColl, previousSelPointColl, previousCropObj, previousText, currentText, previousFilter, isCircleCrop) {
19886
19933
  const parent = this.parent;
@@ -19948,7 +19995,7 @@ class UndoRedo {
19948
19995
  }
19949
19996
  }
19950
19997
  }
19951
- updateUrObj(objColl) {
19998
+ updateUrObj(objColl, operation) {
19952
19999
  const parent = this.parent;
19953
20000
  if (parent.allowUndoRedo) {
19954
20001
  if (parent.currObjType.isUndoAction) {
@@ -19969,7 +20016,8 @@ class UndoRedo {
19969
20016
  parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
19970
20017
  value: { obj: selPointCollObj } });
19971
20018
  obj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
19972
- this.undoRedoColl.push({ operation: 'shapeTransform', previousObj: obj, currentObj: obj,
20019
+ let oper = operation ? operation : 'shapeTransform';
20020
+ this.undoRedoColl.push({ operation: oper, previousObj: obj, currentObj: obj,
19973
20021
  previousObjColl: objColl, currentObjColl: obj.objColl,
19974
20022
  previousPointColl: obj.pointColl, currentPointColl: obj.pointColl,
19975
20023
  previousSelPointColl: obj.selPointColl, currentSelPointColl: obj.selPointColl,
@@ -19978,7 +20026,7 @@ class UndoRedo {
19978
20026
  value: { obj: parent.objColl[parent.objColl.length - 1] } });
19979
20027
  }
19980
20028
  }
19981
- updateUndoRedo() {
20029
+ updateUndoRedo(operation) {
19982
20030
  const parent = this.parent;
19983
20031
  const prevCropObj = extend({}, parent.cropObj, {}, true);
19984
20032
  const object = { currObj: {} };
@@ -19995,7 +20043,8 @@ class UndoRedo {
19995
20043
  parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
19996
20044
  }
19997
20045
  parent.objColl.push(parent.activeObj);
19998
- this.updateUrc('shapeTransform', prevObj, prevObj.objColl, prevObj.pointColl, prevObj.selPointColl, prevCropObj);
20046
+ let oper = operation ? operation : 'shapeTransform';
20047
+ this.updateUrc(oper, prevObj, prevObj.objColl, prevObj.pointColl, prevObj.selPointColl, prevCropObj);
19999
20048
  parent.objColl.pop();
20000
20049
  parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: null } });
20001
20050
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
@@ -25536,7 +25585,13 @@ class ToolbarModule {
25536
25585
  const args = { toolbarType: parent.activeObj.shape ? parent.activeObj.shape : 'shapes',
25537
25586
  toolbarItems: this.defToolbarItems };
25538
25587
  parent.trigger('toolbarUpdating', args);
25539
- this.defToolbarItems = args.toolbarItems;
25588
+ if (this.isToolbarString(args.toolbarItems)) {
25589
+ items = args.toolbarItems;
25590
+ this.excludeItems(args.toolbarItems);
25591
+ }
25592
+ else {
25593
+ this.defToolbarItems = args.toolbarItems;
25594
+ }
25540
25595
  const toolbar = new Toolbar({
25541
25596
  width: '100%',
25542
25597
  items: this.defToolbarItems,
@@ -25546,8 +25601,12 @@ class ToolbarModule {
25546
25601
  this.createShapeColor(items);
25547
25602
  this.createShapeBtn(items);
25548
25603
  if (parent.activeObj.shape === 'arrow') {
25549
- this.createStartBtn();
25550
- this.createEndBtn();
25604
+ if (items.some(item => item.toLowerCase().indexOf('start') > -1)) {
25605
+ this.createStartBtn();
25606
+ }
25607
+ if (items.some(item => item.toLowerCase().indexOf('end') > -1)) {
25608
+ this.createEndBtn();
25609
+ }
25551
25610
  }
25552
25611
  this.wireZoomBtnEvents();
25553
25612
  if (!Browser.isDevice) {
@@ -25710,24 +25769,24 @@ class ToolbarModule {
25710
25769
  createShapeBtn(items) {
25711
25770
  const parent = this.parent;
25712
25771
  const id = parent.element.id;
25713
- let strokeWidthItems = [
25714
- { id: '1', text: this.l10n.getConstant('XSmall') },
25715
- { id: '2', text: this.l10n.getConstant('Small') },
25716
- { id: '3', text: this.l10n.getConstant('Medium') },
25717
- { id: '4', text: this.l10n.getConstant('Large') },
25718
- { id: '5', text: this.l10n.getConstant('XLarge') }
25719
- ];
25720
- if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse')) {
25721
- strokeWidthItems = [
25722
- { id: '1', text: this.l10n.getConstant('NoOutline') },
25723
- { id: '2', text: this.l10n.getConstant('XSmall') },
25724
- { id: '3', text: this.l10n.getConstant('Small') },
25725
- { id: '4', text: this.l10n.getConstant('Medium') },
25726
- { id: '5', text: this.l10n.getConstant('Large') },
25727
- { id: '6', text: this.l10n.getConstant('XLarge') }
25728
- ];
25729
- }
25730
25772
  if (items.indexOf('strokeWidth') > -1) {
25773
+ let strokeWidthItems = [
25774
+ { id: '1', text: this.l10n.getConstant('XSmall') },
25775
+ { id: '2', text: this.l10n.getConstant('Small') },
25776
+ { id: '3', text: this.l10n.getConstant('Medium') },
25777
+ { id: '4', text: this.l10n.getConstant('Large') },
25778
+ { id: '5', text: this.l10n.getConstant('XLarge') }
25779
+ ];
25780
+ if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse')) {
25781
+ strokeWidthItems = [
25782
+ { id: '1', text: this.l10n.getConstant('NoOutline') },
25783
+ { id: '2', text: this.l10n.getConstant('XSmall') },
25784
+ { id: '3', text: this.l10n.getConstant('Small') },
25785
+ { id: '4', text: this.l10n.getConstant('Medium') },
25786
+ { id: '5', text: this.l10n.getConstant('Large') },
25787
+ { id: '6', text: this.l10n.getConstant('XLarge') }
25788
+ ];
25789
+ }
25731
25790
  const strokeWidthBtn = document.getElementById(id + '_borderWidthBtn');
25732
25791
  const spanElem = document.createElement('span');
25733
25792
  spanElem.innerHTML = this.l10n.getConstant('XSmall');
@@ -25943,7 +26002,13 @@ class ToolbarModule {
25943
26002
  }
25944
26003
  const args = { toolbarType: 'text', toolbarItems: this.defToolbarItems };
25945
26004
  parent.trigger('toolbarUpdating', args);
25946
- this.defToolbarItems = args.toolbarItems;
26005
+ if (this.isToolbarString(args.toolbarItems)) {
26006
+ items = args.toolbarItems;
26007
+ this.excludeItems(args.toolbarItems);
26008
+ }
26009
+ else {
26010
+ this.defToolbarItems = args.toolbarItems;
26011
+ }
25947
26012
  const toolbar = new Toolbar({
25948
26013
  width: '100%',
25949
26014
  items: this.defToolbarItems,
@@ -26428,7 +26493,8 @@ class ToolbarModule {
26428
26493
  template: '<button id="' + id + '_penColorBtn"></button>' });
26429
26494
  }
26430
26495
  if (items.indexOf('strokeWidth') > -1) {
26431
- toolbarItems.push({ prefixIcon: 'e-icons e-copy', cssClass: 'top-icon e-size',
26496
+ toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: id + '_pen_strokewidth',
26497
+ cssClass: 'top-icon e-size',
26432
26498
  tooltipText: this.l10n.getConstant('StrokeWidth'),
26433
26499
  align: 'Center', type: 'Input', template: '<button id="' + id + '_penStrokeWidth"></button>' });
26434
26500
  }
@@ -26464,7 +26530,13 @@ class ToolbarModule {
26464
26530
  }
26465
26531
  const args = { toolbarType: 'pen', toolbarItems: this.defToolbarItems };
26466
26532
  parent.trigger('toolbarUpdating', args);
26467
- this.defToolbarItems = args.toolbarItems;
26533
+ if (this.isToolbarString(args.toolbarItems)) {
26534
+ items = args.toolbarItems;
26535
+ this.excludeItems(args.toolbarItems);
26536
+ }
26537
+ else {
26538
+ this.defToolbarItems = args.toolbarItems;
26539
+ }
26468
26540
  const toolbar = new Toolbar({
26469
26541
  width: '100%',
26470
26542
  items: this.defToolbarItems,
@@ -27602,6 +27674,8 @@ class ToolbarModule {
27602
27674
  let ctx;
27603
27675
  parent.notify('draw', { prop: 'getNewPath', value: { obj: pathObject } });
27604
27676
  const type = args.item.id.replace(id + '_', '').toLowerCase();
27677
+ let left;
27678
+ let right;
27605
27679
  switch (type) {
27606
27680
  case 'duplicate':
27607
27681
  if (!parent.element.querySelector('#' + id + '_duplicate').classList.contains('e-disabled')) {
@@ -27651,8 +27725,10 @@ class ToolbarModule {
27651
27725
  break;
27652
27726
  case 'rotleft':
27653
27727
  case 'rotright':
27654
- if (!parent.element.querySelector('#' + id + '_rotLeft').classList.contains('e-disabled') ||
27655
- !parent.element.querySelector('#' + id + '_rotRight').classList.contains('e-disabled')) {
27728
+ left = parent.element.querySelector('#' + id + '_rotLeft');
27729
+ right = parent.element.querySelector('#' + id + '_rotRight');
27730
+ if ((left && !left.classList.contains('e-disabled')) ||
27731
+ (right && !right.classList.contains('e-disabled'))) {
27656
27732
  parent.rotateImage(args.item.id.replace(id + '_', '').toLowerCase());
27657
27733
  }
27658
27734
  break;
@@ -28779,6 +28855,80 @@ class ToolbarModule {
28779
28855
  parent.activeObj.textFlip = parent.transform.currFlipState;
28780
28856
  parent.activeObj.flipObjColl = [];
28781
28857
  }
28858
+ isToolbarString(items) {
28859
+ let isString = false;
28860
+ for (let i = 0; i < items.length; i++) {
28861
+ if (typeof (items[i]) === 'string') {
28862
+ isString = true;
28863
+ break;
28864
+ }
28865
+ }
28866
+ return isString;
28867
+ }
28868
+ excludeItems(items) {
28869
+ const indexArr = [];
28870
+ for (let i = 0; i < items.length; i++) {
28871
+ const index = this.getIndex(items[i]);
28872
+ if (index !== -1) {
28873
+ indexArr.push(index);
28874
+ }
28875
+ }
28876
+ const negativeIndexArr = [];
28877
+ for (let i = 0; i < this.defToolbarItems.length; i++) {
28878
+ if (this.defToolbarItems[i].align === 'Center' && !this.isSameIndex(indexArr, i) &&
28879
+ this.defToolbarItems[i].id !== this.parent.element.id + '_' + 'annotation') {
28880
+ negativeIndexArr.push(i);
28881
+ }
28882
+ }
28883
+ for (let i = negativeIndexArr.length - 1; i >= 0; i--) {
28884
+ this.defToolbarItems.splice(negativeIndexArr[i], 1);
28885
+ }
28886
+ }
28887
+ isSameIndex(indexArr, index) {
28888
+ for (let i = 0; i < indexArr.length; i++) {
28889
+ if (indexArr[i] === index) {
28890
+ return true;
28891
+ }
28892
+ }
28893
+ return false;
28894
+ }
28895
+ getIndex(item) {
28896
+ let index = -1;
28897
+ let isFontColor = false;
28898
+ if (item === 'rotateLeft') {
28899
+ item = 'rotLeft';
28900
+ }
28901
+ if (item === 'rotateRight') {
28902
+ item = 'rotRight';
28903
+ }
28904
+ if (item === 'horizontalFlip') {
28905
+ item = 'hflip';
28906
+ }
28907
+ if (item === 'verticalFlip') {
28908
+ item = 'vflip';
28909
+ }
28910
+ if (item === 'arrowStart') {
28911
+ item = 'start';
28912
+ }
28913
+ if (item === 'arrowEnd') {
28914
+ item = 'end';
28915
+ }
28916
+ if (item === 'fontColor') {
28917
+ item = 'strokeColor';
28918
+ isFontColor = true;
28919
+ }
28920
+ for (let i = 0; i < this.defToolbarItems.length; i++) {
28921
+ const id = this.defToolbarItems[i].id;
28922
+ if (id && id.toLowerCase().indexOf(item.toLowerCase()) !== -1) {
28923
+ index = i;
28924
+ break;
28925
+ }
28926
+ }
28927
+ if (isFontColor) {
28928
+ item = 'fontColor';
28929
+ }
28930
+ return index;
28931
+ }
28782
28932
  getModuleName() {
28783
28933
  return 'toolbar-module';
28784
28934
  }