@syncfusion/ej2-image-editor 22.1.37 → 22.1.39

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 (58) 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 +342 -273
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +344 -274
  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 +10 -10
  12. package/src/image-editor/action/crop.d.ts +2 -0
  13. package/src/image-editor/action/crop.js +92 -97
  14. package/src/image-editor/action/draw.js +88 -71
  15. package/src/image-editor/action/export.js +49 -66
  16. package/src/image-editor/action/freehand-draw.js +24 -1
  17. package/src/image-editor/action/selection.js +17 -7
  18. package/src/image-editor/action/shape.d.ts +2 -0
  19. package/src/image-editor/action/shape.js +54 -22
  20. package/src/image-editor/action/transform.js +10 -0
  21. package/src/image-editor/base/image-editor.js +7 -5
  22. package/src/image-editor/base/interface.d.ts +6 -2
  23. package/src/image-editor/renderer/toolbar.js +4 -5
  24. package/styles/bootstrap-dark.css +20 -8
  25. package/styles/bootstrap.css +20 -8
  26. package/styles/bootstrap4.css +20 -8
  27. package/styles/bootstrap5-dark.css +20 -8
  28. package/styles/bootstrap5.css +20 -8
  29. package/styles/fabric-dark.css +20 -8
  30. package/styles/fabric.css +20 -8
  31. package/styles/fluent-dark.css +20 -8
  32. package/styles/fluent.css +20 -8
  33. package/styles/highcontrast-light.css +20 -8
  34. package/styles/highcontrast.css +20 -8
  35. package/styles/image-editor/_layout.scss +20 -2
  36. package/styles/image-editor/bootstrap-dark.css +20 -8
  37. package/styles/image-editor/bootstrap.css +20 -8
  38. package/styles/image-editor/bootstrap4.css +20 -8
  39. package/styles/image-editor/bootstrap5-dark.css +20 -8
  40. package/styles/image-editor/bootstrap5.css +20 -8
  41. package/styles/image-editor/fabric-dark.css +20 -8
  42. package/styles/image-editor/fabric.css +20 -8
  43. package/styles/image-editor/fluent-dark.css +20 -8
  44. package/styles/image-editor/fluent.css +20 -8
  45. package/styles/image-editor/highcontrast-light.css +20 -8
  46. package/styles/image-editor/highcontrast.css +20 -8
  47. package/styles/image-editor/material-dark.css +20 -8
  48. package/styles/image-editor/material.css +20 -8
  49. package/styles/image-editor/material3-dark.css +20 -8
  50. package/styles/image-editor/material3.css +20 -8
  51. package/styles/image-editor/tailwind-dark.css +20 -8
  52. package/styles/image-editor/tailwind.css +20 -8
  53. package/styles/material-dark.css +20 -8
  54. package/styles/material.css +20 -8
  55. package/styles/material3-dark.css +20 -8
  56. package/styles/material3.css +20 -8
  57. package/styles/tailwind-dark.css +20 -8
  58. package/styles/tailwind.css +20 -8
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 22.1.37
3
+ * version : 22.1.39
4
4
  * Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-image-editor@*",
3
- "_id": "@syncfusion/ej2-image-editor@22.1.36",
3
+ "_id": "@syncfusion/ej2-image-editor@22.1.38",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-ckJ9WXGq8Evlr/L+ToszUEaW5o17UvtPdFBxX8U+ZNvAQHyWiJeH0hrSMUTBRnXzwXpqwhIuUQBEIvA61tjOPw==",
5
+ "_integrity": "sha512-0FKUVs0R2/Fo4Z3xwDMWGEYHM2rLSEstbccSFmWKM+zLef2CUx/8mKoqJ3Z5AC5XQfKJYLaNybviEq3ggjWVwQ==",
6
6
  "_location": "/@syncfusion/ej2-image-editor",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -23,8 +23,8 @@
23
23
  "/@syncfusion/ej2-react-image-editor",
24
24
  "/@syncfusion/ej2-vue-image-editor"
25
25
  ],
26
- "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-image-editor/-/ej2-image-editor-22.1.36.tgz",
27
- "_shasum": "88ab5df13c6b37ffda89a70889cabfc031c1c454",
26
+ "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-image-editor/-/ej2-image-editor-22.1.38.tgz",
27
+ "_shasum": "3ea2b377613208e250a8e58b3334cfbc862543d3",
28
28
  "_spec": "@syncfusion/ej2-image-editor@*",
