@syncfusion/ej2-image-editor 31.1.17 → 31.1.22

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 (55) hide show
  1. package/dist/ej2-image-editor.umd.min.js +3 -3
  2. package/dist/ej2-image-editor.umd.min.js.map +1 -1
  3. package/dist/es6/ej2-image-editor.es2015.js +72 -9
  4. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  5. package/dist/es6/ej2-image-editor.es5.js +72 -9
  6. package/dist/es6/ej2-image-editor.es5.js.map +1 -1
  7. package/dist/global/ej2-image-editor.min.js +3 -3
  8. package/dist/global/ej2-image-editor.min.js.map +1 -1
  9. package/dist/global/index.d.ts +2 -2
  10. package/package.json +14 -46
  11. package/src/image-editor/action/export.js +6 -2
  12. package/src/image-editor/action/freehand-draw.d.ts +1 -0
  13. package/src/image-editor/action/freehand-draw.js +30 -3
  14. package/src/image-editor/action/selection.js +14 -2
  15. package/src/image-editor/action/undo-redo.js +10 -0
  16. package/src/image-editor/base/image-editor.d.ts +1 -0
  17. package/src/image-editor/base/image-editor.js +9 -2
  18. package/src/image-editor/renderer/toolbar.js +3 -0
  19. package/dist/ts/image-editor/action/crop.d.ts +0 -44
  20. package/dist/ts/image-editor/action/crop.ts +0 -867
  21. package/dist/ts/image-editor/action/draw.d.ts +0 -187
  22. package/dist/ts/image-editor/action/draw.ts +0 -4924
  23. package/dist/ts/image-editor/action/export.d.ts +0 -29
  24. package/dist/ts/image-editor/action/export.ts +0 -509
  25. package/dist/ts/image-editor/action/filter.d.ts +0 -48
  26. package/dist/ts/image-editor/action/filter.ts +0 -872
  27. package/dist/ts/image-editor/action/freehand-draw.d.ts +0 -68
  28. package/dist/ts/image-editor/action/freehand-draw.ts +0 -1135
  29. package/dist/ts/image-editor/action/index.d.ts +0 -9
  30. package/dist/ts/image-editor/action/index.ts +0 -9
  31. package/dist/ts/image-editor/action/selection.d.ts +0 -178
  32. package/dist/ts/image-editor/action/selection.ts +0 -5241
  33. package/dist/ts/image-editor/action/shape.d.ts +0 -130
  34. package/dist/ts/image-editor/action/shape.ts +0 -3917
  35. package/dist/ts/image-editor/action/transform.d.ts +0 -77
  36. package/dist/ts/image-editor/action/transform.ts +0 -2008
  37. package/dist/ts/image-editor/action/undo-redo.d.ts +0 -52
  38. package/dist/ts/image-editor/action/undo-redo.ts +0 -1169
  39. package/dist/ts/image-editor/base/enum.d.ts +0 -277
  40. package/dist/ts/image-editor/base/enum.ts +0 -288
  41. package/dist/ts/image-editor/base/image-editor-model.d.ts +0 -770
  42. package/dist/ts/image-editor/base/image-editor.d.ts +0 -1928
  43. package/dist/ts/image-editor/base/image-editor.ts +0 -5496
  44. package/dist/ts/image-editor/base/index.d.ts +0 -4
  45. package/dist/ts/image-editor/base/index.ts +0 -4
  46. package/dist/ts/image-editor/base/interface.d.ts +0 -1637
  47. package/dist/ts/image-editor/base/interface.ts +0 -1709
  48. package/dist/ts/image-editor/index.d.ts +0 -3
  49. package/dist/ts/image-editor/index.ts +0 -3
  50. package/dist/ts/image-editor/renderer/index.d.ts +0 -1
  51. package/dist/ts/image-editor/renderer/index.ts +0 -1
  52. package/dist/ts/image-editor/renderer/toolbar.d.ts +0 -171
  53. package/dist/ts/image-editor/renderer/toolbar.ts +0 -6356
  54. package/dist/ts/index.d.ts +0 -4
  55. package/dist/ts/index.ts +0 -4
