@syncfusion/ej2-image-editor 22.2.11 → 23.1.38

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 (119) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/ej2-image-editor.umd.min.js +3 -3
  3. package/dist/ej2-image-editor.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-image-editor.es2015.js +4446 -678
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +4409 -632
  7. package/dist/es6/ej2-image-editor.es5.js.map +1 -1
  8. package/dist/global/ej2-image-editor.min.js +3 -3
  9. package/dist/global/ej2-image-editor.min.js.map +1 -1
  10. package/dist/global/index.d.ts +2 -2
  11. package/package.json +12 -12
  12. package/src/image-editor/action/crop.js +47 -30
  13. package/src/image-editor/action/draw.d.ts +16 -0
  14. package/src/image-editor/action/draw.js +827 -81
  15. package/src/image-editor/action/export.d.ts +3 -0
  16. package/src/image-editor/action/export.js +84 -20
  17. package/src/image-editor/action/filter.d.ts +0 -1
  18. package/src/image-editor/action/filter.js +28 -41
  19. package/src/image-editor/action/freehand-draw.d.ts +1 -0
  20. package/src/image-editor/action/freehand-draw.js +92 -56
  21. package/src/image-editor/action/selection.d.ts +6 -0
  22. package/src/image-editor/action/selection.js +417 -68
  23. package/src/image-editor/action/shape.d.ts +8 -0
  24. package/src/image-editor/action/shape.js +303 -91
  25. package/src/image-editor/action/transform.d.ts +9 -0
  26. package/src/image-editor/action/transform.js +402 -52
  27. package/src/image-editor/action/undo-redo.d.ts +1 -0
  28. package/src/image-editor/action/undo-redo.js +138 -10
  29. package/src/image-editor/base/enum.d.ts +38 -1
  30. package/src/image-editor/base/enum.js +39 -0
  31. package/src/image-editor/base/image-editor-model.d.ts +16 -2
  32. package/src/image-editor/base/image-editor.d.ts +142 -7
  33. package/src/image-editor/base/image-editor.js +719 -70
  34. package/src/image-editor/base/interface.d.ts +233 -2
  35. package/src/image-editor/renderer/toolbar.d.ts +25 -0
  36. package/src/image-editor/renderer/toolbar.js +1274 -72
  37. package/styles/bootstrap-dark.css +73 -1
  38. package/styles/bootstrap.css +73 -1
  39. package/styles/bootstrap4.css +73 -1
  40. package/styles/bootstrap5-dark.css +73 -1
  41. package/styles/bootstrap5.css +73 -1
  42. package/styles/fabric-dark.css +73 -1
  43. package/styles/fabric.css +73 -1
  44. package/styles/fluent-dark.css +73 -1
  45. package/styles/fluent.css +73 -1
  46. package/styles/highcontrast-light.css +75 -3
  47. package/styles/highcontrast.css +74 -7
  48. package/styles/image-editor/_bootstrap-dark-definition.scss +1 -0
  49. package/styles/image-editor/_bootstrap-definition.scss +1 -0
  50. package/styles/image-editor/_bootstrap4-definition.scss +1 -0
  51. package/styles/image-editor/_bootstrap5-definition.scss +1 -0
  52. package/styles/image-editor/_fabric-dark-definition.scss +1 -0
  53. package/styles/image-editor/_fabric-definition.scss +1 -0
  54. package/styles/image-editor/_fluent-definition.scss +1 -0
  55. package/styles/image-editor/_fusionnew-definition.scss +1 -0
  56. package/styles/image-editor/_highcontrast-definition.scss +2 -1
  57. package/styles/image-editor/_highcontrast-light-definition.scss +2 -1
  58. package/styles/image-editor/_layout.scss +98 -0
  59. package/styles/image-editor/_material-dark-definition.scss +1 -0
  60. package/styles/image-editor/_material-definition.scss +1 -0
  61. package/styles/image-editor/_material3-definition.scss +2 -1
  62. package/styles/image-editor/_tailwind-definition.scss +1 -0
  63. package/styles/image-editor/_theme.scss +4 -2
  64. package/styles/image-editor/bootstrap-dark.css +73 -1
  65. package/styles/image-editor/bootstrap-dark.scss +1 -1
  66. package/styles/image-editor/bootstrap.css +73 -1
  67. package/styles/image-editor/bootstrap.scss +1 -1
  68. package/styles/image-editor/bootstrap4.css +73 -1
  69. package/styles/image-editor/bootstrap4.scss +1 -1
  70. package/styles/image-editor/bootstrap5-dark.css +73 -1
  71. package/styles/image-editor/bootstrap5-dark.scss +1 -1
  72. package/styles/image-editor/bootstrap5.css +73 -1
  73. package/styles/image-editor/bootstrap5.scss +1 -1
  74. package/styles/image-editor/fabric-dark.css +73 -1
  75. package/styles/image-editor/fabric-dark.scss +1 -1
  76. package/styles/image-editor/fabric.css +73 -1
  77. package/styles/image-editor/fabric.scss +1 -1
  78. package/styles/image-editor/fluent-dark.css +73 -1
  79. package/styles/image-editor/fluent-dark.scss +1 -1
  80. package/styles/image-editor/fluent.css +73 -1
  81. package/styles/image-editor/fluent.scss +1 -1
  82. package/styles/image-editor/highcontrast-light.css +75 -3
  83. package/styles/image-editor/highcontrast-light.scss +1 -1
  84. package/styles/image-editor/highcontrast.css +74 -7
  85. package/styles/image-editor/highcontrast.scss +1 -1
  86. package/styles/image-editor/icons/_bootstrap-dark.scss +1 -0
  87. package/styles/image-editor/icons/_bootstrap.scss +1 -0
  88. package/styles/image-editor/icons/_bootstrap4.scss +1 -0
  89. package/styles/image-editor/icons/_bootstrap5.scss +1 -0
  90. package/styles/image-editor/icons/_fabric-dark.scss +1 -0
  91. package/styles/image-editor/icons/_fabric.scss +1 -0
  92. package/styles/image-editor/icons/_fluent.scss +1 -0
  93. package/styles/image-editor/icons/_fusionnew.scss +1 -0
  94. package/styles/image-editor/icons/_highcontrast-light.scss +1 -0
  95. package/styles/image-editor/icons/_highcontrast.scss +1 -0
  96. package/styles/image-editor/icons/_material-dark.scss +1 -0
  97. package/styles/image-editor/icons/_material.scss +1 -0
  98. package/styles/image-editor/icons/_material3.scss +1 -0
  99. package/styles/image-editor/icons/_tailwind.scss +1 -0
  100. package/styles/image-editor/material-dark.css +73 -2
  101. package/styles/image-editor/material-dark.scss +1 -1
  102. package/styles/image-editor/material.css +73 -2
  103. package/styles/image-editor/material.scss +1 -1
  104. package/styles/image-editor/material3-dark.css +78 -4
  105. package/styles/image-editor/material3-dark.scss +1 -1
  106. package/styles/image-editor/material3.css +78 -4
  107. package/styles/image-editor/material3.scss +1 -1
  108. package/styles/image-editor/tailwind-dark.css +73 -2
  109. package/styles/image-editor/tailwind-dark.scss +1 -1
  110. package/styles/image-editor/tailwind.css +73 -2
  111. package/styles/image-editor/tailwind.scss +1 -1
  112. package/styles/material-dark.css +73 -2
  113. package/styles/material.css +73 -2
  114. package/styles/material3-dark.css +78 -4
  115. package/styles/material3-dark.scss +1 -1
  116. package/styles/material3.css +78 -4
  117. package/styles/material3.scss +1 -1
  118. package/styles/tailwind-dark.css +73 -2
  119. package/styles/tailwind.css +73 -2
