@syncfusion/ej2-image-editor 23.1.41 → 23.2.4

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 (67) hide show
  1. package/CHANGELOG.md +12 -2
  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 +305 -163
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +303 -161
  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 +11 -11
  12. package/src/image-editor/action/draw.js +177 -133
  13. package/src/image-editor/action/selection.js +37 -1
  14. package/src/image-editor/action/shape.d.ts +1 -0
  15. package/src/image-editor/action/shape.js +14 -0
  16. package/src/image-editor/action/transform.js +3 -0
  17. package/src/image-editor/base/image-editor.js +3 -1
  18. package/src/image-editor/renderer/toolbar.js +70 -27
  19. package/styles/bootstrap-dark.css +14 -3
  20. package/styles/bootstrap.css +14 -3
  21. package/styles/bootstrap4.css +14 -3
  22. package/styles/bootstrap5-dark.css +14 -3
  23. package/styles/bootstrap5.css +14 -3
  24. package/styles/fabric-dark.css +14 -3
  25. package/styles/fabric.css +14 -3
  26. package/styles/fluent-dark.css +14 -3
  27. package/styles/fluent.css +14 -3
  28. package/styles/highcontrast-light.css +14 -3
  29. package/styles/highcontrast.css +14 -3
  30. package/styles/image-editor/_bootstrap-dark-definition.scss +4 -0
  31. package/styles/image-editor/_bootstrap-definition.scss +4 -0
  32. package/styles/image-editor/_bootstrap4-definition.scss +4 -0
  33. package/styles/image-editor/_bootstrap5-definition.scss +4 -0
  34. package/styles/image-editor/_fabric-dark-definition.scss +4 -0
  35. package/styles/image-editor/_fabric-definition.scss +4 -0
  36. package/styles/image-editor/_fluent-definition.scss +4 -0
  37. package/styles/image-editor/_fusionnew-definition.scss +4 -0
  38. package/styles/image-editor/_highcontrast-definition.scss +4 -0
  39. package/styles/image-editor/_highcontrast-light-definition.scss +4 -0
  40. package/styles/image-editor/_layout.scss +21 -7
  41. package/styles/image-editor/_material-dark-definition.scss +4 -0
  42. package/styles/image-editor/_material-definition.scss +4 -0
  43. package/styles/image-editor/_material3-definition.scss +4 -0
  44. package/styles/image-editor/_tailwind-definition.scss +4 -0
  45. package/styles/image-editor/bootstrap-dark.css +14 -3
  46. package/styles/image-editor/bootstrap.css +14 -3
  47. package/styles/image-editor/bootstrap4.css +14 -3
  48. package/styles/image-editor/bootstrap5-dark.css +14 -3
  49. package/styles/image-editor/bootstrap5.css +14 -3
  50. package/styles/image-editor/fabric-dark.css +14 -3
  51. package/styles/image-editor/fabric.css +14 -3
  52. package/styles/image-editor/fluent-dark.css +14 -3
  53. package/styles/image-editor/fluent.css +14 -3
  54. package/styles/image-editor/highcontrast-light.css +14 -3
  55. package/styles/image-editor/highcontrast.css +14 -3
  56. package/styles/image-editor/material-dark.css +14 -3
  57. package/styles/image-editor/material.css +14 -3
  58. package/styles/image-editor/material3-dark.css +19 -4
  59. package/styles/image-editor/material3.css +19 -4
  60. package/styles/image-editor/tailwind-dark.css +14 -3
  61. package/styles/image-editor/tailwind.css +14 -3
  62. package/styles/material-dark.css +14 -3
  63. package/styles/material.css +14 -3
  64. package/styles/material3-dark.css +19 -4
  65. package/styles/material3.css +19 -4
  66. package/styles/tailwind-dark.css +14 -3
  67. package/styles/tailwind.css +14 -3