29
29
  "_where": "/jenkins/workspace/elease-automation_release_21.1.1/packages/included",
30
30
  "author": {
@@ -32,11 +32,11 @@
32
32
  },
33
33
  "bundleDependencies": false,
34
34
  "dependencies": {
35
- "@syncfusion/ej2-base": "~22.1.34",
36
- "@syncfusion/ej2-buttons": "~22.1.36",
37
- "@syncfusion/ej2-inputs": "~22.1.34",
38
- "@syncfusion/ej2-navigations": "~22.1.36",
39
- "@syncfusion/ej2-popups": "~22.1.37",
35
+ "@syncfusion/ej2-base": "~22.1.38",
36
+ "@syncfusion/ej2-buttons": "~22.1.39",
37
+ "@syncfusion/ej2-inputs": "~22.1.39",
38
+ "@syncfusion/ej2-navigations": "~22.1.39",
39
+ "@syncfusion/ej2-popups": "~22.1.38",
40
40
  "@syncfusion/ej2-splitbuttons": "~22.1.37"
41
41
  },
42
42
  "deprecated": false,
@@ -67,7 +67,7 @@
67
67
  "url": "https://github.com/syncfusion/ej2-javascript-ui-controls/tree/master/controls/imageeditor"
68
68
  },
69
69
  "typings": "index.d.ts",
70
- "version": "22.1.37",
70
+ "version": "22.1.39",
71
71
  "sideEffects": false,
72
72
  "homepage": "https://www.syncfusion.com/javascript-ui-controls"
73
73
  }
