@syncfusion/ej2-image-editor 22.1.34 → 22.1.36

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 +8 -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 +1004 -1059
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +1002 -1061
  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 +8 -8
  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 +0 -1
  19. package/src/image-editor/action/selection.js +55 -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 +5 -5
  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 +34 -222
  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,6 +222,18 @@ 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;
@@ -236,10 +244,10 @@ var Selection = /** @class */ (function () {
236
244
  };
237
245
  Selection.prototype.updatePrivateVariables = function () {
238
246
  var parent = this.parent;
239
- if (!isNullOrUndefined(parent.lowerCanvas)) {
247
+ if (parent.lowerCanvas) {
240
248
  this.lowerContext = parent.lowerCanvas.getContext('2d');
241
249
  }
242
- if (!isNullOrUndefined(parent.upperCanvas)) {
250
+ if (parent.upperCanvas) {
243
251
  this.upperContext = parent.upperCanvas.getContext('2d');
244
252
  }
245
253
  };
@@ -350,7 +358,7 @@ var Selection = /** @class */ (function () {
350
358
  cursor = 'move';
351
359
  }
352
360
  }
353
- else if (!isNullOrUndefined(rotationCirclePoint) && !isApply &&
361
+ else if (rotationCirclePoint && !isApply &&
354
362
  x >= (rotationCirclePoint.x - (actObj.bottomCenterCircle.radius + 2)) &&
355
363
  x <= rotationCirclePoint.x + (actObj.bottomCenterCircle.radius + 2) &&
356
364
  y >= rotationCirclePoint.y - (actObj.bottomCenterCircle.radius + 2) &&
@@ -452,7 +460,7 @@ var Selection = /** @class */ (function () {
452
460
  }
453
461
  }
454
462
  if ((parent.cursor === 'default' || parent.cursor === 'grab')
455
- && !isNullOrUndefined(parent.pointColl[0]) && (parent.cursor !== 'grab' || !isCropSelection)
463
+ && parent.pointColl[0] && (parent.cursor !== 'grab' || !isCropSelection)
456
464
  && !parent.currObjType.isDragging && !parent.currObjType.isResize) {
457
465
  this.setCursorForFreehandDrawing(x, y, upperCanvas);
458
466
  }
@@ -570,7 +578,7 @@ var Selection = /** @class */ (function () {
570
578
  (actObj.bottomCenterCircle.radius + 2))) {
571
579
  upperCanvas.style.cursor = parent.cursor = 'se-resize';
572
580
  }
573
- else if (!isNullOrUndefined(actObj.rotationCirclePointColl) &&
581
+ else if (actObj.rotationCirclePointColl &&
574
582
  x >= (actObj.rotationCirclePointColl.x - (actObj.bottomCenterCircle.radius + 2)) &&
575
583
  x <= actObj.rotationCirclePointColl.x + (actObj.bottomCenterCircle.radius + 2) &&
576
584
  y >= actObj.rotationCirclePointColl.y - (actObj.bottomCenterCircle.radius + 2) &&
@@ -638,7 +646,7 @@ var Selection = /** @class */ (function () {
638
646
  if ((length >= 92 && length <= 182) || (length >= -178 && length <= -88)) {
639
647
  var cursorMap = { 'nw-resize': 'ne-resize', 'n-resize': 's-resize',
640
648
  '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',
649
+ 'sw-resize': 'se-resize', 's-resize': 'n-resize', 'se-resize': 'sw-resize'
642
650
  };
643
651
  if (parent.cursor in cursorMap) {
644
652
  parent.cursor = cursorMap[parent.cursor];
@@ -783,7 +791,7 @@ var Selection = /** @class */ (function () {
783
791
  else if (!this.isFhdEditing || parent.pointColl[n].isSelected) {
784
792
  if (this.isFhdPoint || this.isFhdEditing) {
785
793
  upperContext.clearRect(0, 0, upperCanvas.width, upperCanvas.height);
786
- if (!isNullOrUndefined(parent.activeObj.shape) && textArea.style.display === 'none') {
794
+ if (parent.activeObj.shape && textArea.style.display === 'none') {
787
795
  parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj } });
788
796
  }
789
797
  }
@@ -1059,7 +1067,7 @@ var Selection = /** @class */ (function () {
1059
1067
  if (splitWords !== undefined && splitWords[0] === 'crop') {
1060
1068
  this.isCropSelection = true;
1061
1069
  }
1062
- if (!this.isCropSelection && this.parent.eventType !== 'resize' && isBlazor() && !isNullOrUndefined(parent.events) && this.parent.events.onShapeResizeStart.hasDelegate === true) {
1070
+ if (!this.isCropSelection && this.parent.eventType !== 'resize' && isBlazor() && parent.events && this.parent.events.onShapeResizeStart.hasDelegate === true) {
1063
1071
  shapeResizingArgs.action = 'resize-start';
1064
1072
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1065
1073
  parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShapeResizeStart', shapeResizingArgs).then(function (shapeResizingArgs) {
@@ -2270,7 +2278,7 @@ var Selection = /** @class */ (function () {
2270
2278
  isResize = true;
2271
2279
  this.dragElement = parent.upperCanvas.style.cursor;
2272
2280
  }
2273
- else if (!isNullOrUndefined(rotationCirclePoint) &&
2281
+ else if (rotationCirclePoint &&
2274
2282
  x >= rotationCirclePoint.x - (actObj.topLeftCircle.radius * 2) &&
2275
2283
  x <= rotationCirclePoint.x + (actObj.topLeftCircle.radius * 2) &&
2276
2284
  y >= rotationCirclePoint.y - (actObj.topLeftCircle.radius * 2) &&
@@ -2581,7 +2589,7 @@ var Selection = /** @class */ (function () {
2581
2589
  this.dragCanvas = parent.togglePan = true;
2582
2590
  }
2583
2591
  var imageEditorClickEventArgs = { point: this.setXYPoints(e) };
2584
- if (isBlazor() && !isNullOrUndefined(parent.events) && parent.events.clicked.hasDelegate === true) {
2592
+ if (isBlazor() && parent.events && parent.events.clicked.hasDelegate === true) {
2585
2593
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2586
2594
  parent.dotNetRef.invokeMethodAsync('ClickEventAsync', 'click', imageEditorClickEventArgs).then(function (imageEditorClickEventArgs) {
2587
2595
  _this.clickEvent(imageEditorClickEventArgs, e);
@@ -2612,7 +2620,7 @@ var Selection = /** @class */ (function () {
2612
2620
  var parent = this.parent;
2613
2621
  var x = imageEditorClickEventArgs.point.x;
2614
2622
  var y = imageEditorClickEventArgs.point.y;
2615
- var cursor = !isNullOrUndefined(parent.activeObj.shape) && parent.activeObj.shape === 'text' ?
2623
+ var cursor = parent.activeObj.shape && parent.activeObj.shape === 'text' ?
2616
2624
  parent.cursor : 'default';
2617
2625
  if (this.currentDrawingShape !== '') {
2618
2626
  var object_1 = { currObj: {} };
@@ -2648,7 +2656,7 @@ var Selection = /** @class */ (function () {
2648
2656
  this.isPan = false;
2649
2657
  }
2650
2658
  }
2651
- if (!isNullOrUndefined(parent.activeObj.shape)) {
2659
+ if (parent.activeObj.shape) {
2652
2660
  this.isObjSelected = true;
2653
2661
  }
2654
2662
  else {
@@ -2662,7 +2670,7 @@ var Selection = /** @class */ (function () {
2662
2670
  var isFreehandDraw = this.isFreehandDrawTouch(e, this.isCropSelection);
2663
2671
  var isShapeClick = isShape ? isShape : this.isShapeClick(e, this.isCropSelection);
2664
2672
  var allowUndoRedoPush = this.applyCurrShape(isShapeClick);
2665
- if (this.isTouch && !isShape && !isNullOrUndefined(activeObj.shape) && !this.isCropSelection) {
2673
+ if (this.isTouch && !isShape && activeObj.shape && !this.isCropSelection) {
2666
2674
  if (this.applyObj(x, y)) {
2667
2675
  parent.okBtn(true);
2668
2676
  parent.notify('draw', { prop: 'setPrevActObj', onPropertyChange: false, value: { prevActObj: null } });
@@ -2697,11 +2705,12 @@ var Selection = /** @class */ (function () {
2697
2705
  }
2698
2706
  if (this.isFhdEditing) {
2699
2707
  parent.notify('freehand-draw', { prop: 'applyFhd', onPropertyChange: false });
2708
+ this.isFhdCustomized = false;
2700
2709
  if (!isBlazor()) {
2701
2710
  parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
2702
2711
  }
2703
2712
  }
2704
- if (!isNullOrUndefined(parent.activeObj.shape) && (parent.activeObj.shape === 'rectangle' ||
2713
+ if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' ||
2705
2714
  parent.activeObj.shape === 'ellipse' || parent.activeObj.shape === 'line' ||
2706
2715
  parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path' || parent.activeObj.shape === 'text')) {
2707
2716
  parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
@@ -2719,7 +2728,7 @@ var Selection = /** @class */ (function () {
2719
2728
  }
2720
2729
  else {
2721
2730
  var isLineArrow = false;
2722
- if (!isNullOrUndefined(parent.activeObj.shape) && (parent.activeObj.shape === 'line' ||
2731
+ if (parent.activeObj.shape && (parent.activeObj.shape === 'line' ||
2723
2732
  parent.activeObj.shape === 'arrow')) {
2724
2733
  isLineArrow = true;
2725
2734
  }
@@ -2775,7 +2784,7 @@ var Selection = /** @class */ (function () {
2775
2784
  else {
2776
2785
  if (this.isFhdEditing) {
2777
2786
  parent.notify('freehand-draw', { prop: 'cancelFhd', value: { type: 'ok' } });
2778
- if (!isNullOrUndefined(document.getElementById(parent.element.id + '_quickAccessToolbarArea'))) {
2787
+ if (document.getElementById(parent.element.id + '_quickAccessToolbarArea')) {
2779
2788
  document.getElementById(parent.element.id + '_quickAccessToolbarArea').style.display = 'none';
2780
2789
  }
2781
2790
  }
@@ -2913,7 +2922,7 @@ var Selection = /** @class */ (function () {
2913
2922
  !this.dragCanvas || parent.activeObj.activePoint !== undefined) {
2914
2923
  if (this.dragElement === '') {
2915
2924
  this.setCursor(x, y);
2916
- if ((!isNullOrUndefined(parent.activeObj.activePoint) &&
2925
+ if ((parent.activeObj.activePoint &&
2917
2926
  (parent.activeObj.activePoint.width === 0 || (!isNullOrUndefined(parent.activeObj.currIndex) &&
2918
2927
  this.cursorTargetId !== parent.activeObj.currIndex)))
2919
2928
  && parent.cursor !== 'default' &&
@@ -2988,15 +2997,14 @@ var Selection = /** @class */ (function () {
2988
2997
  if (splitWords !== undefined && splitWords[0] === 'crop') {
2989
2998
  isCropSelection = true;
2990
2999
  }
2991
- if (isBlazor() && !isNullOrUndefined(this.parent.eventType)) {
3000
+ if (isBlazor() && this.parent.eventType) {
2992
3001
  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 */
3002
+ if (parent.events && parent.events.onPanEnd.hasDelegate === true) {
2995
3003
  parent.dotNetRef.invokeMethodAsync('PanEventAsync', 'OnPanEnd', this.parent.panEventArgs);
2996
3004
  }
2997
3005
  }
2998
3006
  else if (this.parent.eventType === 'resize') {
2999
- if (!this.isCropSelection && !isNullOrUndefined(this.parent.events) && this.parent.events.onShapeResizeEnd.hasDelegate === true) {
3007
+ if (!this.isCropSelection && this.parent.events && this.parent.events.onShapeResizeEnd.hasDelegate === true) {
3000
3008
  this.shapeResizingArgs.currentShapeSettings = this.updatePrevShapeSettings();
3001
3009
  this.shapeResizingArgs.action = 'resize-end';
3002
3010
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
@@ -3005,7 +3013,8 @@ var Selection = /** @class */ (function () {
3005
3013
  value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
3006
3014
  });
3007
3015
  }
3008
- else if (!isNullOrUndefined(this.shapeResizingArgs) && !isNullOrUndefined(this.selectionResizingArgs) && !isNullOrUndefined(this.parent.events) && this.parent.events.onSelectionResizeEnd.hasDelegate === true) {
3016
+ else if (this.shapeResizingArgs && this.selectionResizingArgs && this.parent.events &&
3017
+ this.parent.events.onSelectionResizeEnd.hasDelegate === true) {
3009
3018
  var currentSelectionSettings = { type: this.parent.activeObj.shape,
3010
3019
  startX: this.shapeResizingArgs.currentShapeSettings.startX,
3011
3020
  startY: this.shapeResizingArgs.currentShapeSettings.startY,
@@ -3021,7 +3030,7 @@ var Selection = /** @class */ (function () {
3021
3030
  }
3022
3031
  }
3023
3032
  else {
3024
- if (!isNullOrUndefined(this.shapeMovingArgs) && !isNullOrUndefined(this.parent.events) && this.parent.events.onShapeDragEnd.hasDelegate === true) {
3033
+ if (this.shapeMovingArgs && this.parent.events && this.parent.events.onShapeDragEnd.hasDelegate === true) {
3025
3034
  this.shapeMovingArgs.currentShapeSettings = this.updatePrevShapeSettings();
3026
3035
  this.shapeMovingArgs.action = 'drag-end';
3027
3036
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
@@ -3074,7 +3083,7 @@ var Selection = /** @class */ (function () {
3074
3083
  value: { obj: selPointCollObj } });
3075
3084
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
3076
3085
  if (!parent.togglePen && !isCropSelection) {
3077
- if (!isNullOrUndefined(this.tempObjColl) && parent.activeObj.activePoint.width !== 0) {
3086
+ if (this.tempObjColl && parent.activeObj.activePoint.width !== 0) {
3078
3087
  parent.objColl.push(parent.activeObj);
3079
3088
  if (JSON.stringify(parent.activeObj.activePoint) !== JSON.stringify(this.tempActiveObj.activePoint)) {
3080
3089
  parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
@@ -3091,7 +3100,7 @@ var Selection = /** @class */ (function () {
3091
3100
  parent.currObjType.isResize = false;
3092
3101
  }
3093
3102
  }
3094
- if (!isNullOrUndefined(parent.activeObj)) {
3103
+ if (parent.activeObj) {
3095
3104
  var isCropSelection_1 = false;
3096
3105
  var splitWords_1;
3097
3106
  if (parent.activeObj.shape !== undefined) {
@@ -3140,7 +3149,7 @@ var Selection = /** @class */ (function () {
3140
3149
  if (splitWords !== undefined && splitWords[0] === 'crop') {
3141
3150
  isCropSelection = true;
3142
3151
  }
3143
- if (!isNullOrUndefined(parent.activeObj.shape) && !isCropSelection && e.currentTarget === parent.upperCanvas &&
3152
+ if (parent.activeObj.shape && !isCropSelection && e.currentTarget === parent.upperCanvas &&
3144
3153
  parent.textArea.style.display === 'none') {
3145
3154
  if (parent.activeObj.shape === 'text') {
3146
3155
  if (!isBlazor()) {
@@ -3177,7 +3186,7 @@ var Selection = /** @class */ (function () {
3177
3186
  var isAdjusted = false;
3178
3187
  var parent = this.parent;
3179
3188
  obj = obj ? obj : parent.activeObj;
3180
- if (!isNullOrUndefined(obj.shape) && (obj.shape === 'line' || parent.activeObj.shape === 'arrow')) {
3189
+ if (obj.shape && (obj.shape === 'line' || parent.activeObj.shape === 'arrow')) {
3181
3190
  var temp = void 0;
3182
3191
  if ((this.dragElement === 'e-resize' && obj.activePoint.endX < obj.activePoint.startX) ||
3183
3192
  (this.dragElement === 'w-resize' && obj.activePoint.startX > obj.activePoint.endX)) {
@@ -3208,7 +3217,7 @@ var Selection = /** @class */ (function () {
3208
3217
  Selection.prototype.updPtCollForShpRot = function (obj) {
3209
3218
  var parent = this.parent;
3210
3219
  obj = obj ? obj : parent.activeObj;
3211
- if (!isNullOrUndefined(obj.shape) && obj.rotatedAngle !== 0) {
3220
+ if (obj.shape && obj.rotatedAngle !== 0) {
3212
3221
  parent.notify('shape', { prop: 'setPointCollForShapeRotation', onPropertyChange: false,
3213
3222
  value: { obj: obj } });
3214
3223
  // Updating ratio for point collection
@@ -3272,7 +3281,7 @@ var Selection = /** @class */ (function () {
3272
3281
  if (parent.togglePen) {
3273
3282
  return isShape;
3274
3283
  }
3275
- if (!isNullOrUndefined(parent.activeObj.shape) && parent.activeObj.shape === 'text' && this.isShapeInserted) {
3284
+ if (parent.activeObj.shape && parent.activeObj.shape === 'text' && this.isShapeInserted) {
3276
3285
  var isTextArea = parent.textArea.style.display === 'block' ? true : false;
3277
3286
  var activeObj = extend({}, parent.activeObj, null, true);
3278
3287
  parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
@@ -3296,7 +3305,7 @@ var Selection = /** @class */ (function () {
3296
3305
  parent.objColl.splice(index, 1);
3297
3306
  }
3298
3307
  }
3299
- else if (!isShape && !isNullOrUndefined(activeObj.shape)) {
3308
+ else if (!isShape && activeObj.shape) {
3300
3309
  parent.activeObj = activeObj;
3301
3310
  var index = this.getCurrentIndex();
3302
3311
  if ((!isNullOrUndefined(index) &&
@@ -3314,7 +3323,7 @@ var Selection = /** @class */ (function () {
3314
3323
  var parent = this.parent;
3315
3324
  var isShape = false;
3316
3325
  if (e.type === 'touchstart' && !parent.togglePen) {
3317
- if (!isNullOrUndefined(parent.activeObj) && parent.activeObj.shape === 'text') {
3326
+ if (parent.activeObj && parent.activeObj.shape === 'text') {
3318
3327
  this.timer = setTimeout(this.setTimer.bind(this), 1000, e);
3319
3328
  }
3320
3329
  var isTextArea = parent.textArea.style.display === 'block' ? true : false;
@@ -3384,7 +3393,7 @@ var Selection = /** @class */ (function () {
3384
3393
  parent.objColl.splice(index, 1);
3385
3394
  }
3386
3395
  }
3387
- else if (!isNullOrUndefined(activeObj.shape)) {
3396
+ else if (activeObj.shape) {
3388
3397
  parent.activeObj = activeObj;
3389
3398
  var index = this.getCurrentIndex();
3390
3399
  if (!isCropSelection) {
@@ -3403,7 +3412,7 @@ var Selection = /** @class */ (function () {
3403
3412
  Selection.prototype.applyObj = function (x, y) {
3404
3413
  var parent = this.parent;
3405
3414
  var isApply = false;
3406
- if (!isNullOrUndefined(parent.activeObj.shape) && (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse' ||
3415
+ if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse' ||
3407
3416
  parent.activeObj.shape === 'text' || parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' ||
3408
3417
  parent.activeObj.shape === 'path')) {
3409
3418
  if (x >= (parent.activeObj.activePoint.startX - (parent.activeObj.topLeftCircle.radius * 2)) &&
@@ -3583,7 +3592,7 @@ var Selection = /** @class */ (function () {
3583
3592
  var splitWords;
3584
3593
  switch (e.key) {
3585
3594
  case (e.ctrlKey && 's'):
3586
- if (isBlazor() && !isNullOrUndefined(parent.events) && parent.events.saving.hasDelegate === true) {
3595
+ if (isBlazor() && parent.events && parent.events.saving.hasDelegate === true) {
3587
3596
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3588
3597
  parent.dotNetRef.invokeMethodAsync('BeforeSaveEventAsync', 'BeforeSave', beforeSave).then(function (args) {
3589
3598
  _this.beforeSaveEvent(args, e);
@@ -3681,7 +3690,7 @@ var Selection = /** @class */ (function () {
3681
3690
  e.stopPropagation();
3682
3691
  if (e.ctrlKey === true && isInsideCanvas) {
3683
3692
  e.preventDefault();
3684
- if (!parent.isCropTab && (!isNullOrUndefined(parent.activeObj.shape) && parent.activeObj.shape.split('-')[0] !== 'crop')) {
3693
+ if (!parent.isCropTab && (parent.activeObj.shape && parent.activeObj.shape.split('-')[0] !== 'crop')) {
3685
3694
  parent.okBtn();
3686
3695
  if (!isBlazor()) {
3687
3696
  parent.notify('toolbar', { prop: 'close-contextual-toolbar', onPropertyChange: false });
@@ -3704,186 +3713,6 @@ var Selection = /** @class */ (function () {
3704
3713
  }
3705
3714
  }
3706
3715
  };
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
3716
  Selection.prototype.textKeyDown = function (e) {
3888
3717
  var parent = this.parent;
3889
3718
  if (String.fromCharCode(e.which) === '\r') {
@@ -4113,7 +3942,7 @@ var Selection = /** @class */ (function () {
4113
3942
  x <= (actObj.activePoint.endX + (actObj.topLeftCircle.radius * 2)) &&
4114
3943
  y >= (actObj.activePoint.startY - (actObj.topLeftCircle.radius * 2)) &&
4115
3944
  y <= (actObj.activePoint.endY + (actObj.topLeftCircle.radius * 2))) ||
4116
- (!isNullOrUndefined(rotationCirclePoint) &&
3945
+ (rotationCirclePoint &&
4117
3946
  x >= (rotationCirclePoint.x - (actObj.topLeftCircle.radius * 2)) &&
4118
3947
  x <= (rotationCirclePoint.x + (actObj.topLeftCircle.radius * 2)) &&
4119
3948
  y >= (rotationCirclePoint.y - (actObj.topLeftCircle.radius * 2)) &&
@@ -4160,7 +3989,7 @@ var Selection = /** @class */ (function () {
4160
3989
  value: { context: this.lowerContext, points: null } });
4161
3990
  }
4162
3991
  parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
4163
- if ((!isNullOrUndefined(parent.currSelectionPoint) && parent.currSelectionPoint.shape === 'crop-circle') || parent.isCircleCrop) {
3992
+ if ((parent.currSelectionPoint && parent.currSelectionPoint.shape === 'crop-circle') || parent.isCircleCrop) {
4164
3993
  parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
4165
3994
  value: { context: this.lowerContext, isSave: null, isFlip: null } });
4166
3995
  }
@@ -4187,7 +4016,7 @@ var Selection = /** @class */ (function () {
4187
4016
  this.isCropSelection = true;
4188
4017
  }
4189
4018
  if (!this.isCropSelection && isBlazor() && isNullOrUndefined(this.parent.eventType) &&
4190
- !isNullOrUndefined(parent.events) && parent.events.shapeChanging.hasDelegate === true) {
4019
+ parent.events && parent.events.shapeChanging.hasDelegate === true) {
4191
4020
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
4192
4021
  parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs_1).then(function (shapeChangingArgs) {
4193
4022
  _this.shapeEvent(shapeChangingArgs);
@@ -4209,7 +4038,7 @@ var Selection = /** @class */ (function () {
4209
4038
  startY: shapeChangingArgs_1.currentShapeSettings.startY,
4210
4039
  width: shapeChangingArgs_1.currentShapeSettings.width,
4211
4040
  height: shapeChangingArgs_1.currentShapeSettings.height } };
4212
- if (isBlazor() && !isNullOrUndefined(parent.events) && parent.events.onSelectionResizeStart.hasDelegate === true) {
4041
+ if (isBlazor() && parent.events && parent.events.onSelectionResizeStart.hasDelegate === true) {
4213
4042
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
4214
4043
  parent.dotNetRef.invokeMethodAsync('SelectionEventAsync', 'OnSelectionResizeStart', selectionChangingArgs).then(function (selectionChangingArgs) {
4215
4044
  shapeChangingArgs_1.currentShapeSettings.startX = selectionChangingArgs.currentSelectionSettings.startX;
@@ -4278,7 +4107,7 @@ var Selection = /** @class */ (function () {
4278
4107
  Selection.prototype.getDistance = function (a, b) {
4279
4108
  var x = 0;
4280
4109
  var y = 0;
4281
- if (!isNullOrUndefined(a) && !isNullOrUndefined(b)) {
4110
+ if (a && b) {
4282
4111
  x = a.x - b.x;
4283
4112
  y = a.y - b.y;
4284
4113
  }
@@ -4396,7 +4225,7 @@ var Selection = /** @class */ (function () {
4396
4225
  }
4397
4226
  parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
4398
4227
  this.lowerContext.filter = tempFilter;
4399
- if (!isNullOrUndefined(parent.activeObj.shape)) {
4228
+ if (parent.activeObj.shape) {
4400
4229
  parent.notify('shape', { prop: 'apply', onPropertyChange: false,
4401
4230
  value: { shape: null, obj: null, canvas: null } });
4402
4231
  }
@@ -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
  }