@syncfusion/ej2-image-editor 31.1.17 → 31.1.21

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 (53) hide show
  1. package/dist/ej2-image-editor.umd.min.js +2 -2
  2. package/dist/ej2-image-editor.umd.min.js.map +1 -1
  3. package/dist/es6/ej2-image-editor.es2015.js +63 -7
  4. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  5. package/dist/es6/ej2-image-editor.es5.js +63 -7
  6. package/dist/es6/ej2-image-editor.es5.js.map +1 -1
  7. package/dist/global/ej2-image-editor.min.js +2 -2
  8. package/dist/global/ej2-image-editor.min.js.map +1 -1
  9. package/dist/global/index.d.ts +1 -1
  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/renderer/toolbar.js +3 -0
  17. package/dist/ts/image-editor/action/crop.d.ts +0 -44
  18. package/dist/ts/image-editor/action/crop.ts +0 -867
  19. package/dist/ts/image-editor/action/draw.d.ts +0 -187
  20. package/dist/ts/image-editor/action/draw.ts +0 -4924
  21. package/dist/ts/image-editor/action/export.d.ts +0 -29
  22. package/dist/ts/image-editor/action/export.ts +0 -509
  23. package/dist/ts/image-editor/action/filter.d.ts +0 -48
  24. package/dist/ts/image-editor/action/filter.ts +0 -872
  25. package/dist/ts/image-editor/action/freehand-draw.d.ts +0 -68
  26. package/dist/ts/image-editor/action/freehand-draw.ts +0 -1135
  27. package/dist/ts/image-editor/action/index.d.ts +0 -9
  28. package/dist/ts/image-editor/action/index.ts +0 -9
  29. package/dist/ts/image-editor/action/selection.d.ts +0 -178
  30. package/dist/ts/image-editor/action/selection.ts +0 -5241
  31. package/dist/ts/image-editor/action/shape.d.ts +0 -130
  32. package/dist/ts/image-editor/action/shape.ts +0 -3917
  33. package/dist/ts/image-editor/action/transform.d.ts +0 -77
  34. package/dist/ts/image-editor/action/transform.ts +0 -2008
  35. package/dist/ts/image-editor/action/undo-redo.d.ts +0 -52
  36. package/dist/ts/image-editor/action/undo-redo.ts +0 -1169
  37. package/dist/ts/image-editor/base/enum.d.ts +0 -277
  38. package/dist/ts/image-editor/base/enum.ts +0 -288
  39. package/dist/ts/image-editor/base/image-editor-model.d.ts +0 -770
  40. package/dist/ts/image-editor/base/image-editor.d.ts +0 -1928
  41. package/dist/ts/image-editor/base/image-editor.ts +0 -5496
  42. package/dist/ts/image-editor/base/index.d.ts +0 -4
  43. package/dist/ts/image-editor/base/index.ts +0 -4
  44. package/dist/ts/image-editor/base/interface.d.ts +0 -1637
  45. package/dist/ts/image-editor/base/interface.ts +0 -1709
  46. package/dist/ts/image-editor/index.d.ts +0 -3
  47. package/dist/ts/image-editor/index.ts +0 -3
  48. package/dist/ts/image-editor/renderer/index.d.ts +0 -1
  49. package/dist/ts/image-editor/renderer/index.ts +0 -1
  50. package/dist/ts/image-editor/renderer/toolbar.d.ts +0 -171
  51. package/dist/ts/image-editor/renderer/toolbar.ts +0 -6356
  52. package/dist/ts/index.d.ts +0 -4
  53. package/dist/ts/index.ts +0 -4
@@ -6379,8 +6379,12 @@ class Export {
6379
6379
  type = type ? type : 'Png';
6380
6380
  parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
6381
6381
  value: { x: null, y: null, isMouseDown: null } });
6382
+ const imageQualityObj = { currentImageQuality: 1 };
6383
+ if (type.toLowerCase() === 'jpeg') {
6384
+ parent.notify('toolbar', { prop: 'getcurrentImageQuality', onPropertyChange: false, value: { obj: imageQualityObj } });
6385
+ }
6382
6386
  const beforeSave = { cancel: false, fileName: fileName ? fileName : imageName,
6383
- fileType: type, imageQuality: imgQuality };
6387
+ fileType: type, imageQuality: imgQuality || imageQualityObj['currentImageQuality'] };
6384
6388
  parent.trigger('beforeSave', beforeSave);
6385
6389
  this.beforeSaveEvent(beforeSave, type, fileName, imageName, imgQuality);
6386
6390
  }
@@ -6396,7 +6400,7 @@ class Export {
6396
6400
  this.toSVGImg(fileName);
6397
6401
  }
