@syncfusion/ej2-image-editor 22.1.34 → 22.1.37

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 (35) hide show
  1. package/CHANGELOG.md +16 -0
  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 +1018 -1064
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +1016 -1066
  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 +9 -9
  12. package/src/image-editor/action/crop.d.ts +1 -0
  13. package/src/image-editor/action/crop.js +12 -1
  14. package/src/image-editor/action/draw.d.ts +4 -1
  15. package/src/image-editor/action/draw.js +137 -127
  16. package/src/image-editor/action/filter.js +1 -1
  17. package/src/image-editor/action/freehand-draw.js +9 -9
  18. package/src/image-editor/action/selection.d.ts +1 -1
  19. package/src/image-editor/action/selection.js +64 -226
  20. package/src/image-editor/action/shape.d.ts +1 -0
  21. package/src/image-editor/action/shape.js +97 -9
  22. package/src/image-editor/action/transform.js +211 -22
  23. package/src/image-editor/action/undo-redo.js +9 -7
  24. package/src/image-editor/base/image-editor-model.d.ts +2 -2
  25. package/src/image-editor/base/image-editor.d.ts +0 -15
  26. package/src/image-editor/base/image-editor.js +35 -225
  27. package/src/image-editor/base/interface.d.ts +11 -3
  28. package/src/image-editor/renderer/toolbar.js +362 -363
  29. package/styles/highcontrast-light.css +2 -2
  30. package/styles/highcontrast.css +6 -1
  31. package/styles/image-editor/_highcontrast-definition.scss +1 -1
  32. package/styles/image-editor/_highcontrast-light-definition.scss +1 -1
  33. package/styles/image-editor/_theme.scss +2 -4
  34. package/styles/image-editor/highcontrast-light.css +2 -2
  35. package/styles/image-editor/highcontrast.css +6 -1
