@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
@@ -4894,6 +4894,9 @@ var Draw = /** @__PURE__ @class */ (function () {
4894
4894
  if (lastDotIndex !== -1) {
4895
4895
  return url.slice(lastDotIndex + 1).toLowerCase();
4896
4896
  }
4897
+ else if (url.indexOf('base64') !== -1) {
4898
+ return url.slice(url.indexOf('/') + 1, url.indexOf(';')).toLowerCase();
4899
+ }
4897
4900
  return null;
4898
4901
  };
4899
4902
  Draw.prototype.fileSelect = function (inputElement, args) {
@@ -11582,13 +11585,13 @@ var Selection = /** @__PURE__ @class */ (function () {
11582
11585
  if (this.currentDrawingShape === 'text') {
11583
11586
  var prevCropObj_1 = extend({}, parent.cropObj, {}, true);
11584
11587
  parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
11585
- value: { operation: 'shapeTransform', previousObj: this.initialPrevObj, previousObjColl: this.initialPrevObj.objColl,
11588
+ value: { operation: 'shapeInsert', previousObj: this.initialPrevObj, previousObjColl: this.initialPrevObj.objColl,
11586
11589
  previousPointColl: this.initialPrevObj.pointColl, previousSelPointColl: this.initialPrevObj.selPointColl,
11587
11590
  previousCropObj: prevCropObj_1, previousText: null,
11588
11591
  currentText: null, previousFilter: null, isCircleCrop: null } });
11589
11592
  }
11590
11593
  else {
11591
- parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: this.initialPrevObj.objColl } });
11594
+ parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: this.initialPrevObj.objColl, operation: 'shapeInsert' } });
11592
11595
  }
11593
11596
  this.isShapeInserted = true;
11594
11597
  this.currentDrawingShape = '';