@@ -6437,8 +6437,12 @@ var Export = /** @__PURE__ @class */ (function () {
6437
6437
  type = type ? type : 'Png';
6438
6438
  parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
6439
6439
  value: { x: null, y: null, isMouseDown: null } });
6440
+ var imageQualityObj = { currentImageQuality: 1 };
6441
+ if (type.toLowerCase() === 'jpeg') {
6442
+ parent.notify('toolbar', { prop: 'getcurrentImageQuality', onPropertyChange: false, value: { obj: imageQualityObj } });
6443
+ }
6440
6444
  var beforeSave = { cancel: false, fileName: fileName ? fileName : imageName,
6441
- fileType: type, imageQuality: imgQuality };
6445
+ fileType: type, imageQuality: imgQuality || imageQualityObj['currentImageQuality'] };
6442
6446
  parent.trigger('beforeSave', beforeSave);
6443
6447
  this.beforeSaveEvent(beforeSave, type, fileName, imageName, imgQuality);
6444
6448
  }
@@ -6454,7 +6458,7 @@ var Export = /** @__PURE__ @class */ (function () {
6454
6458
  this.toSVGImg(fileName);
6455
6459
  }
6456
6460
  else {
6457
- this.toBlobFn(fileName, lowerCaseType, imgQuality);
6461
+ this.toBlobFn(fileName, lowerCaseType, observableSaveArgs.imageQuality || imgQuality);
6458
6462
  }
6459
6463
  var saved = { fileName: fileName ? fileName : imageName, fileType: type };
6460
6464
  parent.trigger('saved', saved);
@@ -7937,6 +7941,15 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
7937
7941
  case 'resetFreehandDrawSelectedId':
7938
7942
  this.fhdSelID = null;
7939
7943
  break;
7944
+ case 'getFHDSelected':
7945
+ args.value['obj']['isSelected'] = (this.parent.pointColl[this.fhdSelIdx] && this.parent.pointColl[this.fhdSelIdx].isSelected) ? this.parent.pointColl[this.fhdSelIdx].isSelected : false;
7946
+ break;
7947
+ case 'resetFHDIdx':
7948
+ this.fhdHovIdx = this.fhdSelID = this.fhdSelIdx = null;
7949
+ break;
7950
+ case 'getHighestOrder':
7951
+ this.getHighestOrder();
7952
+ break;
7940
7953
  case 'getTempFreeHandDrawEditingStyles':
7941
7954
  args.value['obj']['tempFreeHandDrawEditingStyles'] = this.tempFHDStyles;
7942
7955
  break;
@@ -8119,10 +8132,11 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
8119
8132
  parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false, value: { obj: selPointCollObj } });
8120
8133
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
8121
8134
  var fhCnt = parent.freehandCounter;
8122
- var order = parent.objColl.length + parent.freehandCounter + 1;
8135
+ var penIndex = this.getHighestOrder();
8136
+ var order = parent.objColl.length + penIndex + 1;
8123
8137
  parent.pointColl[fhCnt] = { points: extend([], parent.points), strokeColor: parent.activeObj.strokeSettings.strokeColor,
8124
8138
  strokeWidth: this.penStrokeWidth, flipState: parent.transform.currFlipState,
8125
- id: 'pen_' + (this.currFHDIdx + 1), order: order };
8139
+ id: 'pen_' + (penIndex + 1), order: order };
8126
8140
  parent.points = [];
8127
8141
  this.dummyPoints = [];
8128
8142
  this.selPointColl[fhCnt] = { points: extend([], this.selPoints) };
@@ -8137,7 +8151,7 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
8137
8151
  previousCropObj: prevCropObj, previousText: null,
8138
8152
  currentText: null, previousFilter: null, isCircleCrop: null } });
8139
8153
  }