@@ -31,6 +31,7 @@ var Selection = /** @class */ (function () {
31
31
  this.initialPrevObj = {};
32
32
  this.touchTime = 0;
33
33
  this.resizedElement = '';
34
+ this.isImageClarity = true;
34
35
  this.parent = parent;
35
36
  this.addEventListener();
36
37
  }
@@ -243,6 +244,21 @@ var Selection = /** @class */ (function () {
243
244
  case 'updPtCollForShpRot':
244
245
  this.updPtCollForShpRot(args.value['obj']);
245
246
  break;
247
+ case 'findImageRatio':
248
+ this.findImageRatio(args.value['width'], args.value['height'], args.value['obj']);
249
+ break;
250
+ case 'getNumTextValue':
251
+ this.getNumTextValue(args.value['obj']);
252
+ break;
253
+ case 'setImageClarity':
254
+ this.isImageClarity = args.value['bool'];
255
+ break;
256
+ case 'upgradeImageQuality':
257
+ this.upgradeImageQuality();
258
+ break;
259
+ case 'triggerShapeChange':
260
+ this.triggerShapeChange(args.value['shapeResizingArgs'], args.value['shapeMovingArgs'], args.value['type']);
261
+ break;
246
262
  }
247
263
  };
248
264
  Selection.prototype.getModuleName = function () {
@@ -284,6 +300,7 @@ var Selection = /** @class */ (function () {
284
300
  this.isFhdEditing = false;
285
301
  this.pathAdjustedIndex = null;
286
302
  this.touchTime = 0;
303
+ this.isImageClarity = true;
287
304
  this.currentDrawingShape = '';
288
305
  this.initialPrevObj = {};
289
306
  this.resizedElement = '';
@@ -378,6 +395,12 @@ var Selection = /** @class */ (function () {
378
395
  };
379
396
  Selection.prototype.setCursor = function (x, y) {
380
397
  var parent = this.parent;
398
+ var frameObject = { bool: null };
399
+ parent.notify('toolbar', { prop: 'getFrameToolbar', onPropertyChange: false, value: { obj: frameObject } });
400
+ if (parent.isResize || frameObject['bool']) {
401
+ parent.upperCanvas.style.cursor = 'default';
402
+ return;
403
+ }
381
404
  var lowerCanvas = document.querySelector('#' + parent.element.id + '_lowerCanvas');
382
405
  var upperCanvas = document.querySelector('#' + parent.element.id + '_upperCanvas');
383
406
  var isCropSelection = false;
@@ -853,7 +876,7 @@ var Selection = /** @class */ (function () {
853
876
  var parent = this.parent;
854
877
  var obj = { width: 0, height: 0 };
855
878
  parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
856
- value: { width: parent.activeObj.activePoint.width, height: parent.activeObj.activePoint.height, obj: obj } });
879
+ value: { width: parent.activeObj.activePoint.width, height: parent.activeObj.activePoint.height, obj: obj, isImgShape: null } });
857
880
  var maxDimension = obj;
858
881
  var previousShapeSettings = this.updatePrevShapeSettings();
859
882
  var shapeResizingArgs = { action: 'resize', previousShapeSettings: previousShapeSettings };
@@ -1021,10 +1044,10 @@ var Selection = /** @class */ (function () {
1021
1044
  parent.activeObj.pointColl[i].y += height;
1022
1045
  }
1023
1046
  }
1024
- if (!this.isPreventDragging && (parent.activeObj.activePoint.startX < parent.img.destLeft ||
1047
+ if (!this.isPreventDragging && parent.activeObj.shape !== 'line' && (parent.activeObj.rotatedAngle === 0 && (parent.activeObj.activePoint.startX < parent.img.destLeft ||
1025
1048
  parent.activeObj.activePoint.startY < parent.img.destTop || parent.activeObj.activePoint.endX >
1026
1049
  parent.img.destLeft + parent.img.destWidth || parent.activeObj.activePoint.endY > parent.img.destTop
1027
- + parent.img.destHeight)) {
1050
+ + parent.img.destHeight))) {
1028
1051
  parent.activeObj.activePoint.startX -= width;
1029
1052
  parent.activeObj.activePoint.endX -= width;
1030
1053
  parent.activeObj.activePoint.startY -= height;
@@ -1058,8 +1081,14 @@ var Selection = /** @class */ (function () {
1058
1081
  parent.activeObj.activePoint.width = parent.activeObj.activePoint.endX - parent.activeObj.activePoint.startX;
1059
1082
  parent.activeObj.activePoint.height = parent.activeObj.activePoint.endY - parent.activeObj.activePoint.startY;
1060
1083
  var currentShapeSettings = this.updatePrevShapeSettings();
1061
- shapeResizingArgs.currentShapeSettings = this.shapeResizingArgs.currentShapeSettings = currentShapeSettings;
1062
- shapeMovingArgs.currentShapeSettings = this.shapeMovingArgs.currentShapeSettings = currentShapeSettings;
1084
+ if (!isNullOrUndefined(this.shapeResizingArgs) && !isNullOrUndefined(this.shapeMovingArgs)) {
1085
+ shapeResizingArgs.currentShapeSettings = this.shapeResizingArgs.currentShapeSettings = currentShapeSettings;
1086
+ shapeMovingArgs.currentShapeSettings = this.shapeMovingArgs.currentShapeSettings = currentShapeSettings;
1087
+ }
1088
+ else {
1089
+ shapeResizingArgs.currentShapeSettings = currentShapeSettings;
1090
+ shapeMovingArgs.currentShapeSettings = currentShapeSettings;
1091
+ }
1063
1092
  if (type === 'resize') {
1064
1093
  this.isCropSelection = false;
1065
1094
  var splitWords = void 0;
@@ -1114,6 +1143,20 @@ var Selection = /** @class */ (function () {
1114
1143
  }
1115
1144
  }
1116
1145
  }
1146
+ else if (type === 'mouse-down' || type === 'mouse-up') {
1147
+ if (isBlazor() && parent.events && parent.events.shapeChanging.hasDelegate === true) {
1148
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1149
+ parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeResizingArgs).then(function (shapeResizingArgs) {
1150
+ parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
1151
+ value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
1152
+ });
1153
+ }
1154
+ else {
1155
+ parent.trigger('shapeChanging', shapeResizingArgs);
1156
+ parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
1157
+ value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
1158
+ }
1159
+ }
1117
1160
  else {
1118
1161
  if (isBlazor() && isNullOrUndefined(this.parent.eventType) && parent.events &&
1119
1162
  parent.events.onShapeDragStart.hasDelegate === true) {
@@ -1233,6 +1276,9 @@ var Selection = /** @class */ (function () {
1233
1276
  };
1234
1277
  Selection.prototype.preventDraggingInvertly = function () {
1235
1278
  var parent = this.parent;
1279
+ if (parent.activeObj.shape === 'image') {
1280
+ return;
1281
+ }
1236
1282
  if (!this.isPreventDragging && parent.activeObj.rotatedAngle === 0) {
1237
1283
  this.limitDrag(true);
1238
1284
  if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' ||
@@ -1272,9 +1318,11 @@ var Selection = /** @class */ (function () {
1272
1318
  var point = { x: scale, y: scale };
1273
1319
  if (parent.activeObj.shape && parent.activeObj.shape !== 'crop-custom' &&
1274
1320
  parent.activeObj.shape !== 'crop-circle' && parent.activeObj.shape !== 'crop-square') {
1275
- var ratio = parent.activeObj.shape.split('-');
1276
- if (ratio.length > 1) {
1277
- ratio = ratio[1].split(':');
1321
+ var ratio = parent.activeObj.shape === 'image' ?
1322
+ this.findImageRatio(parent.activeObj.activePoint.width, parent.activeObj.activePoint.height).split('-') :
1323
+ parent.activeObj.shape.split('-');
1324
+ if (ratio.length > 1 || parent.activeObj.shape === 'image') {
1325
+ ratio = parent.activeObj.shape === 'image' ? ratio[0].split(':') : ratio[1].split(':');
1278
1326
  var newScale = scale / (parseInt(ratio[1], 10));
1279
1327
  point.x = newScale * (parseInt(ratio[0], 10));
1280
1328
  point.y = newScale * (parseInt(ratio[1], 10));
@@ -1282,6 +1330,21 @@ var Selection = /** @class */ (function () {
1282
1330
  }
1283
1331
  return point;
1284
1332
  };
1333
+ Selection.prototype.findImageRatio = function (width, height, obj) {
1334
+ // eslint-disable-next-line @typescript-eslint/tslint/config
1335
+ var gcd = function (a, b) {
1336
+ if (b === 0) {
1337
+ return a;
1338
+ }
1339
+ return gcd(b, a % b);
1340
+ };
1341
+ var divisor = gcd(width, height);
1342
+ var ratio = width / divisor + ":" + height / divisor;
1343
+ if (obj) {
1344
+ obj['ratio'] = ratio;
1345
+ }
1346
+ return ratio;
1347
+ };
1285
1348
  Selection.prototype.updateNWPoints = function (x, y, maxDimension) {
1286
1349
  var parent = this.parent;
1287
1350
  var diff;
@@ -1327,7 +1390,12 @@ var Selection = /** @class */ (function () {
1327
1390
  splitWords = parent.activeObj.shape.split('-');
1328
1391
  }
1329
1392
  if (parent.activeObj.shape === 'crop-custom' || (parent.activeObj.shape !== undefined && splitWords[0] !== 'crop')) {
1330
- this.adjustNWPoints(parent.activeObj.activePoint, x, y, parent.activeObj.rotatedAngle);
1393
+ if (parent.activeObj.shape === 'image') {
1394
+ this.resizeImg(x, y, 'nw-resize', tempActiveObj);
1395
+ }
1396
+ else {
1397
+ this.adjustNWPoints(parent.activeObj.activePoint, x, y, parent.activeObj.rotatedAngle);
1398
+ }
1331
1399
  if (parent.activeObj.activePoint.startX > parent.activeObj.activePoint.endX) {
1332
1400
  var temp = parent.activeObj.activePoint.startX;
1333
1401
  parent.activeObj.activePoint.startX = parent.activeObj.activePoint.endX;
@@ -1489,7 +1557,12 @@ var Selection = /** @class */ (function () {
1489
1557
  splitWords = parent.activeObj.shape.split('-');
1490
1558
  }
1491
1559
  if (parent.activeObj.shape === 'crop-custom' || (parent.activeObj.shape !== undefined && splitWords[0] !== 'crop')) {
1492
- this.adjustNEPoints(parent.activeObj.activePoint, x, y, parent.activeObj.rotatedAngle);
1560
+ if (parent.activeObj.shape === 'image') {
1561
+ this.resizeImg(x, y, 'ne-resize', tempActiveObj);
1562
+ }
1563
+ else {
1564
+ this.adjustNEPoints(parent.activeObj.activePoint, x, y, parent.activeObj.rotatedAngle);
1565
+ }
1493
1566
  if (parent.activeObj.activePoint.endX < parent.activeObj.activePoint.startX) {
1494
1567
  var temp = parent.activeObj.activePoint.endX;
1495
1568
  parent.activeObj.activePoint.endX = parent.activeObj.activePoint.startX;
@@ -1746,7 +1819,12 @@ var Selection = /** @class */ (function () {
1746
1819
  splitWords = parent.activeObj.shape.split('-');
1747
1820
  }
1748
1821
  if (parent.activeObj.shape === 'crop-custom' || (parent.activeObj.shape !== undefined && splitWords[0] !== 'crop')) {
1749
- this.adjustSWPoints(parent.activeObj.activePoint, x, y, parent.activeObj.rotatedAngle);
1822
+ if (parent.activeObj.shape === 'image') {
1823
+ this.resizeImg(x, y, 'sw-resize', tempActiveObj);
1824
+ }
1825
+ else {
1826
+ this.adjustSWPoints(parent.activeObj.activePoint, x, y, parent.activeObj.rotatedAngle);
1827
+ }
1750
1828
  if (parent.activeObj.activePoint.startX > parent.activeObj.activePoint.endX) {
1751
1829
  var temp = parent.activeObj.activePoint.startX;
1752
1830
  parent.activeObj.activePoint.startX = parent.activeObj.activePoint.endX;
@@ -1906,11 +1984,17 @@ var Selection = /** @class */ (function () {
1906
1984
  }
1907
1985
  else {
1908
1986
  var splitWords = void 0;
1987
+ var newScale = void 0;
1909
1988
  if (parent.activeObj.shape !== undefined) {
1910
1989
  splitWords = parent.activeObj.shape.split('-');
1911
1990
  }
1912
1991
  if (parent.activeObj.shape === 'crop-custom' || (parent.activeObj.shape !== undefined && splitWords[0] !== 'crop')) {
1913
- this.adjustSEPoints(parent.activeObj.activePoint, x, y, parent.activeObj.rotatedAngle);
1992
+ if (parent.activeObj.shape === 'image') {
1993
+ this.resizeImg(x, y, 'se-resize', tempActiveObj);
1994
+ }
1995
+ else {
1996
+ this.adjustSEPoints(parent.activeObj.activePoint, x, y, parent.activeObj.rotatedAngle);
1997
+ }
1914
1998
  if (parent.activeObj.activePoint.endX < parent.activeObj.activePoint.startX) {
1915
1999
  var temp = parent.activeObj.activePoint.endX;
1916
2000
  parent.activeObj.activePoint.endX = parent.activeObj.activePoint.startX;
@@ -1930,7 +2014,7 @@ var Selection = /** @class */ (function () {
1930
2014
  width = parent.activeObj.activePoint.endX - x;
1931
2015
  height = parent.activeObj.activePoint.endY - y;
1932
2016
  scale = Math.min(width, height);
1933
- var newScale = this.getScaleRatio(scale);
2017
+ newScale = this.getScaleRatio(scale);
1934
2018
  parent.activeObj.activePoint.endX -= newScale.x;
1935
2019
  parent.activeObj.activePoint.endY -= newScale.y;
1936
2020
  var endX = parent.img.destLeft + parent.img.destWidth < parent.lowerCanvas.width ?
@@ -1946,7 +2030,7 @@ var Selection = /** @class */ (function () {
1946
2030
  width = x - parent.activeObj.activePoint.endX;
1947
2031
  height = y - parent.activeObj.activePoint.endY;
1948
2032
  scale = Math.max(width, height);
1949
- var newScale = this.getScaleRatio(scale);
2033
+ newScale = this.getScaleRatio(scale);
1950
2034
  parent.activeObj.activePoint.endX += newScale.x;
1951
2035
  parent.activeObj.activePoint.endY += newScale.y;
1952
2036
  var endX = parent.img.destLeft + parent.img.destWidth < parent.lowerCanvas.width ? parent.img.destLeft +
@@ -1964,6 +2048,106 @@ var Selection = /** @class */ (function () {
1964
2048
  this.preventInverseResize(tempActiveObj);
1965
2049
  }
1966
2050
  };
2051
+ Selection.prototype.resizeImg = function (x, y, elem, tempActiveObj) {
2052
+ var parent = this.parent;
2053
+ var width;
2054
+ var height;
2055
+ var scale;
2056
+ var newScale;
2057
+ if (this.previousPoint.x !== 0 && this.previousPoint.y !== 0) {
2058
+ switch (parent.upperCanvas.style.cursor) {
2059
+ case 'se-resize':
2060
+ case 's-resize':
2061
+ if (this.previousPoint.x > x || this.previousPoint.y > y) {
2062
+ width = (this.previousPoint.x - x);
2063
+ height = (this.previousPoint.y - y);
2064
+ scale = (width + height) / 2;
2065
+ newScale = this.getScaleRatio(scale);
2066
+ this.adjustRotationPoints(parent.activeObj.activePoint, -Math.abs(newScale.x), -Math.abs(newScale.y), parent.activeObj.rotatedAngle, 'img-resize', elem);
2067
+ }
2068
+ else if (this.previousPoint.x !== 0 && this.previousPoint.y !== 0) {
2069
+ width = (x - this.previousPoint.x);
2070
+ height = (y - this.previousPoint.y);
2071
+ scale = (width + height) / 2;
2072
+ newScale = this.getScaleRatio(scale);
2073
+ this.adjustRotationPoints(parent.activeObj.activePoint, Math.abs(newScale.x), Math.abs(newScale.y), parent.activeObj.rotatedAngle, 'img-resize', elem);
2074
+ }
2075
+ break;
2076
+ case 'sw-resize':
2077
+ if (this.previousPoint.x < x || this.previousPoint.y > y) {
2078
+ width = (x - this.previousPoint.x);
2079
+ height = (this.previousPoint.y - y);
2080
+ scale = (width + height) / 2;
2081
+ newScale = this.getScaleRatio(scale);
2082
+ this.adjustRotationPoints(parent.activeObj.activePoint, -Math.abs(newScale.x), -Math.abs(newScale.y), parent.activeObj.rotatedAngle, 'img-resize', elem);
2083
+ }
2084
+ else if (this.previousPoint.x !== 0 && this.previousPoint.y !== 0) {
2085
+ width = (this.previousPoint.x - x);
2086
+ height = (y - this.previousPoint.y);
2087
+ scale = (width + height) / 2;
2088
+ newScale = this.getScaleRatio(scale);
2089
+ this.adjustRotationPoints(parent.activeObj.activePoint, Math.abs(newScale.x), Math.abs(newScale.y), parent.activeObj.rotatedAngle, 'img-resize', elem);
2090
+ }
2091
+ break;
2092
+ case 'w-resize':
2093
+ case 'nw-resize':
2094
+ if (this.previousPoint.x < x || this.previousPoint.y < y) {
2095
+ width = (x - this.previousPoint.x);
2096
+ height = (y - this.previousPoint.y);
2097
+ scale = (width + height) / 2;
2098
+ newScale = this.getScaleRatio(scale);
2099
+ this.adjustRotationPoints(parent.activeObj.activePoint, -Math.abs(newScale.x), -Math.abs(newScale.y), parent.activeObj.rotatedAngle, 'img-resize', elem);
2100
+ }
2101
+ else if (this.previousPoint.x !== 0 && this.previousPoint.y !== 0) {
2102
+ width = (this.previousPoint.x - x);
2103
+ height = (this.previousPoint.y - y);
2104
+ scale = (width + height) / 2;
2105
+ newScale = this.getScaleRatio(scale);
2106
+ this.adjustRotationPoints(parent.activeObj.activePoint, Math.abs(newScale.x), Math.abs(newScale.y), parent.activeObj.rotatedAngle, 'img-resize', elem);
2107
+ }
2108
+ break;
2109
+ case 'n-resize':
2110
+ case 'ne-resize':
2111
+ if (this.previousPoint.x > x || this.previousPoint.y < y) {
2112
+ width = (this.previousPoint.x - x);
2113
+ height = (y - this.previousPoint.y);
2114
+ scale = (width + height) / 2;
2115
+ newScale = this.getScaleRatio(scale);
2116
+ this.adjustRotationPoints(parent.activeObj.activePoint, -Math.abs(newScale.x), -Math.abs(newScale.y), parent.activeObj.rotatedAngle, 'img-resize', elem);
2117
+ }
2118
+ else if (this.previousPoint.x !== 0 && this.previousPoint.y !== 0) {
2119
+ width = (x - this.previousPoint.x);
2120
+ height = (this.previousPoint.y - y);
2121
+ scale = (width + height) / 2;
2122
+ newScale = this.getScaleRatio(scale);
2123
+ this.adjustRotationPoints(parent.activeObj.activePoint, Math.abs(newScale.x), Math.abs(newScale.y), parent.activeObj.rotatedAngle, 'img-resize', elem);
2124
+ }
2125
+ break;
2126
+ case 'e-resize':
2127
+ if (this.previousPoint.x > x || this.previousPoint.y > y) {
2128
+ width = (this.previousPoint.x - x);
2129
+ height = (this.previousPoint.y - y);
2130
+ scale = (width + height) / 2;
2131
+ newScale = this.getScaleRatio(scale);
2132
+ this.adjustRotationPoints(parent.activeObj.activePoint, -Math.abs(newScale.x), -Math.abs(newScale.y), parent.activeObj.rotatedAngle, 'img-resize', elem);
2133
+ }
2134
+ else if (this.previousPoint.x !== 0 && this.previousPoint.y !== 0) {
2135
+ width = (x - this.previousPoint.x);
2136
+ height = (y - this.previousPoint.y);
2137
+ scale = (width + height) / 2;
2138
+ newScale = this.getScaleRatio(scale);
2139
+ this.adjustRotationPoints(parent.activeObj.activePoint, Math.abs(newScale.x), Math.abs(newScale.y), parent.activeObj.rotatedAngle, 'img-resize', elem);
2140
+ }
2141
+ break;
2142
+ }
2143
+ parent.activeObj.activePoint.width = parent.activeObj.activePoint.endX - parent.activeObj.activePoint.startX;
2144
+ parent.activeObj.activePoint.height = parent.activeObj.activePoint.endY - parent.activeObj.activePoint.startY;
2145
+ if (parent.activeObj.activePoint.width < 10 || parent.activeObj.activePoint.height < 10) {
2146
+ parent.activeObj = extend({}, tempActiveObj, null, true);
2147
+ }
2148
+ }
2149
+ this.previousPoint = { x: x, y: y };
2150
+ };
1967
2151
  Selection.prototype.adjustNWPoints = function (rectangle, x, y, angle) {
1968
2152
  var cx = rectangle.startX + rectangle.width / 2;
1969
2153
  var cy = rectangle.startY + rectangle.height / 2;
@@ -2024,10 +2208,10 @@ var Selection = /** @class */ (function () {
2024
2208
  rectangle.endY = rectangle.startY + rectangle.height;
2025
2209
  return rectangle;
2026
2210
  };
2027
- Selection.prototype.adjustRotationPoints = function (rectangle, x, y, angle) {
2211
+ Selection.prototype.adjustRotationPoints = function (rectangle, x, y, angle, type, elem) {
2028
2212
  var cx = rectangle.startX + rectangle.width / 2;
2029
2213
  var cy = rectangle.startY + rectangle.height / 2;
2030
- this.getResizeDirection(rectangle, x, y, angle);
2214
+ this.getResizeDirection(rectangle, x, y, angle, type, elem);
2031
2215
  var rotatedA = this.rotatePoints(rectangle.startX, rectangle.startY, cx, cy, angle);
2032
2216
  var rotatedB = this.rotatePoints(rectangle.endX, rectangle.startY, cx, cy, angle);
2033
2217
  var rotatedC = this.rotatePoints(rectangle.endX, rectangle.endY, cx, cy, angle);
@@ -2076,10 +2260,16 @@ var Selection = /** @class */ (function () {
2076
2260
  case 'x-y':
2077
2261
  value += (x + (y / 2));
2078
2262
  break;
2263
+ case 'img-resize-x':
2264
+ value += x;
2265
+ break;
2266
+ case 'img-resize-y':
2267
+ value += y;
2268
+ break;
2079
2269
  }
2080
2270
  return value;
2081
2271
  };
2082
- Selection.prototype.getResizeDirection = function (rectangle, x, y, angle) {
2272
+ Selection.prototype.getResizeDirection = function (rectangle, x, y, angle, type, elem) {
2083
2273
  var rotatedAngle = angle * (180 / Math.PI);
2084
2274
  var element = this.getResizedElement(rotatedAngle, this.resizedElement);
2085
2275
  if (this.resizedElement === 'e-resize') {
@@ -2098,6 +2288,26 @@ var Selection = /** @class */ (function () {
2098
2288
  rectangle.height = this.setResizedValue(element, rectangle.height, x, y);
2099
2289
  rectangle.endY = rectangle.height + rectangle.startY;
2100
2290
  }
2291
+ else if (type && type === 'img-resize') {
2292
+ rectangle.width = this.setResizedValue('img-resize-x', rectangle.width, x, y);
2293
+ rectangle.height = this.setResizedValue('img-resize-y', rectangle.height, x, y);
2294
+ if (elem === 'se-resize') {
2295
+ rectangle.endX = rectangle.width + rectangle.startX;
2296
+ rectangle.endY = rectangle.height + rectangle.startY;
2297
+ }
2298
+ else if (elem === 'sw-resize') {
2299
+ rectangle.startX = rectangle.endX - rectangle.width;
2300
+ rectangle.endY = rectangle.height + rectangle.startY;
2301
+ }
2302
+ else if (elem === 'ne-resize') {
2303
+ rectangle.endX = rectangle.width + rectangle.startX;
2304
+ rectangle.startY = rectangle.endY - rectangle.height;
2305
+ }
2306
+ else if (elem === 'nw-resize') {
2307
+ rectangle.startX = rectangle.endX - rectangle.width;
2308
+ rectangle.startY = rectangle.endY - rectangle.height;
2309
+ }
2310
+ }
2101
2311
  };
2102
2312
  Selection.prototype.getResizedElement = function (degree, element) {
2103
2313
  var resizeMappings = [];
@@ -2544,7 +2754,7 @@ var Selection = /** @class */ (function () {
2544
2754
  var textWidth = startX ? startX : 0;
2545
2755
  var textHeight = startY ? startY : parent.activeObj.textSettings.fontSize;
2546
2756
  if (parent.activeObj.textSettings.fontSize === undefined) {
2547
- parent.activeObj.textSettings.fontSize = (Math.abs(parent.baseImg.width - parent.baseImg.height)) * 0.1;
2757
+ parent.activeObj.textSettings.fontSize = (Math.abs(parent.baseImgCanvas.width - parent.baseImgCanvas.height)) * 0.1;
2548
2758
  }
2549
2759
  this.setTextSelection(textWidth, textHeight);
2550
2760
  this.mouseDownPoint.x = parent.activeObj.activePoint.endX;
@@ -2625,7 +2835,15 @@ var Selection = /** @class */ (function () {
2625
2835
  var y = imageEditorClickEventArgs.point.y;
2626
2836
  var cursor = parent.activeObj.shape && parent.activeObj.shape === 'text' ?
2627
2837
  parent.cursor : 'default';
2628
- if (this.currentDrawingShape !== '') {
2838
+ if (parent.isResize) {
2839
+ // parent.okBtn();
2840
+ this.performEnterAction();
2841
+ return;
2842
+ }
2843
+ else if (JSON.stringify(parent.frameObj) !== JSON.stringify(parent.tempFrameObj)) {
2844
+ parent.okBtn();
2845
+ }
2846
+ else if (this.currentDrawingShape !== '') {
2629
2847
  var object_1 = { currObj: {} };
2630
2848
  parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object_1 } });
2631
2849
  this.initialPrevObj = object_1['currObj'];
@@ -2650,8 +2868,15 @@ var Selection = /** @class */ (function () {
2650
2868
  parent.activeObj.activePoint.endX = parent.activeObj.activePoint.startX;
2651
2869
  parent.activeObj.activePoint.endY = parent.activeObj.activePoint.startY;
2652
2870
  parent.currObjType.isDragging = true;
2871
+ var previousShapeSettings = this.updatePrevShapeSettings();
2872
+ var shapeResizingArgs = { action: 'draw-start', previousShapeSettings: previousShapeSettings };
2873
+ var shapeMovingArgs = { action: 'move', previousShapeSettings: previousShapeSettings };
2874
+ this.shapeResizingArgs = shapeResizingArgs;
2875
+ this.shapeMovingArgs = shapeMovingArgs;
2876
+ this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'mouse-down');
2653
2877
  return;
2654
2878
  }
2879
+ parent.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false });
2655
2880
  if (this.isCropSelection && this.dragCanvas) {
2656
2881
  this.setCursor(x, y);
2657
2882
  if (parent.cursor !== 'move' && parent.cursor !== 'crosshair' &&
@@ -2715,7 +2940,8 @@ var Selection = /** @class */ (function () {
2715
2940
  }
2716
2941
  if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' ||
2717
2942
  parent.activeObj.shape === 'ellipse' || parent.activeObj.shape === 'line' ||
2718
- parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path' || parent.activeObj.shape === 'text')) {
2943
+ parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path' || parent.activeObj.shape === 'text' ||
2944
+ parent.activeObj.shape === 'image')) {
2719
2945
  parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
2720
2946
  value: { x: null, y: null, isMouseDown: null } });
2721
2947
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
@@ -2769,6 +2995,8 @@ var Selection = /** @class */ (function () {
2769
2995
  parent.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
2770
2996
  if (!isNullOrUndefined(obj['index']) && obj['index'] > -1) {
2771
2997
  parent.notify('freehand-draw', { prop: 'selectFhd', value: { type: 'ok' } });
2998
+ parent.notify('freehand-draw', { prop: 'hoverFhd', onPropertyChange: false,
2999
+ value: { strokeColor: null, strokeWidth: null } });
2772
3000
  if (!isBlazor()) {
2773
3001
  parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
2774
3002
  }
@@ -2783,6 +3011,9 @@ var Selection = /** @class */ (function () {
2783
3011
  parent.notify('freehand-draw', { prop: 'hoverFhd', onPropertyChange: false,
2784
3012
  value: { strokeColor: strokeColor, strokeWidth: parent.pointColl[indexObj['freehandSelectedIndex']].strokeWidth } });
2785
3013
  }
3014
+ else if (this.findTargetObj(x_1, y_1, false)) {
3015
+ this.findTarget(x_1, y_1, e.type);
3016
+ }
2786
3017
  }
2787
3018
  else {
2788
3019
  if (this.isFhdEditing) {
@@ -2830,9 +3061,6 @@ var Selection = /** @class */ (function () {
2830
3061
  }
2831
3062
  if ((parent.cursor !== 'crosshair' && e.type.toLowerCase() === 'touchstart') ||
2832
3063
  (parent.currObjType.isActiveObj && parent.cursor !== 'default' && !parent.togglePen)) {
2833
- if (parent.currObjType.isUndoAction) {
2834
- parent.notify('undo-redo', { prop: 'refreshUrc', value: { bool: null } });
2835
- }
2836
3064
  this.findTarget(x_1, y_1, e.type);
2837
3065
  }
2838
3066
  else if ((parent.currObjType.shape === '' || parent.currObjType.isCustomCrop) && !parent.togglePen && parent.cursor !== 'default') {
@@ -3049,9 +3277,20 @@ var Selection = /** @class */ (function () {
3049
3277
  this.parent.eventType = null;
3050
3278
  }
3051
3279
  if (this.currentDrawingShape === 'path') {
3280
+ var elem = e.srcElement;
3281
+ if (e.currentTarget !== parent.upperCanvas && e.currentTarget !== parent.lowerCanvas && parent.activeObj.pointColl.length > 0 &&
3282
+ (elem.classList.contains('e-upload-icon') || elem.parentElement.id === parent.element.id + '_zoomIn' ||
3283
+ elem.parentElement.id === parent.element.id + '_zoomOut' || elem.parentElement.id === parent.element.id + '_annotationBtn' ||
3284
+ elem.parentElement.id === parent.element.id + '_borderColorBtn' || elem.parentElement.id === parent.element.id + '_borderWidthBtn' ||
3285
+ elem.parentElement.id === parent.element.id + '_saveBtn')) {
3286
+ this.parent.notify('shape', { prop: 'stopPathDrawing', onPropertyChange: false, value: { e: e, isApply: true } });
3287
+ this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
3288
+ parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj, isCropRatio: null,
3289
+ points: null, isPreventDrag: true, saveContext: null, isPreventSelection: true } });
3290
+ }
3052
3291
  return;
3053
3292
  }
3054
- if (e.currentTarget === parent.upperCanvas) {
3293
+ if (e.currentTarget === parent.upperCanvas && !parent.isResize) {
3055
3294
  this.pathAdjustedIndex = null;
3056
3295
  if (this.currentDrawingShape !== '') {
3057
3296
  if (this.currentDrawingShape === 'text') {
@@ -3070,6 +3309,12 @@ var Selection = /** @class */ (function () {
3070
3309
  if (parent.activeObj.activePoint.width === 0 && parent.activeObj.activePoint.height === 0) {
3071
3310
  parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
3072
3311
  }
3312
+ var previousShapeSettings = this.updatePrevShapeSettings();
3313
+ var shapeResizingArgs = { action: 'draw-end', previousShapeSettings: previousShapeSettings };
3314
+ var shapeMovingArgs = { action: 'move', previousShapeSettings: previousShapeSettings };
3315
+ this.shapeResizingArgs = shapeResizingArgs;
3316
+ this.shapeMovingArgs = shapeMovingArgs;
3317
+ this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'mouse-up');
3073
3318
  }
3074
3319
  this.adjustActObjForLineArrow();
3075
3320
  this.updPtCollForShpRot();
@@ -3142,7 +3387,8 @@ var Selection = /** @class */ (function () {
3142
3387
  }
3143
3388
  else {
3144
3389
  if ((parent.activeObj.shape === 'rectangle') || (parent.activeObj.shape === 'ellipse')
3145
- || (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path')) {
3390
+ || (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path'
3391
+ || parent.activeObj.shape === 'image')) {
3146
3392
  parent.updateToolbar(parent.element, parent.activeObj.shape);
3147
3393
  }
3148
3394
  else if (parent.activeObj.shape === 'text' && parent.textArea.style.display === 'none') {
@@ -3300,6 +3546,10 @@ var Selection = /** @class */ (function () {
3300
3546
  isShape = this.findTargetObj(x, y, isCropSelection);
3301
3547
  if (!isCropSelection) {
3302
3548
  this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
3549
+ if (isShape) {
3550
+ parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
3551
+ value: { x: null, y: null, isMouseDown: true } });
3552
+ }
3303
3553
  }
3304
3554
  if (isTextArea) {
3305
3555
  parent.textArea.value = parent.objColl[parent.objColl.length - 1].keyHistory;
@@ -3422,7 +3672,7 @@ var Selection = /** @class */ (function () {
3422
3672
  var isApply = false;
3423
3673
  if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse' ||
3424
3674
  parent.activeObj.shape === 'text' || parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' ||
3425
- parent.activeObj.shape === 'path')) {
3675
+ parent.activeObj.shape === 'path' || parent.activeObj.shape === 'image')) {
3426
3676
  if (x >= (parent.activeObj.activePoint.startX - (parent.activeObj.topLeftCircle.radius * 2)) &&
3427
3677
  x <= (parent.activeObj.activePoint.endX + (parent.activeObj.topLeftCircle.radius * 2)) &&
3428
3678
  y >= (parent.activeObj.activePoint.startY - (parent.activeObj.topLeftCircle.radius * 2)) &&
@@ -3518,6 +3768,12 @@ var Selection = /** @class */ (function () {
3518
3768
  };
3519
3769
  Selection.prototype.canvasMouseMoveHandler = function (e) {
3520
3770
  var parent = this.parent;
3771
+ var frameObject = { bool: null };
3772
+ parent.notify('toolbar', { prop: 'getFrameToolbar', onPropertyChange: false, value: { obj: frameObject } });
3773
+ if (parent.isResize || frameObject['bool']) {
3774
+ parent.upperCanvas.style.cursor = 'default';
3775
+ return;
3776
+ }
3521
3777
  if (this.dragCanvas) {
3522
3778
  parent.lowerCanvas.style.cursor = 'grab';
3523
3779
  }
@@ -3572,7 +3828,7 @@ var Selection = /** @class */ (function () {
3572
3828
  }
3573
3829
  else {
3574
3830
  if (((new Date().getTime()) - this.touchTime) < 400) {
3575
- this.parent.notify('shape', { prop: 'stopPathDrawing', onPropertyChange: false, value: { e: e } });
3831
+ this.parent.notify('shape', { prop: 'stopPathDrawing', onPropertyChange: false, value: { e: e, isApply: null } });
3576
3832
  this.touchTime = 0;
3577
3833
  }
3578
3834
  else {
@@ -3605,7 +3861,6 @@ var Selection = /** @class */ (function () {
3605
3861
  var obj = { fileName: '', fileType: null };
3606
3862
  parent.notify('draw', { prop: 'getFileName', onPropertyChange: false, value: { obj: obj } });
3607
3863
  var beforeSave = { fileName: obj['fileName'], fileType: obj['fileType'], cancel: false };
3608
- var splitWords;
3609
3864
  switch (e.key) {
3610
3865
  case (e.ctrlKey && 's'):
3611
3866
  if (isBlazor() && parent.events && parent.events.saving.hasDelegate === true) {
@@ -3633,14 +3888,14 @@ var Selection = /** @class */ (function () {
3633
3888
  if ((parent.zoomSettings.zoomTrigger & ZoomTrigger.Commands) === ZoomTrigger.Commands) {
3634
3889
  this.zoomType = 'Commands';
3635
3890
  parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3636
- value: { zoomFactor: .1, zoomPoint: null } });
3891
+ value: { zoomFactor: .1, zoomPoint: null }, isResize: null });
3637
3892
  }
3638
3893
  break;
3639
3894
  case (e.ctrlKey && '-'):
3640
3895
  if ((parent.zoomSettings.zoomTrigger & ZoomTrigger.Commands) === ZoomTrigger.Commands) {
3641
3896
  this.zoomType = 'Commands';
3642
3897
  parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3643
- value: { zoomFactor: -.1, zoomPoint: null } });
3898
+ value: { zoomFactor: -.1, zoomPoint: null }, isResize: null });
3644
3899
  }
3645
3900
  break;
3646
3901
  case 'Delete':
@@ -3650,13 +3905,7 @@ var Selection = /** @class */ (function () {
3650
3905
  parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
3651
3906
  break;
3652
3907
  case 'Enter':
3653
- if (parent.activeObj.shape) {
3654
- splitWords = parent.activeObj.shape.split('-');
3655
- }
3656
- if (this.isKeyBoardCrop(e) &&
3657
- parent.activeObj.horTopLine && (parent.activeObj.shape && splitWords[0] === 'crop')) {
3658
- parent.crop();
3659
- }
3908
+ this.performEnterAction(e);
3660
3909
  break;
3661
3910
  case 'Tab':
3662
3911
  this.performTabAction();
@@ -3668,6 +3917,32 @@ var Selection = /** @class */ (function () {
3668
3917
  break;
3669
3918
  }
3670
3919
  };
3920
+ Selection.prototype.performEnterAction = function (e) {
3921
+ var parent = this.parent;
3922
+ if (parent.isResize) {
3923
+ var point = this.getNumTextValue();
3924
+ var aspectRatioElement = this.parent.element.querySelector('#' + this.parent.element.id + '_aspectratio');
3925
+ var blrAspRatElem = this.parent.element.querySelector('.e-ie-toolbar-aspect-ratio-btn');
3926
+ if (point && point.x && point.y) {
3927
+ if (aspectRatioElement || (blrAspRatElem && !blrAspRatElem.classList.contains('e-hidden'))) {
3928
+ parent.notify('transform', { prop: 'resize', value: { width: point.x, height: null, isAspectRatio: true } });
3929
+ }
3930
+ else {
3931
+ parent.notify('transform', { prop: 'resize', value: { width: point.x, height: point.y, isAspectRatio: false } });
3932
+ }
3933
+ }
3934
+ }
3935
+ else {
3936
+ var splitWords = void 0;
3937
+ if (parent.activeObj.shape) {
3938
+ splitWords = parent.activeObj.shape.split('-');
3939
+ }
3940
+ if (e && this.isKeyBoardCrop(e) &&
3941
+ parent.activeObj.horTopLine && (parent.activeObj.shape && splitWords[0] === 'crop')) {
3942
+ parent.crop();
3943
+ }
3944
+ }
3945
+ };
3671
3946
  Selection.prototype.isKeyBoardCrop = function (e) {
3672
3947
  var bool = false;
3673
3948
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
@@ -3910,16 +4185,23 @@ var Selection = /** @class */ (function () {
3910
4185
  x <= actObj.pointColl[j].x + (actObj.topLeftCircle.radius * 2) &&
3911
4186
  y >= actObj.pointColl[j].y - (actObj.topLeftCircle.radius * 2) &&
3912
4187
  y <= actObj.pointColl[j].y + (actObj.topLeftCircle.radius * 2)) {
3913
- if (this.isTouch || parent.cursor === 'move' ||
3914
- parent.cursor === 'grab' || this.isShapeInserted) {
3915
- if (diffX === 0 || diffX > x - actObj.activePoint.startX) {
3916
- diffX = x - parent.objColl[index].activePoint.startX;
4188
+ if (this.tempActiveObj && this.tempActiveObj.activePoint &&
4189
+ JSON.stringify(this.tempActiveObj.activePoint) === JSON.stringify(actObj.activePoint)) {
4190
+ i = index;
4191
+ break;
4192
+ }
4193
+ else {
4194
+ if (this.isTouch || parent.cursor === 'move' ||
4195
+ parent.cursor === 'grab' || this.isShapeInserted) {
4196
+ if (diffX === 0 || diffX > x - actObj.activePoint.startX) {
4197
+ diffX = x - parent.objColl[index].activePoint.startX;
4198
+ i = index;
4199
+ }
4200
+ }
4201
+ else if (parent.objColl[index].currIndex === this.tempActiveObj.currIndex) {
3917
4202
  i = index;
3918
4203
  }
3919
4204
  }
3920
- else if (parent.objColl[index].currIndex === this.tempActiveObj.currIndex) {
3921
- i = index;
3922
- }
3923
4205
  break;
3924
4206
  }
3925
4207
  }
@@ -3927,29 +4209,43 @@ var Selection = /** @class */ (function () {
3927
4209
  else if (actObj.shape === 'path') {
3928
4210
  var cursor_1 = this.setCursorForPath(actObj, x, y, parent.upperCanvas);
3929
4211
  if (cursor_1 !== 'default' && cursor_1 !== 'grab') {
3930
- if (this.isTouch || parent.cursor === 'move' || parent.cursor === 'grab' || this.isShapeInserted) {
3931
- if (diffX === 0 || diffX > x - actObj.activePoint.startX) {
3932
- diffX = x - parent.objColl[index].activePoint.startX;
4212
+ if (this.tempActiveObj && this.tempActiveObj.activePoint &&
4213
+ JSON.stringify(this.tempActiveObj.activePoint) === JSON.stringify(actObj.activePoint)) {
4214
+ i = index;
4215
+ break;
4216
+ }
4217
+ else {
4218
+ if (this.isTouch || parent.cursor === 'move' || parent.cursor === 'grab' || this.isShapeInserted) {
4219
+ if (diffX === 0 || diffX > x - actObj.activePoint.startX) {
4220
+ diffX = x - parent.objColl[index].activePoint.startX;
4221
+ i = index;
4222
+ }
4223
+ }
4224
+ else if (parent.objColl[index].currIndex === this.tempActiveObj.currIndex) {
3933
4225
  i = index;
3934
4226
  }
3935
4227
  }
3936
- else if (parent.objColl[index].currIndex === this.tempActiveObj.currIndex) {
3937
- i = index;
3938
- }
3939
4228
  }
3940
4229
  }
3941
4230
  else if (actObj.rotatedAngle !== 0) {
3942
4231
  var cursor_2 = this.setCursorForRotatedObject(actObj, x, y, parent.upperCanvas);
3943
4232
  if (cursor_2 !== 'default' && cursor_2 !== 'grab') {
3944
- if (this.isTouch || parent.cursor === 'move' || parent.cursor === 'grab' || this.isShapeInserted) {
3945
- if (diffX === 0 || diffX > x - actObj.activePoint.startX) {
3946
- diffX = x - parent.objColl[index].activePoint.startX;
4233
+ if (this.tempActiveObj && this.tempActiveObj.activePoint &&
4234
+ JSON.stringify(this.tempActiveObj.activePoint) === JSON.stringify(actObj.activePoint)) {
4235
+ i = index;
4236
+ break;
4237
+ }
4238
+ else {
4239
+ if (this.isTouch || parent.cursor === 'move' || parent.cursor === 'grab' || this.isShapeInserted) {
4240
+ if (diffX === 0 || diffX > x - actObj.activePoint.startX) {
4241
+ diffX = x - parent.objColl[index].activePoint.startX;
4242
+ i = index;
4243
+ }
4244
+ }
4245
+ else if (parent.objColl[index].currIndex === this.tempActiveObj.currIndex) {
3947
4246
  i = index;
3948
4247
  }
3949
4248
  }
3950
- else if (parent.objColl[index].currIndex === this.tempActiveObj.currIndex) {
3951
- i = index;
3952
- }
3953
4249
  }
3954
4250
  }
3955
4251
  else {
@@ -3963,16 +4259,23 @@ var Selection = /** @class */ (function () {
3963
4259
  x <= (rotationCirclePoint.x + (actObj.topLeftCircle.radius * 2)) &&
3964
4260
  y >= (rotationCirclePoint.y - (actObj.topLeftCircle.radius * 2)) &&
3965
4261
  y <= (rotationCirclePoint.y + (actObj.topLeftCircle.radius * 2)))) {
3966
- if (this.isTouch || cursor === 'move' || cursor === 'grabbing' || this.isShapeInserted
3967
- || parent.cursor === 'move' || parent.cursor === 'grabbing') {
3968
- if (diffX === 0 || diffX > x - actObj.activePoint.startX) {
3969
- diffX = x - parent.objColl[index].activePoint.startX;
4262
+ if (this.tempActiveObj && this.tempActiveObj.activePoint &&
4263
+ JSON.stringify(this.tempActiveObj.activePoint) === JSON.stringify(actObj.activePoint)) {
4264
+ i = index;
4265
+ break;
4266
+ }
4267
+ else {
4268
+ if (this.isTouch || cursor === 'move' || cursor === 'grabbing' || this.isShapeInserted
4269
+ || parent.cursor === 'move' || parent.cursor === 'grabbing') {
4270
+ if (diffX === 0 || diffX > x - actObj.activePoint.startX) {
4271
+ diffX = x - parent.objColl[index].activePoint.startX;
4272
+ i = index;
4273
+ }
4274
+ }
4275
+ else if (parent.objColl[index].currIndex === this.tempActiveObj.currIndex) {
3970
4276
  i = index;
3971
4277
  }
3972
4278
  }
3973
- else if (parent.objColl[index].currIndex === this.tempActiveObj.currIndex) {
3974
- i = index;
3975
- }
3976
4279
  }
3977
4280
  }
3978
4281
  }
@@ -3989,8 +4292,7 @@ var Selection = /** @class */ (function () {
3989
4292
  if (parent.transform.degree === 0) {
3990
4293
  var temp_1 = this.lowerContext.filter;
3991
4294
  this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
3992
- parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
3993
- this.lowerContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, parent.img.destLeft, parent.img.destTop, parent.img.destWidth, parent.img.destHeight);
4295
+ parent.notify('draw', { prop: 'drawImage', onPropertyChange: false });
3994
4296
  this.lowerContext.filter = 'none';
3995
4297
  parent.notify('shape', { prop: 'iterateObjColl', onPropertyChange: false });
3996
4298
  parent.activeObj = extend({}, temp_1, {}, true);
@@ -4009,6 +4311,7 @@ var Selection = /** @class */ (function () {
4009
4311
  parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
4010
4312
  value: { context: this.lowerContext, isSave: null, isFlip: null } });
4011
4313
  }
4314
+ parent.activeObj = extend({}, temp, {}, true);
4012
4315
  this.setActivePoint();
4013
4316
  parent.activeObj = extend({}, temp, {}, true);
4014
4317
  var tempStrokeSettings = extend({}, parent.activeObj.strokeSettings, {}, true);
@@ -4089,6 +4392,10 @@ var Selection = /** @class */ (function () {
4089
4392
  parent.notify('draw', { prop: 'setPrevActObj', onPropertyChange: false,
4090
4393
  value: { prevActObj: extend({}, parent.activeObj, {}, true) } });
4091
4394
  }
4395
+ if (parent.activeObj.shape === 'image' && !this.isImageClarity) {
4396
+ this.upgradeImageQuality();
4397
+ this.isImageClarity = true;
4398
+ }
4092
4399
  parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj, isCropRatio: null,
4093
4400
  points: null, isPreventDrag: true, saveContext: null, isPreventSelection: true } });
4094
4401
  if (!this.isShapeInserted) {
@@ -4107,6 +4414,19 @@ var Selection = /** @class */ (function () {
4107
4414
  }
4108
4415
  }
4109
4416
  };
4417
+ Selection.prototype.upgradeImageQuality = function () {
4418
+ var parent = this.parent;
4419
+ var activeObj = extend({}, parent.activeObj, null, true);
4420
+ var ctx = parent.activeObj.imageCanvas.getContext('2d');
4421
+ var dimObj = { width: 0, height: 0 };
4422
+ parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
4423
+ value: { width: parent.activeObj.imageElement.width, height: parent.activeObj.imageElement.height, obj: dimObj, isImgShape: null } });
4424
+ parent.notify('shape', { prop: 'updateObj', onPropertyChange: false, value: { dimObj: dimObj, x: null, y: null } });
4425
+ ctx.clearRect(0, 0, parent.activeObj.imageCanvas.width, parent.activeObj.imageCanvas.height);
4426
+ parent.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
4427
+ value: { ctx: ctx, isImgAnnotation: true, isHFlip: null, isVFlip: null } });
4428
+ parent.activeObj = activeObj;
4429
+ };
4110
4430
  // eslint-disable-next-line
4111
4431
  Selection.prototype.targetTouches = function (touches) {
4112
4432
  var bbox = this.parent.lowerCanvas.getBoundingClientRect();
@@ -4194,7 +4514,7 @@ var Selection = /** @class */ (function () {
4194
4514
  this.tempActiveObj = { activePoint: { startX: 0, startY: 0, endX: 0, endY: 0, width: 0, height: 0 },
4195
4515
  flipObjColl: [], triangle: [], triangleRatio: [] };
4196
4516
  }
4197
- else if (actObj.shape === 'text' && this.dragElement !== '') {
4517
+ else if ((actObj.shape === 'text' || actObj.shape === 'image') && this.dragElement !== '') {
4198
4518
  isInside = true;
4199
4519
  }
4200
4520
  else if (actObj.shape === 'line' || actObj.shape === 'arrow') {
@@ -4238,7 +4558,8 @@ var Selection = /** @class */ (function () {
4238
4558
  parent.objColl.push(extend({}, parent.activeObj, {}, true));
4239
4559
  }
4240
4560
  if (parent.activeObj.shape === 'text' || (parent.currObjType.shape === 'ellipse' || parent.currObjType.shape === 'rectangle' ||
4241
- parent.currObjType.shape === 'line' || parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path')) {
4561
+ parent.currObjType.shape === 'line' || parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path' ||
4562
+ parent.activeObj.shape === 'image')) {
4242
4563
  var tempFilter = this.lowerContext.filter;
4243
4564
  this.lowerContext.filter = 'brightness(' + 1 + ') ' + 'contrast(' + 100 + '%) ' + 'hue-rotate(' + 0 + 'deg) ' +
4244
4565
  'saturate(' + 100 + '%) ' + 'opacity(' + 1 + ') ' + 'blur(' + 0 + 'px) ' + 'sepia(0%) ' + 'grayscale(0%) ' +
@@ -4452,7 +4773,10 @@ var Selection = /** @class */ (function () {
4452
4773
  fontSize: parent.activeObj.shape === 'text' ? (parent.activeObj.textSettings ? parent.activeObj.textSettings.fontSize : null) : null,
4453
4774
  fontFamily: parent.activeObj.shape === 'text' ? (parent.activeObj.textSettings ? parent.activeObj.textSettings.fontFamily : null) : null,
4454
4775
  fontStyle: parent.activeObj.shape === 'text' ? fontStyle : null,
4455
- color: parent.activeObj.shape === 'text' ? (parent.activeObj.strokeSettings ? parent.activeObj.strokeSettings.strokeColor : null) : null
4776
+ color: parent.activeObj.shape === 'text' ? (parent.activeObj.strokeSettings ? parent.activeObj.strokeSettings.strokeColor : null) : null,
4777
+ degree: parent.activeObj.shape === 'ellipse' || parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'image' ?
4778
+ parent.activeObj.rotatedAngle * (180 / Math.PI) : null,
4779
+ imageData: parent.activeObj.shape === 'image' ? parent.activeObj.imageElement.src : null
4456
4780
  };
4457
4781
  if (obj) {
4458
4782
  obj['shapeSettingsObj'] = shapeSettingsObj;
@@ -4549,6 +4873,31 @@ var Selection = /** @class */ (function () {
4549
4873
  }
4550
4874
  return rotationCirclePoint;
4551
4875
  };
4876
+ Selection.prototype.getNumTextValue = function (obj) {
4877
+ var height;
4878
+ var width;
4879
+ var widthElement;
4880
+ var heightElement;
4881
+ if (!isBlazor()) {
4882
+ widthElement = this.parent.element.querySelector('#' + this.parent.element.id + '_resizeWidth');
4883
+ heightElement = this.parent.element.querySelector('#' + this.parent.element.id + '_resizeHeight');
4884
+ }
4885
+ else {
4886
+ widthElement = this.parent.element.querySelector('.e-ie-toolbar-e-resize-width-input .e-numerictextbox');
4887
+ heightElement = this.parent.element.querySelector('.e-ie-toolbar-e-resize-height-input .e-numerictextbox');
4888
+ }
4889
+ if (widthElement && heightElement) {
4890
+ var heightString = heightElement.value.replace(/,/g, '');
4891
+ var widthString = widthElement.value.replace(/,/g, '');
4892
+ height = parseFloat(heightString);
4893
+ width = parseFloat(widthString);
4894
+ }
4895
+ if (obj) {
4896
+ obj['width'] = width;
4897
+ obj['height'] = height;
4898
+ }
4899
+ return { x: width, y: height };
4900
+ };
4552
4901
  return Selection;
4553
4902
  }());
4554
4903
  export { Selection };