@syncfusion/ej2-image-editor 20.3.47 → 20.3.48

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 20.3.47
3
+ * version : 20.3.48
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@20.2.52",
3
+ "_id": "@syncfusion/ej2-image-editor@20.3.47",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-XXA7tsh8G5fSVsWD0gq2hx3oqzU/y+RmufrctYIqDbPBxjoeOnMkH2N8cSp27i/lp1LOhjtMPB8uWqQsBIeNdA==",
5
+ "_integrity": "sha512-Q62yo/sQO5+omyPnSjFaUTf9jOEPjzBURoZEtIr2TZKIgSumJhofZcN80i/Lq8cJOGAQixaIANZIcZV2tn2Wng==",
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": "http://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-image-editor/-/ej2-image-editor-20.2.52.tgz",
27
- "_shasum": "bc48db2256ebc59e271c1506bea6f38c63c2870d",
26
+ "_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-image-editor/-/ej2-image-editor-20.3.47.tgz",
27
+ "_shasum": "92f90ea59cb20e1aa045767d9da0ff40b10f584f",
28
28
  "_spec": "@syncfusion/ej2-image-editor@*",
29
29
  "_where": "/jenkins/workspace/automation_release_19.1.0.1-ZPMUBNQ6AUYH6YGEFBPVYMEQLRRW2SLD4XCZ6GATNZJFYJ3RIAOA/packages/included",
30
30
  "author": {
@@ -32,11 +32,11 @@
32
32
  },
33
33
  "bundleDependencies": false,
34
34
  "dependencies": {
35
- "@syncfusion/ej2-base": "~20.3.47",
36
- "@syncfusion/ej2-buttons": "~20.3.47",
35
+ "@syncfusion/ej2-base": "~20.3.48",
36
+ "@syncfusion/ej2-buttons": "~20.3.48",
37
37
  "@syncfusion/ej2-inputs": "~20.3.47",
38
- "@syncfusion/ej2-navigations": "~20.3.47",
39
- "@syncfusion/ej2-popups": "~20.3.47",
38
+ "@syncfusion/ej2-navigations": "~20.3.48",
39
+ "@syncfusion/ej2-popups": "~20.3.48",
40
40
  "@syncfusion/ej2-splitbuttons": "~20.3.47"
41
41
  },
42
42
  "deprecated": false,
@@ -69,6 +69,6 @@
69
69
  "url": "https://github.com/syncfusion/ej2-javascript-ui-controls/tree/master/controls/imageeditor"
70
70
  },
71
71
  "typings": "index.d.ts",
72
- "version": "20.3.47",
72
+ "version": "20.3.48",
73
73
  "sideEffects": false
74
74
  }
@@ -42,7 +42,6 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
42
42
  private dragPoint;
43
43
  private diffPoint;
44
44
  private oldPoint;
45
- private zoomedImg;
46
45
  private objColl;
47
46
  private undoRedoColl;
48
47
  private imgDataColl;