@@ -2450,6 +2450,7 @@ var Draw = /** @__PURE__ @class */ (function () {
2450
2450
  };
2451
2451
  Draw.prototype.shapeImage = function (canvasDraw) {
2452
2452
  var parent = this.parent;
2453
+ var actObj = extend({}, parent.activeObj);
2453
2454
  var ctx = parent.activeObj.imageCanvas.getContext('2d');
2454
2455
  if (canvasDraw === this.lowerContext && this.isImageApply) {
2455
2456
  var dimObj = { width: 0, height: 0 };
@@ -2472,41 +2473,17 @@ var Draw = /** @__PURE__ @class */ (function () {
2472
2473
  parent.activeObj.flipObjColl = [];
2473
2474
  parent.activeObj.shapeFlip = '';
2474
2475
  }
2475
- for (var j = 0, len = parent.activeObj.flipObjColl.length; j < len; j++) {
2476
- if (parent.activeObj.flipObjColl[j].toLowerCase() === 'horizontal') {
2477
- canvasDraw.translate(canvasDraw.canvas.width, 0);
2478
- canvasDraw.scale(-1, 1);
2479
- parent.activeObj.activePoint = this.updateActPoint('horizontal', canvasDraw);
2480
- }
2481
- else if (parent.activeObj.flipObjColl[j].toLowerCase() === 'vertical') {
2482
- canvasDraw.translate(0, canvasDraw.canvas.height);
2483
- canvasDraw.scale(1, -1);
2484
- parent.activeObj.activePoint = this.updateActPoint('vertical', canvasDraw);
2485
- }
2486
- }
2487
2476
  imgPoint.startX = ((parent.activeObj.activePoint.width - imgPoint.width) / 2) + parent.activeObj.activePoint.startX;
2488
2477
  imgPoint.startY = ((parent.activeObj.activePoint.height - imgPoint.height) / 2) + parent.activeObj.activePoint.startY;
2489
2478
  var temp = canvasDraw.globalAlpha;
2490
2479
  canvasDraw.globalAlpha = parent.activeObj.imageTransparency;
2491
- if (parent.activeObj.shapeDegree !== parent.transform.degree) {
2480
+ if (actObj.rotateFlipColl && actObj.rotateFlipColl.length > 0) {
2492
2481
  this.rotateImage(canvasDraw);
2493
2482
  }
2494
2483
  else {
2495
2484
  canvasDraw.drawImage(parent.activeObj.imageCanvas, imgPoint.startX, imgPoint.startY, imgPoint.width, imgPoint.height);
2496
2485
  }
2497
2486
  canvasDraw.globalAlpha = temp;
2498
- for (var k = 0, len = parent.activeObj.flipObjColl.length; k < len; k++) {
2499
- if (parent.activeObj.flipObjColl[k].toLowerCase() === 'horizontal') {
2500
- canvasDraw.translate(canvasDraw.canvas.width, 0);
2501
- canvasDraw.scale(-1, 1);
2502
- parent.activeObj.activePoint = this.updateActPoint('horizontal', canvasDraw);
2503
- }
2504
- else if (parent.activeObj.flipObjColl[k].toLowerCase() === 'vertical') {
2505
- canvasDraw.translate(0, canvasDraw.canvas.height);
2506
- canvasDraw.scale(1, -1);
2507
- parent.activeObj.activePoint = this.updateActPoint('vertical', canvasDraw);
2508
- }
2509
- }
2510
2487
  parent.currObjType.isText = false;
2511
2488
  };
2512
2489
  Draw.prototype.shapeText = function (canvasDraw) {
@@ -2514,6 +2491,7 @@ var Draw = /** @__PURE__ @class */ (function () {
2514
2491
  canvasDraw.filter = 'none';
2515
2492
  var parent = this.parent;
2516
2493
  var actPoint = parent.activeObj.activePoint;
2494
+ var actObj = extend({}, parent.activeObj);
2517
2495
  var rows = parent.activeObj.keyHistory.split('\n');
2518
2496
  var height = parent.activeObj.textSettings.fontSize + parent.activeObj.textSettings.fontSize * 0.25;
2519
2497
  var lineHeight = ((height * rows.length) - (parent.activeObj.textSettings.fontSize * rows.length)) / rows.length;
@@ -2553,36 +2531,12 @@ var Draw = /** @__PURE__ @class */ (function () {
2553
2531
  parent.activeObj.flipObjColl = [];
2554
2532
  parent.activeObj.shapeFlip = '';
2555
2533
  }
2556
- for (var j = 0, len = parent.activeObj.flipObjColl.length; j < len; j++) {
2557
- if (parent.activeObj.flipObjColl[j].toLowerCase() === 'horizontal') {
2558
- canvasDraw.translate(canvasDraw.canvas.width, 0);
2559
- canvasDraw.scale(-1, 1);
2560
- actPoint = this.updateActPoint('horizontal', canvasDraw);
2561
- }
2562
- else if (parent.activeObj.flipObjColl[j].toLowerCase() === 'vertical') {
2563
- canvasDraw.translate(0, canvasDraw.canvas.height);
2564
- canvasDraw.scale(1, -1);
2565
- actPoint = this.updateActPoint('vertical', canvasDraw);
2566
- }
2567
- }
2568
- if (parent.activeObj.shapeDegree !== parent.transform.degree) {
2534
+ if (actObj.rotateFlipColl && actObj.rotateFlipColl.length > 0) {
2569
2535
  this.rotateText(canvasDraw);
2570
2536
  }
2571
2537
  else {
2572
2538
  canvasDraw.fillText(text, actPoint.startX + parent.activeObj.textSettings.fontSize * 0.1, actPoint.startY + yPoint);
2573
2539
  }
2574
- for (var k = 0, len = parent.activeObj.flipObjColl.length; k < len; k++) {
2575
- if (parent.activeObj.flipObjColl[k].toLowerCase() === 'horizontal') {
2576
- canvasDraw.translate(canvasDraw.canvas.width, 0);
2577
- canvasDraw.scale(-1, 1);
2578
- actPoint = this.updateActPoint('horizontal', canvasDraw);
2579
- }
2580
- else if (parent.activeObj.flipObjColl[k].toLowerCase() === 'vertical') {
2581
- canvasDraw.translate(0, canvasDraw.canvas.height);
2582
- canvasDraw.scale(1, -1);
2583
- actPoint = this.updateActPoint('vertical', canvasDraw);
2584
- }
2585
- }
2586
2540
  }
2587
2541
  canvasDraw.filter = filter;
2588
2542
  parent.currObjType.isText = false;
@@ -2622,6 +2576,8 @@ var Draw = /** @__PURE__ @class */ (function () {
2622
2576
  Draw.prototype.rotateImage = function (canvasDraw) {
2623
2577
  var parent = this.parent;
2624
2578
  var degree;
2579
+ var actObj = parent.activeObj;
2580
+ var tempActiveObj = extend({}, parent.activeObj, null, true);
2625
2581
  if (parent.activeObj.shapeDegree === 0) {
2626
2582
  degree = parent.transform.degree;
2627
2583
  }
@@ -2642,49 +2598,91 @@ var Draw = /** @__PURE__ @class */ (function () {
2642
2598
  imgPoint.startY = parent.activeObj.activePoint.startY;
2643
2599
  var startX = imgPoint.startX;
2644
2600
  var startY = imgPoint.startY;
2645
- if (degree % 360 === 0 && (parent.transform.degree !== -360 || parent.transform.currFlipState === '')) {
2646
- canvasDraw.drawImage(parent.activeObj.imageCanvas, imgPoint.startX, imgPoint.startY, imgPoint.width, imgPoint.height);
2647
- }
2648
- else if (degree % 90 === 0 && degree % 180 !== 0) {
2649
- canvasDraw.translate(parent.lowerCanvas.width / 2, parent.lowerCanvas.height / 2);
2650
- canvasDraw.rotate(Math.PI / 180 * degree);
2651
- canvasDraw.translate(-parent.lowerCanvas.height / 2, -parent.lowerCanvas.width / 2);
2652
- if (degree % 90 === 0 && degree % 270 !== 0) {
2653
- startY = parent.lowerCanvas.width - (parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width);
2654
- startY += ((parent.activeObj.activePoint.width - imgPoint.height) / 2);
2655
- startX = imgPoint.startY;
2656
- }
2657
- else if (degree % 270 === 0) {
2658
- startX = parent.lowerCanvas.height - (parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height);
2659
- startX += ((parent.activeObj.activePoint.height - imgPoint.width) / 2);
2660
- startY = imgPoint.startX;
2661
- }
2662
- canvasDraw.drawImage(parent.activeObj.imageCanvas, startX, startY, imgPoint.width, imgPoint.height);
2663
- canvasDraw.translate(parent.lowerCanvas.height / 2, parent.lowerCanvas.width / 2);
2664
- canvasDraw.rotate(Math.PI / 180 * -degree);
2665
- canvasDraw.translate(-parent.lowerCanvas.width / 2, -parent.lowerCanvas.height / 2);
2601
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2602
+ var tempDegree;
2603
+ var tempColl = [];
2604
+ canvasDraw.save();
2605
+ for (var i = 0, len = actObj.rotateFlipColl.length; i < len; i++) {
2606
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2607
+ var coll = actObj.rotateFlipColl[i];
2608
+ tempColl.push(coll);
2609
+ if (typeof (coll) === 'number') {
2610
+ if (actObj.shapeDegree === 0) {
2611
+ tempDegree = coll;
2612
+ }
2613
+ else {
2614
+ tempDegree = coll - actObj.shapeDegree;
2615
+ }
2616
+ if (tempDegree === -450) {
2617
+ tempDegree = -90;
2618
+ }
2619
+ if (tempDegree < 0) {
2620
+ tempDegree = 360 + tempDegree;
2621
+ }
2622
+ imgPoint.width = tempDegree % 90 === 0 && tempDegree % 180 !== 0 ? actObj.activePoint.height : actObj.activePoint.width;
2623
+ imgPoint.height = tempDegree % 90 === 0 && tempDegree % 180 !== 0 ? actObj.activePoint.width :
2624
+ actObj.activePoint.height;
2625
+ canvasDraw.translate(canvasDraw.canvas.width / 2, canvasDraw.canvas.height / 2);
2626
+ canvasDraw.rotate(Math.PI / 180 * coll);
2627
+ canvasDraw.translate(-canvasDraw.canvas.height / 2, -canvasDraw.canvas.width / 2);
2628
+ if (tempDegree % 90 === 0 && tempDegree % 270 !== 0) {
2629
+ startY = canvasDraw.canvas.width - (actObj.activePoint.startX + actObj.activePoint.width);
2630
+ startY += ((actObj.activePoint.width - imgPoint.height) / 2);
2631
+ startX = imgPoint.startY;
2632
+ }
2633
+ else if (tempDegree % 270 === 0) {
2634
+ startX = canvasDraw.canvas.height - (actObj.activePoint.startY + actObj.activePoint.height);
2635
+ startX += ((actObj.activePoint.height - imgPoint.width) / 2);
2636
+ startY = imgPoint.startX;
2637
+ }
2638
+ imgPoint.startX = startX;
2639
+ imgPoint.startY = startY;
2640
+ actObj.activePoint.startX = startX;
2641
+ actObj.activePoint.startY = startY;
2642
+ actObj.activePoint.endX = actObj.activePoint.startX + imgPoint.width;
2643
+ actObj.activePoint.endY = actObj.activePoint.startY + imgPoint.height;
2644
+ actObj = this.updateWidthHeight(actObj);
2645
+ }
2646
+ else {
2647
+ if (coll === 'horizontal' && degree % 90 === 0 && degree % 180 !== 0) {
2648
+ coll = 'vertical';
2649
+ }
2650
+ else if (coll === 'vertical' && degree % 90 === 0 && degree % 180 !== 0) {
2651
+ coll = 'horizontal';
2652
+ }
2653
+ if (coll === 'horizontal') {
2654
+ canvasDraw.translate(canvasDraw.canvas.width, 0);
2655
+ canvasDraw.scale(-1, 1);
2656
+ actObj.activePoint = this.updateActPoint('horizontal', canvasDraw);
2657
+ }
2658
+ else if (coll === 'vertical') {
2659
+ canvasDraw.translate(0, canvasDraw.canvas.height);
2660
+ canvasDraw.scale(1, -1);
2661
+ actObj.activePoint = this.updateActPoint('vertical', canvasDraw);
2662
+ }
2663
+ imgPoint.startX = actObj.activePoint.startX;
2664
+ imgPoint.startY = actObj.activePoint.startY;
2665
+ }
2666
+ imgPoint.startX = actObj.activePoint.startX;
2667
+ imgPoint.startY = actObj.activePoint.startY;
2668
+ startX = imgPoint.startX;
2669
+ startY = imgPoint.startY;
2666
2670
  }
2667
- else {
2668
- canvasDraw.translate(parent.lowerCanvas.width / 2, parent.lowerCanvas.height / 2);
2669
- canvasDraw.rotate(Math.PI / 180 * degree);
2670
- startX = parent.lowerCanvas.width - (imgPoint.startX + imgPoint.width);
2671
- startY = parent.lowerCanvas.height - (imgPoint.startY + imgPoint.height);
2672
- canvasDraw.translate(-parent.lowerCanvas.width / 2, -parent.lowerCanvas.height / 2);
2673
- canvasDraw.drawImage(parent.activeObj.imageCanvas, startX, startY, imgPoint.width, imgPoint.height);
2674
- canvasDraw.translate(parent.lowerCanvas.width / 2, parent.lowerCanvas.height / 2);
2675
- canvasDraw.rotate(Math.PI / 180 * -degree);
2676
- canvasDraw.translate(-parent.lowerCanvas.width / 2, -parent.lowerCanvas.height / 2);
2671
+ if (actObj.rotatedAngle !== 0) {
2672
+ parent.notify('shape', { prop: 'setPointCollForShapeRotation', onPropertyChange: false, value: { obj: actObj } });
2677
2673
  }
2674
+ canvasDraw.drawImage(actObj.imageCanvas, imgPoint.startX, imgPoint.startY, imgPoint.width, imgPoint.height);
2675
+ canvasDraw.restore();
2676
+ parent.activeObj = tempActiveObj;
2678
2677
  if (parent.transform.degree === 360 || parent.transform.degree === -360) {
2679
2678
  parent.transform.degree = 0;
2680
2679
  }
2681
2680
  };
2682
2681
  Draw.prototype.rotateText = function (canvasDraw) {
2683
2682
  var parent = this.parent;
2684
- var startX = parent.activeObj.activePoint.startX;
2685
- var startY = parent.activeObj.activePoint.startY;
2686
2683
  var degree;
2687
- var actPoint = parent.activeObj.activePoint;
2684
+ var actObj = parent.activeObj;
2685
+ var tempActiveObj = extend({}, parent.activeObj, null, true);
2688
2686
  if (parent.activeObj.shapeDegree === 0) {
2689
2687
  degree = parent.transform.degree;
2690
2688
  }
@@ -2697,45 +2695,89 @@ var Draw = /** @__PURE__ @class */ (function () {
2697
2695
  if (degree < 0) {
2698
2696
  degree = 360 + degree;
2699
2697
  }
2700
- if (degree % 360 === 0 && (parent.transform.degree !== -360 || parent.transform.currFlipState === '')) {
2701
- startX = actPoint.startX + parent.activeObj.textSettings.fontSize * 0.15;
2702
- startY = actPoint.startY + (actPoint.endY - actPoint.startY);
2703
- var rows = parent.activeObj.keyHistory.split('\n');
2704
- for (var i = 0; i < rows.length; i++) {
2705
- startY = actPoint.startY + (i * parent.activeObj.textSettings.fontSize + parent.activeObj.textSettings.fontSize * 0.25);
2706
- canvasDraw.fillText(rows[i], startX, startY);
2707
- }
2708
- }
2709
- else if (degree % 90 === 0 && degree % 180 !== 0) {
2710
- canvasDraw.translate(parent.lowerCanvas.width / 2, parent.lowerCanvas.height / 2);
2711
- canvasDraw.rotate(Math.PI / 180 * degree);
2712
- canvasDraw.translate(-parent.lowerCanvas.height / 2, -parent.lowerCanvas.width / 2);
2713
- if (degree % 90 === 0 && degree % 270 !== 0) {
2714
- startY = (parent.lowerCanvas.width - actPoint.endX) +
2715
- parent.activeObj.textSettings.fontSize * 0.4;
2716
- startX = actPoint.startY;
2717
- }
2718
- else if (degree % 270 === 0) {
2719
- startX = parent.lowerCanvas.height - actPoint.endY;
2720
- startY = actPoint.startX + parent.activeObj.textSettings.fontSize * 0.4;
2721
- }
2722
- this.textFlipDegree(canvasDraw, startX, startY);
2723
- canvasDraw.translate(parent.lowerCanvas.height / 2, parent.lowerCanvas.width / 2);
2724
- canvasDraw.rotate(Math.PI / 180 * -degree);
2725
- canvasDraw.translate(-parent.lowerCanvas.width / 2, -parent.lowerCanvas.height / 2);
2698
+ var imgPoint = { startX: 0, startY: 0, width: 0, height: 0 };
2699
+ imgPoint.width = degree % 90 === 0 && degree % 180 !== 0 ? actObj.activePoint.height : actObj.activePoint.width;
2700
+ imgPoint.height = degree % 90 === 0 && degree % 180 !== 0 ? actObj.activePoint.width :
2701
+ actObj.activePoint.height;
2702
+ imgPoint.startX = actObj.activePoint.startX;
2703
+ imgPoint.startY = actObj.activePoint.startY;
2704
+ var startX = imgPoint.startX;
2705
+ var startY = imgPoint.startY;
2706
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2707
+ var tempDegree;
2708
+ var tempColl = [];
2709
+ canvasDraw.save();
2710
+ for (var i = 0, len = actObj.rotateFlipColl.length; i < len; i++) {
2711
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2712
+ var coll = actObj.rotateFlipColl[i];
2713
+ tempColl.push(coll);
2714
+ if (typeof (coll) === 'number') {
2715
+ if (actObj.shapeDegree === 0) {
2716
+ tempDegree = coll;
2717
+ }
2718
+ else {
2719
+ tempDegree = coll - actObj.shapeDegree;
2720
+ }
2721
+ if (tempDegree === -450) {
2722
+ tempDegree = -90;
2723
+ }
2724
+ if (tempDegree < 0) {
2725
+ tempDegree = 360 + tempDegree;
2726
+ }
2727
+ imgPoint.width = tempDegree % 90 === 0 && tempDegree % 180 !== 0 ? actObj.activePoint.height : actObj.activePoint.width;
2728
+ imgPoint.height = tempDegree % 90 === 0 && tempDegree % 180 !== 0 ? actObj.activePoint.width :
2729
+ actObj.activePoint.height;
2730
+ canvasDraw.translate(canvasDraw.canvas.width / 2, canvasDraw.canvas.height / 2);
2731
+ canvasDraw.rotate(Math.PI / 180 * coll);
2732
+ canvasDraw.translate(-canvasDraw.canvas.height / 2, -canvasDraw.canvas.width / 2);
2733
+ if (tempDegree % 90 === 0 && tempDegree % 270 !== 0) {
2734
+ startY = (parent.lowerCanvas.width - actObj.activePoint.endX);
2735
+ startX = actObj.activePoint.startY;
2736
+ }
2737
+ else if (tempDegree % 270 === 0) {
2738
+ startX = parent.lowerCanvas.height - actObj.activePoint.endY;
2739
+ startY = actObj.activePoint.startX;
2740
+ }
2741
+ imgPoint.startX = startX;
2742
+ imgPoint.startY = startY;
2743
+ actObj.activePoint.startX = startX;
2744
+ actObj.activePoint.startY = startY;
2745
+ actObj.activePoint.endX = actObj.activePoint.startX + imgPoint.width;
2746
+ actObj.activePoint.endY = actObj.activePoint.startY + imgPoint.height;
2747
+ actObj = this.updateWidthHeight(actObj);
2748
+ }
2749
+ else {
2750
+ if (coll === 'horizontal' && degree % 90 === 0 && degree % 180 !== 0) {
2751
+ coll = 'vertical';
2752
+ }
2753
+ else if (coll === 'vertical' && degree % 90 === 0 && degree % 180 !== 0) {
2754
+ coll = 'horizontal';
2755
+ }
2756
+ if (coll === 'horizontal') {
2757
+ canvasDraw.translate(canvasDraw.canvas.width, 0);
2758
+ canvasDraw.scale(-1, 1);
2759
+ actObj.activePoint = this.updateActPoint('horizontal', canvasDraw);
2760
+ }
2761
+ else if (coll === 'vertical') {
2762
+ canvasDraw.translate(0, canvasDraw.canvas.height);
2763
+ canvasDraw.scale(1, -1);
2764
+ actObj.activePoint = this.updateActPoint('vertical', canvasDraw);
2765
+ }
2766
+ imgPoint.startX = actObj.activePoint.startX;
2767
+ imgPoint.startY = actObj.activePoint.startY;
2768
+ }
2769
+ imgPoint.startX = actObj.activePoint.startX;
2770
+ imgPoint.startY = actObj.activePoint.startY;
2771
+ startX = imgPoint.startX;
2772
+ startY = imgPoint.startY;
2726
2773
  }
2727
- else {
2728
- canvasDraw.translate(parent.lowerCanvas.width / 2, parent.lowerCanvas.height / 2);
2729
- canvasDraw.rotate(Math.PI / 180 * degree);
2730
- startX = parent.lowerCanvas.width - actPoint.endX;
2731
- startY = (parent.lowerCanvas.height - actPoint.endY) +
2732
- parent.activeObj.textSettings.fontSize * 0.4;
2733
- canvasDraw.translate(-parent.lowerCanvas.width / 2, -parent.lowerCanvas.height / 2);
2734
- this.textFlipDegree(canvasDraw, startX, startY);
2735
- canvasDraw.translate(parent.lowerCanvas.width / 2, parent.lowerCanvas.height / 2);
2736
- canvasDraw.rotate(Math.PI / 180 * -degree);
2737
- canvasDraw.translate(-parent.lowerCanvas.width / 2, -parent.lowerCanvas.height / 2);
2774
+ if (actObj.rotatedAngle !== 0) {
2775
+ parent.notify('shape', { prop: 'setPointCollForShapeRotation', onPropertyChange: false, value: { obj: actObj } });
2738
2776
  }
2777
+ startY += actObj.textSettings.fontSize * 0.4;
2778
+ this.textFlipDegree(canvasDraw, startX, startY);
2779
+ canvasDraw.restore();
2780
+ parent.activeObj = tempActiveObj;
2739
2781
  if (parent.transform.degree === 360 || parent.transform.degree === -360) {
2740
2782
  parent.transform.degree = 0;
2741
2783
  }
@@ -3270,22 +3312,23 @@ var Draw = /** @__PURE__ @class */ (function () {
3270
3312
  this.parent.notify('toolbar', { prop: 'getPrevCropObj', onPropertyChange: false, value: { obj: obj1 } });
3271
3313
  this.parent.notify('toolbar', { prop: 'getPrevObj', onPropertyChange: false, value: { obj: obj2 } });
3272
3314
  if (obj1['prevCropObj'] && obj2['prevObj']) {
3273
- if (!aspectRatioElement) {
3274
- parent.objColl = [];
3275
- parent.pointColl = [];
3276
- parent.freehandCounter = 0;
3277
- parent.cropObj = extend({}, obj1['prevCropObj'], {}, true);
3278
- this.setCurrentObj(obj2['prevObj']);
3279
- parent.objColl = obj2['prevObj']['objColl'];
3280
- parent.pointColl = obj2['prevObj']['pointColl'];
3281
- parent.freehandCounter = parent.pointColl.length;
3282
- parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
3283
- parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
3284
- }
3315
+ parent.objColl = [];
3316
+ parent.pointColl = [];
3317
+ parent.freehandCounter = 0;
3318
+ parent.cropObj = extend({}, obj1['prevCropObj'], {}, true);
3319
+ this.setCurrentObj(obj2['prevObj']);
3320
+ parent.objColl = obj2['prevObj']['objColl'];
3321
+ parent.pointColl = obj2['prevObj']['pointColl'];
3322
+ parent.freehandCounter = parent.pointColl.length;
3323
+ parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
3324
+ parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
3325
+ var currObj = parent.currSelectionPoint ?
3326
+ extend({}, parent.currSelectionPoint, {}, true) : null;
3285
3327
  this.parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3286
3328
  value: { zoomFactor: -this.parent.transform.zoomFactor, zoomPoint: null, isResize: true } });
3287
3329
  this.parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3288
3330
  value: { zoomFactor: obj2['prevObj']['defaultZoom'], zoomPoint: null, isResize: true } });
3331
+ parent.currSelectionPoint = currObj;
3289
3332
  if (obj2['prevObj'].zoomFactor) {
3290
3333
  parent.setProperties({ zoomSettings: { zoomFactor: obj2['prevObj'].zoomFactor } }, true);
3291
3334
  }
@@ -3293,6 +3336,7 @@ var Draw = /** @__PURE__ @class */ (function () {
3293
3336
  value: { previousZoomValue: parent.zoomSettings.zoomFactor } });
3294
3337
  }
3295
3338
  parent.isResize = false;
3339
+ parent.notify('transform', { prop: 'setResizedImgAngle', onPropertyChange: false, value: { angle: null } });
3296
3340
  }
3297
3341
  }
3298
3342
  if (parent.togglePen) {
@@ -11049,6 +11093,36 @@ var Selection = /** @__PURE__ @class */ (function () {
11049
11093
  parent.notify('transform', { prop: 'resize', value: { width: point.x, height: point.y, isAspectRatio: false } });
11050
11094
  }
11051
11095
  }
11096
+ if (isBlazor()) {
11097
+ var aspectRatioHeight = this.parent.element.querySelector('.e-ie-toolbar-e-resize-height-input .e-numerictextbox');
11098
+ var aspectRatioWidth = this.parent.element.querySelector('.e-ie-toolbar-e-resize-width-input .e-numerictextbox');
11099
+ if ((blrAspRatElem && blrAspRatElem.classList.contains('e-hidden'))) {
11100
+ if (aspectRatioHeight && aspectRatioHeight.value === "") {
11101
+ aspectRatioHeight.value = aspectRatioHeight.placeholder;
11102
+ aspectRatioHeight.value = Math.floor(parent.img.destHeight).toString();
11103
+ }
11104
+ if (aspectRatioWidth && aspectRatioWidth.value === "") {
11105
+ aspectRatioWidth.value = aspectRatioWidth.placeholder;
11106
+ aspectRatioWidth.value = Math.floor(parent.img.destWidth).toString();
11107
+ }
11108
+ }
11109
+ }
11110
+ else {
11111
+ var aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
11112
+ var aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
11113
+ if (isNullOrUndefined(aspectRatioElement)) {
11114
+ var elem = getComponent(aspectRatioHeight, 'numerictextbox');
11115
+ if (aspectRatioHeight && isNullOrUndefined(elem.value)) {
11116
+ elem.value = parseFloat(elem.placeholder);
11117
+ aspectRatioHeight.value = Math.floor(parent.img.destHeight).toString() + ' px';
11118
+ }
11119
+ elem = getComponent(aspectRatioWidth, 'numerictextbox');
11120
+ if (aspectRatioWidth && isNullOrUndefined(elem.value)) {
11121
+ elem.value = parseFloat(elem.placeholder);
11122
+ aspectRatioWidth.value = Math.floor(parent.img.destWidth).toString() + ' px';
11123
+ }
11124
+ }
11125
+ }
11052
11126
  }
11053
11127
  else {
11054
11128
  var splitWords = void 0;
@@ -12007,6 +12081,12 @@ var Selection = /** @__PURE__ @class */ (function () {
12007
12081
  if (widthElement && heightElement) {
12008
12082
  var heightString = heightElement.value.replace(/,/g, '');
12009
12083
  var widthString = widthElement.value.replace(/,/g, '');
12084
+ if (heightString === '') {
12085
+ heightString = heightElement.placeholder.replace(/,/g, '');
12086
+ }
12087
+ if (widthString === '') {
12088
+ widthString = widthElement.placeholder.replace(/,/g, '');
12089
+ }
12010
12090
  height = parseFloat(heightString);
12011
12091
  width = parseFloat(widthString);
12012
12092
  }
@@ -12246,6 +12326,9 @@ var Shape = /** @__PURE__ @class */ (function () {
12246
12326
  case 'updateObj':
12247
12327
  this.updateObj(args.value['dimObj'], args.value['x'], args.value['y']);
12248
12328
  break;
12329
+ case 'updateSelectionChangeEventArgs':
12330
+ this.updateSelectionChangeEventArgs(args.value['selectionSettings']);
12331
+ break;
12249
12332
  }
12250
12333
  };
12251
12334
  Shape.prototype.getModuleName = function () {
@@ -12812,6 +12895,17 @@ var Shape = /** @__PURE__ @class */ (function () {
12812
12895
  }
12813
12896
  }
12814
12897
  };
12898
+ Shape.prototype.updateSelectionChangeEventArgs = function (selectionSettings) {
12899
+ var parent = this.parent;
12900
+ parent.activeObj.activePoint.startX = selectionSettings.startX;
12901
+ parent.activeObj.activePoint.startY = selectionSettings.startY;
12902
+ if (selectionSettings.width && selectionSettings.height) {
12903
+ parent.activeObj.activePoint.width = selectionSettings.width;
12904
+ parent.activeObj.activePoint.height = selectionSettings.height;
12905
+ parent.activeObj.activePoint.endX = parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width;
12906
+ parent.activeObj.activePoint.endY = parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height;
12907
+ }
12908
+ };
12815
12909
  Shape.prototype.addLetter = function (letter) {
12816
12910
  var parent = this.parent;
12817
12911
  if (parent.textArea.style.display === 'none' && (parent.currObjType.isText || parent.activeObj.shape === 'text')) {
@@ -15179,6 +15273,9 @@ var Transform = /** @__PURE__ @class */ (function () {
15179
15273
  case 'resize':
15180
15274
  this.resize(args.value['width'], args.value['height'], args.value['isAspectRatio']);
15181
15275
  break;
15276
+ case 'setResizedImgAngle':
15277
+ this.resizedImgAngle = args.value['angle'];
15278
+ break;
15182
15279
  case 'reset':
15183
15280
  this.reset();
15184
15281
  break;
@@ -19158,6 +19255,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
19158
19255
  this.afterCropActions = [];
19159
19256
  this.currentFilter = '';
19160
19257
  this.tempFrameZoomLevel = null;
19258
+ this.cxtTbarHeight = null;
19161
19259
  var obj_1 = { initialZoomValue: false };
19162
19260
  this.notify('draw', { prop: 'getInitialZoomValue', onPropertyChange: false, value: { obj: obj_1 } });
19163
19261
  if (obj_1['initialZoomValue']) {
@@ -19805,7 +19903,8 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
19805
19903
  value = 'vertical';
19806
19904
  }
19807
19905
  for (var i = 0; i < this.objColl.length; i++) {
19808
- if (this.objColl[i].shape === 'image') {
19906
+ var shape = this.objColl[i].shape;
19907
+ if (shape === 'image' || shape === 'text') {
19809
19908
  if (isNullOrUndefined(this.objColl[i].rotateFlipColl)) {
19810
19909
  this.objColl[i].rotateFlipColl = [];
19811
19910
  }
@@ -22224,19 +22323,32 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
22224
22323
  var parent = this.parent;
22225
22324
  var aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
22226
22325
  var aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
22227
- var aspectRatioIcon = parent.element.querySelector('#' + parent.element.id + '_aspectratio');
22326
+ var icon = parent.element.querySelector('#' + parent.element.id + '_aspectratio');
22228
22327
  var originalWidth = parent.img.destWidth;
22229
22328
  var originalHeight = parent.img.destHeight;
22230
22329
  var aspectRatioHeightValue = parseFloat(aspectRatioHeight.value);
22231
22330
  var width = Math.floor((aspectRatioHeightValue / (originalHeight / originalWidth)));
22232
- if (aspectRatioIcon) {
22331
+ var widthNumeric = getComponent(aspectRatioWidth, 'numerictextbox');
22332
+ if (icon) {
22233
22333
  if (width != null && !isNaN(width)) {
22234
- getComponent(aspectRatioWidth, 'numerictextbox').value = width;
22235
- aspectRatioWidth.value = width.toString() + ' px';
22334
+ if (isNullOrUndefined(widthNumeric.value)) {
22335
+ widthNumeric.placeholder = width + ' px';
22336
+ aspectRatioWidth.placeholder = width.toString() + ' px';
22337
+ }
22338
+ else {
22339
+ widthNumeric.value = width;
22340
+ aspectRatioWidth.value = width.toString() + ' px';
22341
+ }
22236
22342
  }
22237
22343
  else {
22238
- getComponent(aspectRatioWidth, 'numerictextbox').value = 0;
22239
- aspectRatioWidth.value = '0 px';
22344
+ if (isNullOrUndefined(widthNumeric.value)) {
22345
+ widthNumeric.placeholder = '0 px';
22346
+ aspectRatioWidth.placeholder = '0 px';
22347
+ }
22348
+ else {
22349
+ widthNumeric.value = 0;
22350
+ aspectRatioWidth.value = '0 px';
22351
+ }
22240
22352
  }
22241
22353
  }
22242
22354
  };
@@ -22245,37 +22357,53 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
22245
22357
  var parent = this.parent;
22246
22358
  var aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
22247
22359
  var aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
22248
- var aspectRatioIcon = parent.element.querySelector('#' + parent.element.id + '_aspectratio');
22360
+ var icon = parent.element.querySelector('#' + parent.element.id + '_aspectratio');
22249
22361
  var originalWidth = parent.img.destWidth;
22250
22362
  var originalHeight = parent.img.destHeight;
22251
22363
  var aspectRatioWidthValue = parseFloat(aspectRatioWidth.value);
22252
22364
  var height = Math.floor((aspectRatioWidthValue / (originalWidth / originalHeight)));
22253
- if (aspectRatioIcon && !isNaN(height)) {
22254
- getComponent(aspectRatioHeight, 'numerictextbox').value = height;
22255
- aspectRatioHeight.value = height.toString() + ' px';
22256
- }
22257
- else {
22258
- getComponent(aspectRatioHeight, 'numerictextbox').value = 0;
22259
- aspectRatioHeight.value = '0 px';
22365
+ var heightNumeric = getComponent(aspectRatioHeight, 'numerictextbox');
22366
+ if (icon) {
22367
+ if (!isNaN(height)) {
22368
+ if (isNullOrUndefined(heightNumeric.value)) {
22369
+ heightNumeric.placeholder = height + ' px';
22370
+ aspectRatioHeight.placeholder = height.toString() + ' px';
22371
+ }
22372
+ else {
22373
+ heightNumeric.value = height;
22374
+ aspectRatioHeight.value = height.toString() + ' px';
22375
+ }
22376
+ }
22377
+ else {
22378
+ if (isNullOrUndefined(heightNumeric.value)) {
22379
+ heightNumeric.placeholder = '0 px';
22380
+ aspectRatioHeight.placeholder = '0 px';
22381
+ }
22382
+ else {
22383
+ heightNumeric.value = 0;
22384
+ aspectRatioHeight.value = '0 px';
22385
+ }
22386
+ }
22260
22387
  }
22261
22388
  };
22262
22389
  ToolbarModule.prototype.getResizeToolbarItem = function () {
22263
22390
  var toolbarItems = [];
22391
+ var isResize = this.parent.aspectWidth && this.parent.aspectHeight ? true : false;
22264
22392
  var spanWidth = document.createElement('span');
22265
22393
  spanWidth.innerHTML = this.l10n.getConstant('W');
22266
22394
  toolbarItems.push({ id: this.parent.element.id + '_width', cssClass: 'e-ie-resize-width', template: spanWidth, align: 'Center' });
22267
22395
  toolbarItems.push({ id: this.parent.element.id + '_resizeWidth', prefixIcon: 'e-icons e-anti-clock-wise',
22268
22396
  tooltipText: this.l10n.getConstant('Width'), align: 'Center', type: 'Input', template: new NumericTextBox({ width: 75, htmlAttributes: { maxLength: "4" },
22269
- showSpinButton: false, value: (this.parent.aspectWidth && this.parent.aspectHeight) ? this.parent.aspectWidth : Math.ceil(this.parent.img.destWidth),
22270
- format: '###.## px' })
22397
+ showSpinButton: false, value: isResize ? this.parent.aspectWidth : null,
22398
+ placeholder: isResize ? null : Math.ceil(this.parent.img.srcWidth).toString(), format: '###.## px' })
22271
22399
  });
22272
22400
  var spanHeight = document.createElement('span');
22273
22401
  spanHeight.innerHTML = this.l10n.getConstant('H');
22274
22402
  toolbarItems.push({ id: this.parent.element.id + '_height', cssClass: 'e-ie-resize-height', template: spanHeight, align: 'Center' });
22275
22403
  toolbarItems.push({ id: this.parent.element.id + '_resizeHeight', prefixIcon: 'e-icons e-clock-wise',
22276
22404
  tooltipText: this.l10n.getConstant('Height'), align: 'Center', type: 'Input', template: new NumericTextBox({ width: 75, htmlAttributes: { maxLength: "4" },
22277
- showSpinButton: false, value: (this.parent.aspectWidth && this.parent.aspectHeight) ? this.parent.aspectHeight : Math.ceil(this.parent.img.destHeight),
22278
- format: '###.## px' })
22405
+ showSpinButton: false, value: isResize ? this.parent.aspectHeight : null,
22406
+ placeholder: isResize ? null : Math.ceil(this.parent.img.srcHeight).toString(), format: '###.## px' })
22279
22407
  });
22280
22408
  if (!this.isAspectRatio) {
22281
22409
  toolbarItems.push({ id: this.parent.element.id + '_aspectratio', prefixIcon: 'e-icons e-lock', align: 'Center', tooltipText: this.l10n.getConstant('AspectRatio'), type: 'Button' });
@@ -22345,14 +22473,11 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
22345
22473
  var parent = this.parent;
22346
22474
  var aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
22347
22475
  var aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
22348
- var aspectRatio = parent.element.querySelector('#' + parent.element.id + '_aspectratio');
22349
- if (aspectRatio) {
22350
- if (!isNullOrUndefined(aspectRatioHeight)) {
22351
- aspectRatioWidth.addEventListener('keyup', this.heightAspectRatio.bind(this));
22352
- }
22353
- if (!isNullOrUndefined(aspectRatioWidth)) {
22354
- aspectRatioHeight.addEventListener('keyup', this.widthAspectRatio.bind(this));
22355
- }
22476
+ if (!isNullOrUndefined(aspectRatioHeight)) {
22477
+ aspectRatioWidth.addEventListener('keyup', this.heightAspectRatio.bind(this));
22478
+ }
22479
+ if (!isNullOrUndefined(aspectRatioWidth)) {
22480
+ aspectRatioHeight.addEventListener('keyup', this.widthAspectRatio.bind(this));
22356
22481
  }
22357
22482
  };
22358
22483
  ToolbarModule.prototype.enableDisableTbrBtn = function () {
@@ -22431,7 +22556,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
22431
22556
  };
22432
22557
  ToolbarModule.prototype.fileSelect = function (inputElement, args) {
22433
22558
  var type = inputElement.files[0].type.split('/')[1];
22434
- if (type === 'png' || type === 'jpg' || type === 'jpeg' || type === 'svg') {
22559
+ if (type === 'png' || type === 'jpg' || type === 'jpeg' || type === 'svg' || type === 'svg+xml') {
22435
22560
  this.parent.notify('draw', { prop: 'fileSelect', value: { inputElement: inputElement, args: args } });
22436
22561
  }
22437
22562
  else {
@@ -24949,6 +25074,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
24949
25074
  ToolbarModule.prototype.performDefTbrClick = function (type, isContextualToolbar, isDisabledAdjustment, isDisabledFilter, isFilterFinetune) {
24950
25075
  var parent = this.parent;
24951
25076
  var zoomIn = parent.element.querySelector('#' + parent.element.id + '_zoomIn');
25077
+ var aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
25078
+ var aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
24952
25079
  var isCropSelection = false;
24953
25080
  var panBtn;
24954
25081
  var splitWords;
@@ -25028,12 +25155,27 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25028
25155
  case 'aspectratio':
25029
25156
  if (!parent.isCircleCrop && (isNullOrUndefined(parent.currSelectionPoint)) ||
25030
25157
  (parent.currSelectionPoint && parent.currSelectionPoint.shape !== 'crop-circle')) {
25158
+ if (getComponent(aspectRatioWidth, 'numerictextbox').value) {
25159
+ parent.aspectWidth = getComponent(aspectRatioWidth, 'numerictextbox').value;
25160
+ parent.aspectHeight = getComponent(aspectRatioHeight, 'numerictextbox').value;
25161
+ parent.notify('transform', { prop: 'resize', value: { width: parent.aspectWidth, height: null, isAspectRatio: true } });
25162
+ }
25031
25163
  parent.resizeSrc = { startX: parent.img.srcLeft, startY: parent.img.srcTop, width: parent.img.srcWidth,
25032
25164
  height: parent.img.srcHeight };
25033
25165
  this.refreshToolbar('resize');
25034
25166
  }
25035
25167
  break;
25036
25168
  case 'nonaspectratio':
25169
+ if (getComponent(aspectRatioWidth, 'numerictextbox').value ||
25170
+ getComponent(aspectRatioHeight, 'numerictextbox').value) {
25171
+ parent.aspectWidth = getComponent(aspectRatioWidth, 'numerictextbox').value ?
25172
+ getComponent(aspectRatioWidth, 'numerictextbox').value :
25173
+ parseFloat(getComponent(aspectRatioWidth, 'numerictextbox').placeholder);
25174
+ parent.aspectHeight = getComponent(aspectRatioHeight, 'numerictextbox').value ?
25175
+ getComponent(aspectRatioHeight, 'numerictextbox').value :
25176
+ parseFloat(getComponent(aspectRatioHeight, 'numerictextbox').placeholder);
25177
+ parent.notify('transform', { prop: 'resize', value: { width: parent.aspectWidth, height: parent.aspectHeight, isAspectRatio: false } });
25178
+ }
25037
25179
  parent.resizeSrc = { startX: parent.img.srcLeft, startY: parent.img.srcTop, width: parent.img.srcWidth,
25038
25180
  height: parent.img.srcHeight };
25039
25181
  this.refreshToolbar('resize');