6398
6402
  else {
6399
- this.toBlobFn(fileName, lowerCaseType, imgQuality);
6403
+ this.toBlobFn(fileName, lowerCaseType, observableSaveArgs.imageQuality || imgQuality);
6400
6404
  }
6401
6405
  const saved = { fileName: fileName ? fileName : imageName, fileType: type };
6402
6406
  parent.trigger('saved', saved);
@@ -7867,6 +7871,15 @@ class FreehandDrawing {
7867
7871
  case 'resetFreehandDrawSelectedId':
7868
7872
  this.fhdSelID = null;
7869
7873
  break;
7874
+ case 'getFHDSelected':
7875
+ args.value['obj']['isSelected'] = (this.parent.pointColl[this.fhdSelIdx] && this.parent.pointColl[this.fhdSelIdx].isSelected) ? this.parent.pointColl[this.fhdSelIdx].isSelected : false;
7876
+ break;
7877
+ case 'resetFHDIdx':
7878
+ this.fhdHovIdx = this.fhdSelID = this.fhdSelIdx = null;
7879
+ break;
7880
+ case 'getHighestOrder':
7881
+ this.getHighestOrder();
7882
+ break;
7870
7883
  case 'getTempFreeHandDrawEditingStyles':
7871
7884
  args.value['obj']['tempFreeHandDrawEditingStyles'] = this.tempFHDStyles;
7872
7885
  break;
@@ -8049,10 +8062,11 @@ class FreehandDrawing {
8049
8062
  parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false, value: { obj: selPointCollObj } });
8050
8063
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
8051
8064
  const fhCnt = parent.freehandCounter;
8052
- const order = parent.objColl.length + parent.freehandCounter + 1;
8065
+ const penIndex = this.getHighestOrder();
8066
+ const order = parent.objColl.length + penIndex + 1;
8053
8067
  parent.pointColl[fhCnt] = { points: extend([], parent.points), strokeColor: parent.activeObj.strokeSettings.strokeColor,
8054
8068
  strokeWidth: this.penStrokeWidth, flipState: parent.transform.currFlipState,
8055
- id: 'pen_' + (this.currFHDIdx + 1), order: order };
8069
+ id: 'pen_' + (penIndex + 1), order: order };
8056
8070
  parent.points = [];
8057
8071
  this.dummyPoints = [];
8058
8072
  this.selPointColl[fhCnt] = { points: extend([], this.selPoints) };
@@ -8067,7 +8081,7 @@ class FreehandDrawing {
8067
8081
  previousCropObj: prevCropObj, previousText: null,
8068
8082
  currentText: null, previousFilter: null, isCircleCrop: null } });
8069
8083
  }
8070
- const shapeSettings = { id: 'pen_' + (this.currFHDIdx + 1), type: ShapeType.FreehandDraw,
8084
+ const shapeSettings = { id: 'pen_' + (penIndex + 1), type: ShapeType.FreehandDraw,
8071
8085
  startX: this.freehandDownPoint.x, startY: this.freehandDownPoint.y,
8072
8086
  strokeColor: parent.activeObj.strokeSettings.strokeColor, strokeWidth: this.penStrokeWidth,
8073
8087
  points: parent.pointColl[this.currFHDIdx].points, index: order };
@@ -8076,6 +8090,17 @@ class FreehandDrawing {
8076
8090
  this.triggerShapeChanging(shapeChangingArgs);
8077
8091
  this.currFHDIdx++;
8078
8092
  }
8093
+ getHighestOrder() {
8094
+ const parent = this.parent;
8095
+ let index = 0;
8096
+ for (let i = 0; i < parent.pointColl.length; i++) {
8097
+ const value = parseInt(parent.pointColl[i].id.split('_')[1], 10);
8098
+ if (index < value) {
8099
+ index = value;
8100
+ }
8101
+ }
8102
+ return index;
8103
+ }
8079
8104
  freehandMoveHandler(e) {
8080
8105
  this.isFreehandPointMoved = true;
8081
8106
  const rect = this.parent.upperCanvas.getBoundingClientRect();
@@ -8464,6 +8489,7 @@ class FreehandDrawing {
8464
8489
  }
8465
8490
  parent.freehandCounter -= 1;
8466
8491
  this.fhdHovIdx = this.fhdSelIdx = null;
8492
+ this.currFHDIdx--;
8467
8493
  parent.notify('selection', { prop: 'resetFreehandDrawVariables' });
8468
8494
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null } });
8469
8495
  parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
