@syncfusion/ej2-image-editor 23.1.43 → 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 +4 -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 +304 -162
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +302 -160
  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 +69 -26
  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
@@ -2448,6 +2448,7 @@ class Draw {
2448
2448
  }
2449
2449
  shapeImage(canvasDraw) {
2450
2450
  const parent = this.parent;
2451
+ const actObj = extend({}, parent.activeObj);
2451
2452
  const ctx = parent.activeObj.imageCanvas.getContext('2d');
2452
2453
  if (canvasDraw === this.lowerContext && this.isImageApply) {
2453
2454
  let dimObj = { width: 0, height: 0 };
@@ -2470,41 +2471,17 @@ class Draw {
2470
2471
  parent.activeObj.flipObjColl = [];
2471
2472
  parent.activeObj.shapeFlip = '';
2472
2473
  }
2473
- for (let j = 0, len = parent.activeObj.flipObjColl.length; j < len; j++) {
2474
- if (parent.activeObj.flipObjColl[j].toLowerCase() === 'horizontal') {
2475
- canvasDraw.translate(canvasDraw.canvas.width, 0);
2476
- canvasDraw.scale(-1, 1);
2477
- parent.activeObj.activePoint = this.updateActPoint('horizontal', canvasDraw);
2478
- }
2479
- else if (parent.activeObj.flipObjColl[j].toLowerCase() === 'vertical') {
2480
- canvasDraw.translate(0, canvasDraw.canvas.height);
2481
- canvasDraw.scale(1, -1);
2482
- parent.activeObj.activePoint = this.updateActPoint('vertical', canvasDraw);
2483
- }
2484
- }
2485
2474
  imgPoint.startX = ((parent.activeObj.activePoint.width - imgPoint.width) / 2) + parent.activeObj.activePoint.startX;
2486
2475
  imgPoint.startY = ((parent.activeObj.activePoint.height - imgPoint.height) / 2) + parent.activeObj.activePoint.startY;
2487
2476
  const temp = canvasDraw.globalAlpha;
2488
2477
  canvasDraw.globalAlpha = parent.activeObj.imageTransparency;
2489
- if (parent.activeObj.shapeDegree !== parent.transform.degree) {
2478
+ if (actObj.rotateFlipColl && actObj.rotateFlipColl.length > 0) {
2490
2479
  this.rotateImage(canvasDraw);
2491
2480
  }
2492
2481
  else {
2493
2482
  canvasDraw.drawImage(parent.activeObj.imageCanvas, imgPoint.startX, imgPoint.startY, imgPoint.width, imgPoint.height);
2494
2483
  }
2495
2484
  canvasDraw.globalAlpha = temp;
2496
- for (let k = 0, len = parent.activeObj.flipObjColl.length; k < len; k++) {
2497
- if (parent.activeObj.flipObjColl[k].toLowerCase() === 'horizontal') {
2498
- canvasDraw.translate(canvasDraw.canvas.width, 0);
2499
- canvasDraw.scale(-1, 1);
2500
- parent.activeObj.activePoint = this.updateActPoint('horizontal', canvasDraw);
2501
- }
2502
- else if (parent.activeObj.flipObjColl[k].toLowerCase() === 'vertical') {
2503
- canvasDraw.translate(0, canvasDraw.canvas.height);
2504
- canvasDraw.scale(1, -1);
2505
- parent.activeObj.activePoint = this.updateActPoint('vertical', canvasDraw);
2506
- }
2507
- }
2508
2485
  parent.currObjType.isText = false;
2509
2486
  }
2510
2487
  shapeText(canvasDraw) {
@@ -2512,6 +2489,7 @@ class Draw {
2512
2489
  canvasDraw.filter = 'none';
2513
2490
  const parent = this.parent;
2514
2491
  let actPoint = parent.activeObj.activePoint;
2492
+ const actObj = extend({}, parent.activeObj);
2515
2493
  const rows = parent.activeObj.keyHistory.split('\n');
2516
2494
  const height = parent.activeObj.textSettings.fontSize + parent.activeObj.textSettings.fontSize * 0.25;
2517
2495
  const lineHeight = ((height * rows.length) - (parent.activeObj.textSettings.fontSize * rows.length)) / rows.length;
@@ -2551,36 +2529,12 @@ class Draw {
2551
2529
  parent.activeObj.flipObjColl = [];
2552
2530
  parent.activeObj.shapeFlip = '';
2553
2531
  }
2554
- for (let j = 0, len = parent.activeObj.flipObjColl.length; j < len; j++) {
2555
- if (parent.activeObj.flipObjColl[j].toLowerCase() === 'horizontal') {
2556
- canvasDraw.translate(canvasDraw.canvas.width, 0);
2557
- canvasDraw.scale(-1, 1);
2558
- actPoint = this.updateActPoint('horizontal', canvasDraw);
2559
- }
2560
- else if (parent.activeObj.flipObjColl[j].toLowerCase() === 'vertical') {
2561
- canvasDraw.translate(0, canvasDraw.canvas.height);
2562
- canvasDraw.scale(1, -1);
2563
- actPoint = this.updateActPoint('vertical', canvasDraw);
2564
- }
2565
- }
2566
- if (parent.activeObj.shapeDegree !== parent.transform.degree) {
2532
+ if (actObj.rotateFlipColl && actObj.rotateFlipColl.length > 0) {
2567
2533
  this.rotateText(canvasDraw);
2568
2534
  }
2569
2535
  else {
2570
2536
  canvasDraw.fillText(text, actPoint.startX + parent.activeObj.textSettings.fontSize * 0.1, actPoint.startY + yPoint);
2571
2537
  }
2572
- for (let k = 0, len = parent.activeObj.flipObjColl.length; k < len; k++) {
2573
- if (parent.activeObj.flipObjColl[k].toLowerCase() === 'horizontal') {
2574
- canvasDraw.translate(canvasDraw.canvas.width, 0);
2575
- canvasDraw.scale(-1, 1);
2576
- actPoint = this.updateActPoint('horizontal', canvasDraw);
2577
- }
2578
- else if (parent.activeObj.flipObjColl[k].toLowerCase() === 'vertical') {
2579
- canvasDraw.translate(0, canvasDraw.canvas.height);
2580
- canvasDraw.scale(1, -1);
2581
- actPoint = this.updateActPoint('vertical', canvasDraw);
2582
- }
2583
- }
2584
2538
  }
2585
2539
  canvasDraw.filter = filter;
2586
2540
  parent.currObjType.isText = false;
@@ -2620,6 +2574,8 @@ class Draw {
2620
2574
  rotateImage(canvasDraw) {
2621
2575
  const parent = this.parent;
2622
2576
  let degree;
2577
+ let actObj = parent.activeObj;
2578
+ const tempActiveObj = extend({}, parent.activeObj, null, true);
2623
2579
  if (parent.activeObj.shapeDegree === 0) {
2624
2580
  degree = parent.transform.degree;
2625
2581
  }
@@ -2640,49 +2596,91 @@ class Draw {
2640
2596
  imgPoint.startY = parent.activeObj.activePoint.startY;
2641
2597
  let startX = imgPoint.startX;
2642
2598
  let startY = imgPoint.startY;
2643
- if (degree % 360 === 0 && (parent.transform.degree !== -360 || parent.transform.currFlipState === '')) {
2644
- canvasDraw.drawImage(parent.activeObj.imageCanvas, imgPoint.startX, imgPoint.startY, imgPoint.width, imgPoint.height);
2645
- }
2646
- else if (degree % 90 === 0 && degree % 180 !== 0) {
2647
- canvasDraw.translate(parent.lowerCanvas.width / 2, parent.lowerCanvas.height / 2);
2648
- canvasDraw.rotate(Math.PI / 180 * degree);
2649
- canvasDraw.translate(-parent.lowerCanvas.height / 2, -parent.lowerCanvas.width / 2);
2650
- if (degree % 90 === 0 && degree % 270 !== 0) {
2651
- startY = parent.lowerCanvas.width - (parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width);
2652
- startY += ((parent.activeObj.activePoint.width - imgPoint.height) / 2);
2653
- startX = imgPoint.startY;
2654
- }
2655
- else if (degree % 270 === 0) {
2656
- startX = parent.lowerCanvas.height - (parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height);
2657
- startX += ((parent.activeObj.activePoint.height - imgPoint.width) / 2);
2658
- startY = imgPoint.startX;
2659
- }
2660
- canvasDraw.drawImage(parent.activeObj.imageCanvas, startX, startY, imgPoint.width, imgPoint.height);
2661
- canvasDraw.translate(parent.lowerCanvas.height / 2, parent.lowerCanvas.width / 2);
2662
- canvasDraw.rotate(Math.PI / 180 * -degree);
2663
- canvasDraw.translate(-parent.lowerCanvas.width / 2, -parent.lowerCanvas.height / 2);
2599
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2600
+ let tempDegree;
2601
+ const tempColl = [];
2602
+ canvasDraw.save();
2603
+ for (let i = 0, len = actObj.rotateFlipColl.length; i < len; i++) {
2604
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2605
+ let coll = actObj.rotateFlipColl[i];
2606
+ tempColl.push(coll);
2607
+ if (typeof (coll) === 'number') {
2608
+ if (actObj.shapeDegree === 0) {
2609
+ tempDegree = coll;
2610
+ }
2611
+ else {
2612
+ tempDegree = coll - actObj.shapeDegree;
2613
+ }
2614
+ if (tempDegree === -450) {
2615
+ tempDegree = -90;
2616
+ }
2617
+ if (tempDegree < 0) {
2618
+ tempDegree = 360 + tempDegree;
2619
+ }
2620
+ imgPoint.width = tempDegree % 90 === 0 && tempDegree % 180 !== 0 ? actObj.activePoint.height : actObj.activePoint.width;
2621
+ imgPoint.height = tempDegree % 90 === 0 && tempDegree % 180 !== 0 ? actObj.activePoint.width :
2622
+ actObj.activePoint.height;
2623
+ canvasDraw.translate(canvasDraw.canvas.width / 2, canvasDraw.canvas.height / 2);
2624
+ canvasDraw.rotate(Math.PI / 180 * coll);
2625
+ canvasDraw.translate(-canvasDraw.canvas.height / 2, -canvasDraw.canvas.width / 2);
2626
+ if (tempDegree % 90 === 0 && tempDegree % 270 !== 0) {
2627
+ startY = canvasDraw.canvas.width - (actObj.activePoint.startX + actObj.activePoint.width);
2628
+ startY += ((actObj.activePoint.width - imgPoint.height) / 2);
2629
+ startX = imgPoint.startY;
2630
+ }
2631
+ else if (tempDegree % 270 === 0) {
2632
+ startX = canvasDraw.canvas.height - (actObj.activePoint.startY + actObj.activePoint.height);
2633
+ startX += ((actObj.activePoint.height - imgPoint.width) / 2);
2634
+ startY = imgPoint.startX;
2635
+ }
2636
+ imgPoint.startX = startX;
2637
+ imgPoint.startY = startY;
2638
+ actObj.activePoint.startX = startX;
2639
+ actObj.activePoint.startY = startY;
2640
+ actObj.activePoint.endX = actObj.activePoint.startX + imgPoint.width;
2641
+ actObj.activePoint.endY = actObj.activePoint.startY + imgPoint.height;
2642
+ actObj = this.updateWidthHeight(actObj);
2643
+ }
2644
+ else {
2645
+ if (coll === 'horizontal' && degree % 90 === 0 && degree % 180 !== 0) {
2646
+ coll = 'vertical';
2647
+ }
2648
+ else if (coll === 'vertical' && degree % 90 === 0 && degree % 180 !== 0) {
2649
+ coll = 'horizontal';
2650
+ }
2651
+ if (coll === 'horizontal') {
2652
+ canvasDraw.translate(canvasDraw.canvas.width, 0);
2653
+ canvasDraw.scale(-1, 1);
2654
+ actObj.activePoint = this.updateActPoint('horizontal', canvasDraw);
2655
+ }
2656
+ else if (coll === 'vertical') {
2657
+ canvasDraw.translate(0, canvasDraw.canvas.height);
2658
+ canvasDraw.scale(1, -1);
2659
+ actObj.activePoint = this.updateActPoint('vertical', canvasDraw);
2660
+ }
2661
+ imgPoint.startX = actObj.activePoint.startX;
2662
+ imgPoint.startY = actObj.activePoint.startY;
2663
+ }
2664
+ imgPoint.startX = actObj.activePoint.startX;
2665
+ imgPoint.startY = actObj.activePoint.startY;
2666
+ startX = imgPoint.startX;
2667
+ startY = imgPoint.startY;
2664
2668
  }
2665
- else {
2666
- canvasDraw.translate(parent.lowerCanvas.width / 2, parent.lowerCanvas.height / 2);
2667
- canvasDraw.rotate(Math.PI / 180 * degree);
2668
- startX = parent.lowerCanvas.width - (imgPoint.startX + imgPoint.width);
2669
- startY = parent.lowerCanvas.height - (imgPoint.startY + imgPoint.height);
2670
- canvasDraw.translate(-parent.lowerCanvas.width / 2, -parent.lowerCanvas.height / 2);
2671
- canvasDraw.drawImage(parent.activeObj.imageCanvas, startX, startY, imgPoint.width, imgPoint.height);
2672
- canvasDraw.translate(parent.lowerCanvas.width / 2, parent.lowerCanvas.height / 2);
2673
- canvasDraw.rotate(Math.PI / 180 * -degree);
2674
- canvasDraw.translate(-parent.lowerCanvas.width / 2, -parent.lowerCanvas.height / 2);
2669
+ if (actObj.rotatedAngle !== 0) {
2670
+ parent.notify('shape', { prop: 'setPointCollForShapeRotation', onPropertyChange: false, value: { obj: actObj } });
2675
2671
  }
2672
+ canvasDraw.drawImage(actObj.imageCanvas, imgPoint.startX, imgPoint.startY, imgPoint.width, imgPoint.height);
2673
+ canvasDraw.restore();
2674
+ parent.activeObj = tempActiveObj;
2676
2675
  if (parent.transform.degree === 360 || parent.transform.degree === -360) {
2677
2676
  parent.transform.degree = 0;
2678
2677
  }
2679
2678
  }
2680
2679
  rotateText(canvasDraw) {
2681
2680
  const parent = this.parent;
2682
- let startX = parent.activeObj.activePoint.startX;
2683
- let startY = parent.activeObj.activePoint.startY;
2684
2681
  let degree;
2685
- const actPoint = parent.activeObj.activePoint;
2682
+ let actObj = parent.activeObj;
2683
+ const tempActiveObj = extend({}, parent.activeObj, null, true);
2686
2684
  if (parent.activeObj.shapeDegree === 0) {
2687
2685
  degree = parent.transform.degree;
2688
2686
  }
@@ -2695,45 +2693,89 @@ class Draw {
2695
2693
  if (degree < 0) {
2696
2694
  degree = 360 + degree;
2697
2695
  }
2698
- if (degree % 360 === 0 && (parent.transform.degree !== -360 || parent.transform.currFlipState === '')) {
2699
- startX = actPoint.startX + parent.activeObj.textSettings.fontSize * 0.15;
2700
- startY = actPoint.startY + (actPoint.endY - actPoint.startY);
2701
- const rows = parent.activeObj.keyHistory.split('\n');
2702
- for (let i = 0; i < rows.length; i++) {
2703
- startY = actPoint.startY + (i * parent.activeObj.textSettings.fontSize + parent.activeObj.textSettings.fontSize * 0.25);
2704
- canvasDraw.fillText(rows[i], startX, startY);
2705
- }
2706
- }
2707
- else if (degree % 90 === 0 && degree % 180 !== 0) {
2708
- canvasDraw.translate(parent.lowerCanvas.width / 2, parent.lowerCanvas.height / 2);
2709
- canvasDraw.rotate(Math.PI / 180 * degree);
2710
- canvasDraw.translate(-parent.lowerCanvas.height / 2, -parent.lowerCanvas.width / 2);
2711
- if (degree % 90 === 0 && degree % 270 !== 0) {
2712
- startY = (parent.lowerCanvas.width - actPoint.endX) +
2713
- parent.activeObj.textSettings.fontSize * 0.4;
2714
- startX = actPoint.startY;
2715
- }
2716
- else if (degree % 270 === 0) {
2717
- startX = parent.lowerCanvas.height - actPoint.endY;
2718
- startY = actPoint.startX + parent.activeObj.textSettings.fontSize * 0.4;
2719
- }
2720
- this.textFlipDegree(canvasDraw, startX, startY);
2721
- canvasDraw.translate(parent.lowerCanvas.height / 2, parent.lowerCanvas.width / 2);
2722
- canvasDraw.rotate(Math.PI / 180 * -degree);
2723
- canvasDraw.translate(-parent.lowerCanvas.width / 2, -parent.lowerCanvas.height / 2);
2696
+ const imgPoint = { startX: 0, startY: 0, width: 0, height: 0 };
2697
+ imgPoint.width = degree % 90 === 0 && degree % 180 !== 0 ? actObj.activePoint.height : actObj.activePoint.width;
2698
+ imgPoint.height = degree % 90 === 0 && degree % 180 !== 0 ? actObj.activePoint.width :
2699
+ actObj.activePoint.height;
2700
+ imgPoint.startX = actObj.activePoint.startX;
2701
+ imgPoint.startY = actObj.activePoint.startY;
2702
+ let startX = imgPoint.startX;
2703
+ let startY = imgPoint.startY;
2704
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2705
+ let tempDegree;
2706
+ const tempColl = [];
2707
+ canvasDraw.save();
2708
+ for (let i = 0, len = actObj.rotateFlipColl.length; i < len; i++) {
2709
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2710
+ let coll = actObj.rotateFlipColl[i];
2711
+ tempColl.push(coll);
2712
+ if (typeof (coll) === 'number') {
2713
+ if (actObj.shapeDegree === 0) {
2714
+ tempDegree = coll;
2715
+ }
2716
+ else {
2717
+ tempDegree = coll - actObj.shapeDegree;
2718
+ }
2719
+ if (tempDegree === -450) {
2720
+ tempDegree = -90;
2721
+ }
2722
+ if (tempDegree < 0) {
2723
+ tempDegree = 360 + tempDegree;
2724
+ }
2725
+ imgPoint.width = tempDegree % 90 === 0 && tempDegree % 180 !== 0 ? actObj.activePoint.height : actObj.activePoint.width;
2726
+ imgPoint.height = tempDegree % 90 === 0 && tempDegree % 180 !== 0 ? actObj.activePoint.width :
2727
+ actObj.activePoint.height;
2728
+ canvasDraw.translate(canvasDraw.canvas.width / 2, canvasDraw.canvas.height / 2);
2729
+ canvasDraw.rotate(Math.PI / 180 * coll);
2730
+ canvasDraw.translate(-canvasDraw.canvas.height / 2, -canvasDraw.canvas.width / 2);
2731
+ if (tempDegree % 90 === 0 && tempDegree % 270 !== 0) {
2732
+ startY = (parent.lowerCanvas.width - actObj.activePoint.endX);
2733
+ startX = actObj.activePoint.startY;
2734
+ }
2735
+ else if (tempDegree % 270 === 0) {
2736
+ startX = parent.lowerCanvas.height - actObj.activePoint.endY;
2737
+ startY = actObj.activePoint.startX;
2738
+ }
2739
+ imgPoint.startX = startX;
2740
+ imgPoint.startY = startY;
2741
+ actObj.activePoint.startX = startX;
2742
+ actObj.activePoint.startY = startY;
2743
+ actObj.activePoint.endX = actObj.activePoint.startX + imgPoint.width;
2744
+ actObj.activePoint.endY = actObj.activePoint.startY + imgPoint.height;
2745
+ actObj = this.updateWidthHeight(actObj);
2746
+ }
2747
+ else {
2748
+ if (coll === 'horizontal' && degree % 90 === 0 && degree % 180 !== 0) {
2749
+ coll = 'vertical';
2750
+ }
2751
+ else if (coll === 'vertical' && degree % 90 === 0 && degree % 180 !== 0) {
2752
+ coll = 'horizontal';
2753
+ }
2754
+ if (coll === 'horizontal') {
2755
+ canvasDraw.translate(canvasDraw.canvas.width, 0);
2756
+ canvasDraw.scale(-1, 1);
2757
+ actObj.activePoint = this.updateActPoint('horizontal', canvasDraw);
2758
+ }
2759
+ else if (coll === 'vertical') {
2760
+ canvasDraw.translate(0, canvasDraw.canvas.height);
2761
+ canvasDraw.scale(1, -1);
2762
+ actObj.activePoint = this.updateActPoint('vertical', canvasDraw);
2763
+ }
2764
+ imgPoint.startX = actObj.activePoint.startX;
2765
+ imgPoint.startY = actObj.activePoint.startY;
2766
+ }
2767
+ imgPoint.startX = actObj.activePoint.startX;
2768
+ imgPoint.startY = actObj.activePoint.startY;
2769
+ startX = imgPoint.startX;
2770
+ startY = imgPoint.startY;
2724
2771
  }
2725
- else {
2726
- canvasDraw.translate(parent.lowerCanvas.width / 2, parent.lowerCanvas.height / 2);
2727
- canvasDraw.rotate(Math.PI / 180 * degree);
2728
- startX = parent.lowerCanvas.width - actPoint.endX;
2729
- startY = (parent.lowerCanvas.height - actPoint.endY) +
2730
- parent.activeObj.textSettings.fontSize * 0.4;
2731
- canvasDraw.translate(-parent.lowerCanvas.width / 2, -parent.lowerCanvas.height / 2);
2732
- this.textFlipDegree(canvasDraw, startX, startY);
2733
- canvasDraw.translate(parent.lowerCanvas.width / 2, parent.lowerCanvas.height / 2);
2734
- canvasDraw.rotate(Math.PI / 180 * -degree);
2735
- canvasDraw.translate(-parent.lowerCanvas.width / 2, -parent.lowerCanvas.height / 2);
2772
+ if (actObj.rotatedAngle !== 0) {
2773
+ parent.notify('shape', { prop: 'setPointCollForShapeRotation', onPropertyChange: false, value: { obj: actObj } });
2736
2774
  }
2775
+ startY += actObj.textSettings.fontSize * 0.4;
2776
+ this.textFlipDegree(canvasDraw, startX, startY);
2777
+ canvasDraw.restore();
2778
+ parent.activeObj = tempActiveObj;
2737
2779
  if (parent.transform.degree === 360 || parent.transform.degree === -360) {
2738
2780
  parent.transform.degree = 0;
2739
2781
  }
@@ -3267,22 +3309,23 @@ class Draw {
3267
3309
  this.parent.notify('toolbar', { prop: 'getPrevCropObj', onPropertyChange: false, value: { obj: obj1 } });
3268
3310
  this.parent.notify('toolbar', { prop: 'getPrevObj', onPropertyChange: false, value: { obj: obj2 } });
3269
3311
  if (obj1['prevCropObj'] && obj2['prevObj']) {
3270
- if (!aspectRatioElement) {
3271
- parent.objColl = [];
3272
- parent.pointColl = [];
3273
- parent.freehandCounter = 0;
3274
- parent.cropObj = extend({}, obj1['prevCropObj'], {}, true);
3275
- this.setCurrentObj(obj2['prevObj']);
3276
- parent.objColl = obj2['prevObj']['objColl'];
3277
- parent.pointColl = obj2['prevObj']['pointColl'];
3278
- parent.freehandCounter = parent.pointColl.length;
3279
- parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
3280
- parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
3281
- }
3312
+ parent.objColl = [];
3313
+ parent.pointColl = [];
3314
+ parent.freehandCounter = 0;
3315
+ parent.cropObj = extend({}, obj1['prevCropObj'], {}, true);
3316
+ this.setCurrentObj(obj2['prevObj']);
3317
+ parent.objColl = obj2['prevObj']['objColl'];
3318
+ parent.pointColl = obj2['prevObj']['pointColl'];
3319
+ parent.freehandCounter = parent.pointColl.length;
3320
+ parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
3321
+ parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
3322
+ const currObj = parent.currSelectionPoint ?
3323
+ extend({}, parent.currSelectionPoint, {}, true) : null;
3282
3324
  this.parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3283
3325
  value: { zoomFactor: -this.parent.transform.zoomFactor, zoomPoint: null, isResize: true } });
3284
3326
  this.parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3285
3327
  value: { zoomFactor: obj2['prevObj']['defaultZoom'], zoomPoint: null, isResize: true } });
3328
+ parent.currSelectionPoint = currObj;
3286
3329
  if (obj2['prevObj'].zoomFactor) {
3287
3330
  parent.setProperties({ zoomSettings: { zoomFactor: obj2['prevObj'].zoomFactor } }, true);
3288
3331
  }
@@ -3290,6 +3333,7 @@ class Draw {
3290
3333
  value: { previousZoomValue: parent.zoomSettings.zoomFactor } });
3291
3334
  }
3292
3335
  parent.isResize = false;
3336
+ parent.notify('transform', { prop: 'setResizedImgAngle', onPropertyChange: false, value: { angle: null } });
3293
3337
  }
3294
3338
  }
3295
3339
  if (parent.togglePen) {
@@ -11032,6 +11076,36 @@ class Selection {
11032
11076
  parent.notify('transform', { prop: 'resize', value: { width: point.x, height: point.y, isAspectRatio: false } });
11033
11077
  }
11034
11078
  }
11079
+ if (isBlazor()) {
11080
+ const aspectRatioHeight = this.parent.element.querySelector('.e-ie-toolbar-e-resize-height-input .e-numerictextbox');
11081
+ const aspectRatioWidth = this.parent.element.querySelector('.e-ie-toolbar-e-resize-width-input .e-numerictextbox');
11082
+ if ((blrAspRatElem && blrAspRatElem.classList.contains('e-hidden'))) {
11083
+ if (aspectRatioHeight && aspectRatioHeight.value === "") {
11084
+ aspectRatioHeight.value = aspectRatioHeight.placeholder;
11085
+ aspectRatioHeight.value = Math.floor(parent.img.destHeight).toString();
11086
+ }
11087
+ if (aspectRatioWidth && aspectRatioWidth.value === "") {
11088
+ aspectRatioWidth.value = aspectRatioWidth.placeholder;
11089
+ aspectRatioWidth.value = Math.floor(parent.img.destWidth).toString();
11090
+ }
11091
+ }
11092
+ }
11093
+ else {
11094
+ const aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
11095
+ const aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
11096
+ if (isNullOrUndefined(aspectRatioElement)) {
11097
+ let elem = getComponent(aspectRatioHeight, 'numerictextbox');
11098
+ if (aspectRatioHeight && isNullOrUndefined(elem.value)) {
11099
+ elem.value = parseFloat(elem.placeholder);
11100
+ aspectRatioHeight.value = Math.floor(parent.img.destHeight).toString() + ' px';
11101
+ }
11102
+ elem = getComponent(aspectRatioWidth, 'numerictextbox');
11103
+ if (aspectRatioWidth && isNullOrUndefined(elem.value)) {
11104
+ elem.value = parseFloat(elem.placeholder);
11105
+ aspectRatioWidth.value = Math.floor(parent.img.destWidth).toString() + ' px';
11106
+ }
11107
+ }
11108
+ }
11035
11109
  }
11036
11110
  else {
11037
11111
  let splitWords;
@@ -11987,8 +12061,14 @@ class Selection {
11987
12061
  heightElement = this.parent.element.querySelector('.e-ie-toolbar-e-resize-height-input .e-numerictextbox');
11988
12062
  }
11989
12063
  if (widthElement && heightElement) {
11990
- const heightString = heightElement.value.replace(/,/g, '');
11991
- const widthString = widthElement.value.replace(/,/g, '');
12064
+ let heightString = heightElement.value.replace(/,/g, '');
12065
+ let widthString = widthElement.value.replace(/,/g, '');
12066
+ if (heightString === '') {
12067
+ heightString = heightElement.placeholder.replace(/,/g, '');
12068
+ }
12069
+ if (widthString === '') {
12070
+ widthString = widthElement.placeholder.replace(/,/g, '');
12071
+ }
11992
12072
  height = parseFloat(heightString);
11993
12073
  width = parseFloat(widthString);
11994
12074
  }
@@ -12227,6 +12307,9 @@ class Shape {
12227
12307
  case 'updateObj':
12228
12308
  this.updateObj(args.value['dimObj'], args.value['x'], args.value['y']);
12229
12309
  break;
12310
+ case 'updateSelectionChangeEventArgs':
12311
+ this.updateSelectionChangeEventArgs(args.value['selectionSettings']);
12312
+ break;
12230
12313
  }
12231
12314
  }
12232
12315
  getModuleName() {
@@ -12791,6 +12874,17 @@ class Shape {
12791
12874
  }
12792
12875
  }
12793
12876
  }
12877
+ updateSelectionChangeEventArgs(selectionSettings) {
12878
+ const parent = this.parent;
12879
+ parent.activeObj.activePoint.startX = selectionSettings.startX;
12880
+ parent.activeObj.activePoint.startY = selectionSettings.startY;
12881
+ if (selectionSettings.width && selectionSettings.height) {
12882
+ parent.activeObj.activePoint.width = selectionSettings.width;
12883
+ parent.activeObj.activePoint.height = selectionSettings.height;
12884
+ parent.activeObj.activePoint.endX = parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width;
12885
+ parent.activeObj.activePoint.endY = parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height;
12886
+ }
12887
+ }
12794
12888
  addLetter(letter) {
12795
12889
  const parent = this.parent;
12796
12890
  if (parent.textArea.style.display === 'none' && (parent.currObjType.isText || parent.activeObj.shape === 'text')) {
@@ -15154,6 +15248,9 @@ class Transform {
15154
15248
  case 'resize':
15155
15249
  this.resize(args.value['width'], args.value['height'], args.value['isAspectRatio']);
15156
15250
  break;
15251
+ case 'setResizedImgAngle':
15252
+ this.resizedImgAngle = args.value['angle'];
15253
+ break;
15157
15254
  case 'reset':
15158
15255
  this.reset();
15159
15256
  break;
@@ -19092,6 +19189,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
19092
19189
  this.afterCropActions = [];
19093
19190
  this.currentFilter = '';
19094
19191
  this.tempFrameZoomLevel = null;
19192
+ this.cxtTbarHeight = null;
19095
19193
  const obj = { initialZoomValue: false };
19096
19194
  this.notify('draw', { prop: 'getInitialZoomValue', onPropertyChange: false, value: { obj: obj } });
19097
19195
  if (obj['initialZoomValue']) {
@@ -19739,7 +19837,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
19739
19837
  value = 'vertical';
19740
19838
  }
19741
19839
  for (let i = 0; i < this.objColl.length; i++) {
19742
- if (this.objColl[i].shape === 'image') {
19840
+ const shape = this.objColl[i].shape;
19841
+ if (shape === 'image' || shape === 'text') {
19743
19842
  if (isNullOrUndefined(this.objColl[i].rotateFlipColl)) {
19744
19843
  this.objColl[i].rotateFlipColl = [];
19745
19844
  }
@@ -22152,19 +22251,32 @@ class ToolbarModule {
22152
22251
  const parent = this.parent;
22153
22252
  const aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
22154
22253
  const aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
22155
- const aspectRatioIcon = parent.element.querySelector('#' + parent.element.id + '_aspectratio');
22254
+ const icon = parent.element.querySelector('#' + parent.element.id + '_aspectratio');
22156
22255
  const originalWidth = parent.img.destWidth;
22157
22256
  const originalHeight = parent.img.destHeight;
22158
22257
  const aspectRatioHeightValue = parseFloat(aspectRatioHeight.value);
22159
22258
  const width = Math.floor((aspectRatioHeightValue / (originalHeight / originalWidth)));
22160
- if (aspectRatioIcon) {
22259
+ const widthNumeric = getComponent(aspectRatioWidth, 'numerictextbox');
22260
+ if (icon) {
22161
22261
  if (width != null && !isNaN(width)) {
22162
- getComponent(aspectRatioWidth, 'numerictextbox').value = width;
22163
- aspectRatioWidth.value = width.toString() + ' px';
22262
+ if (isNullOrUndefined(widthNumeric.value)) {
22263
+ widthNumeric.placeholder = width + ' px';
22264
+ aspectRatioWidth.placeholder = width.toString() + ' px';
22265
+ }
22266
+ else {
22267
+ widthNumeric.value = width;
22268
+ aspectRatioWidth.value = width.toString() + ' px';
22269
+ }
22164
22270
  }
22165
22271
  else {
22166
- getComponent(aspectRatioWidth, 'numerictextbox').value = 0;
22167
- aspectRatioWidth.value = '0 px';
22272
+ if (isNullOrUndefined(widthNumeric.value)) {
22273
+ widthNumeric.placeholder = '0 px';
22274
+ aspectRatioWidth.placeholder = '0 px';
22275
+ }
22276
+ else {
22277
+ widthNumeric.value = 0;
22278
+ aspectRatioWidth.value = '0 px';
22279
+ }
22168
22280
  }
22169
22281
  }
22170
22282
  }
@@ -22173,37 +22285,53 @@ class ToolbarModule {
22173
22285
  const parent = this.parent;
22174
22286
  const aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
22175
22287
  const aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
22176
- const aspectRatioIcon = parent.element.querySelector('#' + parent.element.id + '_aspectratio');
22288
+ const icon = parent.element.querySelector('#' + parent.element.id + '_aspectratio');
22177
22289
  const originalWidth = parent.img.destWidth;
22178
22290
  const originalHeight = parent.img.destHeight;
22179
22291
  const aspectRatioWidthValue = parseFloat(aspectRatioWidth.value);
22180
22292
  const height = Math.floor((aspectRatioWidthValue / (originalWidth / originalHeight)));
22181
- if (aspectRatioIcon && !isNaN(height)) {
22182
- getComponent(aspectRatioHeight, 'numerictextbox').value = height;
22183
- aspectRatioHeight.value = height.toString() + ' px';
22184
- }
22185
- else {
22186
- getComponent(aspectRatioHeight, 'numerictextbox').value = 0;
22187
- aspectRatioHeight.value = '0 px';
22293
+ const heightNumeric = getComponent(aspectRatioHeight, 'numerictextbox');
22294
+ if (icon) {
22295
+ if (!isNaN(height)) {
22296
+ if (isNullOrUndefined(heightNumeric.value)) {
22297
+ heightNumeric.placeholder = height + ' px';
22298
+ aspectRatioHeight.placeholder = height.toString() + ' px';
22299
+ }
22300
+ else {
22301
+ heightNumeric.value = height;
22302
+ aspectRatioHeight.value = height.toString() + ' px';
22303
+ }
22304
+ }
22305
+ else {
22306
+ if (isNullOrUndefined(heightNumeric.value)) {
22307
+ heightNumeric.placeholder = '0 px';
22308
+ aspectRatioHeight.placeholder = '0 px';
22309
+ }
22310
+ else {
22311
+ heightNumeric.value = 0;
22312
+ aspectRatioHeight.value = '0 px';
22313
+ }
22314
+ }
22188
22315
  }
22189
22316
  }
22190
22317
  getResizeToolbarItem() {
22191
22318
  const toolbarItems = [];
22319
+ const isResize = this.parent.aspectWidth && this.parent.aspectHeight ? true : false;
22192
22320
  const spanWidth = document.createElement('span');
22193
22321
  spanWidth.innerHTML = this.l10n.getConstant('W');
22194
22322
  toolbarItems.push({ id: this.parent.element.id + '_width', cssClass: 'e-ie-resize-width', template: spanWidth, align: 'Center' });
22195
22323
  toolbarItems.push({ id: this.parent.element.id + '_resizeWidth', prefixIcon: 'e-icons e-anti-clock-wise',
22196
22324
  tooltipText: this.l10n.getConstant('Width'), align: 'Center', type: 'Input', template: new NumericTextBox({ width: 75, htmlAttributes: { maxLength: "4" },
22197
- showSpinButton: false, value: (this.parent.aspectWidth && this.parent.aspectHeight) ? this.parent.aspectWidth : Math.ceil(this.parent.img.destWidth),
22198
- format: '###.## px' })
22325
+ showSpinButton: false, value: isResize ? this.parent.aspectWidth : null,
22326
+ placeholder: isResize ? null : Math.ceil(this.parent.img.srcWidth).toString(), format: '###.## px' })
22199
22327
  });
22200
22328
  const spanHeight = document.createElement('span');
22201
22329
  spanHeight.innerHTML = this.l10n.getConstant('H');
22202
22330
  toolbarItems.push({ id: this.parent.element.id + '_height', cssClass: 'e-ie-resize-height', template: spanHeight, align: 'Center' });
22203
22331
  toolbarItems.push({ id: this.parent.element.id + '_resizeHeight', prefixIcon: 'e-icons e-clock-wise',
22204
22332
  tooltipText: this.l10n.getConstant('Height'), align: 'Center', type: 'Input', template: new NumericTextBox({ width: 75, htmlAttributes: { maxLength: "4" },
22205
- showSpinButton: false, value: (this.parent.aspectWidth && this.parent.aspectHeight) ? this.parent.aspectHeight : Math.ceil(this.parent.img.destHeight),
22206
- format: '###.## px' })
22333
+ showSpinButton: false, value: isResize ? this.parent.aspectHeight : null,
22334
+ placeholder: isResize ? null : Math.ceil(this.parent.img.srcHeight).toString(), format: '###.## px' })
22207
22335
  });
22208
22336
  if (!this.isAspectRatio) {
22209
22337
  toolbarItems.push({ id: this.parent.element.id + '_aspectratio', prefixIcon: 'e-icons e-lock', align: 'Center', tooltipText: this.l10n.getConstant('AspectRatio'), type: 'Button' });
@@ -22272,14 +22400,11 @@ class ToolbarModule {
22272
22400
  const parent = this.parent;
22273
22401
  const aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
22274
22402
  const aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
22275
- const aspectRatio = parent.element.querySelector('#' + parent.element.id + '_aspectratio');
22276
- if (aspectRatio) {
22277
- if (!isNullOrUndefined(aspectRatioHeight)) {
22278
- aspectRatioWidth.addEventListener('keyup', this.heightAspectRatio.bind(this));
22279
- }
22280
- if (!isNullOrUndefined(aspectRatioWidth)) {
22281
- aspectRatioHeight.addEventListener('keyup', this.widthAspectRatio.bind(this));
22282
- }
22403
+ if (!isNullOrUndefined(aspectRatioHeight)) {
22404
+ aspectRatioWidth.addEventListener('keyup', this.heightAspectRatio.bind(this));
22405
+ }
22406
+ if (!isNullOrUndefined(aspectRatioWidth)) {
22407
+ aspectRatioHeight.addEventListener('keyup', this.widthAspectRatio.bind(this));
22283
22408
  }
22284
22409
  }
22285
22410
  enableDisableTbrBtn() {
@@ -24866,6 +24991,8 @@ class ToolbarModule {
24866
24991
  performDefTbrClick(type, isContextualToolbar, isDisabledAdjustment, isDisabledFilter, isFilterFinetune) {
24867
24992
  const parent = this.parent;
24868
24993
  const zoomIn = parent.element.querySelector('#' + parent.element.id + '_zoomIn');
24994
+ const aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
24995
+ const aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
24869
24996
  let isCropSelection = false;
24870
24997
  let panBtn;
24871
24998
  let splitWords;
@@ -24945,12 +25072,27 @@ class ToolbarModule {
24945
25072
  case 'aspectratio':
24946
25073
  if (!parent.isCircleCrop && (isNullOrUndefined(parent.currSelectionPoint)) ||
24947
25074
  (parent.currSelectionPoint && parent.currSelectionPoint.shape !== 'crop-circle')) {
25075
+ if (getComponent(aspectRatioWidth, 'numerictextbox').value) {
25076
+ parent.aspectWidth = getComponent(aspectRatioWidth, 'numerictextbox').value;
25077
+ parent.aspectHeight = getComponent(aspectRatioHeight, 'numerictextbox').value;
25078
+ parent.notify('transform', { prop: 'resize', value: { width: parent.aspectWidth, height: null, isAspectRatio: true } });
25079
+ }
24948
25080
  parent.resizeSrc = { startX: parent.img.srcLeft, startY: parent.img.srcTop, width: parent.img.srcWidth,
24949
25081
  height: parent.img.srcHeight };
24950
25082
  this.refreshToolbar('resize');
24951
25083
  }
24952
25084
  break;
24953
25085
  case 'nonaspectratio':
25086
+ if (getComponent(aspectRatioWidth, 'numerictextbox').value ||
25087
+ getComponent(aspectRatioHeight, 'numerictextbox').value) {
25088
+ parent.aspectWidth = getComponent(aspectRatioWidth, 'numerictextbox').value ?
25089
+ getComponent(aspectRatioWidth, 'numerictextbox').value :
25090
+ parseFloat(getComponent(aspectRatioWidth, 'numerictextbox').placeholder);
25091
+ parent.aspectHeight = getComponent(aspectRatioHeight, 'numerictextbox').value ?
25092
+ getComponent(aspectRatioHeight, 'numerictextbox').value :
25093
+ parseFloat(getComponent(aspectRatioHeight, 'numerictextbox').placeholder);
25094
+ parent.notify('transform', { prop: 'resize', value: { width: parent.aspectWidth, height: parent.aspectHeight, isAspectRatio: false } });
25095
+ }
24954
25096
  parent.resizeSrc = { startX: parent.img.srcLeft, startY: parent.img.srcTop, width: parent.img.srcWidth,
24955
25097
  height: parent.img.srcHeight };
24956
25098
  this.refreshToolbar('resize');