@@ -19,11 +19,13 @@ export declare class Crop {
19
19
  private cropImg;
20
20
  private updateCropObj;
21
21
  private rotateCrop;
22
+ private revertTransform;
22
23
  private flipCrop;
23
24
  private cropObjColl;
24
25
  private cropPointCollection;
25
26
  private cropFreehandDrawColl;
26
27
  private setCurrSelPoints;
28
+ private panToSelRangle;
27
29
  private cropCircle;
28
30
  private getCurrCropState;
29
31
  private isInitialRotate;
@@ -41,7 +41,7 @@ var Crop = /** @class */ (function () {
41
41
  this.crop(args.value['obj']);
42
42
  break;
43
43
  case 'calcRatio':
44
- this.calcRatio(args.value['obj']);
44
+ this.calcRatio(args.value['obj'], args.value['dimension']);
45
45
  break;
46
46
  case 'isObjInImage':
47
47
  this.isObjInImage(args.value['obj'], args.value['object']);
@@ -187,112 +187,74 @@ var Crop = /** @class */ (function () {
187
187
  Crop.prototype.rotateCrop = function () {
188
188
  var parent = this.parent;
189
189
  var shape = parent.activeObj.shape || '';
190
- var tempDegree = parent.transform.degree;
191
190
  parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
192
191
  parent.currSelectionPoint = extend({}, parent.activeObj, {}, true);
193
192
  parent.objColl.push(parent.activeObj);
194
193
  parent.activeObj = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
195
- this.lowerContext.setTransform(1, 0, 0, 1, 0, 0);
196
- parent.notify('draw', { prop: 'setClientTransDim', onPropertyChange: false,
197
- value: { isPreventDimension: null } });
198
- this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
199
- parent.transform.degree = 0;
200
- var temp = this.lowerContext.filter;
201
- parent.notify('finetune', { prop: 'updateBrightFilter', onPropertyChange: false });
202
- 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);
203
- this.lowerContext.filter = temp;
204
- var length = 0;
205
- if (tempDegree === 90 || tempDegree === -270) {
206
- length = 3;
207
- }
208
- else if (tempDegree === 180 || tempDegree === -180) {
209
- length = 2;
210
- }
211
- else if (tempDegree === 270 || tempDegree === -90) {
212
- length = 1;
213
- }
214
- for (var i = 0; i < length; i++) {
215
- parent.notify('shape', { prop: 'rotateObjColl', onPropertyChange: false });
216
- parent.notify('freehand-draw', { prop: 'rotateFhdColl', onPropertyChange: false });
217
- }
218
194
  var activeObj = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
219
- if (parent.transform.currFlipState !== '') {
220
- for (var i = 0, len = parent.objColl.length; i < len; i++) {
221
- parent.objColl[i].shapeFlip = '';
222
- }
223
- for (var i = 0; i < parent.freehandCounter; i++) {
224
- parent.pointColl[i].shapeFlip = '';
225
- }
226
- parent.transform.degree = tempDegree;
227
- var flipState = this.getCurrCropState('initial');
228
- parent.transform.degree = 0;
229
- parent.notify('shape', { prop: 'redrawObj', onPropertyChange: false, value: { degree: flipState } });
230
- parent.notify('freehand-draw', { prop: 'flipFHDColl', onPropertyChange: false,
231
- value: { value: flipState } });
232
- }
233
- parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
234
- parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
195
+ var tempCurrSelObj = extend({}, parent.currSelectionPoint, {}, true);
196
+ var preventSelObj = { bool: null };
197
+ parent.notify('transform', { prop: 'getPreventSelect', onPropertyChange: false, value: { obj: preventSelObj } });
198
+ parent.notify('transform', { prop: 'setPreventSelect', onPropertyChange: false, value: { bool: true } });
199
+ var coll = extend([], parent.rotateFlipColl, [], true);
200
+ this.panToSelRangle(true);
201
+ this.revertTransform('initial', coll);
235
202
  activeObj = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
236
203
  this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
237
204
  parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: activeObj } });
238
205
  parent.objColl.pop();
239
206
  parent.transform.degree = 0;
240
207
  this.cropImg(true);
241
- parent.notify('transform', { prop: 'setReverseRotate', onPropertyChange: false, value: { bool: true } });
242
- this.lowerContext.setTransform(1, 0, 0, 1, 0, 0);
243
- parent.transform.degree = tempDegree;
244
- parent.notify('draw', { prop: 'setDestPoints', onPropertyChange: false });
245
- parent.notify('draw', { prop: 'currTransState', onPropertyChange: false,
246
- value: { type: 'initial', isPreventDestination: null, context: null, isPreventCircleCrop: null } });
247
- parent.notify('finetune', { prop: 'updateBrightFilter', onPropertyChange: false });
248
- 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);
249
- this.lowerContext.filter = temp;
250
- parent.notify('draw', { prop: 'currTransState', onPropertyChange: false,
251
- value: { type: 'reverse', isPreventDestination: null, context: null, isPreventCircleCrop: null } });
252
- length = 0;
253
- if (tempDegree === 90 || tempDegree === -270) {
254
- length = 1;
255
- }
256
- else if (tempDegree === 180 || tempDegree === -180) {
257
- length = 2;
258
- }
259
- else if (tempDegree === 270 || tempDegree === -90) {
260
- length = 3;
208
+ this.revertTransform('reverse', coll);
209
+ parent.currSelectionPoint = tempCurrSelObj;
210
+ parent.notify('transform', { prop: 'setPreventSelect', onPropertyChange: false, value: { bool: preventSelObj['bool'] } });
211
+ parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
212
+ parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
213
+ if (shape === 'crop-circle') {
214
+ this.cropCircle(this.lowerContext);
261
215
  }
262
- for (var i = 0; i < length; i++) {
263
- parent.notify('shape', { prop: 'rotateObjColl', onPropertyChange: false });
264
- parent.notify('freehand-draw', { prop: 'rotateFhdColl', onPropertyChange: false });
216
+ this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
217
+ parent.notify('draw', { prop: 'resetPanPoints', onPropertyChange: false });
218
+ };
219
+ Crop.prototype.revertTransform = function (type, coll) {
220
+ var parent = this.parent;
221
+ var obj = { isRotate: false };
222
+ if (type === 'initial') {
223
+ for (var i = coll.length - 1; i >= 0; i--) {
224
+ switch (coll[i]) {
225
+ case 90:
226
+ parent.notify('transform', { prop: 'rotate', value: { degree: -90, obj: obj } });
227
+ break;
228
+ case -90:
229
+ parent.notify('transform', { prop: 'rotate', value: { degree: 90, obj: obj } });
230
+ break;
231
+ default:
232
+ parent.notify('transform', { prop: 'flipImage', value: { direction: parent.toPascalCase(coll[i]) } });
233
+ break;
234
+ }
235
+ }
265
236
  }
266
- if (this.getCurrFlipState() !== '') {
237
+ else {
267
238
  for (var i = 0, len = parent.objColl.length; i < len; i++) {
268
239
  parent.objColl[i].shapeFlip = '';
269
240
  }
270
241
  for (var i = 0; i < parent.freehandCounter; i++) {
271
242
  parent.pointColl[i].shapeFlip = '';
272
243
  }
273
- var flipState = this.getCurrCropState('reverse');
274
- parent.notify('shape', { prop: 'redrawObj', onPropertyChange: false, value: { degree: flipState } });
275
- parent.notify('freehand-draw', { prop: 'flipFHDColl', onPropertyChange: false,
276
- value: { value: flipState } });
277
- }
278
- parent.notify('transform', { prop: 'setReverseRotate', onPropertyChange: false, value: { bool: false } });
279
- this.lowerContext.filter = 'none';
280
- for (var i = 0, len = parent.objColl.length; i < len; i++) {
281
- if (this.isObjInImage(parent.objColl[i])) {
282
- parent.notify('shape', { prop: 'apply', onPropertyChange: false,
283
- value: { shape: parent.objColl[i].shape, obj: parent.objColl[i], canvas: null } });
284
- parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
244
+ for (var i = 0, len = coll.length; i < len; i++) {
245
+ switch (coll[i]) {
246
+ case 90:
247
+ parent.notify('transform', { prop: 'rotate', value: { degree: 90, obj: obj } });
248
+ break;
249
+ case -90:
250
+ parent.notify('transform', { prop: 'rotate', value: { degree: -90, obj: obj } });
251
+ break;
252
+ default:
253
+ parent.notify('transform', { prop: 'flipImage', value: { direction: parent.toPascalCase(coll[i]) } });
254
+ break;
255
+ }
285
256
  }
286
257
  }
287
- parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
288
- this.lowerContext.filter = temp;
289
- parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
290
- parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
291
- if (shape === 'crop-circle') {
292
- this.cropCircle(this.lowerContext);
293
- }
294
- this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
295
- parent.notify('draw', { prop: 'resetPanPoints', onPropertyChange: false });
296
258
  };
297
259
  Crop.prototype.flipCrop = function () {
298
260
  var parent = this.parent;
@@ -493,6 +455,15 @@ var Crop = /** @class */ (function () {
493
455
  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);
494
456
  parent.notify('draw', { prop: 'currTransState', onPropertyChange: false,
495
457
  value: { type: 'reverse', isPreventDestination: null, context: null, isPreventCircleCrop: true } });
458
+ var cropObjColl = extend([], parent.objColl, null, true);
459
+ var cropPointColl = extend([], parent.pointColl, null, true);
460
+ parent.objColl = [];
461
+ parent.pointColl = [];
462
+ parent.freehandCounter = 0;
463
+ this.panToSelRangle();
464
+ parent.objColl = cropObjColl;
465
+ parent.pointColl = cropPointColl;
466
+ parent.freehandCounter = parent.pointColl.length;
496
467
  if (parent.cropObj.activeObj.shape) {
497
468
  var destPoints = { startX: parent.img.destLeft, startY: parent.img.destTop, width: parent.img.destWidth,
498
469
  height: parent.img.destHeight };
@@ -509,8 +480,8 @@ var Crop = /** @class */ (function () {
509
480
  parent.img.destWidth = destPoints.width;
510
481
  parent.img.destHeight = destPoints.height;
511
482
  parent.notify('freehand-draw', { prop: 'updateFHDColl', onPropertyChange: false });
512
- var cropObjColl = extend([], parent.objColl, null, true);
513
- var cropPointColl = extend([], parent.pointColl, null, true);
483
+ cropObjColl = extend([], parent.objColl, null, true);
484
+ cropPointColl = extend([], parent.pointColl, null, true);
514
485
  parent.objColl = [];
515
486
  parent.pointColl = [];
516
487
  parent.freehandCounter = 0;
@@ -521,9 +492,12 @@ var Crop = /** @class */ (function () {
521
492
  parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
522
493
  value: { obj: { selPointColl: [] } } });
523
494
  parent.cropObj.filter = this.lowerContext.filter;
495
+ var actObj = extend({}, parent.currSelectionPoint, null, true);
524
496
  parent.notify('draw', { prop: 'setCurrentObj', onPropertyChange: false, value: { obj: null } });
497
+ parent.activeObj = extend({}, actObj, null, true);
525
498
  var activeObj = extend({}, parent.activeObj, null, true);
526
499
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
500
+ this.panToSelRangle();
527
501
  parent.objColl = cropObjColl;
528
502
  parent.pointColl = cropPointColl;
529
503
  parent.freehandCounter = parent.pointColl.length;
@@ -555,6 +529,28 @@ var Crop = /** @class */ (function () {
555
529
  parent.currSelectionPoint = null;
556
530
  }
557
531
  };
532
+ Crop.prototype.panToSelRangle = function (isReverse) {
533
+ var parent = this.parent;
534
+ var obj = extend({}, parent.currSelectionPoint, null, true);
535
+ parent.currSelectionPoint = null;
536
+ var panX = parent.transform.degree === 0 ?
537
+ isReverse ? -parent.cropObj.totalPannedPoint.x : parent.cropObj.totalPannedPoint.x :
538
+ isReverse ? -parent.cropObj.totalPannedClientPoint.x : parent.cropObj.totalPannedClientPoint.x;
539
+ var panY = parent.transform.degree === 0 ?
540
+ isReverse ? -parent.cropObj.totalPannedPoint.y : parent.cropObj.totalPannedPoint.y :
541
+ isReverse ? -parent.cropObj.totalPannedClientPoint.y : parent.cropObj.totalPannedClientPoint.y;
542
+ if (parent.transform.degree === 0) {
543
+ parent.img.destLeft += panX;
544
+ parent.img.destTop += panY;
545
+ parent.notify('transform', { prop: 'drawPannImage', value: { point: { x: panX, y: panY } } });
546
+ }
547
+ else {
548
+ parent.panPoint.currentPannedPoint = { x: panX, y: panY };
549
+ parent.notify('transform', { prop: 'drawPannedImage', value: { xDiff: panX, yDiff: panY } });
550
+ parent.panPoint.currentPannedPoint = { x: 0, y: 0 };
551
+ }
552
+ parent.currSelectionPoint = obj;
553
+ };
558
554
  Crop.prototype.cropCircle = function (context, isSave, isFlip) {
559
555
  var parent = this.parent;
560
556
  if (isFlip && parent.transform.currFlipState !== '') {
@@ -563,9 +559,9 @@ var Crop = /** @class */ (function () {
563
559
  }
564
560
  context.globalCompositeOperation = 'destination-in';
565
561
  context.beginPath();
566
- var centerX = isNullOrUndefined(isSave) ? parent.img.destLeft + (parent.img.destWidth / 2) : parent.img.destWidth / 2;
567
- var centerY = isNullOrUndefined(isSave) ? parent.img.destTop + (parent.img.destHeight / 2) : parent.img.destHeight / 2;
568
- var radius = parent.img.destWidth / 2;
562
+ var centerX = isNullOrUndefined(isSave) ? parent.img.destLeft + (parent.img.destWidth / 2) : context.canvas.width / 2;
563
+ var centerY = isNullOrUndefined(isSave) ? parent.img.destTop + (parent.img.destHeight / 2) : context.canvas.height / 2;
564
+ var radius = isSave ? context.canvas.width / 2 : parent.img.destWidth / 2;
569
565
  context.arc(centerX, centerY, radius, 0, Math.PI * 2);
570
566
  context.closePath();
571
567
  context.fill();
@@ -744,7 +740,6 @@ var Crop = /** @class */ (function () {
744
740
  }
745
741
  this.cropImg();
746
742
  parent.transform.zoomFactor = 0;
747
- parent.zoomSettings.zoomFactor = 1;
748
743
  parent.setProperties({ zoomSettings: { zoomFactor: 1 } }, true);
749
744
  parent.notify('transform', { prop: 'setPreviousZoomValue', onPropertyChange: false,
750
745
  value: { previousZoomValue: parent.zoomSettings.zoomFactor } });
@@ -770,17 +765,17 @@ var Crop = /** @class */ (function () {
770
765
  }
771
766
  }
772
767
  };
773
- Crop.prototype.calcRatio = function (obj) {
768
+ Crop.prototype.calcRatio = function (obj, dimension) {
774
769
  var parent = this.parent;
775
770
  var widthRatio;
776
771
  var heightRatio;
777
772
  if (parent.transform.degree === 0 || parent.transform.degree % 180 === 0) {
778
- widthRatio = parent.baseImg.width / parent.img.destWidth;
779
- heightRatio = parent.baseImg.height / parent.img.destHeight;
773
+ widthRatio = (dimension ? dimension.width : parent.baseImg.width) / parent.img.destWidth;
774
+ heightRatio = (dimension ? dimension.height : parent.baseImg.height) / parent.img.destHeight;
780
775
  }
781
776
  else {
782
- widthRatio = parent.baseImg.height / parent.img.destWidth;
783
- heightRatio = parent.baseImg.width / parent.img.destHeight;
777
+ widthRatio = (dimension ? dimension.height : parent.baseImg.height) / parent.img.destWidth;
778
+ heightRatio = (dimension ? dimension.width : parent.baseImg.width) / parent.img.destHeight;
784
779
  }
785
780
  if (obj) {
786
781
  obj['width'] = widthRatio;
@@ -286,6 +286,10 @@ var Draw = /** @class */ (function () {
286
286
  parent.activeObj = extend({}, obj, {}, true);
287
287
  }
288
288
  this.updateActiveObject();
289
+ if (isNullOrUndefined(parent.activeObj.activePoint.startX) &&
290
+ isNullOrUndefined(parent.activeObj.activePoint.startY)) {
291
+ return;
292
+ }
289
293
  if (parent.currObjType.isText) {
290
294
  var obj_2 = { keyHistory: '' };
291
295
  parent.notify('shape', { prop: 'getKeyHistory', onPropertyChange: false, value: { obj: obj_2 } });
@@ -956,12 +960,14 @@ var Draw = /** @class */ (function () {
956
960
  if (degree < 0) {
957
961
  degree = 360 + degree;
958
962
  }
959
- for (var i = 0, len = parent.activeObj.flipObjColl.length; i < len; i++) {
960
- if (parent.activeObj.flipObjColl[i].toLowerCase() === 'horizontal') {
961
- isHorizontalflip = true;
962
- }
963
- else if (parent.activeObj.flipObjColl[i].toLowerCase() === 'vertical') {
964
- isVerticalflip = true;
963
+ if (parent.activeObj.flipObjColl) {
964
+ for (var i = 0, len = parent.activeObj.flipObjColl.length; i < len; i++) {
965
+ if (parent.activeObj.flipObjColl[i].toLowerCase() === 'horizontal') {
966
+ isHorizontalflip = true;
967
+ }
968
+ else if (parent.activeObj.flipObjColl[i].toLowerCase() === 'vertical') {
969
+ isVerticalflip = true;
970
+ }
965
971
  }
966
972
  }
967
973
  switch (degree) {
@@ -1540,17 +1546,18 @@ var Draw = /** @class */ (function () {
1540
1546
  parent.activeObj.textSettings.fontFamily;
1541
1547
  if (parent.activeObj.flipObjColl.length === 4) {
1542
1548
  parent.activeObj.flipObjColl = [];
1549
+ parent.activeObj.shapeFlip = '';
1543
1550
  }
1544
1551
  for (var j = 0, len = parent.activeObj.flipObjColl.length; j < len; j++) {
1545
1552
  if (parent.activeObj.flipObjColl[j].toLowerCase() === 'horizontal') {
1546
1553
  canvasDraw.translate(canvasDraw.canvas.width, 0);
1547
1554
  canvasDraw.scale(-1, 1);
1548
- this.updateActPoint('horizontal', canvasDraw);
1555
+ actPoint = this.updateActPoint('horizontal', canvasDraw);
1549
1556
  }
1550
1557
  else if (parent.activeObj.flipObjColl[j].toLowerCase() === 'vertical') {
1551
1558
  canvasDraw.translate(0, canvasDraw.canvas.height);
1552
1559
  canvasDraw.scale(1, -1);
1553
- this.updateActPoint('vertical', canvasDraw);
1560
+ actPoint = this.updateActPoint('vertical', canvasDraw);
1554
1561
  }
1555
1562
  }
1556
1563
  if (parent.activeObj.shapeDegree !== parent.transform.degree) {
@@ -1563,12 +1570,12 @@ var Draw = /** @class */ (function () {
1563
1570
  if (parent.activeObj.flipObjColl[k].toLowerCase() === 'horizontal') {
1564
1571
  canvasDraw.translate(canvasDraw.canvas.width, 0);
1565
1572
  canvasDraw.scale(-1, 1);
1566
- this.updateActPoint('horizontal', canvasDraw);
1573
+ actPoint = this.updateActPoint('horizontal', canvasDraw);
1567
1574
  }
1568
1575
  else if (parent.activeObj.flipObjColl[k].toLowerCase() === 'vertical') {
1569
1576
  canvasDraw.translate(0, canvasDraw.canvas.height);
1570
1577
  canvasDraw.scale(1, -1);
1571
- this.updateActPoint('vertical', canvasDraw);
1578
+ actPoint = this.updateActPoint('vertical', canvasDraw);
1572
1579
  }
1573
1580
  }
1574
1581
  }
@@ -1604,6 +1611,7 @@ var Draw = /** @class */ (function () {
1604
1611
  this.updateActiveObject(actPoint, parent.activeObj);
1605
1612
  }
1606
1613
  }
1614
+ return actPoint;
1607
1615
  };
1608
1616
  Draw.prototype.rotateText = function (canvasDraw) {
1609
1617
  var parent = this.parent;
@@ -1617,6 +1625,9 @@ var Draw = /** @class */ (function () {
1617
1625
  else {
1618
1626
  degree = parent.transform.degree - parent.activeObj.shapeDegree;
1619
1627
  }
1628
+ if (degree === -450) {
1629
+ degree = -90;
1630
+ }
1620
1631
  if (degree < 0) {
1621
1632
  degree = 360 + degree;
1622
1633
  }
@@ -2942,11 +2953,8 @@ var Draw = /** @class */ (function () {
2942
2953
  }
2943
2954
  }
2944
2955
  else {
2945
- if (parent.element.querySelector('#' + parent.element.id + '_toolbar')) {
2946
- parent.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbar').clientHeight;
2947
- }
2948
- else {
2949
- parent.toolbarHeight = 0;
2956
+ if (parent.element.querySelector('#' + parent.element.id + '_toolbarArea')) {
2957
+ parent.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
2950
2958
  }
2951
2959
  }
2952
2960
  parent.reset();
@@ -2989,8 +2997,8 @@ var Draw = /** @class */ (function () {
2989
2997
  parent.clearContext(this.lowerContext);
2990
2998
  parent.clearContext(this.upperContext);
2991
2999
  parent.clearContext(inMemoryContext);
2992
- parent.inMemoryCanvas.width = parent.baseImg.width = this.openURL.width;
2993
- parent.inMemoryCanvas.height = parent.baseImg.height = this.openURL.height;
3000
+ parent.inMemoryCanvas.width = this.openURL.width;
3001
+ parent.inMemoryCanvas.height = this.openURL.height;
2994
3002
  inMemoryContext.putImageData(this.openURL, 0, 0);
2995
3003
  parent.baseImg.src = parent.inMemoryCanvas.toDataURL();
2996
3004
  }
@@ -3146,75 +3154,84 @@ var Draw = /** @class */ (function () {
3146
3154
  Draw.prototype.moveToSelectionRange = function (type, activeObj) {
3147
3155
  var parent = this.parent;
3148
3156
  if (parent.activeObj.shape) {
3149
- if (type === 'rotateleft' || type === 'rotateright') {
3157
+ var isRotated = false;
3158
+ for (var i = 0; i < parent.rotateFlipColl.length; i++) {
3159
+ if (parent.rotateFlipColl[i] === 90 || parent.rotateFlipColl[i] === -90) {
3160
+ isRotated = true;
3161
+ break;
3162
+ }
3163
+ }
3164
+ if (isRotated) {
3150
3165
  var zoomFactor = parent.transform.zoomFactor;
3151
3166
  parent.objColl.push(parent.activeObj);
3152
3167
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
3153
- if (parent.transform.degree % 90 === 0 && parent.transform.degree % 180 !== 0) {
3154
- if (parent.objColl[parent.objColl.length - 1].activePoint.width < activeObj.activePoint.height) {
3155
- for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
3156
- if (parent.objColl[parent.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
3157
- this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
3158
- this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
3159
- if (!isNullOrUndefined(zoomFactor)) {
3160
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3161
- value: { zoomFactor: -0.1, zoomPoint: null } });
3168
+ if (type === 'rotateleft' || type === 'rotateright') {
3169
+ if (parent.transform.degree % 90 === 0 && parent.transform.degree % 180 !== 0) {
3170
+ if (parent.objColl[parent.objColl.length - 1].activePoint.width < activeObj.activePoint.height) {
3171
+ for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
3172
+ if (parent.objColl[parent.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
3173
+ this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
3174
+ this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
3175
+ if (!isNullOrUndefined(zoomFactor)) {
3176
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3177
+ value: { zoomFactor: -0.1, zoomPoint: null } });
3178
+ }
3179
+ break;
3162
3180
  }
3163
- break;
3181
+ zoomFactor += 0.1;
3182
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3183
+ value: { zoomFactor: zoomFactor, zoomPoint: null } });
3164
3184
  }
3165
- zoomFactor += 0.1;
3166
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3167
- value: { zoomFactor: zoomFactor, zoomPoint: null } });
3168
3185
  }
3169
- }
3170
- else {
3171
- for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
3172
- if (parent.objColl[parent.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
3173
- this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
3174
- this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
3175
- if (!isNullOrUndefined(zoomFactor)) {
3176
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3177
- value: { zoomFactor: 0.1, zoomPoint: null } });
3186
+ else {
3187
+ for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
3188
+ if (parent.objColl[parent.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
3189
+ this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
3190
+ this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
3191
+ if (!isNullOrUndefined(zoomFactor)) {
3192
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3193
+ value: { zoomFactor: 0.1, zoomPoint: null } });
3194
+ }
3195
+ break;
3178
3196
  }
3179
- break;
3197
+ zoomFactor -= .1;
3198
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3199
+ value: { zoomFactor: zoomFactor, zoomPoint: null } });
3180
3200
  }
3181
- zoomFactor -= .1;
3182
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3183
- value: { zoomFactor: zoomFactor, zoomPoint: null } });
3184
3201
  }
3185
3202
  }
3186
- }
3187
- else {
3188
- if (parent.objColl[parent.objColl.length - 1].activePoint.height < activeObj.activePoint.width) {
3189
- for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
3190
- if (parent.objColl[parent.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
3191
- this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
3192
- this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
3193
- if (!isNullOrUndefined(zoomFactor)) {
3194
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3195
- value: { zoomFactor: -0.1, zoomPoint: null } });
3203
+ else {
3204
+ if (parent.objColl[parent.objColl.length - 1].activePoint.height < activeObj.activePoint.width) {
3205
+ for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
3206
+ if (parent.objColl[parent.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
3207
+ this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
3208
+ this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
3209
+ if (!isNullOrUndefined(zoomFactor)) {
3210
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3211
+ value: { zoomFactor: -0.1, zoomPoint: null } });
3212
+ }
3213
+ break;
3196
3214
  }
3197
- break;
3215
+ zoomFactor += 0.1;
3216
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3217
+ value: { zoomFactor: zoomFactor, zoomPoint: null } });
3198
3218
  }
3199
- zoomFactor += 0.1;
3200
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3201
- value: { zoomFactor: zoomFactor, zoomPoint: null } });
3202
3219
  }
3203
- }
3204
- else {
3205
- for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
3206
- if (parent.objColl[parent.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
3207
- this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
3208
- this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
3209
- if (!isNullOrUndefined(zoomFactor)) {
3210
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3211
- value: { zoomFactor: 0.1, zoomPoint: null } });
3220
+ else {
3221
+ for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
3222
+ if (parent.objColl[parent.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
3223
+ this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
3224
+ this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
3225
+ if (!isNullOrUndefined(zoomFactor)) {
3226
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3227
+ value: { zoomFactor: 0.1, zoomPoint: null } });
3228
+ }
3229
+ break;
3212
3230
  }
3213
- break;
3231
+ zoomFactor -= .1;
3232
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3233
+ value: { zoomFactor: zoomFactor, zoomPoint: null } });
3214
3234
  }
3215
- zoomFactor -= .1;
3216
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3217
- value: { zoomFactor: zoomFactor, zoomPoint: null } });
3218
3235
  }
3219
3236
  }
3220
3237
  }