@@ -8860,6 +8886,11 @@ class FreehandDrawing {
8860
8886
  const parent = this.parent;
8861
8887
  const point = parent.pointColl[this.fhdSelIdx];
8862
8888
  parent.trigger('shapeChanging', shapeChangingArgs);
8889
+ if (shapeChangingArgs.cancel) {
8890
+ parent.editCompleteArgs = shapeChangingArgs;
8891
+ this.cancelFhd();
8892
+ return;
8893
+ }
8863
8894
  if (parent.element.getAttribute('data-value') === 'mask-drawing' && !this.isMasking) {
8864
8895
  this.isMasking = true;
8865
8896
  parent.upperCanvas.style.cursor = 'crosshair';
@@ -12381,6 +12412,9 @@ class Selection {
12381
12412
  const objColl = extend([], parent.objColl, [], true);
12382
12413
  if (!isNullOrUndefined(obj['index']) && obj['index'] > -1) {
12383
12414
  parent.notify('freehand-draw', { prop: 'selectFhd', value: { type: 'ok' } });
12415
+ if (!this.isFhdPoint) {
12416
+ return;
12417
+ }
12384
12418
  parent.notify('freehand-draw', { prop: 'hoverFhd', onPropertyChange: false,
12385
12419
  value: { strokeColor: null, strokeWidth: null } });
12386
12420
  parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
@@ -12925,7 +12959,9 @@ class Selection {
12925
12959
  this.currentDrawingShape = parent.drawingShape.toLowerCase();
12926
12960
  if (dummyClick) {
12927
12961
  parent.enableShapeDrawing(parent.toPascalCase(parent.drawingShape), true);
12928
- parent.upperCanvas.style.cursor = 'crosshair';
12962
+ if (parent.cursor !== 'move') {
12963
+ parent.upperCanvas.style.cursor = 'crosshair';
12964
+ }
12929
12965
  }
12930
12966
  }
12931
12967
  parent.isShapeDrawing = false;
@@ -13947,7 +13983,14 @@ class Selection {
13947
13983
  }
13948
13984
  if (!this.isCropSelection && parent.activeObj.shape !== 'redact') {
13949
13985
  parent.trigger('shapeChanging', shapeChangingArgs);
13950
- this.shapeEvent(shapeChangingArgs);
13986
+ if (shapeChangingArgs.cancel) {
13987
+ parent.objColl.splice(i, 0, temp);
13988
+ parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
13989
+ parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null } });
13990
+ }
13991
+ else {
13992
+ this.shapeEvent(shapeChangingArgs);
13993
+ }
13951
13994
  parent.editCompleteArgs = shapeChangingArgs;
13952
13995
  }
13953
13996
  else {
@@ -21457,6 +21500,12 @@ class UndoRedo {
21457
21500
  parent.initialAdjustmentValue = this.lowerContext.filter;
21458
21501
  parent.notify('filter', { prop: 'setBevelFilter', onPropertyChange: false, value: { bevelFilter: this.lowerContext.filter } });
21459
21502
  const editCompleteArgs = { action: this.getUndoRedoAction(obj.operation) };
21503
+ let isSelected;
21504
+ if (obj.operation === 'freehanddraw' || obj.operation === 'freehand-draw') {
21505
+ const object = { isSelected: null };
21506
+ parent.notify('freehand-draw', { prop: 'getFHDSelected', onPropertyChange: false, value: { obj: object } });
21507
+ isSelected = object['isSelected'];
21508
+ }
21460
21509
  switch (obj.operation) {
21461
21510
  case 'shapeTransform':
21462
21511
  case 'brightness':
@@ -21484,6 +21533,10 @@ class UndoRedo {
21484
21533
  this.updateFreehandDraw(obj.previousPointColl, obj.previousSelPointColl);
21485
21534
  parent.notify('freehand-draw', { prop: 'setCurrentFreehandDrawIndex',
21486
21535
  value: { value: parent.pointColl.length } });
21536
+ if (isSelected) {
21537
+ parent.notify('freehand-draw', { prop: 'resetFHDIdx' });
21538
+ parent.notify('selection', { prop: 'resetFreehandDrawVariables' });
21539
+ }
21487
21540
  break;
21488
21541
  case 'freehanddrawCustomized':
21489
21542
  this.updateFreehandDrawCustomized(obj.previousObjColl, obj.previousPointColl);
@@ -27817,6 +27870,9 @@ class ToolbarModule {
27817
27870
  case 'getToolbarHeight':
27818
27871
  args.value['obj']['toolbarHeight'] = this.toolbarHeight;
27819
27872
  break;
27873
+ case 'getcurrentImageQuality':
27874
+ args.value['obj']['currentImageQuality'] = this.currentQuality;
27875
+ break;
27820
27876
  case 'setToolbarHeight':
27821
27877
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0 && parent.toolbar.indexOf('Open') > -1)) {
27822
27878
  this.toolbarHeight = args.value['height'];