@@ -12437,8 +12440,8 @@ var Selection = /** @__PURE__ @class */ (function () {
12437
12440
  actPoint.height = height;
12438
12441
  actPoint.startX = (this.dragPoint.startX = (originalWidth - width) / 2) + arcRadius;
12439
12442
  actPoint.startY = (this.dragPoint.startY = (originalHeight - height) / 2) + arcRadius;
12440
- actPoint.endX = ((originalWidth - width) / 2 + width) - arcRadius;
12441
- actPoint.endY = ((originalHeight - height) / 2 + height) - arcRadius;
12443
+ actPoint.endX = actPoint.startX + actPoint.width;
12444
+ actPoint.endY = actPoint.startY + actPoint.height;
12442
12445
  if (actPoint.startX < destLeft && destLeft + destWidth > parent.lowerCanvas.clientWidth) {
12443
12446
  actPoint.startX = destLeft;
12444
12447
  actPoint.endX = actPoint.startX + width - arcRadius;
@@ -12923,7 +12926,9 @@ var Selection = /** @__PURE__ @class */ (function () {
12923
12926
  }
12924
12927
  if (!isInside) {
12925
12928
  if (isNullOrUndefined(parent.activeObj.currIndex)) {
12926
- parent.activeObj.currIndex = 'shape_' + (parent.objColl.length + 1);
12929
+ var shapeIDObj = { id: 'shape_' + (parent.objColl.length + 1) };
12930
+ parent.notify('shape', { prop: 'getNewShapeId', onPropertyChange: false, value: { obj: shapeIDObj } });
12931
+ parent.activeObj.currIndex = shapeIDObj['id'];
12927
12932
  }
12928
12933
  parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
12929
12934
  if (parent.activeObj.horTopLine !== undefined && parent.activeObj.horTopLine.startX !== 0 && parent.activeObj.horTopLine.endX
@@ -13547,6 +13552,9 @@ var Shape = /** @__PURE__ @class */ (function () {
13547
13552
  case 'setFlipState':
13548
13553
  this.setFlipState(args.value['x'], args.value['y'], args.value['obj'], args.value['object']);
13549
13554
  break;
13555
+ case 'getNewShapeId':
13556
+ args.value['obj']['id'] = this.getNewShapeId();
13557
+ break;
13550
13558
  }
13551
13559
  };
13552
13560
  Shape.prototype.getModuleName = function () {
@@ -13746,7 +13754,7 @@ var Shape = /** @__PURE__ @class */ (function () {
13746
13754
  parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
13747
13755
  parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl_1 } });
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
  });
@@ -13772,7 +13780,7 @@ var Shape = /** @__PURE__ @class */ (function () {
13772
13780
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
13773
13781
  parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
13774
13782
  if (parent.isPublicMethod) {
13775
- parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
13783
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
13776
13784
  }
13777
13785
  parent.isPublicMethod = false;
13778
13786
  }
@@ -13870,7 +13878,7 @@ var Shape = /** @__PURE__ @class */ (function () {
13870
13878
  parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs, null).then(function (shapeChangingArgs) {
13871
13879
  _this.drawShapeTextEvent(shapeChangingArgs);
13872
13880
  if (parent.isPublicMethod) {
13873
- parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
13881
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
13874
13882
  }
13875
13883
  parent.isPublicMethod = false;
13876
13884
  });
@@ -13879,7 +13887,7 @@ var Shape = /** @__PURE__ @class */ (function () {
13879
13887
  parent.trigger('shapeChanging', shapeChangingArgs);
13880
13888
  this.drawShapeTextEvent(shapeChangingArgs);
13881
13889
  if (parent.isPublicMethod) {
13882
- parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
13890
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
13883
13891
  }
13884
13892
  parent.isPublicMethod = false;
13885
13893
  }
@@ -13892,7 +13900,7 @@ var Shape = /** @__PURE__ @class */ (function () {
13892
13900
  parent.objColl.push(parent.activeObj);
13893
13901
  var prevCropObj = extend({}, parent.cropObj, {}, true);
13894
13902
  parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
13895
- value: { operation: 'shapeTransform', previousObj: this.prevObj, previousObjColl: this.prevObj.objColl,
13903
+ value: { operation: 'shapeInsert', previousObj: this.prevObj, previousObjColl: this.prevObj.objColl,
13896
13904
  previousPointColl: this.prevObj.pointColl, previousSelPointColl: this.prevObj.selPointColl, previousCropObj: prevCropObj,
13897
13905
  previousText: null, currentText: null, previousFilter: null, isCircleCrop: null } });
13898
13906
  parent.notify('selection', { prop: 'redrawShape', onPropertyChange: false,
@@ -13923,7 +13931,7 @@ var Shape = /** @__PURE__ @class */ (function () {
13923
13931
  parent.objColl.push(parent.activeObj);
13924
13932
  var prevCropObj = extend({}, parent.cropObj, {}, true);
13925
13933
  parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
13926
- value: { operation: 'shapeTransform', previousObj: this.prevObj, previousObjColl: this.prevObj.objColl,
13934
+ value: { operation: 'shapeInsert', previousObj: this.prevObj, previousObjColl: this.prevObj.objColl,
13927
13935
  previousPointColl: this.prevObj.pointColl, previousSelPointColl: this.prevObj.selPointColl,
13928
13936
  previousCropObj: prevCropObj, previousText: null, currentText: null, previousFilter: null, isCircleCrop: null } });
13929
13937
  parent.notify('selection', { prop: 'redrawShape', onPropertyChange: false,
@@ -13937,6 +13945,7 @@ var Shape = /** @__PURE__ @class */ (function () {
13937
13945
  parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
13938
13946
  if (isBlazor()) {
13939
13947
  parent.updateToolbar(parent.element, 'text');
13948
+ parent.getFontSizes();
13940
13949
  }
13941
13950
  else {
13942
13951
  parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
@@ -16006,7 +16015,7 @@ var Shape = /** @__PURE__ @class */ (function () {
16006
16015
  }
16007
16016
  if (!isActObj) {
16008
16017
  if (isNullOrUndefined(parent.activeObj.currIndex)) {
16009
- parent.activeObj.currIndex = 'shape_' + (parent.objColl.length + 1);
16018
+ parent.activeObj.currIndex = this.getNewShapeId();
16010
16019
  }
16011
16020
  this.updImgRatioForActObj();
16012
16021
  var splitWords_1 = parent.activeObj.currIndex.split('_');
@@ -16042,6 +16051,17 @@ var Shape = /** @__PURE__ @class */ (function () {
16042
16051
  }
16043
16052
  }
16044
16053
  };
16054
+ Shape.prototype.getNewShapeId = function () {
16055
+ var parent = this.parent;
16056
+ var value = parent.objColl.length + 1;
16057
+ for (var i = 0; i < parent.objColl.length; i++) {
16058
+ if (parent.objColl[i].currIndex === 'shape_' + value) {
16059
+ value++;
16060
+ i = -1;
16061
+ }
16062
+ }
16063
+ return 'shape_' + value;
16064
+ };
16045
16065
  Shape.prototype.alignTextAreaIntoCanvas = function () {
16046
16066
  var parent = this.parent;
16047
16067
  var letters = parent.textArea.value;
@@ -16152,6 +16172,7 @@ var Shape = /** @__PURE__ @class */ (function () {
16152
16172
  case 'text':
16153
16173
  shapeDetails.text = obj.keyHistory;
16154
16174
  shapeDetails.fontSize = obj.textSettings.fontSize;
16175
+ shapeDetails.fontFamily = obj.textSettings.fontFamily;
16155
16176
  shapeDetails.color = obj.strokeSettings.strokeColor;
16156
16177
  shapeDetails.fontStyle = [];
16157
16178
  if (obj.textSettings.bold) {
@@ -19161,10 +19182,10 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
19161
19182
  this.redo();
19162
19183
  break;
19163
19184
  case 'updateUrObj':
19164
- this.updateUrObj(args.value['objColl']);
19185
+ this.updateUrObj(args.value['objColl'], args.value['operation']);
19165
19186
  break;
19166
19187
  case 'updateUndoRedo':
19167
- this.updateUndoRedo();
19188
+ this.updateUndoRedo(args.value ? args.value['operation'] : null);
19168
19189
  break;
19169
19190
  case 'getAppliedUndoRedoColl':
19170
19191
  args.value['obj']['appliedUndoRedoColl'] = this.appliedUndoRedoColl;
@@ -19431,6 +19452,7 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
19431
19452
  case 'invert':
19432
19453
  case 'sharpen':
19433
19454
  case 'imageRotate':
19455
+ case 'shapeInsert':
19434
19456
  this.shapeTransform(obj.previousObjColl);
19435
19457
  break;
19436
19458
  case 'freehanddraw':
@@ -19564,6 +19586,7 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
19564
19586
  case 'invert':
19565
19587
  case 'sharpen':
19566
19588
  case 'imageRotate':
19589
+ case 'shapeInsert':
19567
19590
  this.shapeTransform(obj.currentObjColl);
19568
19591
  break;
19569
19592
  case 'freehanddraw':
@@ -19901,6 +19924,37 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
19901
19924
  }
19902
19925
  parent.notify('filter', { prop: 'setAdjustmentValue', onPropertyChange: false, value: { adjustmentValue: this.lowerContext.filter } });
19903
19926
  parent.currObjType.isCustomCrop = false;
19927
+ if (isBlazor() && parent.events && parent.events.historyChanged.hasDelegate === true) {
19928
+ var imageAction = this.getImageAction(operation);
19929
+ var args = { length: this.undoRedoColl.length, index: this.undoRedoStep, actionTrigger: isUndo ? 'Undo' : 'Redo', imageAction: imageAction };
19930
+ parent.dotNetRef.invokeMethodAsync('OnHistoryChangedAsync', args);
19931
+ }
19932
+ };
19933
+ UndoRedo.prototype.getImageAction = function (operation) {
19934
+ if (['brightness', 'contrast', 'saturation', 'opacity', 'blur', 'hue'].indexOf(operation) !== -1) {
19935
+ return 'FinetuneApplied';
19936
+ }
19937
+ else if (['chrome', 'cold', 'warm', 'grayscale', 'blackandwhite', 'sepia', 'invert'].indexOf(operation) !== -1) {
19938
+ return 'FilterApplied';
19939
+ }
19940
+ else if (operation === 'frame') {
19941
+ return 'FrameApplied';
19942
+ }
19943
+ else if (operation === 'resize') {
19944
+ return 'ImageResized';
19945
+ }
19946
+ else if (['deleteFreehandDrawing', 'deleteObj'].indexOf(operation) !== -1) {
19947
+ return 'ShapeDeleted';
19948
+ }
19949
+ else if (operation === 'crop') {
19950
+ return 'Cropped';
19951
+ }
19952
+ else if (['shapeInsert', 'freehanddraw', 'freehand-draw'].indexOf(operation) !== -1) {
19953
+ return 'ShapeInserted';
19954
+ }
19955
+ else {
19956
+ return 'ShapeCustomized';
19957
+ }
19904
19958
  };
19905
19959
  UndoRedo.prototype.updateUrc = function (operation, previousObj, previousObjColl, previousPointColl, previousSelPointColl, previousCropObj, previousText, currentText, previousFilter, isCircleCrop) {
19906
19960
  var parent = this.parent;
@@ -19968,7 +20022,7 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
19968
20022
  }
19969
20023
  }
19970
20024
  };
19971
- UndoRedo.prototype.updateUrObj = function (objColl) {
20025
+ UndoRedo.prototype.updateUrObj = function (objColl, operation) {
19972
20026
  var parent = this.parent;
19973
20027
  if (parent.allowUndoRedo) {
19974
20028
  if (parent.currObjType.isUndoAction) {
@@ -19989,7 +20043,8 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
19989
20043
  parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
19990
20044
  value: { obj: selPointCollObj } });
19991
20045
  obj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
19992
- this.undoRedoColl.push({ operation: 'shapeTransform', previousObj: obj, currentObj: obj,
20046
+ var oper = operation ? operation : 'shapeTransform';
20047
+ this.undoRedoColl.push({ operation: oper, previousObj: obj, currentObj: obj,
19993
20048
  previousObjColl: objColl, currentObjColl: obj.objColl,
19994
20049
  previousPointColl: obj.pointColl, currentPointColl: obj.pointColl,
19995
20050
  previousSelPointColl: obj.selPointColl, currentSelPointColl: obj.selPointColl,
@@ -19998,7 +20053,7 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
19998
20053
  value: { obj: parent.objColl[parent.objColl.length - 1] } });
19999
20054
  }
20000
20055
  };
20001
- UndoRedo.prototype.updateUndoRedo = function () {
20056
+ UndoRedo.prototype.updateUndoRedo = function (operation) {
20002
20057
  var parent = this.parent;
20003
20058
  var prevCropObj = extend({}, parent.cropObj, {}, true);
20004
20059
  var object = { currObj: {} };
@@ -20015,7 +20070,8 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
20015
20070
  parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
20016
20071
  }
20017
20072
  parent.objColl.push(parent.activeObj);
20018
- this.updateUrc('shapeTransform', prevObj, prevObj.objColl, prevObj.pointColl, prevObj.selPointColl, prevCropObj);
20073
+ var oper = operation ? operation : 'shapeTransform';
20074
+ this.updateUrc(oper, prevObj, prevObj.objColl, prevObj.pointColl, prevObj.selPointColl, prevCropObj);
20019
20075
  parent.objColl.pop();
20020
20076
  parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: null } });
20021
20077
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
@@ -21338,6 +21394,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
21338
21394
  *
21339
21395
  */
21340
21396
  ImageEditor.prototype.zoom = function (zoomFactor, zoomPoint) {
21397
+ this.isZoomBtnClick = true;
21341
21398
  this.notify('transform', { prop: 'zoom', onPropertyChange: false,
21342
21399
  value: { zoomFactor: zoomFactor, zoomPoint: zoomPoint } });
21343
21400
  this.notify('draw', { prop: 'redrawDownScale' });