@syncfusion/ej2-image-editor 24.1.45 → 24.2.3

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 (67) hide show
  1. package/CHANGELOG.md +16 -2
  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 +75 -18
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +75 -18
  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.js +7 -5
  14. package/src/image-editor/action/shape.d.ts +1 -0
  15. package/src/image-editor/action/shape.js +23 -7
  16. package/src/image-editor/action/undo-redo.d.ts +1 -0
  17. package/src/image-editor/action/undo-redo.js +41 -6
  18. package/src/image-editor/base/image-editor.js +1 -0
  19. package/styles/bootstrap-dark.css +12 -0
  20. package/styles/bootstrap.css +12 -0
  21. package/styles/bootstrap4.css +13 -1
  22. package/styles/bootstrap5-dark.css +12 -0
  23. package/styles/bootstrap5.css +12 -0
  24. package/styles/fabric-dark.css +12 -0
  25. package/styles/fabric.css +12 -0
  26. package/styles/fluent-dark.css +12 -0
  27. package/styles/fluent.css +12 -0
  28. package/styles/highcontrast-light.css +12 -0
  29. package/styles/highcontrast.css +12 -0
  30. package/styles/image-editor/_bootstrap-dark-definition.scss +1 -0
  31. package/styles/image-editor/_bootstrap-definition.scss +1 -0
  32. package/styles/image-editor/_bootstrap4-definition.scss +1 -0
  33. package/styles/image-editor/_bootstrap5-definition.scss +1 -0
  34. package/styles/image-editor/_fabric-dark-definition.scss +1 -0
  35. package/styles/image-editor/_fabric-definition.scss +1 -0
  36. package/styles/image-editor/_fluent-definition.scss +1 -0
  37. package/styles/image-editor/_fusionnew-definition.scss +1 -0
  38. package/styles/image-editor/_highcontrast-definition.scss +1 -0
  39. package/styles/image-editor/_highcontrast-light-definition.scss +1 -0
  40. package/styles/image-editor/_layout.scss +32 -2
  41. package/styles/image-editor/_material-dark-definition.scss +1 -0
  42. package/styles/image-editor/_material-definition.scss +1 -0
  43. package/styles/image-editor/_material3-definition.scss +3 -2
  44. package/styles/image-editor/_tailwind-definition.scss +1 -0
  45. package/styles/image-editor/bootstrap-dark.css +12 -0
  46. package/styles/image-editor/bootstrap.css +12 -0
  47. package/styles/image-editor/bootstrap4.css +13 -1
  48. package/styles/image-editor/bootstrap5-dark.css +12 -0
  49. package/styles/image-editor/bootstrap5.css +12 -0
  50. package/styles/image-editor/fabric-dark.css +12 -0
  51. package/styles/image-editor/fabric.css +12 -0
  52. package/styles/image-editor/fluent-dark.css +12 -0
  53. package/styles/image-editor/fluent.css +12 -0
  54. package/styles/image-editor/highcontrast-light.css +12 -0
  55. package/styles/image-editor/highcontrast.css +12 -0
  56. package/styles/image-editor/material-dark.css +12 -0
  57. package/styles/image-editor/material.css +12 -0
  58. package/styles/image-editor/material3-dark.css +25 -4
  59. package/styles/image-editor/material3.css +25 -4
  60. package/styles/image-editor/tailwind-dark.css +15 -2
  61. package/styles/image-editor/tailwind.css +15 -2
  62. package/styles/material-dark.css +12 -0
  63. package/styles/material.css +12 -0
  64. package/styles/material3-dark.css +25 -4
  65. package/styles/material3.css +25 -4
  66. package/styles/tailwind-dark.css +15 -2
  67. 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) {
@@ -11560,13 +11563,13 @@ class Selection {
11560
11563
  if (this.currentDrawingShape === 'text') {
11561
11564
  const prevCropObj = extend({}, parent.cropObj, {}, true);
11562
11565
  parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
11563
- value: { operation: 'shapeTransform', previousObj: this.initialPrevObj, previousObjColl: this.initialPrevObj.objColl,
11566
+ value: { operation: 'shapeInsert', previousObj: this.initialPrevObj, previousObjColl: this.initialPrevObj.objColl,
11564
11567
  previousPointColl: this.initialPrevObj.pointColl, previousSelPointColl: this.initialPrevObj.selPointColl,
11565
11568
  previousCropObj: prevCropObj, previousText: null,
11566
11569
  currentText: null, previousFilter: null, isCircleCrop: null } });
11567
11570
  }
11568
11571
  else {
11569
- parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: this.initialPrevObj.objColl } });
11572
+ parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: this.initialPrevObj.objColl, operation: 'shapeInsert' } });
11570
11573
  }