@@ -61,7 +61,6 @@ var ImageEditor = /** @class */ (function (_super) {
61
61
  _this.dragPoint = { startX: 0, startY: 0, endX: 0, endY: 0 }; // updates drag start and end points in mousedown and mousemove
62
62
  _this.diffPoint = { x: 0, y: 0 }; // updates resize points
63
63
  _this.oldPoint = {};
64
- _this.zoomedImg = { startX: 0, startY: 0, endX: 0, endY: 0, width: 0, height: 0 }; // calculates zoomed image's points
65
64
  _this.objColl = []; // shapes, text obj collection
66
65
  _this.undoRedoColl = [];
67
66
  _this.imgDataColl = []; // collection of Image Data mainly used for reset state
@@ -2131,8 +2130,6 @@ var ImageEditor = /** @class */ (function (_super) {
2131
2130
  }
2132
2131
  };
2133
2132
  ImageEditor.prototype.updateCanvas = function () {
2134
- this.zoomedImg.width = this.baseImg.width;
2135
- this.zoomedImg.height = this.baseImg.height;
2136
2133
  this.lastX = this.baseImg.width / 2;
2137
2134
  this.lastY = this.baseImg.height / 2;
2138
2135
  var wrapperWidth;
@@ -2553,6 +2550,9 @@ var ImageEditor = /** @class */ (function (_super) {
2553
2550
  EventHandler.add(this.upperCanvas, 'touchmove', this.mouseMoveEventHandler, this); // Unbind mousedown to prevent double triggers from touch devices
2554
2551
  };
2555
2552
  ImageEditor.prototype.mouseDownEventHandler = function (e) {
2553
+ if (e.type === 'touchstart' && e.currentTarget === this.lowerCanvas && this.imgDataColl.length === 0) {
2554
+ return;
2555
+ }
2556
2556
  var ratio = this.calcRatio();
2557
2557
  if (this.dragCanvas) {
2558
2558
  this.canvasMouseDownHandler(e);
@@ -2864,6 +2864,17 @@ var ImageEditor = /** @class */ (function (_super) {
2864
2864
  this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
2865
2865
  this.lowerCanvas.width = this.upperCanvas.width = this.element.offsetWidth;
2866
2866
  this.lowerCanvas.height = this.upperCanvas.height = this.element.offsetHeight;
2867
+ var canvasWrapper = document.querySelector('#' + this.element.id + '_canvasWrapper');
2868
+ if (!isNullOrUndefined(canvasWrapper)) {
2869
+ canvasWrapper.style.width = this.element.offsetWidth + 'px';
2870
+ canvasWrapper.style.height = this.element.offsetHeight + 'px';
2871
+ if (Browser.isDevice) {
2872
+ canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - (2 * this.toolbarHeight)) - 3 + 'px';
2873
+ }
2874
+ else {
2875
+ canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - this.toolbarHeight) - 3 + 'px';
2876
+ }
2877
+ }
2867
2878
  this.redrawImg();
2868
2879
  // eslint-disable-next-line @typescript-eslint/tslint/config
2869
2880
  this.lowerCanvas.toBlob(function (blob) {
@@ -2878,7 +2889,7 @@ var ImageEditor = /** @class */ (function (_super) {
2878
2889
  ImageEditor.prototype.screenOrientation = function () {
2879
2890
  if (Browser.isDevice) {
2880
2891
  this.isScreenOriented = true;
2881
- this.adjustToScreen();
2892
+ setTimeout(this.adjustToScreen.bind(this), 100);
2882
2893
  }
2883
2894
  };
2884
2895
  ImageEditor.prototype.windowResizeHandler = function () {
@@ -3675,24 +3686,28 @@ var ImageEditor = /** @class */ (function (_super) {
3675
3686
  this.textBox.value = actObj.keyHistory;
3676
3687
  this.textBox.style.overflow = 'hidden';
3677
3688
  this.textBox.style.height = 'auto';
3678
- this.setTextBoxWidth();
3679
- this.setTextBoxHeight();
3680
3689
  if (degree % 90 === 0 && degree % 180 !== 0 && degree !== 0) {
3681
3690
  if (this.factor === 1) {
3691
+ this.textBox.style.width = (actObj.activePoint.height / ratio.height) + 'px';
3682
3692
  this.textBox.style.height = (actObj.activePoint.width / ratio.width) + 'px';
3683
3693
  }
3684
3694
  else {
3695
+ this.textBox.style.width = actObj.activePoint.height + 'px';
3685
3696
  this.textBox.style.height = actObj.activePoint.width + 'px';
3686
3697
  }
3687
3698
  }
3688
3699
  else {
3689
3700
  if (this.factor === 1) {
3701
+ this.textBox.style.width = (actObj.activePoint.width / ratio.width) + 'px';
3690
3702
  this.textBox.style.height = (actObj.activePoint.height / ratio.height) + 'px';
3691
3703
  }
3692
3704
  else {
3705
+ this.textBox.style.width = actObj.activePoint.width + 'px';
3693
3706
  this.textBox.style.height = actObj.activePoint.height + 'px';
3694
3707
  }
3695
3708
  }
3709
+ this.setTextBoxWidth();
3710
+ this.setTextBoxHeight();
3696
3711
  }
3697
3712
  else {
3698
3713
  this.applyActObj();
@@ -3725,42 +3740,55 @@ var ImageEditor = /** @class */ (function (_super) {
3725
3740
  }
3726
3741
  if (degree === 0) {
3727
3742
  if (flip.toLowerCase() === 'vertical') {
3728
- this.textBox.style.maxHeight = ((this.lowerCanvas.height - (this.lowerCanvas.height - actObj.activePoint.endY)) / ratio.height) + 'px';
3743
+ this.textBox.style.maxHeight = (parseFloat(this.lowerCanvas.style.maxHeight) - (parseFloat(this.lowerCanvas.style.maxHeight)
3744
+ - parseFloat(this.textBox.style.top))) + 'px';
3729
3745
  }
3730
3746
  else {
3731
3747
  textBoxTop = parseFloat(this.textBox.style.top) - parseFloat(this.lowerCanvas.style.top);
3732
- this.textBox.style.maxHeight = ((this.lowerCanvas.height / ratio.height) - textBoxTop) + 'px';
3748
+ this.textBox.style.maxHeight = (parseFloat(this.lowerCanvas.style.maxHeight) - textBoxTop) + 'px';
3733
3749
  }
3734
3750
  }
3735
3751
  else if (degree === 90) {
3736
3752
  if (flip.toLowerCase() === 'horizontal') {
3737
- this.textBox.style.maxHeight = ((this.lowerCanvas.width - actObj.activePoint.startX) / ratio.width) + 'px';
3753
+ this.textBox.style.maxHeight = (parseFloat(this.lowerCanvas.style.maxWidth) - (parseFloat(this.textBox.style.left)
3754
+ - parseFloat(this.lowerCanvas.style.left))) + 'px';
3738
3755
  }
3739
3756
  else {
3740
- this.textBox.style.maxHeight = ((this.lowerCanvas.width - (this.lowerCanvas.width - actObj.activePoint.endX)) / ratio.width) + 'px';
3757
+ this.textBox.style.maxHeight = (parseFloat(this.textBox.style.left)
3758
+ - parseFloat(this.lowerCanvas.style.left)) + 'px';
3741
3759
  }
3742
3760
  }
3743
3761
  else if (degree === 180) {
3744
3762
  if (flip.toLowerCase() === 'vertical') {
3745
- this.textBox.style.maxHeight = ((this.lowerCanvas.height - actObj.activePoint.startY) / ratio.height) + 'px';
3763
+ textBoxTop = parseFloat(this.textBox.style.top) - parseFloat(this.lowerCanvas.style.top);
3764
+ this.textBox.style.maxHeight = (parseFloat(this.lowerCanvas.style.maxHeight) - textBoxTop) + 'px';
3746
3765
  }
3747
3766
  else {
3748
- this.textBox.style.maxHeight = ((this.lowerCanvas.height - (this.lowerCanvas.height - actObj.activePoint.endY)) / ratio.height) + 'px';
3767
+ this.textBox.style.maxHeight = (parseFloat(this.textBox.style.top)
3768
+ - parseFloat(this.lowerCanvas.style.top)) + 'px';
3749
3769
  }
3750
3770
  }
3751
3771
  else if (degree === 270) {
3752
3772
  if (flip.toLowerCase() === 'horizontal') {
3753
- this.textBox.style.maxHeight = ((this.lowerCanvas.width - (this.lowerCanvas.width - actObj.activePoint.endX)) / ratio.width) + 'px';
3773
+ this.textBox.style.maxHeight = (parseFloat(this.textBox.style.left)
3774
+ - parseFloat(this.lowerCanvas.style.left)) + 'px';
3754
3775
  }
3755
3776
  else {
3756
- this.textBox.style.maxHeight = ((this.lowerCanvas.width - actObj.activePoint.startX) / ratio.width) + 'px';
3777
+ this.textBox.style.maxHeight = parseFloat(this.lowerCanvas.style.maxWidth) - (parseFloat(this.textBox.style.left)
3778
+ - parseFloat(this.lowerCanvas.style.left)) + 'px';
3757
3779
  }
3758
3780
  }
3759
- this.textBox.style.maxHeight = ((parseFloat(this.textBox.style.maxHeight) - parseFloat(this.textBox.style.fontSize) * 0.5)) * this.factor + 'px';
3781
+ this.textBox.style.maxHeight = ((parseFloat(this.textBox.style.maxHeight) - parseFloat(this.textBox.style.fontSize) * 0.5)) + 'px';
3760
3782
  };
3761
3783
  ImageEditor.prototype.setTextBoxWidth = function (e) {
3762
3784
  var ratio = this.calcRatio();
3763
3785
  var text = this.getMaxText(true);
3786
+ if (this.textBox.style.display === 'block') {
3787
+ this.updateFontStyles(true);
3788
+ }
3789
+ else {
3790
+ this.updateFontStyles();
3791
+ }
3764
3792
  var textBoxWidth = (this.upperContext.measureText(text).width + (parseFloat(this.textBox.style.fontSize) / 2));
3765
3793
  var letterWidth = e ? this.upperContext.measureText(String.fromCharCode(e.which)).width : 0;
3766
3794
  var actObj = extend({}, this.activeObj, {}, true);
@@ -3787,56 +3815,56 @@ var ImageEditor = /** @class */ (function (_super) {
3787
3815
  if ((!isNullOrUndefined(e) && parseFloat(this.textBox.style.width) < (textBoxWidth + letterWidth)) || isNullOrUndefined(e)) {
3788
3816
  if (degree === 0) {
3789
3817
  if (flip.toLowerCase() === 'horizontal') {
3790
- if (actObj.activePoint.endX - textBoxWidth - letterWidth > 0) {
3791
- this.textBox.style.width = ((textBoxWidth + letterWidth) / ratio.width) + 'px';
3818
+ if ((parseFloat(this.textBox.style.left) - parseFloat(this.lowerCanvas.style.left)) - textBoxWidth - letterWidth > 0) {
3819
+ this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
3792
3820
  }
3793
3821
  }
3794
3822
  else {
3795
- if (textBoxWidth + letterWidth + actObj.activePoint.startX < this.lowerCanvas.width) {
3796
- this.textBox.style.width = ((textBoxWidth + letterWidth) / ratio.width) + 'px';
3823
+ if ((parseFloat(this.lowerCanvas.style.maxWidth) - (parseFloat(this.textBox.style.left)
3824
+ - parseFloat(this.lowerCanvas.style.left))) > (textBoxWidth + letterWidth)) {
3825
+ this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
3797
3826
  }
3798
3827
  }
3799
3828
  }
3800
3829
  else if (degree === 90) {
3801
3830
  if (flip.toLowerCase() === 'vertical') {
3802
- if (actObj.activePoint.endY - textBoxWidth - letterWidth > 0) {
3803
- this.textBox.style.width = ((textBoxWidth + letterWidth) / ratio.height) + 'px';
3831
+ if ((parseFloat(this.textBox.style.top) - parseFloat(this.lowerCanvas.style.top)) - textBoxWidth - letterWidth > 0) {
3832
+ this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
3804
3833
  }
3805
3834
  }
3806
3835
  else {
3807
- if (textBoxWidth + letterWidth + actObj.activePoint.startY < this.lowerCanvas.height) {
3808
- this.textBox.style.width = ((textBoxWidth + letterWidth) / ratio.height) + 'px';
3836
+ if ((parseFloat(this.lowerCanvas.style.maxHeight) - (parseFloat(this.textBox.style.top)
3837
+ - parseFloat(this.lowerCanvas.style.top))) > (textBoxWidth + letterWidth)) {
3838
+ this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
3809
3839
  }
3810
3840
  }
3811
3841
  }
3812
3842
  else if (degree === 180) {
3813
3843
  if (flip.toLowerCase() === 'horizontal') {
3814
- if (textBoxWidth + letterWidth + actObj.activePoint.startX < this.lowerCanvas.width) {
3815
- this.textBox.style.width = ((textBoxWidth + letterWidth) / ratio.width) + 'px';
3844
+ if ((parseFloat(this.lowerCanvas.style.maxWidth) - (parseFloat(this.textBox.style.left)
3845
+ - parseFloat(this.lowerCanvas.style.left))) > (textBoxWidth + letterWidth)) {
3846
+ this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
3816
3847
  }
3817
3848
  }
3818
3849
  else {
3819
- if (actObj.activePoint.endX - textBoxWidth - letterWidth > 0) {
3820
- this.textBox.style.width = ((textBoxWidth + letterWidth) / ratio.width) + 'px';
3850
+ if ((parseFloat(this.textBox.style.left) - parseFloat(this.lowerCanvas.style.left)) - textBoxWidth - letterWidth > 0) {
3851
+ this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
3821
3852
  }
3822
3853
  }
3823
3854
  }
3824
3855
  else if (degree === 270) {
3825
3856
  if (flip.toLowerCase() === 'vertical') {
3826
- if (textBoxWidth + letterWidth + actObj.activePoint.startY < this.lowerCanvas.height) {
3827
- this.textBox.style.width = ((textBoxWidth + letterWidth) / ratio.height) + 'px';
3857
+ if ((parseFloat(this.lowerCanvas.style.maxHeight) - (parseFloat(this.textBox.style.top)
3858
+ - parseFloat(this.lowerCanvas.style.top))) > (textBoxWidth + letterWidth)) {
3859
+ this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
3828
3860
  }
3829
3861
  }
3830
3862
  else {
3831
- if (actObj.activePoint.endY - textBoxWidth - letterWidth > 0) {
3832
- this.textBox.style.width = ((textBoxWidth + letterWidth) / ratio.height) + 'px';
3863
+ if ((parseFloat(this.textBox.style.top) - parseFloat(this.lowerCanvas.style.top)) - textBoxWidth - letterWidth > 0) {
3864
+ this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
3833
3865
  }
3834
3866
  }
3835
3867
  }
3836
- this.textBox.style.width = parseFloat(this.textBox.style.width) * this.factor + 'px';
3837
- if (isNullOrUndefined(e)) {
3838
- this.textBox.style.width = parseFloat(this.textBox.style.width) + parseFloat(this.textBox.style.fontSize) + 'px';
3839
- }
3840
3868
  }
3841
3869
  };
3842
3870
  ImageEditor.prototype.setActivePoint = function (startX, startY) {
@@ -5802,7 +5830,7 @@ var ImageEditor = /** @class */ (function (_super) {
5802
5830
  this.setActivePoint(width, height);
5803
5831
  }
5804
5832
  };
5805
- ImageEditor.prototype.updateFontStyles = function () {
5833
+ ImageEditor.prototype.updateFontStyles = function (isTextBox) {
5806
5834
  this.upperContext.strokeStyle = this.activeObj.strokeSettings.strokeColor;
5807
5835
  this.upperContext.fillStyle = this.activeObj.strokeSettings.strokeColor;
5808
5836
  var textStyle = '';
@@ -5815,7 +5843,7 @@ var ImageEditor = /** @class */ (function (_super) {
5815
5843
  if (this.activeObj.textSettings.bold && this.activeObj.textSettings.italic) {
5816
5844
  textStyle = 'italic bold ';
5817
5845
  }
5818
- var fontSize = this.activeObj.textSettings.fontSize;
5846
+ var fontSize = isTextBox ? parseFloat(this.textBox.style.fontSize) : this.activeObj.textSettings.fontSize;
5819
5847
  var fontFamily = this.textBox.style.display === 'block' ? this.textBox.style.fontFamily : this.activeObj.textSettings.fontFamily;
5820
5848
  this.upperContext.font = textStyle + fontSize + 'px' + ' ' + fontFamily;
5821
5849
  };
@@ -5931,24 +5959,14 @@ var ImageEditor = /** @class */ (function (_super) {
5931
5959
  this.degree = 0;
5932
5960
  }
5933
5961
  };
5934
- ImageEditor.prototype.redrawSelection = function (isZoomed) {
5962
+ ImageEditor.prototype.redrawSelection = function () {
5935
5963
  var ratio = this.calcRatio();
5936
- if (isZoomed) {
5937
- this.activeObj.activePoint.startX = (this.lowerCanvas.width - this.zoomedImg.width) / 2;
5938
- this.activeObj.activePoint.startY = (this.lowerCanvas.height - this.zoomedImg.height) / 2;
5939
- this.activeObj.activePoint.endX = this.activeObj.activePoint.startX + this.zoomedImg.width;
5940
- this.activeObj.activePoint.endY = this.activeObj.activePoint.startY + this.zoomedImg.height;
5941
- this.activeObj.activePoint.width = this.zoomedImg.width;
5942
- this.activeObj.activePoint.height = this.zoomedImg.height;
5943
- }
5944
- else {
5945
- this.activeObj.activePoint.startX = 0;
5946
- this.activeObj.activePoint.startY = 0;
5947
- this.activeObj.activePoint.endX = this.lowerCanvas.width;
5948
- this.activeObj.activePoint.endY = this.lowerCanvas.height;
5949
- this.activeObj.activePoint.width = this.activeObj.activePoint.endX - this.activeObj.activePoint.startX;
5950
- this.activeObj.activePoint.height = this.activeObj.activePoint.endY - this.activeObj.activePoint.startY;
5951
- }
5964
+ this.activeObj.activePoint.startX = 0;
5965
+ this.activeObj.activePoint.startY = 0;
5966
+ this.activeObj.activePoint.endX = this.lowerCanvas.width;
5967
+ this.activeObj.activePoint.endY = this.lowerCanvas.height;
5968
+ this.activeObj.activePoint.width = this.activeObj.activePoint.endX - this.activeObj.activePoint.startX;
5969
+ this.activeObj.activePoint.height = this.activeObj.activePoint.endY - this.activeObj.activePoint.startY;
5952
5970
  this.updateActiveObject(ratio, this.activeObj.activePoint, this.activeObj);
5953
5971
  this.drawObject('duplicate', this.activeObj);
5954
5972
  };