@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
@@ -1,5 +1,4 @@
1
- import { Browser, EventHandler, extend, getComponent, isBlazor, isNullOrUndefined } from '@syncfusion/ej2-base';
2
- import { hideSpinner, showSpinner } from '@syncfusion/ej2-popups';
1
+ import { Browser, EventHandler, extend, isBlazor, isNullOrUndefined } from '@syncfusion/ej2-base';
3
2
  import { ZoomTrigger } from '../index';
4
3
  var Selection = /** @class */ (function () {
5
4
  function Selection(parent) {
@@ -132,9 +131,6 @@ var Selection = /** @class */ (function () {
132
131
  case 'handleScroll':
133
132
  this.handleScroll(args.value['e']);
134
133
  break;
135
- case 'adjustToScreen':
136
- this.adjustToScreen();
137
- break;
138
134
  case 'textKeyDown':
139
135
  setTimeout(this.textKeyDown.bind(this), 1, args.value['e']);
140
136
  break;
@@ -226,9 +222,24 @@ var Selection = /** @class */ (function () {
226
222
  case 'getTransRotationPoint':
227
223
  this.getTransRotationPoint(args.value['obj'], args.value['object']);
228
224
  break;
225
+ case 'adjustNEPoints':
226
+ this.adjustNEPoints(args.value['rectangle'], args.value['x'], args.value['y'], args.value['angle']);
227
+ break;
228
+ case 'adjustRotationPoints':
229
+ this.adjustRotationPoints(args.value['rectangle'], args.value['x'], args.value['y'], args.value['angle']);
230
+ break;
231
+ case 'getResizeDirection':
232
+ this.getResizeDirection(args.value['rectangle'], args.value['x'], args.value['y'], args.value['angle']);
233
+ break;
234
+ case 'setResizedElement':
235
+ this.resizedElement = args.value['value'];
236
+ break;
229
237
  case 'reset':
230
238
  this.reset();
231
239
  break;
240
+ case 'unWireEvent':
241
+ this.unwireEvent();
242
+ break;
232
243
  }
233
244
  };
234
245
  Selection.prototype.getModuleName = function () {
@@ -236,10 +247,10 @@ var Selection = /** @class */ (function () {
236
247
  };
237
248
  Selection.prototype.updatePrivateVariables = function () {
238
249
  var parent = this.parent;
239
- if (!isNullOrUndefined(parent.lowerCanvas)) {
250
+ if (parent.lowerCanvas) {
240
251
  this.lowerContext = parent.lowerCanvas.getContext('2d');
241
252
  }
242
- if (!isNullOrUndefined(parent.upperCanvas)) {
253
+ if (parent.upperCanvas) {
243
254
  this.upperContext = parent.upperCanvas.getContext('2d');
244
255
  }
245
256
  };
@@ -350,7 +361,7 @@ var Selection = /** @class */ (function () {
350
361
  cursor = 'move';
351
362
  }
352
363
  }
353
- else if (!isNullOrUndefined(rotationCirclePoint) && !isApply &&
364
+ else if (rotationCirclePoint && !isApply &&
354
365
  x >= (rotationCirclePoint.x - (actObj.bottomCenterCircle.radius + 2)) &&
355
366
  x <= rotationCirclePoint.x + (actObj.bottomCenterCircle.radius + 2) &&
356
367
  y >= rotationCirclePoint.y - (actObj.bottomCenterCircle.radius + 2) &&
@@ -452,7 +463,7 @@ var Selection = /** @class */ (function () {
452
463
  }
453
464
  }
454
465
  if ((parent.cursor === 'default' || parent.cursor === 'grab')
455
- && !isNullOrUndefined(parent.pointColl[0]) && (parent.cursor !== 'grab' || !isCropSelection)
466
+ && parent.pointColl[0] && (parent.cursor !== 'grab' || !isCropSelection)
456
467
  && !parent.currObjType.isDragging && !parent.currObjType.isResize) {
457
468
  this.setCursorForFreehandDrawing(x, y, upperCanvas);
458
469
  }
@@ -570,7 +581,7 @@ var Selection = /** @class */ (function () {
570
581
  (actObj.bottomCenterCircle.radius + 2))) {
571
582
  upperCanvas.style.cursor = parent.cursor = 'se-resize';
572
583
  }
573
- else if (!isNullOrUndefined(actObj.rotationCirclePointColl) &&
584
+ else if (actObj.rotationCirclePointColl &&
574
585
  x >= (actObj.rotationCirclePointColl.x - (actObj.bottomCenterCircle.radius + 2)) &&
575
586
  x <= actObj.rotationCirclePointColl.x + (actObj.bottomCenterCircle.radius + 2) &&
576
587
  y >= actObj.rotationCirclePointColl.y - (actObj.bottomCenterCircle.radius + 2) &&
@@ -638,7 +649,7 @@ var Selection = /** @class */ (function () {
638
649
  if ((length >= 92 && length <= 182) || (length >= -178 && length <= -88)) {
639
650
  var cursorMap = { 'nw-resize': 'ne-resize', 'n-resize': 's-resize',
640
651
  'ne-resize': 'nw-resize', 'w-resize': 'e-resize', 'e-resize': 'w-resize',
641
- 'sw-resize': 'se-resize', 's-resize': 'n-resize', 'se-resize': 'sw-resize',
652
+ 'sw-resize': 'se-resize', 's-resize': 'n-resize', 'se-resize': 'sw-resize'
642
653
  };
643
654
  if (parent.cursor in cursorMap) {
644
655
  parent.cursor = cursorMap[parent.cursor];
@@ -783,7 +794,7 @@ var Selection = /** @class */ (function () {
783
794
  else if (!this.isFhdEditing || parent.pointColl[n].isSelected) {
784
795
  if (this.isFhdPoint || this.isFhdEditing) {
785
796
  upperContext.clearRect(0, 0, upperCanvas.width, upperCanvas.height);
786
- if (!isNullOrUndefined(parent.activeObj.shape) && textArea.style.display === 'none') {
797
+ if (parent.activeObj.shape && textArea.style.display === 'none') {
787
798
  parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj } });
788
799
  }
789
800
  }
@@ -1059,7 +1070,7 @@ var Selection = /** @class */ (function () {
1059
1070
  if (splitWords !== undefined && splitWords[0] === 'crop') {
1060
1071
  this.isCropSelection = true;
1061
1072
  }
1062
- if (!this.isCropSelection && this.parent.eventType !== 'resize' && isBlazor() && !isNullOrUndefined(parent.events) && this.parent.events.onShapeResizeStart.hasDelegate === true) {
1073
+ if (!this.isCropSelection && this.parent.eventType !== 'resize' && isBlazor() && parent.events && this.parent.events.onShapeResizeStart.hasDelegate === true) {
1063
1074
  shapeResizingArgs.action = 'resize-start';
1064
1075
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1065
1076
  parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShapeResizeStart', shapeResizingArgs).then(function (shapeResizingArgs) {
@@ -2270,7 +2281,7 @@ var Selection = /** @class */ (function () {
2270
2281
  isResize = true;
2271
2282
  this.dragElement = parent.upperCanvas.style.cursor;
2272
2283
  }
2273
- else if (!isNullOrUndefined(rotationCirclePoint) &&
2284
+ else if (rotationCirclePoint &&
2274
2285
  x >= rotationCirclePoint.x - (actObj.topLeftCircle.radius * 2) &&
2275
2286
  x <= rotationCirclePoint.x + (actObj.topLeftCircle.radius * 2) &&
2276
2287
  y >= rotationCirclePoint.y - (actObj.topLeftCircle.radius * 2) &&
@@ -2581,7 +2592,7 @@ var Selection = /** @class */ (function () {
2581
2592
  this.dragCanvas = parent.togglePan = true;
2582
2593
  }
2583
2594
  var imageEditorClickEventArgs = { point: this.setXYPoints(e) };
2584
- if (isBlazor() && !isNullOrUndefined(parent.events) && parent.events.clicked.hasDelegate === true) {
2595
+ if (isBlazor() && parent.events && parent.events.clicked.hasDelegate === true) {
2585
2596
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2586
2597
  parent.dotNetRef.invokeMethodAsync('ClickEventAsync', 'click', imageEditorClickEventArgs).then(function (imageEditorClickEventArgs) {
2587
2598
  _this.clickEvent(imageEditorClickEventArgs, e);
@@ -2612,7 +2623,7 @@ var Selection = /** @class */ (function () {
2612
2623
  var parent = this.parent;
2613
2624
  var x = imageEditorClickEventArgs.point.x;
2614
2625
  var y = imageEditorClickEventArgs.point.y;
2615
- var cursor = !isNullOrUndefined(parent.activeObj.shape) && parent.activeObj.shape === 'text' ?
2626
+ var cursor = parent.activeObj.shape && parent.activeObj.shape === 'text' ?
2616
2627
  parent.cursor : 'default';
2617
2628
  if (this.currentDrawingShape !== '') {
2618
2629
  var object_1 = { currObj: {} };
@@ -2648,7 +2659,7 @@ var Selection = /** @class */ (function () {
2648
2659
  this.isPan = false;
2649
2660
  }
2650
2661
  }
2651
- if (!isNullOrUndefined(parent.activeObj.shape)) {
2662
+ if (parent.activeObj.shape) {
2652
2663
  this.isObjSelected = true;
2653
2664
  }
2654
2665
  else {
@@ -2662,7 +2673,7 @@ var Selection = /** @class */ (function () {
2662
2673
  var isFreehandDraw = this.isFreehandDrawTouch(e, this.isCropSelection);
2663
2674
  var isShapeClick = isShape ? isShape : this.isShapeClick(e, this.isCropSelection);
2664
2675
  var allowUndoRedoPush = this.applyCurrShape(isShapeClick);
2665
- if (this.isTouch && !isShape && !isNullOrUndefined(activeObj.shape) && !this.isCropSelection) {
2676
+ if (this.isTouch && !isShape && activeObj.shape && !this.isCropSelection) {
2666
2677
  if (this.applyObj(x, y)) {
2667
2678
  parent.okBtn(true);
2668
2679
  parent.notify('draw', { prop: 'setPrevActObj', onPropertyChange: false, value: { prevActObj: null } });
@@ -2697,11 +2708,12 @@ var Selection = /** @class */ (function () {
2697
2708
  }
2698
2709
  if (this.isFhdEditing) {
2699
2710
  parent.notify('freehand-draw', { prop: 'applyFhd', onPropertyChange: false });
2711
+ this.isFhdCustomized = false;
2700
2712
  if (!isBlazor()) {
2701
2713
  parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
2702
2714
  }
2703
2715
  }
2704
- if (!isNullOrUndefined(parent.activeObj.shape) && (parent.activeObj.shape === 'rectangle' ||
2716
+ if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' ||
2705
2717
  parent.activeObj.shape === 'ellipse' || parent.activeObj.shape === 'line' ||
2706
2718
  parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path' || parent.activeObj.shape === 'text')) {
2707
2719
  parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
@@ -2719,7 +2731,7 @@ var Selection = /** @class */ (function () {
2719
2731
  }
2720
2732
  else {
2721
2733
  var isLineArrow = false;
2722
- if (!isNullOrUndefined(parent.activeObj.shape) && (parent.activeObj.shape === 'line' ||
2734
+ if (parent.activeObj.shape && (parent.activeObj.shape === 'line' ||
2723
2735
  parent.activeObj.shape === 'arrow')) {
2724
2736
  isLineArrow = true;
2725
2737
  }
@@ -2775,7 +2787,7 @@ var Selection = /** @class */ (function () {
2775
2787
  else {
2776
2788
  if (this.isFhdEditing) {
2777
2789
  parent.notify('freehand-draw', { prop: 'cancelFhd', value: { type: 'ok' } });
2778
- if (!isNullOrUndefined(document.getElementById(parent.element.id + '_quickAccessToolbarArea'))) {
2790
+ if (document.getElementById(parent.element.id + '_quickAccessToolbarArea')) {
2779
2791
  document.getElementById(parent.element.id + '_quickAccessToolbarArea').style.display = 'none';
2780
2792
  }
2781
2793
  }
@@ -2913,7 +2925,7 @@ var Selection = /** @class */ (function () {
2913
2925
  !this.dragCanvas || parent.activeObj.activePoint !== undefined) {
2914
2926
  if (this.dragElement === '') {
2915
2927
  this.setCursor(x, y);
2916
- if ((!isNullOrUndefined(parent.activeObj.activePoint) &&
2928
+ if ((parent.activeObj.activePoint &&
2917
2929
  (parent.activeObj.activePoint.width === 0 || (!isNullOrUndefined(parent.activeObj.currIndex) &&
2918
2930
  this.cursorTargetId !== parent.activeObj.currIndex)))
2919
2931
  && parent.cursor !== 'default' &&
@@ -2988,15 +3000,14 @@ var Selection = /** @class */ (function () {
2988
3000
  if (splitWords !== undefined && splitWords[0] === 'crop') {
2989
3001
  isCropSelection = true;
2990
3002
  }
2991
- if (isBlazor() && !isNullOrUndefined(this.parent.eventType)) {
3003
+ if (isBlazor() && this.parent.eventType) {
2992
3004
  if (this.parent.eventType === 'pan') {
2993
- if (!isNullOrUndefined(parent.events) && parent.events.onPanEnd.hasDelegate === true) {
2994
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3005
+ if (parent.events && parent.events.onPanEnd.hasDelegate === true) {
2995
3006
  parent.dotNetRef.invokeMethodAsync('PanEventAsync', 'OnPanEnd', this.parent.panEventArgs);
2996
3007
  }
2997
3008
  }
2998
3009
  else if (this.parent.eventType === 'resize') {
2999
- if (!this.isCropSelection && !isNullOrUndefined(this.parent.events) && this.parent.events.onShapeResizeEnd.hasDelegate === true) {
3010
+ if (!this.isCropSelection && this.parent.events && this.parent.events.onShapeResizeEnd.hasDelegate === true) {
3000
3011
  this.shapeResizingArgs.currentShapeSettings = this.updatePrevShapeSettings();
3001
3012
  this.shapeResizingArgs.action = 'resize-end';
3002
3013
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
@@ -3005,7 +3016,8 @@ var Selection = /** @class */ (function () {
3005
3016
  value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
3006
3017
  });
3007
3018
  }
3008
- else if (!isNullOrUndefined(this.shapeResizingArgs) && !isNullOrUndefined(this.selectionResizingArgs) && !isNullOrUndefined(this.parent.events) && this.parent.events.onSelectionResizeEnd.hasDelegate === true) {
3019
+ else if (this.shapeResizingArgs && this.selectionResizingArgs && this.parent.events &&
3020
+ this.parent.events.onSelectionResizeEnd.hasDelegate === true) {
3009
3021
  var currentSelectionSettings = { type: this.parent.activeObj.shape,
3010
3022
  startX: this.shapeResizingArgs.currentShapeSettings.startX,
3011
3023
  startY: this.shapeResizingArgs.currentShapeSettings.startY,
@@ -3021,7 +3033,7 @@ var Selection = /** @class */ (function () {
3021
3033
  }
3022
3034
  }
3023
3035
  else {
3024
- if (!isNullOrUndefined(this.shapeMovingArgs) && !isNullOrUndefined(this.parent.events) && this.parent.events.onShapeDragEnd.hasDelegate === true) {
3036
+ if (this.shapeMovingArgs && this.parent.events && this.parent.events.onShapeDragEnd.hasDelegate === true) {
3025
3037
  this.shapeMovingArgs.currentShapeSettings = this.updatePrevShapeSettings();
3026
3038
  this.shapeMovingArgs.action = 'drag-end';
3027
3039
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
@@ -3074,7 +3086,7 @@ var Selection = /** @class */ (function () {
3074
3086
  value: { obj: selPointCollObj } });
3075
3087
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
3076
3088
  if (!parent.togglePen && !isCropSelection) {
3077
- if (!isNullOrUndefined(this.tempObjColl) && parent.activeObj.activePoint.width !== 0) {
3089
+ if (this.tempObjColl && parent.activeObj.activePoint.width !== 0) {
3078
3090
  parent.objColl.push(parent.activeObj);
3079
3091
  if (JSON.stringify(parent.activeObj.activePoint) !== JSON.stringify(this.tempActiveObj.activePoint)) {
3080
3092
  parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
@@ -3091,7 +3103,7 @@ var Selection = /** @class */ (function () {
3091
3103
  parent.currObjType.isResize = false;
3092
3104
  }
3093
3105
  }
3094
- if (!isNullOrUndefined(parent.activeObj)) {
3106
+ if (parent.activeObj) {
3095
3107
  var isCropSelection_1 = false;
3096
3108
  var splitWords_1;
3097
3109
  if (parent.activeObj.shape !== undefined) {
@@ -3140,7 +3152,7 @@ var Selection = /** @class */ (function () {
3140
3152
  if (splitWords !== undefined && splitWords[0] === 'crop') {
3141
3153
  isCropSelection = true;
3142
3154
  }
3143
- if (!isNullOrUndefined(parent.activeObj.shape) && !isCropSelection && e.currentTarget === parent.upperCanvas &&
3155
+ if (parent.activeObj.shape && !isCropSelection && e.currentTarget === parent.upperCanvas &&
3144
3156
  parent.textArea.style.display === 'none') {
3145
3157
  if (parent.activeObj.shape === 'text') {
3146
3158
  if (!isBlazor()) {
@@ -3177,7 +3189,7 @@ var Selection = /** @class */ (function () {
3177
3189
  var isAdjusted = false;
3178
3190
  var parent = this.parent;
3179
3191
  obj = obj ? obj : parent.activeObj;
3180
- if (!isNullOrUndefined(obj.shape) && (obj.shape === 'line' || parent.activeObj.shape === 'arrow')) {
3192
+ if (obj.shape && (obj.shape === 'line' || parent.activeObj.shape === 'arrow')) {
3181
3193
  var temp = void 0;
3182
3194
  if ((this.dragElement === 'e-resize' && obj.activePoint.endX < obj.activePoint.startX) ||
3183
3195
  (this.dragElement === 'w-resize' && obj.activePoint.startX > obj.activePoint.endX)) {
@@ -3208,7 +3220,7 @@ var Selection = /** @class */ (function () {
3208
3220
  Selection.prototype.updPtCollForShpRot = function (obj) {
3209
3221
  var parent = this.parent;
3210
3222
  obj = obj ? obj : parent.activeObj;
3211
- if (!isNullOrUndefined(obj.shape) && obj.rotatedAngle !== 0) {
3223
+ if (obj.shape && obj.rotatedAngle !== 0) {
3212
3224
  parent.notify('shape', { prop: 'setPointCollForShapeRotation', onPropertyChange: false,
3213
3225
  value: { obj: obj } });
3214
3226
  // Updating ratio for point collection
@@ -3272,7 +3284,7 @@ var Selection = /** @class */ (function () {
3272
3284
  if (parent.togglePen) {
3273
3285
  return isShape;
3274
3286
  }
3275
- if (!isNullOrUndefined(parent.activeObj.shape) && parent.activeObj.shape === 'text' && this.isShapeInserted) {
3287
+ if (parent.activeObj.shape && parent.activeObj.shape === 'text' && this.isShapeInserted) {
3276
3288
  var isTextArea = parent.textArea.style.display === 'block' ? true : false;
3277
3289
  var activeObj = extend({}, parent.activeObj, null, true);
3278
3290
  parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
@@ -3296,7 +3308,7 @@ var Selection = /** @class */ (function () {
3296
3308
  parent.objColl.splice(index, 1);
3297
3309
  }
3298
3310
  }
3299
- else if (!isShape && !isNullOrUndefined(activeObj.shape)) {
3311
+ else if (!isShape && activeObj.shape) {
3300
3312
  parent.activeObj = activeObj;
3301
3313
  var index = this.getCurrentIndex();
3302
3314
  if ((!isNullOrUndefined(index) &&
@@ -3314,7 +3326,7 @@ var Selection = /** @class */ (function () {
3314
3326
  var parent = this.parent;
3315
3327
  var isShape = false;
3316
3328
  if (e.type === 'touchstart' && !parent.togglePen) {
3317
- if (!isNullOrUndefined(parent.activeObj) && parent.activeObj.shape === 'text') {
3329
+ if (parent.activeObj && parent.activeObj.shape === 'text') {
3318
3330
  this.timer = setTimeout(this.setTimer.bind(this), 1000, e);
3319
3331
  }
3320
3332
  var isTextArea = parent.textArea.style.display === 'block' ? true : false;
@@ -3384,7 +3396,7 @@ var Selection = /** @class */ (function () {
3384
3396
  parent.objColl.splice(index, 1);
3385
3397
  }
3386
3398
  }
3387
- else if (!isNullOrUndefined(activeObj.shape)) {
3399
+ else if (activeObj.shape) {
3388
3400
  parent.activeObj = activeObj;
3389
3401
  var index = this.getCurrentIndex();
3390
3402
  if (!isCropSelection) {
@@ -3403,7 +3415,7 @@ var Selection = /** @class */ (function () {
3403
3415
  Selection.prototype.applyObj = function (x, y) {
3404
3416
  var parent = this.parent;
3405
3417
  var isApply = false;
3406
- if (!isNullOrUndefined(parent.activeObj.shape) && (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse' ||
3418
+ if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse' ||
3407
3419
  parent.activeObj.shape === 'text' || parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' ||
3408
3420
  parent.activeObj.shape === 'path')) {
3409
3421
  if (x >= (parent.activeObj.activePoint.startX - (parent.activeObj.topLeftCircle.radius * 2)) &&
@@ -3571,6 +3583,12 @@ var Selection = /** @class */ (function () {
3571
3583
  EventHandler.add(this.parent.upperCanvas, 'touchend', this.mouseUpEventHandler, this);
3572
3584
  EventHandler.add(this.parent.upperCanvas, 'touchmove', this.mouseMoveEventHandler, this);
3573
3585
  };
3586
+ Selection.prototype.unwireEvent = function () {
3587
+ EventHandler.remove(this.parent.lowerCanvas, 'touchend', this.mouseUpEventHandler);
3588
+ EventHandler.remove(this.parent.lowerCanvas, 'touchmove', this.mouseMoveEventHandler);
3589
+ EventHandler.remove(this.parent.upperCanvas, 'touchend', this.mouseUpEventHandler);
3590
+ EventHandler.remove(this.parent.upperCanvas, 'touchmove', this.mouseMoveEventHandler);
3591
+ };
3574
3592
  Selection.prototype.keyDownEventHandler = function (e) {
3575
3593
  var _this = this;
3576
3594
  var parent = this.parent;
@@ -3583,7 +3601,7 @@ var Selection = /** @class */ (function () {
3583
3601
  var splitWords;
3584
3602
  switch (e.key) {
3585
3603
  case (e.ctrlKey && 's'):
3586
- if (isBlazor() && !isNullOrUndefined(parent.events) && parent.events.saving.hasDelegate === true) {
3604
+ if (isBlazor() && parent.events && parent.events.saving.hasDelegate === true) {
3587
3605
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3588
3606
  parent.dotNetRef.invokeMethodAsync('BeforeSaveEventAsync', 'BeforeSave', beforeSave).then(function (args) {
3589
3607
  _this.beforeSaveEvent(args, e);
@@ -3681,7 +3699,7 @@ var Selection = /** @class */ (function () {
3681
3699
  e.stopPropagation();
3682
3700
  if (e.ctrlKey === true && isInsideCanvas) {
3683
3701
  e.preventDefault();
3684
- if (!parent.isCropTab && (!isNullOrUndefined(parent.activeObj.shape) && parent.activeObj.shape.split('-')[0] !== 'crop')) {
3702
+ if (!parent.isCropTab && (parent.activeObj.shape && parent.activeObj.shape.split('-')[0] !== 'crop')) {
3685
3703
  parent.okBtn();
3686
3704
  if (!isBlazor()) {
3687
3705
  parent.notify('toolbar', { prop: 'close-contextual-toolbar', onPropertyChange: false });
@@ -3704,186 +3722,6 @@ var Selection = /** @class */ (function () {
3704
3722
  }
3705
3723
  }
3706
3724
  };
3707
- Selection.prototype.adjustToScreen = function () {
3708
- var parent = this.parent;
3709
- if (!parent.isImageLoaded) {
3710
- return;
3711
- }
3712
- if ((!isNullOrUndefined(parent.element.querySelector('#' + parent.element.id + '_contextualToolbar')) &&
3713
- !parent.element.querySelector('#' + parent.element.id + '_contextualToolbar').parentElement.classList.contains('e-hide')) ||
3714
- (!isNullOrUndefined(parent.element.querySelector('#' + parent.element.id + '_headWrapper'))
3715
- && !parent.element.querySelector('#' + parent.element.id + '_headWrapper').parentElement.classList.contains('e-hide'))) {
3716
- parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
3717
- parent.okBtn();
3718
- if (!isBlazor()) {
3719
- parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
3720
- parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
3721
- }
3722
- else {
3723
- parent.updateToolbar(parent.element, 'imageLoaded');
3724
- }
3725
- }
3726
- if (this.isFhdEditing) {
3727
- if (!isBlazor()) {
3728
- parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
3729
- }
3730
- else {
3731
- parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
3732
- }
3733
- }
3734
- var isActiveObj = false;
3735
- if (parent.activeObj.shape !== undefined) {
3736
- isActiveObj = true;
3737
- if (parent.textArea.style.display === 'block') {
3738
- parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
3739
- value: { x: null, y: null, isMouseDown: null } });
3740
- if (!isBlazor()) {
3741
- parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
3742
- }
3743
- else {
3744
- parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
3745
- }
3746
- }
3747
- else {
3748
- parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
3749
- parent.objColl.push(parent.activeObj);
3750
- }
3751
- parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
3752
- }
3753
- var tempFilter = this.lowerContext.filter;
3754
- parent.update();
3755
- parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: null } });
3756
- parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
3757
- this.lowerContext.filter = tempFilter;
3758
- parent.initialAdjustmentValue = tempFilter;
3759
- if (parent.isImageLoaded) {
3760
- showSpinner(parent.element);
3761
- parent.element.style.opacity = '0.5';
3762
- }
3763
- this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
3764
- this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
3765
- var canvasWrapper = document.querySelector('#' + parent.element.id + '_canvasWrapper');
3766
- if (!isNullOrUndefined(canvasWrapper)) {
3767
- canvasWrapper.style.width = parent.element.offsetWidth - 2 + 'px';
3768
- canvasWrapper.style.height = parent.element.offsetHeight + 'px';
3769
- var obj_3 = { toolbarHeight: !isBlazor() ? 0 : parent.toolbarHeight };
3770
- if (!isBlazor()) {
3771
- parent.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: obj_3 } });
3772
- }
3773
- if (Browser.isDevice) {
3774
- canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - (2 * obj_3['toolbarHeight'])) - 3 + 'px';
3775
- }
3776
- else {
3777
- canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - obj_3['toolbarHeight']) - 3 + 'px';
3778
- }
3779
- }
3780
- var obj = { width: 0, height: 0 };
3781
- parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
3782
- value: { width: parent.img.srcWidth, height: parent.img.srcHeight, obj: obj } });
3783
- var maxDimension = obj;
3784
- if (parent.transform.defaultZoomFactor > 0) {
3785
- maxDimension.width += (maxDimension.width * parent.transform.defaultZoomFactor);
3786
- maxDimension.height += (maxDimension.height * parent.transform.defaultZoomFactor);
3787
- }
3788
- parent.img.destLeft = (parent.lowerCanvas.clientWidth - maxDimension.width) / 2;
3789
- parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height) / 2;
3790
- if (parent.transform.degree === 0 && parent.transform.currFlipState === '') {
3791
- if (parent.transform.defaultZoomFactor > 0) {
3792
- parent.img.destLeft += parent.panPoint.totalPannedPoint.x;
3793
- parent.img.destTop += parent.panPoint.totalPannedPoint.y;
3794
- }
3795
- parent.notify('draw', { prop: 'draw-image-to-canvas', value: { dimension: maxDimension } });
3796
- }
3797
- else {
3798
- parent.notify('draw', { prop: 'draw-image-to-canvas', value: { dimension: maxDimension } });
3799
- parent.notify('draw', { prop: 'updateCurrTransState', onPropertyChange: false,
3800
- value: { type: 'initial', isPreventDestination: null, isRotatePan: null } });
3801
- var temp = this.lowerContext.filter;
3802
- parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
3803
- 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);
3804
- this.lowerContext.filter = temp;
3805
- parent.notify('draw', { prop: 'updateCurrTransState', onPropertyChange: false,
3806
- value: { type: 'reverse', isPreventDestination: null, isRotatePan: null } });
3807
- }
3808
- parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
3809
- parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
3810
- if (parent.isCircleCrop) {
3811
- parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
3812
- value: { context: this.lowerContext, isSave: null, isFlip: null } });
3813
- }
3814
- hideSpinner(parent.element);
3815
- parent.element.style.opacity = '1';
3816
- var obj1 = { defToolbarItems: null };
3817
- if (!isBlazor()) {
3818
- parent.notify('toolbar', { prop: 'getDefToolbarItems', value: { obj: obj1 } });
3819
- if (obj1['defToolbarItems'] && obj1['defToolbarItems'].length > 0 && (!isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar')))) {
3820
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3821
- var toolbar_1 = getComponent(parent.element.id + '_toolbar', 'toolbar');
3822
- toolbar_1.refreshOverflow();
3823
- if (!isNullOrUndefined(parent.element.querySelector('.e-contextual-toolbar-wrapper'))) {
3824
- parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
3825
- }
3826
- }
3827
- }
3828
- parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
3829
- this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
3830
- if (isActiveObj) {
3831
- parent.activeObj = extend({}, parent.objColl[parent.objColl.length - 1], null, true);
3832
- parent.objColl.pop();
3833
- parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj } });
3834
- if (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse' || parent.activeObj.shape === 'text' ||
3835
- parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path') {
3836
- if (!isBlazor()) {
3837
- parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
3838
- }
3839
- else {
3840
- parent.updateToolbar(parent.element, 'quickAccessToolbar', parent.activeObj.shape);
3841
- }
3842
- }
3843
- }
3844
- if (this.isFhdEditing) {
3845
- if (!isBlazor()) {
3846
- parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
3847
- }
3848
- else {
3849
- parent.updateToolbar(parent.element, 'quickAccessToolbar', 'pen');
3850
- }
3851
- }
3852
- if ((parent.transform.degree !== 0 || parent.transform.currFlipState !== '') && parent.transform.defaultZoomFactor > 0) {
3853
- var totalPannedPoint = extend({}, parent.panPoint.totalPannedPoint, null, true);
3854
- var totalPannedInternalPoint = extend({}, parent.panPoint.totalPannedInternalPoint, null, true);
3855
- var totalPannedClientPoint = extend({}, parent.panPoint.totalPannedClientPoint, null, true);
3856
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3857
- value: { zoomFactor: .1, zoomPoint: null } });
3858
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3859
- value: { zoomFactor: -.1, zoomPoint: null } });
3860
- if (parent.transform.degree === 0) {
3861
- parent.img.destLeft += totalPannedPoint.x;
3862
- parent.img.destTop += totalPannedPoint.y;
3863
- parent.panPoint.totalPannedPoint = totalPannedPoint;
3864
- parent.notify('draw', { prop: 'updateFlipPan', value: { tempSelectionObj: null } });
3865
- }
3866
- else {
3867
- parent.panPoint.totalPannedInternalPoint = totalPannedInternalPoint;
3868
- parent.panPoint.totalPannedClientPoint = totalPannedClientPoint;
3869
- parent.panPoint.currentPannedPoint = { x: 0, y: 0 };
3870
- parent.isCropTab = true;
3871
- parent.notify('transform', { prop: 'rotatePan', onPropertyChange: false,
3872
- value: { isCropSelection: null, isDefaultZoom: null } });
3873
- parent.isCropTab = false;
3874
- }
3875
- }
3876
- else if (parent.transform.degree !== 0 && parent.transform.cropZoomFactor > 0) {
3877
- parent.transform.zoomFactor = 0;
3878
- parent.transform.cropZoomFactor = null;
3879
- if (!isBlazor()) {
3880
- parent.notify('toolbar', { prop: 'enable-disable-btns', onPropertyChange: false });
3881
- }
3882
- else {
3883
- parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
3884
- }
3885
- }
3886
- };
3887
3725
  Selection.prototype.textKeyDown = function (e) {
3888
3726
  var parent = this.parent;
3889
3727
  if (String.fromCharCode(e.which) === '\r') {
@@ -4113,7 +3951,7 @@ var Selection = /** @class */ (function () {
4113
3951
  x <= (actObj.activePoint.endX + (actObj.topLeftCircle.radius * 2)) &&
4114
3952
  y >= (actObj.activePoint.startY - (actObj.topLeftCircle.radius * 2)) &&
4115
3953
  y <= (actObj.activePoint.endY + (actObj.topLeftCircle.radius * 2))) ||
4116
- (!isNullOrUndefined(rotationCirclePoint) &&
3954
+ (rotationCirclePoint &&
4117
3955
  x >= (rotationCirclePoint.x - (actObj.topLeftCircle.radius * 2)) &&
4118
3956
  x <= (rotationCirclePoint.x + (actObj.topLeftCircle.radius * 2)) &&
4119
3957
  y >= (rotationCirclePoint.y - (actObj.topLeftCircle.radius * 2)) &&
@@ -4160,7 +3998,7 @@ var Selection = /** @class */ (function () {
4160
3998
  value: { context: this.lowerContext, points: null } });
4161
3999
  }
4162
4000
  parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
4163
- if ((!isNullOrUndefined(parent.currSelectionPoint) && parent.currSelectionPoint.shape === 'crop-circle') || parent.isCircleCrop) {
4001
+ if ((parent.currSelectionPoint && parent.currSelectionPoint.shape === 'crop-circle') || parent.isCircleCrop) {
4164
4002
  parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
4165
4003
  value: { context: this.lowerContext, isSave: null, isFlip: null } });
4166
4004
  }
@@ -4187,7 +4025,7 @@ var Selection = /** @class */ (function () {
4187
4025
  this.isCropSelection = true;
4188
4026
  }
4189
4027
  if (!this.isCropSelection && isBlazor() && isNullOrUndefined(this.parent.eventType) &&
4190
- !isNullOrUndefined(parent.events) && parent.events.shapeChanging.hasDelegate === true) {
4028
+ parent.events && parent.events.shapeChanging.hasDelegate === true) {
4191
4029
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
4192
4030
  parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs_1).then(function (shapeChangingArgs) {
4193
4031
  _this.shapeEvent(shapeChangingArgs);
@@ -4209,7 +4047,7 @@ var Selection = /** @class */ (function () {
4209
4047
  startY: shapeChangingArgs_1.currentShapeSettings.startY,
4210
4048
  width: shapeChangingArgs_1.currentShapeSettings.width,
4211
4049
  height: shapeChangingArgs_1.currentShapeSettings.height } };
4212
- if (isBlazor() && !isNullOrUndefined(parent.events) && parent.events.onSelectionResizeStart.hasDelegate === true) {
4050
+ if (isBlazor() && parent.events && parent.events.onSelectionResizeStart.hasDelegate === true) {
4213
4051
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
4214
4052
  parent.dotNetRef.invokeMethodAsync('SelectionEventAsync', 'OnSelectionResizeStart', selectionChangingArgs).then(function (selectionChangingArgs) {
4215
4053
  shapeChangingArgs_1.currentShapeSettings.startX = selectionChangingArgs.currentSelectionSettings.startX;
@@ -4278,7 +4116,7 @@ var Selection = /** @class */ (function () {
4278
4116
  Selection.prototype.getDistance = function (a, b) {
4279
4117
  var x = 0;
4280
4118
  var y = 0;
4281
- if (!isNullOrUndefined(a) && !isNullOrUndefined(b)) {
4119
+ if (a && b) {
4282
4120
  x = a.x - b.x;
4283
4121
  y = a.y - b.y;
4284
4122
  }
@@ -4396,7 +4234,7 @@ var Selection = /** @class */ (function () {
4396
4234
  }
4397
4235
  parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
4398
4236
  this.lowerContext.filter = tempFilter;
4399
- if (!isNullOrUndefined(parent.activeObj.shape)) {
4237
+ if (parent.activeObj.shape) {
4400
4238
  parent.notify('shape', { prop: 'apply', onPropertyChange: false,
4401
4239
  value: { shape: null, obj: null, canvas: null } });
4402
4240
  }
@@ -90,4 +90,5 @@ export declare class Shape {
90
90
  private getSlope;
91
91
  private getIntercept;
92
92
  private setPointCollForShapeRotation;
93
+ private getSquarePointForRotatedShape;
93
94
  }