11571
11574
  this.isShapeInserted = true;
11572
11575
  this.currentDrawingShape = '';
@@ -12414,8 +12417,8 @@ class Selection {
12414
12417
  actPoint.height = height;
12415
12418
  actPoint.startX = (this.dragPoint.startX = (originalWidth - width) / 2) + arcRadius;
12416
12419
  actPoint.startY = (this.dragPoint.startY = (originalHeight - height) / 2) + arcRadius;
12417
- actPoint.endX = ((originalWidth - width) / 2 + width) - arcRadius;
12418
- actPoint.endY = ((originalHeight - height) / 2 + height) - arcRadius;
12420
+ actPoint.endX = actPoint.startX + actPoint.width;
12421
+ actPoint.endY = actPoint.startY + actPoint.height;
12419
12422
  if (actPoint.startX < destLeft && destLeft + destWidth > parent.lowerCanvas.clientWidth) {
12420
12423
  actPoint.startX = destLeft;
12421
12424
  actPoint.endX = actPoint.startX + width - arcRadius;
@@ -12899,7 +12902,9 @@ class Selection {
12899
12902
  }
12900
12903
  if (!isInside) {
12901
12904
  if (isNullOrUndefined(parent.activeObj.currIndex)) {
12902
- parent.activeObj.currIndex = 'shape_' + (parent.objColl.length + 1);
12905
+ const shapeIDObj = { id: 'shape_' + (parent.objColl.length + 1) };
12906
+ parent.notify('shape', { prop: 'getNewShapeId', onPropertyChange: false, value: { obj: shapeIDObj } });
12907
+ parent.activeObj.currIndex = shapeIDObj['id'];
12903
12908
  }
12904
12909
  parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
12905
12910
  if (parent.activeObj.horTopLine !== undefined && parent.activeObj.horTopLine.startX !== 0 && parent.activeObj.horTopLine.endX
@@ -13522,6 +13527,9 @@ class Shape {
13522
13527
  case 'setFlipState':
13523
13528
  this.setFlipState(args.value['x'], args.value['y'], args.value['obj'], args.value['object']);
13524
13529
  break;
13530
+ case 'getNewShapeId':
13531
+ args.value['obj']['id'] = this.getNewShapeId();
13532
+ break;
13525
13533
  }
13526
13534
  }
13527
13535
  getModuleName() {
@@ -13720,7 +13728,7 @@ class Shape {
13720
13728
  parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
13721
13729
  parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
13722
13730
  if (parent.isPublicMethod) {
13723
- parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
13731
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
13724
13732
  }
13725
13733
  parent.isPublicMethod = false;
13726
13734
  });
@@ -13746,7 +13754,7 @@ class Shape {
13746
13754
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
13747
13755
  parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
13748
13756
  if (parent.isPublicMethod) {
13749
- parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
13757
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
13750
13758
  }
13751
13759
  parent.isPublicMethod = false;
13752
13760
  }
@@ -13843,7 +13851,7 @@ class Shape {
13843
13851
  parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs, null).then((shapeChangingArgs) => {
13844
13852
  this.drawShapeTextEvent(shapeChangingArgs);
13845
13853
  if (parent.isPublicMethod) {
13846
- parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
13854
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
13847
13855
  }
13848
13856
  parent.isPublicMethod = false;
13849
13857
  });
@@ -13852,7 +13860,7 @@ class Shape {
13852
13860
  parent.trigger('shapeChanging', shapeChangingArgs);
13853
13861
  this.drawShapeTextEvent(shapeChangingArgs);
13854
13862
  if (parent.isPublicMethod) {
13855
- parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
13863
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
13856
13864
  }
13857
13865
  parent.isPublicMethod = false;
13858
13866
  }
@@ -13865,7 +13873,7 @@ class Shape {
13865
13873
  parent.objColl.push(parent.activeObj);
13866
13874
  const prevCropObj = extend({}, parent.cropObj, {}, true);
13867
13875
  parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
13868
- value: { operation: 'shapeTransform', previousObj: this.prevObj, previousObjColl: this.prevObj.objColl,
13876
+ value: { operation: 'shapeInsert', previousObj: this.prevObj, previousObjColl: this.prevObj.objColl,
13869
13877
  previousPointColl: this.prevObj.pointColl, previousSelPointColl: this.prevObj.selPointColl, previousCropObj: prevCropObj,
13870
13878
  previousText: null, currentText: null, previousFilter: null, isCircleCrop: null } });
13871
13879
  parent.notify('selection', { prop: 'redrawShape', onPropertyChange: false,
@@ -13896,7 +13904,7 @@ class Shape {
13896
13904
  parent.objColl.push(parent.activeObj);
13897
13905
  const prevCropObj = extend({}, parent.cropObj, {}, true);
13898
13906
  parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
13899
- value: { operation: 'shapeTransform', previousObj: this.prevObj, previousObjColl: this.prevObj.objColl,
13907
+ value: { operation: 'shapeInsert', previousObj: this.prevObj, previousObjColl: this.prevObj.objColl,
13900
13908
  previousPointColl: this.prevObj.pointColl, previousSelPointColl: this.prevObj.selPointColl,
13901
13909
  previousCropObj: prevCropObj, previousText: null, currentText: null, previousFilter: null, isCircleCrop: null } });
13902
13910
  parent.notify('selection', { prop: 'redrawShape', onPropertyChange: false,
@@ -13910,6 +13918,7 @@ class Shape {
13910
13918
  parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
13911
13919
  if (isBlazor()) {
13912
13920
  parent.updateToolbar(parent.element, 'text');
13921
+ parent.getFontSizes();
13913
13922
  }
13914
13923
  else {
13915
13924
  parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
@@ -15976,7 +15985,7 @@ class Shape {
15976
15985
  }
15977
15986
  if (!isActObj) {
15978
15987
  if (isNullOrUndefined(parent.activeObj.currIndex)) {
15979
- parent.activeObj.currIndex = 'shape_' + (parent.objColl.length + 1);
15988
+ parent.activeObj.currIndex = this.getNewShapeId();
15980
15989
  }
15981
15990
  this.updImgRatioForActObj();
15982
15991
  const splitWords = parent.activeObj.currIndex.split('_');
@@ -16012,6 +16021,17 @@ class Shape {
16012
16021
  }
16013
16022
  }
16014
16023
  }
16024
+ getNewShapeId() {
16025
+ const parent = this.parent;
16026
+ let value = parent.objColl.length + 1;
16027
+ for (let i = 0; i < parent.objColl.length; i++) {
16028
+ if (parent.objColl[i].currIndex === 'shape_' + value) {
16029
+ value++;
16030
+ i = -1;
16031
+ }
16032
+ }
16033
+ return 'shape_' + value;
16034
+ }
16015
16035
  alignTextAreaIntoCanvas() {
16016
16036
  const parent = this.parent;
16017
16037
  const letters = parent.textArea.value;
@@ -16122,6 +16142,7 @@ class Shape {
16122
16142
  case 'text':
16123
16143
  shapeDetails.text = obj.keyHistory;
16124
16144
  shapeDetails.fontSize = obj.textSettings.fontSize;
16145
+ shapeDetails.fontFamily = obj.textSettings.fontFamily;
16125
16146
  shapeDetails.color = obj.strokeSettings.strokeColor;
16126
16147
  shapeDetails.fontStyle = [];
16127
16148
  if (obj.textSettings.bold) {
@@ -19123,10 +19144,10 @@ class UndoRedo {
19123
19144
  this.redo();
19124
19145
  break;
19125
19146
  case 'updateUrObj':
19126
- this.updateUrObj(args.value['objColl']);
19147
+ this.updateUrObj(args.value['objColl'], args.value['operation']);
19127
19148
  break;
19128
19149
  case 'updateUndoRedo':
19129
- this.updateUndoRedo();
19150
+ this.updateUndoRedo(args.value ? args.value['operation'] : null);
19130
19151
  break;
19131
19152
  case 'getAppliedUndoRedoColl':
19132
19153
  args.value['obj']['appliedUndoRedoColl'] = this.appliedUndoRedoColl;
@@ -19393,6 +19414,7 @@ class UndoRedo {
19393
19414
  case 'invert':
19394
19415
  case 'sharpen':
19395
19416
  case 'imageRotate':
19417
+ case 'shapeInsert':
19396
19418
  this.shapeTransform(obj.previousObjColl);
19397
19419
  break;
19398
19420
  case 'freehanddraw':
@@ -19526,6 +19548,7 @@ class UndoRedo {
19526
19548
  case 'invert':
19527
19549
  case 'sharpen':
19528
19550
  case 'imageRotate':
19551
+ case 'shapeInsert':
19529
19552
  this.shapeTransform(obj.currentObjColl);
19530
19553
  break;
19531
19554
  case 'freehanddraw':
@@ -19863,6 +19886,37 @@ class UndoRedo {
19863
19886
  }
19864
19887
  parent.notify('filter', { prop: 'setAdjustmentValue', onPropertyChange: false, value: { adjustmentValue: this.lowerContext.filter } });
19865
19888
  parent.currObjType.isCustomCrop = false;
19889
+ if (isBlazor() && parent.events && parent.events.historyChanged.hasDelegate === true) {
19890
+ let imageAction = this.getImageAction(operation);
19891
+ const args = { length: this.undoRedoColl.length, index: this.undoRedoStep, actionTrigger: isUndo ? 'Undo' : 'Redo', imageAction: imageAction };
19892
+ parent.dotNetRef.invokeMethodAsync('OnHistoryChangedAsync', args);
19893
+ }
19894
+ }
19895
+ getImageAction(operation) {
19896
+ if (['brightness', 'contrast', 'saturation', 'opacity', 'blur', 'hue'].indexOf(operation) !== -1) {
19897
+ return 'FinetuneApplied';
19898
+ }
19899
+ else if (['chrome', 'cold', 'warm', 'grayscale', 'blackandwhite', 'sepia', 'invert'].indexOf(operation) !== -1) {
19900
+ return 'FilterApplied';
19901
+ }
19902
+ else if (operation === 'frame') {
19903
+ return 'FrameApplied';
19904
+ }
19905
+ else if (operation === 'resize') {
19906
+ return 'ImageResized';
19907
+ }
19908
+ else if (['deleteFreehandDrawing', 'deleteObj'].indexOf(operation) !== -1) {
19909
+ return 'ShapeDeleted';
19910
+ }
19911
+ else if (operation === 'crop') {
19912
+ return 'Cropped';
19913
+ }
19914
+ else if (['shapeInsert', 'freehanddraw', 'freehand-draw'].indexOf(operation) !== -1) {
19915
+ return 'ShapeInserted';
19916
+ }
19917
+ else {
19918
+ return 'ShapeCustomized';
19919
+ }
19866
19920
  }
19867
19921
  updateUrc(operation, previousObj, previousObjColl, previousPointColl, previousSelPointColl, previousCropObj, previousText, currentText, previousFilter, isCircleCrop) {
19868
19922
  const parent = this.parent;
@@ -19930,7 +19984,7 @@ class UndoRedo {
19930
19984
  }
19931
19985
  }
19932
19986
  }
19933
- updateUrObj(objColl) {
19987
+ updateUrObj(objColl, operation) {
19934
19988
  const parent = this.parent;
19935
19989
  if (parent.allowUndoRedo) {
19936
19990
  if (parent.currObjType.isUndoAction) {
@@ -19951,7 +20005,8 @@ class UndoRedo {
19951
20005
  parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
19952
20006
  value: { obj: selPointCollObj } });
19953
20007
  obj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
19954
- this.undoRedoColl.push({ operation: 'shapeTransform', previousObj: obj, currentObj: obj,
20008
+ let oper = operation ? operation : 'shapeTransform';
20009
+ this.undoRedoColl.push({ operation: oper, previousObj: obj, currentObj: obj,
19955
20010
  previousObjColl: objColl, currentObjColl: obj.objColl,
19956
20011
  previousPointColl: obj.pointColl, currentPointColl: obj.pointColl,
19957
20012
  previousSelPointColl: obj.selPointColl, currentSelPointColl: obj.selPointColl,
@@ -19960,7 +20015,7 @@ class UndoRedo {
19960
20015
  value: { obj: parent.objColl[parent.objColl.length - 1] } });
19961
20016
  }
19962
20017
  }
19963
- updateUndoRedo() {
20018
+ updateUndoRedo(operation) {
19964
20019
  const parent = this.parent;
19965
20020
  const prevCropObj = extend({}, parent.cropObj, {}, true);
19966
20021
  const object = { currObj: {} };
@@ -19977,7 +20032,8 @@ class UndoRedo {
19977
20032
  parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
19978
20033
  }
19979
20034
  parent.objColl.push(parent.activeObj);
19980
- this.updateUrc('shapeTransform', prevObj, prevObj.objColl, prevObj.pointColl, prevObj.selPointColl, prevCropObj);
20035
+ let oper = operation ? operation : 'shapeTransform';
20036
+ this.updateUrc(oper, prevObj, prevObj.objColl, prevObj.pointColl, prevObj.selPointColl, prevCropObj);
19981
20037
  parent.objColl.pop();
19982
20038
  parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: null } });
19983
20039
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
@@ -21261,6 +21317,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21261
21317
  *
21262
21318
  */
21263
21319
  zoom(zoomFactor, zoomPoint) {
21320
+ this.isZoomBtnClick = true;
21264
21321
  this.notify('transform', { prop: 'zoom', onPropertyChange: false,
21265
21322
  value: { zoomFactor: zoomFactor, zoomPoint: zoomPoint } });
21266
21323
  this.notify('draw', { prop: 'redrawDownScale' });