@@ -309,7 +309,7 @@ var ImageEditor = /** @class */ (function (_super) {
309
309
  break;
310
310
  case 'theme':
311
311
  if (newProperties.theme) {
312
- if (!isNullOrUndefined(this.theme) && this.theme !== '') {
312
+ if (this.theme && this.theme !== '') {
313
313
  this.theme = this.toPascalCase(this.theme);
314
314
  }
315
315
  else {
@@ -371,7 +371,7 @@ var ImageEditor = /** @class */ (function (_super) {
371
371
  case 'selectionSettings':
372
372
  if (newProperties.selectionSettings) {
373
373
  this.selectionSettings = newProperties.selectionSettings;
374
- if (!isNullOrUndefined(this.activeObj.shape)) {
374
+ if (this.activeObj.shape) {
375
375
  this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
376
376
  this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: this.activeObj } });
377
377
  }
@@ -391,9 +391,7 @@ var ImageEditor = /** @class */ (function (_super) {
391
391
  this.element.removeAttribute('class');
392
392
  }
393
393
  if (!isBlazor()) {
394
- this.notify('toolbar', {
395
- prop: 'destroySubComponents', onPropertyChange: false
396
- });
394
+ this.notify('toolbar', { prop: 'destroySubComponents', onPropertyChange: false });
397
395
  this.notify('destroyed', null);
398
396
  _super.prototype.destroy.call(this);
399
397
  }
@@ -404,7 +402,7 @@ var ImageEditor = /** @class */ (function (_super) {
404
402
  this.element.innerHTML = '';
405
403
  };
406
404
  ImageEditor.prototype.initialize = function () {
407
- if (!isNullOrUndefined(this.toolbarTemplate)) {
405
+ if (this.toolbarTemplate) {
408
406
  this.element.appendChild(this.createElement('div', {
409
407
  id: this.element.id + '_toolbarArea', className: 'e-toolbar-area'
410
408
  }));
@@ -423,13 +421,13 @@ var ImageEditor = /** @class */ (function (_super) {
423
421
  var quickAccessToolbar = document.getElementById(this.element.id + '_quickAccessToolbarArea');
424
422
  quickAccessToolbar.style.position = 'absolute';
425
423
  quickAccessToolbar.style.display = 'none';
426
- if (!isNullOrUndefined(this.activeObj)) {
424
+ if (this.activeObj) {
427
425
  quickAccessToolbar.style.left = this.activeObj.activePoint.startX + 'px';
428
426
  quickAccessToolbar.style.top = this.activeObj.activePoint.startY + 'px';
429
427
  }
430
428
  quickAccessToolbar.style.width = '100%';
431
429
  }
432
- if (!isNullOrUndefined(this.quickAccessToolbarTemplate)) {
430
+ if (this.quickAccessToolbarTemplate) {
433
431
  this.quickAccessToolbarTemplateFn();
434
432
  }
435
433
  else {
@@ -506,6 +504,7 @@ var ImageEditor = /** @class */ (function (_super) {
506
504
  screen.orientation.removeEventListener('change', this.screenOrientation.bind(this));
507
505
  }
508
506
  this.notify('shape', { prop: 'unWireEvent', onPropertyChange: false });
507
+ this.notify('selection', { prop: 'unWireEvent', onPropertyChange: false });
509
508
  };
510
509
  ImageEditor.prototype.createCanvas = function () {
511
510
  this.element.style.boxSizing = 'border-box';
@@ -585,7 +584,7 @@ var ImageEditor = /** @class */ (function (_super) {
585
584
  this.notify('selection', { prop: 'handleScroll', onPropertyChange: false, value: { e: e } });
586
585
  };
587
586
  ImageEditor.prototype.adjustToScreen = function () {
588
- this.notify('selection', { prop: 'adjustToScreen', onPropertyChange: false });
587
+ this.update();
589
588
  };
590
589
  ImageEditor.prototype.screenOrientation = function () {
591
590
  if (Browser.isDevice) {
@@ -742,10 +741,10 @@ var ImageEditor = /** @class */ (function (_super) {
742
741
  this.currentFilter = '';
743
742
  var obj_1 = { initialZoomValue: false };
744
743
  this.notify('draw', { prop: 'getInitialZoomValue', onPropertyChange: false, value: { obj: obj_1 } });
745
- if (!isNullOrUndefined(obj_1['initialZoomValue'])) {
744
+ if (obj_1['initialZoomValue']) {
746
745
  this.setProperties({ zoomSettings: { zoomFactor: obj_1['initialZoomValue'] } }, true);
747
746
  }
748
- if (!isNullOrUndefined(document.getElementById(this.element.id + '_quickAccessToolbarArea'))) {
747
+ if (document.getElementById(this.element.id + '_quickAccessToolbarArea')) {
749
748
  document.getElementById(this.element.id + '_quickAccessToolbarArea').style.display = 'none';
750
749
  }
751
750
  this.notifyResetForAllModules();
@@ -754,7 +753,7 @@ var ImageEditor = /** @class */ (function (_super) {
754
753
  this.notify('draw', { prop: 'update-canvas', onPropertyChange: false });
755
754
  this.isImageLoaded = true;
756
755
  if (!isBlazor()) {
757
- if (!isNullOrUndefined(this.element.querySelector('.e-contextual-toolbar-wrapper'))) {
756
+ if (this.element.querySelector('.e-contextual-toolbar-wrapper')) {
758
757
  this.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
759
758
  }
760
759
  this.notify('toolbar', { prop: 'refresh-dropdown-btn', value: { isDisabled: false } });
@@ -890,7 +889,7 @@ var ImageEditor = /** @class */ (function (_super) {
890
889
  ImageEditor.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor) {
891
890
  var isEllipse = false;
892
891
  var isPointsInRange = this.allowShape(x, y);
893
- if (!this.disabled && this.isImageLoaded && isPointsInRange) {
892
+ if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
894
893
  isEllipse = true;
895
894
  this.notify('shape', { prop: 'drawEllipse', onPropertyChange: false, value: { x: x, y: y, radiusX: radiusX, radiusY: radiusY,
896
895
  strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor } });
@@ -911,7 +910,7 @@ var ImageEditor = /** @class */ (function (_super) {
911
910
  ImageEditor.prototype.drawLine = function (startX, startY, endX, endY, strokeWidth, strokeColor) {
912
911
  var isLine = false;
913
912
  var isPointsInRange = this.allowShape(startX, startY);
914
- if (!this.disabled && this.isImageLoaded && isPointsInRange) {
913
+ if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(startX) && isNullOrUndefined(startY)))) {
915
914
  isLine = true;
916
915
  this.notify('shape', { prop: 'drawLine', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
917
916
  endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor } });
@@ -929,14 +928,12 @@ var ImageEditor = /** @class */ (function (_super) {
929
928
  * @param {string} strokeColor - Specifies the stroke color of arrow.
930
929
  * @param {ArrowheadType} arrowStart – Specifies the type of arrowhead for start position. The default value is ‘None’.
931
930
  * @param {ArrowheadType} arrowEnd – Specifies the type of arrowhead for end position. The default value is ‘SolidArrow’.
932
-
933
931
  * @returns {boolean}.
934
- * @private
935
932
  */
936
933
  ImageEditor.prototype.drawArrow = function (startX, startY, endX, endY, strokeWidth, strokeColor, arrowStart, arrowEnd) {
937
934
  var isArrow = false;
938
935
  var isPointsInRange = this.allowShape(startX, startY);
939
- if (!this.disabled && this.isImageLoaded && isPointsInRange) {
936
+ if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(startX) && isNullOrUndefined(startY)))) {
940
937
  isArrow = true;
941
938
  this.notify('shape', { prop: 'drawArrow', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
942
939
  endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, arrowStart: arrowStart, arrowEnd: arrowEnd } });
@@ -955,7 +952,7 @@ var ImageEditor = /** @class */ (function (_super) {
955
952
  this.isPublicMethod = true;
956
953
  var obj = { inRange: false };
957
954
  var isPath = false;
958
- if (pointColl.length > 0) {
955
+ if (pointColl && pointColl.length > 0) {
959
956
  for (var i = 0; i < pointColl.length; i++) {
960
957
  if (obj['inRange']) {
961
958
  break;
@@ -964,7 +961,7 @@ var ImageEditor = /** @class */ (function (_super) {
964
961
  value: { x: pointColl[i].x, y: pointColl[i].y, obj: obj } });
965
962
  }
966
963
  }
967
- if (!this.disabled && this.isImageLoaded && obj['inRange']) {
964
+ if (!this.disabled && this.isImageLoaded && (obj['inRange'] || isNullOrUndefined(pointColl))) {
968
965
  isPath = true;
969
966
  this.notify('shape', { prop: 'drawPath', onPropertyChange: false, value: { pointColl: pointColl,
970
967
  strokeWidth: strokeWidth, strokeColor: strokeColor } });
@@ -986,7 +983,7 @@ var ImageEditor = /** @class */ (function (_super) {
986
983
  ImageEditor.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor) {
987
984
  var isRectangle = false;
988
985
  var isPointsInRange = this.allowShape(x, y);
989
- if (!this.disabled && this.isImageLoaded && isPointsInRange) {
986
+ if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
990
987
  isRectangle = true;
991
988
  this.notify('shape', { prop: 'drawRectangle', onPropertyChange: false, value: { x: x, y: y, width: width, height: height,
992
989
  strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor } });
@@ -1012,7 +1009,7 @@ var ImageEditor = /** @class */ (function (_super) {
1012
1009
  ImageEditor.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color) {
1013
1010
  var isText = false;
1014
1011
  var isPointsInRange = this.allowShape(x, y);
1015
- if (!this.disabled && this.isImageLoaded && isPointsInRange) {
1012
+ if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
1016
1013
  isText = true;
1017
1014
  this.notify('shape', { prop: 'drawText', onPropertyChange: false, value: { x: x, y: y, text: text, fontFamily: fontFamily,
1018
1015
  fontSize: fontSize, bold: bold, italic: italic, color: color } });
@@ -1164,6 +1161,8 @@ var ImageEditor = /** @class */ (function (_super) {
1164
1161
  template = this.toolbarFn({ type: 'toolbar' }, this, 'Template', templateID)[0];
1165
1162
  }
1166
1163
  toolbarArea.appendChild(template);
1164
+ this.toolbarHeight = toolbarArea.clientHeight;
1165
+ this.notify('toolbar', { prop: 'setToolbarHeight', value: { height: this.toolbarHeight } });
1167
1166
  this['renderReactTemplates']();
1168
1167
  }
1169
1168
  };
@@ -1231,7 +1230,7 @@ var ImageEditor = /** @class */ (function (_super) {
1231
1230
  var isUndoRedo = this.isUndoRedo;
1232
1231
  this.isCropTab = false;
1233
1232
  this.isUndoRedo = true;
1234
- if (!isNullOrUndefined(this.transform.cropZoomFactor) && this.transform.cropZoomFactor > 0) {
1233
+ if (this.transform.cropZoomFactor && this.transform.cropZoomFactor > 0) {
1235
1234
  this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
1236
1235
  value: { zoomFactor: -this.transform.cropZoomFactor, zoomPoint: null } });
1237
1236
  }
@@ -1248,120 +1247,6 @@ var ImageEditor = /** @class */ (function (_super) {
1248
1247
  this.isCropTab = true;
1249
1248
  this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: this.activeObj } });
1250
1249
  };
1251
- ImageEditor.prototype.moveToSelectionRange = function (type, activeObj) {
1252
- if (!isNullOrUndefined(this.activeObj.shape)) {
1253
- if (type === 'rotateleft' || type === 'rotateright') {
1254
- var zoomFactor = this.transform.zoomFactor;
1255
- this.objColl.push(this.activeObj);
1256
- this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
1257
- if (this.transform.degree % 90 === 0 && this.transform.degree % 180 !== 0) {
1258
- if (this.objColl[this.objColl.length - 1].activePoint.width < activeObj.activePoint.height) {
1259
- for (var i = 2; i < this.zoomSettings.maxZoomFactor; i++) {
1260
- if (this.objColl[this.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
1261
- this.isSelectionBiggerThanCanvas(this.objColl[this.objColl.length - 1]) ||
1262
- this.isSelectionOutsideCanvas(this.objColl[this.objColl.length - 1])) {
1263
- if (!isNullOrUndefined(zoomFactor)) {
1264
- this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
1265
- value: { zoomFactor: -0.1, zoomPoint: null } });
1266
- }
1267
- break;
1268
- }
1269
- zoomFactor += .1;
1270
- this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
1271
- value: { zoomFactor: zoomFactor, zoomPoint: null } });
1272
- }
1273
- }
1274
- else {
1275
- for (var i = 2; i < this.zoomSettings.maxZoomFactor; i++) {
1276
- if (this.objColl[this.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
1277
- this.isSelectionBiggerThanCanvas(this.objColl[this.objColl.length - 1]) ||
1278
- this.isSelectionOutsideCanvas(this.objColl[this.objColl.length - 1])) {
1279
- if (!isNullOrUndefined(zoomFactor)) {
1280
- this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
1281
- value: { zoomFactor: 0.1, zoomPoint: null } });
1282
- }
1283
- break;
1284
- }
1285
- zoomFactor -= .1;
1286
- this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
1287
- value: { zoomFactor: zoomFactor, zoomPoint: null } });
1288
- }
1289
- }
1290
- }
1291
- else {
1292
- if (this.objColl[this.objColl.length - 1].activePoint.height < activeObj.activePoint.width) {
1293
- for (var i = 2; i < this.zoomSettings.maxZoomFactor; i++) {
1294
- if (this.objColl[this.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
1295
- this.isSelectionBiggerThanCanvas(this.objColl[this.objColl.length - 1]) ||
1296
- this.isSelectionOutsideCanvas(this.objColl[this.objColl.length - 1])) {
1297
- if (!isNullOrUndefined(zoomFactor)) {
1298
- this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
1299
- value: { zoomFactor: -0.1, zoomPoint: null } });
1300
- }
1301
- break;
1302
- }
1303
- zoomFactor += .1;
1304
- this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
1305
- value: { zoomFactor: zoomFactor, zoomPoint: null } });
1306
- }
1307
- }
1308
- else {
1309
- for (var i = 2; i < this.zoomSettings.maxZoomFactor; i++) {
1310
- if (this.objColl[this.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
1311
- this.isSelectionBiggerThanCanvas(this.objColl[this.objColl.length - 1]) ||
1312
- this.isSelectionOutsideCanvas(this.objColl[this.objColl.length - 1])) {
1313
- if (!isNullOrUndefined(zoomFactor)) {
1314
- this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
1315
- value: { zoomFactor: 0.1, zoomPoint: null } });
1316
- }
1317
- break;
1318
- }
1319
- zoomFactor -= .1;
1320
- this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
1321
- value: { zoomFactor: zoomFactor, zoomPoint: null } });
1322
- }
1323
- }
1324
- }
1325
- var panX = (this.lowerCanvas.clientWidth / 2) - (this.objColl[this.objColl.length - 1].activePoint.startX +
1326
- (this.objColl[this.objColl.length - 1].activePoint.width / 2));
1327
- var panY = (this.lowerCanvas.clientHeight / 2) - (this.objColl[this.objColl.length - 1].activePoint.startY +
1328
- (this.objColl[this.objColl.length - 1].activePoint.height / 2));
1329
- if (this.transform.degree === 0) {
1330
- this.img.destLeft += panX;
1331
- this.img.destTop += panY;
1332
- this.notify('transform', { prop: 'drawPannImage', value: { point: { x: panX, y: panY } } });
1333
- }
1334
- else {
1335
- this.panPoint.currentPannedPoint = { x: panX, y: panY };
1336
- this.notify('transform', { prop: 'drawPannedImage', value: { xDiff: panX, yDiff: panY } });
1337
- this.panPoint.currentPannedPoint = { x: 0, y: 0 };
1338
- }
1339
- this.notify('transform', { prop: 'setTempPanMove', onPropertyChange: false,
1340
- value: { point: null } });
1341
- this.activeObj = extend({}, this.objColl[this.objColl.length - 1]);
1342
- this.objColl.pop();
1343
- this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: this.activeObj } });
1344
- }
1345
- }
1346
- };
1347
- ImageEditor.prototype.isSelectionBiggerThanCanvas = function (obj) {
1348
- var isBigger = false;
1349
- if (obj.activePoint.startX <= this.img.destLeft ||
1350
- obj.activePoint.startY <= this.img.destTop ||
1351
- obj.activePoint.endX >= this.img.destLeft + this.img.destWidth ||
1352
- obj.activePoint.endY >= this.img.destTop + this.img.destHeight) {
1353
- isBigger = true;
1354
- }
1355
- return isBigger;
1356
- };
1357
- ImageEditor.prototype.isSelectionOutsideCanvas = function (obj) {
1358
- var isOutside = false;
1359
- if ((obj.activePoint.height < this.lowerCanvas.height - this.toolbarHeight) ||
1360
- (obj.activePoint.width < this.lowerCanvas.width)) {
1361
- isOutside = true;
1362
- }
1363
- return isOutside;
1364
- };
1365
1250
  /**
1366
1251
  * Set the old item Transform item state.
1367
1252
  *
@@ -1405,7 +1290,7 @@ var ImageEditor = /** @class */ (function (_super) {
1405
1290
  for (var i = 0; i < strArr.length; i++) {
1406
1291
  strArr[i] = strArr[i].charAt(0).toUpperCase() + strArr[i].slice(1);
1407
1292
  }
1408
- if (!isNullOrUndefined(obj)) {
1293
+ if (obj) {
1409
1294
  obj['maxText'] = strArr.join('');
1410
1295
  }
1411
1296
  return strArr.join('');
@@ -1472,7 +1357,7 @@ var ImageEditor = /** @class */ (function (_super) {
1472
1357
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
1473
1358
  }
1474
1359
  }
1475
- else if ((!isBlazor() && !isNullOrUndefined(document.querySelector('#' + this.element.id + '_sliderWrapper'))) || (isBlazor() && !this.element.querySelector('.e-ie-contextual-slider').classList.contains('e-hidden')) ||
1360
+ else if ((!isBlazor() && document.querySelector('#' + this.element.id + '_sliderWrapper')) || (isBlazor() && !this.element.querySelector('.e-ie-contextual-slider').classList.contains('e-hidden')) ||
1476
1361
  this.currObjType.isFiltered) {
1477
1362
  this.initialAdjustmentValue = this.canvasFilter = this.lowerContext.filter;
1478
1363
  this.currObjType.isFiltered = false;
@@ -1534,7 +1419,7 @@ var ImageEditor = /** @class */ (function (_super) {
1534
1419
  * @returns {void}.
1535
1420
  */
1536
1421
  ImageEditor.prototype.cropSelectedState = function () {
1537
- if (!isNullOrUndefined(this.activeObj.shape) && this.activeObj.shape.split('-')[0] === 'crop') {
1422
+ if (this.activeObj.shape && this.activeObj.shape.split('-')[0] === 'crop') {
1538
1423
  this.okBtn();
1539
1424
  }
1540
1425
  };
@@ -1549,7 +1434,10 @@ var ImageEditor = /** @class */ (function (_super) {
1549
1434
  var tempFilter = this.lowerContext.filter;
1550
1435
  this.lowerContext.filter = this.canvasFilter = 'none';
1551
1436
  var objColl = extend([], this.objColl, null, true);
1437
+ var pointColl = extend([], this.pointColl, null, true);
1552
1438
  this.objColl = [];
1439
+ this.pointColl = [];
1440
+ this.freehandCounter = 0;
1553
1441
  this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
1554
1442
  var data = this.getImageData();
1555
1443
  if (!isBlazor()) {
@@ -1558,6 +1446,8 @@ var ImageEditor = /** @class */ (function (_super) {
1558
1446
  this.element.querySelector('#' + this.element.id + '_contextualToolbarArea').classList.remove('e-hide');
1559
1447
  }
1560
1448
  this.objColl = objColl;
1449
+ this.pointColl = pointColl;
1450
+ this.freehandCounter = pointColl.length;
1561
1451
  this.notify('shape', { prop: 'iterateObjColl', onPropertyChange: false });
1562
1452
  this.lowerContext.filter = this.canvasFilter = tempFilter;
1563
1453
  return data;
@@ -1574,7 +1464,7 @@ var ImageEditor = /** @class */ (function (_super) {
1574
1464
  var _this = this;
1575
1465
  var finetuneValueChanging = { finetune: this.getFinetuneOption(type),
1576
1466
  value: value, cancel: false };
1577
- if (isBlazor() && !isNullOrUndefined(this.events) && this.events.finetuneValueChanging.hasDelegate === true) {
1467
+ if (isBlazor() && this.events && this.events.finetuneValueChanging.hasDelegate === true) {
1578
1468
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1579
1469
  this.dotNetRef.invokeMethodAsync('OnFinetuneValueChangeAsync', finetuneValueChanging).then(function (finetuneValueChanging) {
1580
1470
  if (finetuneValueChanging.cancel) {
@@ -1591,82 +1481,6 @@ var ImageEditor = /** @class */ (function (_super) {
1591
1481
  this.notify('filter', { prop: 'setCurrAdjValue', value: { type: type.toLowerCase(), value: value } });
1592
1482
  }
1593
1483
  };
1594
- /**
1595
- * Get the square point for rotated shape.
1596
- *
1597
- * @param { SelectionPoint } obj - Specifies the selection point.
1598
- * @param { Object } object - Specifies the object.
1599
- * @hidden
1600
- * @returns {ActivePoint}.
1601
- * An ActivePoint object which returns the square point.
1602
- */
1603
- ImageEditor.prototype.getSquarePointForRotatedShape = function (obj, object) {
1604
- var point = { startX: 0, startY: 0, endX: 0, endY: 0, width: 0, height: 0 };
1605
- var center = { x: obj.activePoint.startX + (obj.activePoint.width / 2), y: obj.activePoint.startY +
1606
- (obj.activePoint.height / 2) };
1607
- var p1 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.startX - center.x) - Math.sin(obj.rotatedAngle)
1608
- * (obj.activePoint.startY - center.y) + center.x,
1609
- y: Math.sin(obj.rotatedAngle) * (obj.activePoint.startX - center.x) + Math.cos(obj.rotatedAngle) * (obj.activePoint.startY
1610
- - center.y) + center.y };
1611
- var p2 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.endX - center.x) - Math.sin(obj.rotatedAngle) *
1612
- (obj.activePoint.startY - center.y) + center.x,
1613
- y: Math.sin(obj.rotatedAngle) * (obj.activePoint.endX - center.x) + Math.cos(obj.rotatedAngle) * (obj.activePoint.startY
1614
- - center.y) + center.y };
1615
- var p3 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.startX - center.x) - Math.sin(obj.rotatedAngle) *
1616
- (obj.activePoint.endY - center.y) + center.x,
1617
- y: Math.sin(obj.rotatedAngle) * (obj.activePoint.startX - center.x) + Math.cos(obj.rotatedAngle) * (obj.activePoint.endY
1618
- - center.y) + center.y };
1619
- var p4 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.endX - center.x) - Math.sin(obj.rotatedAngle) *
1620
- (obj.activePoint.endY - center.y) + center.x,
1621
- y: Math.sin(obj.rotatedAngle) * (obj.activePoint.endX - center.x) + Math.cos(obj.rotatedAngle) *
1622
- (obj.activePoint.endY - center.y) + center.y };
1623
- point.startX = p1.x;
1624
- point.startY = p1.y;
1625
- point.endX = p1.x;
1626
- point.endY = p1.y;
1627
- if (point.startX > p2.x) {
1628
- point.startX = p2.x;
1629
- }
1630
- if (point.startX > p3.x) {
1631
- point.startX = p3.x;
1632
- }
1633
- if (point.startX > p4.x) {
1634
- point.startX = p4.x;
1635
- }
1636
- if (point.startY > p2.y) {
1637
- point.startY = p2.y;
1638
- }
1639
- if (point.startY > p3.y) {
1640
- point.startY = p3.y;
1641
- }
1642
- if (point.startY > p4.y) {
1643
- point.startY = p4.y;
1644
- }
1645
- if (point.endX < p2.x) {
1646
- point.endX = p2.x;
1647
- }
1648
- if (point.endX < p3.x) {
1649
- point.endX = p3.x;
1650
- }
1651
- if (point.endX < p4.x) {
1652
- point.endX = p4.x;
1653
- }
1654
- if (point.endY < p2.y) {
1655
- point.endY = p2.y;
1656
- }
1657
- if (point.endY < p3.y) {
1658
- point.endY = p3.y;
1659
- }
1660
- if (point.endY < p4.y) {
1661
- point.endY = p4.y;
1662
- }
1663
- point.width = point.endX - point.startX;
1664
- point.height = point.endY - point.startY;
1665
- if (!isNullOrUndefined(object)) {
1666
- object['activePoint'] = point;
1667
- }
1668
- return point;
1669
- };
1670
1484
  /**
1671
1485
  * Get the square point for path.
1672
1486
  *
@@ -1755,14 +1569,14 @@ var ImageEditor = /** @class */ (function (_super) {
1755
1569
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
1756
1570
  if (!isBlazor()) {
1757
1571
  if (Browser.isDevice) {
1758
- if (!isNullOrUndefined(document.getElementById(this.element.id + '_bottomToolbar'))) {
1572
+ if (document.getElementById(this.element.id + '_bottomToolbar')) {
1759
1573
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1760
1574
  var toolbar_1 = getComponent(this.element.id + '_bottomToolbar', 'toolbar');
1761
1575
  toolbar_1.refreshOverflow();
1762
1576
  }
1763
1577
  }
1764
1578
  else {
1765
- if (!isNullOrUndefined(document.getElementById(this.element.id + '_toolbar'))) {
1579
+ if (document.getElementById(this.element.id + '_toolbar')) {
1766
1580
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1767
1581
  var toolbar_2 = getComponent(this.element.id + '_toolbar', 'toolbar');
1768
1582
  toolbar_2.refreshOverflow();
@@ -2196,9 +2010,8 @@ var ImageEditor = /** @class */ (function (_super) {
2196
2010
  var obj = { adjustmentLevel: null };
2197
2011
  this.notify('filter', { prop: 'getAdjustmentLevel', onPropertyChange: false,
2198
2012
  value: { obj: obj } });
2199
- var value;
2200
2013
  var typeToAdjustmentLevel = { 'brightness': obj['adjustmentLevel'].brightness,
2201
- 'contrast': value = obj['adjustmentLevel'].contrast, 'hue': obj['adjustmentLevel'].hue,
2014
+ 'contrast': obj['adjustmentLevel'].contrast, 'hue': obj['adjustmentLevel'].hue,
2202
2015
  'saturation': obj['adjustmentLevel'].saturation, 'opacity': obj['adjustmentLevel'].opacity,
2203
2016
  'blur': obj['adjustmentLevel'].blur, 'exposure': obj['adjustmentLevel'].exposure };
2204
2017
  return typeToAdjustmentLevel["" + type];
@@ -2217,7 +2030,7 @@ var ImageEditor = /** @class */ (function (_super) {
2217
2030
  this.cropSelectedState();
2218
2031
  this.notify('draw', { prop: 'resetCurrentSelectionPoint' });
2219
2032
  this.notify('transform', { prop: 'performTransformation', value: { text: type } });
2220
- this.moveToSelectionRange(type, activeObj);
2033
+ this.notify('draw', { prop: 'moveToSelectionRange', value: { type: type, activeObj: activeObj } });
2221
2034
  this.isCropToolbar = false;
2222
2035
  };
2223
2036
  /**
@@ -2244,7 +2057,7 @@ var ImageEditor = /** @class */ (function (_super) {
2244
2057
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2245
2058
  this.element = element;
2246
2059
  var canvasWrapper = this.element.querySelector('.e-canvas-wrapper');
2247
- if (!isNullOrUndefined(this.element.querySelector('#' + this.element.id + '_toolbar'))) {
2060
+ if (this.element.querySelector('#' + this.element.id + '_toolbar')) {
2248
2061
  this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbar').clientHeight;
2249
2062
  }
2250
2063
  else {
@@ -2262,9 +2075,6 @@ var ImageEditor = /** @class */ (function (_super) {
2262
2075
  });
2263
2076
  this.upperCanvas.width = this.lowerCanvas.width = this.inMemoryCanvas.width = this.element.offsetWidth;
2264
2077
  this.upperCanvas.height = this.lowerCanvas.height = this.inMemoryCanvas.height = (this.element.offsetHeight - this.toolbarHeight);
2265
- this.baseImg = this.createElement('img', {
2266
- id: this.element.id + '_orgImg', attrs: { name: 'Image', crossorigin: 'anonymous' }
2267
- });
2268
2078
  this.lowerContext = this.lowerCanvas.getContext('2d');
2269
2079
  this.baseImg = this.createElement('img', {
2270
2080
  id: this.element.id + '_orgImg', attrs: { name: 'Image', crossorigin: 'anonymous' }
@@ -90,14 +90,14 @@ export interface PanEventArgs {
90
90
  cancel: boolean;
91
91
  }
92
92
  /**
93
- * The Interface which contains the properties for crop transition occur in the Image Editor.
93
+ * The Interface which contains the properties for crop transition occurs in the Image Editor.
94
94
  */
95
95
  export interface CropEventArgs {
96
96
  /**
97
97
  * Returns the start point of the crop region.
98
98
  *
99
99
  * @remarks
100
- * The start and end point is used get the cropping region in a image editor.
100
+ * The start and end point is used get the cropping region in an image editor.
101
101
  *
102
102
  */
103
103
  startPoint: Point;
@@ -105,10 +105,14 @@ export interface CropEventArgs {
105
105
  * Returns the end point of the crop region.
106
106
  *
107
107
  * @remarks
108
- * The start and end point is used get the cropping region in a image editor.
108
+ * The start and end point is used get the cropping region in an image editor.
109
109
  *
110
110
  */
111
111
  endPoint: Point;
112
+ /**
113
+ * Specifies whether to prevent scale-based cropping in the image editor.
114
+ */
115
+ preventScaling: boolean;
112
116
  /**
113
117
  * Defines whether to cancel the cropping action of image editor.
114
118
  */
@@ -221,6 +225,10 @@ export interface OpenEventArgs {
221
225
  * Returns the file type of an image.
222
226
  */
223
227
  fileType: FileType;
228
+ /**
229
+ * Returns whether the loaded file is valid in the image editor.
230
+ */
231
+ isValidImage: boolean;
224
232
  }
225
233
  /**
226
234
  * The Interface which contains the properties for saving the canvas as image.