8140
- var shapeSettings = { id: 'pen_' + (this.currFHDIdx + 1), type: ShapeType.FreehandDraw,
8154
+ var shapeSettings = { id: 'pen_' + (penIndex + 1), type: ShapeType.FreehandDraw,
8141
8155
  startX: this.freehandDownPoint.x, startY: this.freehandDownPoint.y,
8142
8156
  strokeColor: parent.activeObj.strokeSettings.strokeColor, strokeWidth: this.penStrokeWidth,
8143
8157
  points: parent.pointColl[this.currFHDIdx].points, index: order };
@@ -8146,6 +8160,17 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
8146
8160
  this.triggerShapeChanging(shapeChangingArgs);
8147
8161
  this.currFHDIdx++;
8148
8162
  };
8163
+ FreehandDrawing.prototype.getHighestOrder = function () {
8164
+ var parent = this.parent;
8165
+ var index = 0;
8166
+ for (var i = 0; i < parent.pointColl.length; i++) {
8167
+ var value = parseInt(parent.pointColl[i].id.split('_')[1], 10);
8168
+ if (index < value) {
8169
+ index = value;
8170
+ }
8171
+ }
8172
+ return index;
8173
+ };
8149
8174
  FreehandDrawing.prototype.freehandMoveHandler = function (e) {
8150
8175
  this.isFreehandPointMoved = true;
8151
8176
  var rect = this.parent.upperCanvas.getBoundingClientRect();
@@ -8534,6 +8559,7 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
8534
8559
  }
8535
8560
  parent.freehandCounter -= 1;
8536
8561
  this.fhdHovIdx = this.fhdSelIdx = null;
8562
+ this.currFHDIdx--;
8537
8563
  parent.notify('selection', { prop: 'resetFreehandDrawVariables' });
8538
8564
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null } });
8539
8565
  parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
@@ -8930,6 +8956,11 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
8930
8956
  var parent = this.parent;
8931
8957
  var point = parent.pointColl[this.fhdSelIdx];
8932
8958
  parent.trigger('shapeChanging', shapeChangingArgs);
8959
+ if (shapeChangingArgs.cancel) {
8960
+ parent.editCompleteArgs = shapeChangingArgs;
8961
+ this.cancelFhd();
8962
+ return;
8963
+ }
8933
8964
  if (parent.element.getAttribute('data-value') === 'mask-drawing' && !this.isMasking) {
8934
8965
  this.isMasking = true;
8935
8966
  parent.upperCanvas.style.cursor = 'crosshair';
@@ -12454,6 +12485,9 @@ var Selection = /** @__PURE__ @class */ (function () {
12454
12485
  var objColl = extend([], parent.objColl, [], true);
12455
12486
  if (!isNullOrUndefined(obj['index']) && obj['index'] > -1) {
12456
12487
  parent.notify('freehand-draw', { prop: 'selectFhd', value: { type: 'ok' } });
12488
+ if (!this.isFhdPoint) {
12489
+ return;
12490
+ }
12457
12491
  parent.notify('freehand-draw', { prop: 'hoverFhd', onPropertyChange: false,
12458
12492
  value: { strokeColor: null, strokeWidth: null } });
12459
12493
  parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
@@ -12998,7 +13032,9 @@ var Selection = /** @__PURE__ @class */ (function () {
12998
13032
  this.currentDrawingShape = parent.drawingShape.toLowerCase();
12999
13033
  if (dummyClick) {
13000
13034
  parent.enableShapeDrawing(parent.toPascalCase(parent.drawingShape), true);
13001
- parent.upperCanvas.style.cursor = 'crosshair';
13035
+ if (parent.cursor !== 'move') {
13036
+ parent.upperCanvas.style.cursor = 'crosshair';
13037
+ }
13002
13038
  }
13003
13039
  }
13004
13040
  parent.isShapeDrawing = false;
@@ -14020,7 +14056,14 @@ var Selection = /** @__PURE__ @class */ (function () {
14020
14056
  }
14021
14057
  if (!this.isCropSelection && parent.activeObj.shape !== 'redact') {
14022
14058
  parent.trigger('shapeChanging', shapeChangingArgs);
14023
- this.shapeEvent(shapeChangingArgs);
14059
+ if (shapeChangingArgs.cancel) {
14060
+ parent.objColl.splice(i, 0, temp);
14061
+ parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
14062
+ parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null } });
14063
+ }
14064
+ else {
14065
+ this.shapeEvent(shapeChangingArgs);
14066
+ }
14024
14067
  parent.editCompleteArgs = shapeChangingArgs;
14025
14068
  }
14026
14069
  else {
@@ -21536,6 +21579,12 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
21536
21579
  parent.initialAdjustmentValue = this.lowerContext.filter;
21537
21580
  parent.notify('filter', { prop: 'setBevelFilter', onPropertyChange: false, value: { bevelFilter: this.lowerContext.filter } });
21538
21581
  var editCompleteArgs = { action: this.getUndoRedoAction(obj.operation) };
21582
+ var isSelected = void 0;
21583
+ if (obj.operation === 'freehanddraw' || obj.operation === 'freehand-draw') {
21584
+ var object = { isSelected: null };
21585
+ parent.notify('freehand-draw', { prop: 'getFHDSelected', onPropertyChange: false, value: { obj: object } });
21586
+ isSelected = object['isSelected'];
21587
+ }
21539
21588
  switch (obj.operation) {
21540
21589
  case 'shapeTransform':
21541
21590
  case 'brightness':
@@ -21563,6 +21612,10 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
21563
21612
  this.updateFreehandDraw(obj.previousPointColl, obj.previousSelPointColl);
21564
21613
  parent.notify('freehand-draw', { prop: 'setCurrentFreehandDrawIndex',
21565
21614
  value: { value: parent.pointColl.length } });
21615
+ if (isSelected) {
21616
+ parent.notify('freehand-draw', { prop: 'resetFHDIdx' });
21617
+ parent.notify('selection', { prop: 'resetFreehandDrawVariables' });
21618
+ }
21566
21619
  break;
21567
21620
  case 'freehanddrawCustomized':
21568
21621
  this.updateFreehandDrawCustomized(obj.previousObjColl, obj.previousPointColl);
@@ -24468,7 +24521,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
24468
24521
  * @returns {void}.
24469
24522
  */
24470
24523
  ImageEditor.prototype.undo = function () {
24471
- this.manageActiveAction();
24524
+ this.handlePenActiveState();
24472
24525
  this.notify('undo-redo', { prop: 'undo', onPropertyChange: false });
24473
24526
  this.notify('draw', { prop: 'redrawDownScale' });
24474
24527
  };
@@ -24480,7 +24533,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
24480
24533
  * @returns {void}.
24481
24534
  */
24482
24535
  ImageEditor.prototype.redo = function () {
24483
- this.manageActiveAction();
24536
+ this.handlePenActiveState();
24484
24537
  this.notify('undo-redo', { prop: 'redo', onPropertyChange: false });
24485
24538
  this.notify('draw', { prop: 'redrawDownScale' });
24486
24539
  };
@@ -27248,6 +27301,13 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
27248
27301
  }
27249
27302
  return isRedact;
27250
27303
  };
27304
+ ImageEditor.prototype.handlePenActiveState = function () {
27305
+ var freehandDrawObj = { freehandDrawSelectedId: null };
27306
+ this.notify('freehand-draw', { prop: 'getFreehandDrawSelectedId', onPropertyChange: false, value: { obj: freehandDrawObj } });
27307
+ if (isNullOrUndefined(freehandDrawObj['freehandDrawSelectedId'])) {
27308
+ this.manageActiveAction();
27309
+ }
27310
+ };
27251
27311
  var ImageEditor_1;
27252
27312
  __decorate([
27253
27313
  Property('')
@@ -27946,6 +28006,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
27946
28006
  case 'getToolbarHeight':
27947
28007
  args.value['obj']['toolbarHeight'] = this.toolbarHeight;
27948
28008
  break;
28009
+ case 'getcurrentImageQuality':
28010
+ args.value['obj']['currentImageQuality'] = this.currentQuality;
28011
+ break;
27949
28012
  case 'setToolbarHeight':
27950
28013
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0 && parent.toolbar.indexOf('Open') > -1)) {
27951
28014
  this.toolbarHeight = args.value['height'];