@syncfusion/ej2-image-editor 20.3.47 → 20.3.50
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.
- package/CHANGELOG.md +16 -0
- package/dist/ej2-image-editor.umd.min.js +2 -2
- package/dist/ej2-image-editor.umd.min.js.map +1 -1
- package/dist/es6/ej2-image-editor.es2015.js +234 -56
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +234 -56
- package/dist/es6/ej2-image-editor.es5.js.map +1 -1
- package/dist/global/ej2-image-editor.min.js +2 -2
- package/dist/global/ej2-image-editor.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +10 -10
- package/src/image-editor/image-editor-model.d.ts +93 -0
- package/src/image-editor/image-editor.d.ts +184 -1
- package/src/image-editor/image-editor.js +234 -56
|
@@ -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;
|
|
@@ -2144,12 +2141,21 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2144
2141
|
wrapperWidth = this.element.clientWidth;
|
|
2145
2142
|
}
|
|
2146
2143
|
var maxDimension = this.calcMaxDimension(this.baseImg.width, this.baseImg.height);
|
|
2144
|
+
var toolbarHeight = 0;
|
|
2145
|
+
if (!isNullOrUndefined(this.toolbarTemplate) && !isNullOrUndefined(document.querySelector('.e-toolbar'))) {
|
|
2146
|
+
toolbarHeight = document.querySelector('.e-toolbar').clientHeight;
|
|
2147
|
+
maxDimension.width -= toolbarHeight;
|
|
2148
|
+
maxDimension.height -= toolbarHeight;
|
|
2149
|
+
}
|
|
2147
2150
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
2148
2151
|
this.lowerCanvas.width = this.upperCanvas.width = this.inMemoryCanvas.width = this.baseImg.width;
|
|
2149
2152
|
this.lowerCanvas.height = this.upperCanvas.height = this.inMemoryCanvas.height = this.baseImg.height;
|
|
2150
2153
|
this.lowerCanvas.style.maxWidth = this.upperCanvas.style.maxWidth = maxDimension.width + 'px';
|
|
2151
2154
|
this.lowerCanvas.style.maxHeight = this.upperCanvas.style.maxHeight = maxDimension.height + 'px';
|
|
2152
2155
|
this.lowerCanvas.style.left = this.upperCanvas.style.left = (wrapperWidth - maxDimension.width) / 2 + 1 + 'px';
|
|
2156
|
+
if (!isNullOrUndefined(this.toolbarTemplate)) {
|
|
2157
|
+
this.lowerCanvas.style.left = parseFloat(this.lowerCanvas.style.left) + (toolbarHeight / 2) + 'px';
|
|
2158
|
+
}
|
|
2153
2159
|
if (canvasWrapper) {
|
|
2154
2160
|
this.lowerCanvas.style.top = this.upperCanvas.style.top = (parseFloat(canvasWrapper.style.height) - maxDimension.height - 1) / 2 + 'px';
|
|
2155
2161
|
}
|
|
@@ -2553,6 +2559,9 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2553
2559
|
EventHandler.add(this.upperCanvas, 'touchmove', this.mouseMoveEventHandler, this); // Unbind mousedown to prevent double triggers from touch devices
|
|
2554
2560
|
};
|
|
2555
2561
|
ImageEditor.prototype.mouseDownEventHandler = function (e) {
|
|
2562
|
+
if (e.type === 'touchstart' && e.currentTarget === this.lowerCanvas && this.imgDataColl.length === 0) {
|
|
2563
|
+
return;
|
|
2564
|
+
}
|
|
2556
2565
|
var ratio = this.calcRatio();
|
|
2557
2566
|
if (this.dragCanvas) {
|
|
2558
2567
|
this.canvasMouseDownHandler(e);
|
|
@@ -2864,6 +2873,17 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2864
2873
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
2865
2874
|
this.lowerCanvas.width = this.upperCanvas.width = this.element.offsetWidth;
|
|
2866
2875
|
this.lowerCanvas.height = this.upperCanvas.height = this.element.offsetHeight;
|
|
2876
|
+
var canvasWrapper = document.querySelector('#' + this.element.id + '_canvasWrapper');
|
|
2877
|
+
if (!isNullOrUndefined(canvasWrapper)) {
|
|
2878
|
+
canvasWrapper.style.width = this.element.offsetWidth + 'px';
|
|
2879
|
+
canvasWrapper.style.height = this.element.offsetHeight + 'px';
|
|
2880
|
+
if (Browser.isDevice) {
|
|
2881
|
+
canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - (2 * this.toolbarHeight)) - 3 + 'px';
|
|
2882
|
+
}
|
|
2883
|
+
else {
|
|
2884
|
+
canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - this.toolbarHeight) - 3 + 'px';
|
|
2885
|
+
}
|
|
2886
|
+
}
|
|
2867
2887
|
this.redrawImg();
|
|
2868
2888
|
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
2869
2889
|
this.lowerCanvas.toBlob(function (blob) {
|
|
@@ -2878,7 +2898,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2878
2898
|
ImageEditor.prototype.screenOrientation = function () {
|
|
2879
2899
|
if (Browser.isDevice) {
|
|
2880
2900
|
this.isScreenOriented = true;
|
|
2881
|
-
this.adjustToScreen();
|
|
2901
|
+
setTimeout(this.adjustToScreen.bind(this), 100);
|
|
2882
2902
|
}
|
|
2883
2903
|
};
|
|
2884
2904
|
ImageEditor.prototype.windowResizeHandler = function () {
|
|
@@ -3675,24 +3695,28 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
3675
3695
|
this.textBox.value = actObj.keyHistory;
|
|
3676
3696
|
this.textBox.style.overflow = 'hidden';
|
|
3677
3697
|
this.textBox.style.height = 'auto';
|
|
3678
|
-
this.setTextBoxWidth();
|
|
3679
|
-
this.setTextBoxHeight();
|
|
3680
3698
|
if (degree % 90 === 0 && degree % 180 !== 0 && degree !== 0) {
|
|
3681
3699
|
if (this.factor === 1) {
|
|
3700
|
+
this.textBox.style.width = (actObj.activePoint.height / ratio.height) + 'px';
|
|
3682
3701
|
this.textBox.style.height = (actObj.activePoint.width / ratio.width) + 'px';
|
|
3683
3702
|
}
|
|
3684
3703
|
else {
|
|
3704
|
+
this.textBox.style.width = actObj.activePoint.height + 'px';
|
|
3685
3705
|
this.textBox.style.height = actObj.activePoint.width + 'px';
|
|
3686
3706
|
}
|
|
3687
3707
|
}
|
|
3688
3708
|
else {
|
|
3689
3709
|
if (this.factor === 1) {
|
|
3710
|
+
this.textBox.style.width = (actObj.activePoint.width / ratio.width) + 'px';
|
|
3690
3711
|
this.textBox.style.height = (actObj.activePoint.height / ratio.height) + 'px';
|
|
3691
3712
|
}
|
|
3692
3713
|
else {
|
|
3714
|
+
this.textBox.style.width = actObj.activePoint.width + 'px';
|
|
3693
3715
|
this.textBox.style.height = actObj.activePoint.height + 'px';
|
|
3694
3716
|
}
|
|
3695
3717
|
}
|
|
3718
|
+
this.setTextBoxWidth();
|
|
3719
|
+
this.setTextBoxHeight();
|
|
3696
3720
|
}
|
|
3697
3721
|
else {
|
|
3698
3722
|
this.applyActObj();
|
|
@@ -3725,42 +3749,55 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
3725
3749
|
}
|
|
3726
3750
|
if (degree === 0) {
|
|
3727
3751
|
if (flip.toLowerCase() === 'vertical') {
|
|
3728
|
-
this.textBox.style.maxHeight = ((this.lowerCanvas.
|
|
3752
|
+
this.textBox.style.maxHeight = (parseFloat(this.lowerCanvas.style.maxHeight) - (parseFloat(this.lowerCanvas.style.maxHeight)
|
|
3753
|
+
- parseFloat(this.textBox.style.top))) + 'px';
|
|
3729
3754
|
}
|
|
3730
3755
|
else {
|
|
3731
3756
|
textBoxTop = parseFloat(this.textBox.style.top) - parseFloat(this.lowerCanvas.style.top);
|
|
3732
|
-
this.textBox.style.maxHeight = ((this.lowerCanvas.
|
|
3757
|
+
this.textBox.style.maxHeight = (parseFloat(this.lowerCanvas.style.maxHeight) - textBoxTop) + 'px';
|
|
3733
3758
|
}
|
|
3734
3759
|
}
|
|
3735
3760
|
else if (degree === 90) {
|
|
3736
3761
|
if (flip.toLowerCase() === 'horizontal') {
|
|
3737
|
-
this.textBox.style.maxHeight = ((this.lowerCanvas.
|
|
3762
|
+
this.textBox.style.maxHeight = (parseFloat(this.lowerCanvas.style.maxWidth) - (parseFloat(this.textBox.style.left)
|
|
3763
|
+
- parseFloat(this.lowerCanvas.style.left))) + 'px';
|
|
3738
3764
|
}
|
|
3739
3765
|
else {
|
|
3740
|
-
this.textBox.style.maxHeight = ((this.
|
|
3766
|
+
this.textBox.style.maxHeight = (parseFloat(this.textBox.style.left)
|
|
3767
|
+
- parseFloat(this.lowerCanvas.style.left)) + 'px';
|
|
3741
3768
|
}
|
|
3742
3769
|
}
|
|
3743
3770
|
else if (degree === 180) {
|
|
3744
3771
|
if (flip.toLowerCase() === 'vertical') {
|
|
3745
|
-
this.textBox.style.
|
|
3772
|
+
textBoxTop = parseFloat(this.textBox.style.top) - parseFloat(this.lowerCanvas.style.top);
|
|
3773
|
+
this.textBox.style.maxHeight = (parseFloat(this.lowerCanvas.style.maxHeight) - textBoxTop) + 'px';
|
|
3746
3774
|
}
|
|
3747
3775
|
else {
|
|
3748
|
-
this.textBox.style.maxHeight = ((this.
|
|
3776
|
+
this.textBox.style.maxHeight = (parseFloat(this.textBox.style.top)
|
|
3777
|
+
- parseFloat(this.lowerCanvas.style.top)) + 'px';
|
|
3749
3778
|
}
|
|
3750
3779
|
}
|
|
3751
3780
|
else if (degree === 270) {
|
|
3752
3781
|
if (flip.toLowerCase() === 'horizontal') {
|
|
3753
|
-
this.textBox.style.maxHeight = ((this.
|
|
3782
|
+
this.textBox.style.maxHeight = (parseFloat(this.textBox.style.left)
|
|
3783
|
+
- parseFloat(this.lowerCanvas.style.left)) + 'px';
|
|
3754
3784
|
}
|
|
3755
3785
|
else {
|
|
3756
|
-
this.textBox.style.maxHeight = (
|
|
3786
|
+
this.textBox.style.maxHeight = parseFloat(this.lowerCanvas.style.maxWidth) - (parseFloat(this.textBox.style.left)
|
|
3787
|
+
- parseFloat(this.lowerCanvas.style.left)) + 'px';
|
|
3757
3788
|
}
|
|
3758
3789
|
}
|
|
3759
|
-
this.textBox.style.maxHeight = ((parseFloat(this.textBox.style.maxHeight) - parseFloat(this.textBox.style.fontSize) * 0.5))
|
|
3790
|
+
this.textBox.style.maxHeight = ((parseFloat(this.textBox.style.maxHeight) - parseFloat(this.textBox.style.fontSize) * 0.5)) + 'px';
|
|
3760
3791
|
};
|
|
3761
3792
|
ImageEditor.prototype.setTextBoxWidth = function (e) {
|
|
3762
3793
|
var ratio = this.calcRatio();
|
|
3763
3794
|
var text = this.getMaxText(true);
|
|
3795
|
+
if (this.textBox.style.display === 'block') {
|
|
3796
|
+
this.updateFontStyles(true);
|
|
3797
|
+
}
|
|
3798
|
+
else {
|
|
3799
|
+
this.updateFontStyles();
|
|
3800
|
+
}
|
|
3764
3801
|
var textBoxWidth = (this.upperContext.measureText(text).width + (parseFloat(this.textBox.style.fontSize) / 2));
|
|
3765
3802
|
var letterWidth = e ? this.upperContext.measureText(String.fromCharCode(e.which)).width : 0;
|
|
3766
3803
|
var actObj = extend({}, this.activeObj, {}, true);
|
|
@@ -3787,56 +3824,56 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
3787
3824
|
if ((!isNullOrUndefined(e) && parseFloat(this.textBox.style.width) < (textBoxWidth + letterWidth)) || isNullOrUndefined(e)) {
|
|
3788
3825
|
if (degree === 0) {
|
|
3789
3826
|
if (flip.toLowerCase() === 'horizontal') {
|
|
3790
|
-
if (
|
|
3791
|
-
this.textBox.style.width = (
|
|
3827
|
+
if ((parseFloat(this.textBox.style.left) - parseFloat(this.lowerCanvas.style.left)) - textBoxWidth - letterWidth > 0) {
|
|
3828
|
+
this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
|
|
3792
3829
|
}
|
|
3793
3830
|
}
|
|
3794
3831
|
else {
|
|
3795
|
-
if (
|
|
3796
|
-
this.
|
|
3832
|
+
if ((parseFloat(this.lowerCanvas.style.maxWidth) - (parseFloat(this.textBox.style.left)
|
|
3833
|
+
- parseFloat(this.lowerCanvas.style.left))) > (textBoxWidth + letterWidth)) {
|
|
3834
|
+
this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
|
|
3797
3835
|
}
|
|
3798
3836
|
}
|
|
3799
3837
|
}
|
|
3800
3838
|
else if (degree === 90) {
|
|
3801
3839
|
if (flip.toLowerCase() === 'vertical') {
|
|
3802
|
-
if (
|
|
3803
|
-
this.textBox.style.width = (
|
|
3840
|
+
if ((parseFloat(this.textBox.style.top) - parseFloat(this.lowerCanvas.style.top)) - textBoxWidth - letterWidth > 0) {
|
|
3841
|
+
this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
|
|
3804
3842
|
}
|
|
3805
3843
|
}
|
|
3806
3844
|
else {
|
|
3807
|
-
if (
|
|
3808
|
-
this.
|
|
3845
|
+
if ((parseFloat(this.lowerCanvas.style.maxHeight) - (parseFloat(this.textBox.style.top)
|
|
3846
|
+
- parseFloat(this.lowerCanvas.style.top))) > (textBoxWidth + letterWidth)) {
|
|
3847
|
+
this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
|
|
3809
3848
|
}
|
|
3810
3849
|
}
|
|
3811
3850
|
}
|
|
3812
3851
|
else if (degree === 180) {
|
|
3813
3852
|
if (flip.toLowerCase() === 'horizontal') {
|
|
3814
|
-
if (
|
|
3815
|
-
this.
|
|
3853
|
+
if ((parseFloat(this.lowerCanvas.style.maxWidth) - (parseFloat(this.textBox.style.left)
|
|
3854
|
+
- parseFloat(this.lowerCanvas.style.left))) > (textBoxWidth + letterWidth)) {
|
|
3855
|
+
this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
|
|
3816
3856
|
}
|
|
3817
3857
|
}
|
|
3818
3858
|
else {
|
|
3819
|
-
if (
|
|
3820
|
-
this.textBox.style.width = (
|
|
3859
|
+
if ((parseFloat(this.textBox.style.left) - parseFloat(this.lowerCanvas.style.left)) - textBoxWidth - letterWidth > 0) {
|
|
3860
|
+
this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
|
|
3821
3861
|
}
|
|
3822
3862
|
}
|
|
3823
3863
|
}
|
|
3824
3864
|
else if (degree === 270) {
|
|
3825
3865
|
if (flip.toLowerCase() === 'vertical') {
|
|
3826
|
-
if (
|
|
3827
|
-
this.
|
|
3866
|
+
if ((parseFloat(this.lowerCanvas.style.maxHeight) - (parseFloat(this.textBox.style.top)
|
|
3867
|
+
- parseFloat(this.lowerCanvas.style.top))) > (textBoxWidth + letterWidth)) {
|
|
3868
|
+
this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
|
|
3828
3869
|
}
|
|
3829
3870
|
}
|
|
3830
3871
|
else {
|
|
3831
|
-
if (
|
|
3832
|
-
this.textBox.style.width = (
|
|
3872
|
+
if ((parseFloat(this.textBox.style.top) - parseFloat(this.lowerCanvas.style.top)) - textBoxWidth - letterWidth > 0) {
|
|
3873
|
+
this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
|
|
3833
3874
|
}
|
|
3834
3875
|
}
|
|
3835
3876
|
}
|
|
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
3877
|
}
|
|
3841
3878
|
};
|
|
3842
3879
|
ImageEditor.prototype.setActivePoint = function (startX, startY) {
|
|
@@ -5802,7 +5839,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
5802
5839
|
this.setActivePoint(width, height);
|
|
5803
5840
|
}
|
|
5804
5841
|
};
|
|
5805
|
-
ImageEditor.prototype.updateFontStyles = function () {
|
|
5842
|
+
ImageEditor.prototype.updateFontStyles = function (isTextBox) {
|
|
5806
5843
|
this.upperContext.strokeStyle = this.activeObj.strokeSettings.strokeColor;
|
|
5807
5844
|
this.upperContext.fillStyle = this.activeObj.strokeSettings.strokeColor;
|
|
5808
5845
|
var textStyle = '';
|
|
@@ -5815,7 +5852,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
5815
5852
|
if (this.activeObj.textSettings.bold && this.activeObj.textSettings.italic) {
|
|
5816
5853
|
textStyle = 'italic bold ';
|
|
5817
5854
|
}
|
|
5818
|
-
var fontSize = this.activeObj.textSettings.fontSize;
|
|
5855
|
+
var fontSize = isTextBox ? parseFloat(this.textBox.style.fontSize) : this.activeObj.textSettings.fontSize;
|
|
5819
5856
|
var fontFamily = this.textBox.style.display === 'block' ? this.textBox.style.fontFamily : this.activeObj.textSettings.fontFamily;
|
|
5820
5857
|
this.upperContext.font = textStyle + fontSize + 'px' + ' ' + fontFamily;
|
|
5821
5858
|
};
|
|
@@ -5931,24 +5968,14 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
5931
5968
|
this.degree = 0;
|
|
5932
5969
|
}
|
|
5933
5970
|
};
|
|
5934
|
-
ImageEditor.prototype.redrawSelection = function (
|
|
5971
|
+
ImageEditor.prototype.redrawSelection = function () {
|
|
5935
5972
|
var ratio = this.calcRatio();
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
5941
|
-
|
|
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
|
-
}
|
|
5973
|
+
this.activeObj.activePoint.startX = 0;
|
|
5974
|
+
this.activeObj.activePoint.startY = 0;
|
|
5975
|
+
this.activeObj.activePoint.endX = this.lowerCanvas.width;
|
|
5976
|
+
this.activeObj.activePoint.endY = this.lowerCanvas.height;
|
|
5977
|
+
this.activeObj.activePoint.width = this.activeObj.activePoint.endX - this.activeObj.activePoint.startX;
|
|
5978
|
+
this.activeObj.activePoint.height = this.activeObj.activePoint.endY - this.activeObj.activePoint.startY;
|
|
5952
5979
|
this.updateActiveObject(ratio, this.activeObj.activePoint, this.activeObj);
|
|
5953
5980
|
this.drawObject('duplicate', this.activeObj);
|
|
5954
5981
|
};
|
|
@@ -6758,7 +6785,9 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
6758
6785
|
(isNullOrUndefined(document.getElementById(this.element.id + '_toolbar')))) {
|
|
6759
6786
|
this.toolbarHeight = 0;
|
|
6760
6787
|
}
|
|
6761
|
-
this.
|
|
6788
|
+
if (isNullOrUndefined(this.toolbarTemplate)) {
|
|
6789
|
+
this.update();
|
|
6790
|
+
}
|
|
6762
6791
|
var type = typeof (data);
|
|
6763
6792
|
if (type === 'string') {
|
|
6764
6793
|
this.imageOnLoad(data);
|
|
@@ -7226,7 +7255,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
7226
7255
|
}
|
|
7227
7256
|
this.currObjType.isCustomCrop = false;
|
|
7228
7257
|
var start = { x: x, y: y };
|
|
7229
|
-
this.drawShape('
|
|
7258
|
+
this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY);
|
|
7230
7259
|
}
|
|
7231
7260
|
return isEllipse;
|
|
7232
7261
|
};
|
|
@@ -7470,6 +7499,125 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
7470
7499
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
7471
7500
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
7472
7501
|
};
|
|
7502
|
+
/**
|
|
7503
|
+
* To check whether the undo collection is empty or not.
|
|
7504
|
+
*
|
|
7505
|
+
* @returns {boolean}.
|
|
7506
|
+
* @private
|
|
7507
|
+
*/
|
|
7508
|
+
ImageEditor.prototype.canUndo = function () {
|
|
7509
|
+
return _super.prototype.canUndo.call(this);
|
|
7510
|
+
};
|
|
7511
|
+
/**
|
|
7512
|
+
* To check whether the redo collection is empty or not.
|
|
7513
|
+
*
|
|
7514
|
+
* @returns {boolean}.
|
|
7515
|
+
* @private
|
|
7516
|
+
*/
|
|
7517
|
+
ImageEditor.prototype.canRedo = function () {
|
|
7518
|
+
return _super.prototype.canRedo.call(this);
|
|
7519
|
+
};
|
|
7520
|
+
/**
|
|
7521
|
+
* Erases all the signature strokes signed by user.
|
|
7522
|
+
*
|
|
7523
|
+
* @returns {void}.
|
|
7524
|
+
* @private
|
|
7525
|
+
*/
|
|
7526
|
+
ImageEditor.prototype.clear = function () {
|
|
7527
|
+
_super.prototype.clear.call(this);
|
|
7528
|
+
};
|
|
7529
|
+
/**
|
|
7530
|
+
* To draw the signature based on the given text, with the font family and font size.
|
|
7531
|
+
*
|
|
7532
|
+
* @param {string} text - specify text to be drawn as signature.
|
|
7533
|
+
* @param {string} fontFamily - specify font family of a signature.
|
|
7534
|
+
* @param {number} fontSize - specify font size of a signature.
|
|
7535
|
+
*
|
|
7536
|
+
* @returns {void}.
|
|
7537
|
+
* @private
|
|
7538
|
+
*/
|
|
7539
|
+
ImageEditor.prototype.draw = function (text, fontFamily, fontSize) {
|
|
7540
|
+
_super.prototype.draw.call(this, text, fontFamily, fontSize);
|
|
7541
|
+
};
|
|
7542
|
+
/**
|
|
7543
|
+
* To get the signature as Blob.
|
|
7544
|
+
*
|
|
7545
|
+
* @param {string} url - specify the url/base 64 string to get blob of the signature.
|
|
7546
|
+
* @returns {Blob}.
|
|
7547
|
+
* @private
|
|
7548
|
+
*/
|
|
7549
|
+
ImageEditor.prototype.getBlob = function (url) {
|
|
7550
|
+
return _super.prototype.getBlob.call(this, url);
|
|
7551
|
+
};
|
|
7552
|
+
/**
|
|
7553
|
+
* To check whether the signature is empty or not.
|
|
7554
|
+
*
|
|
7555
|
+
* @returns {boolean}.
|
|
7556
|
+
* @private
|
|
7557
|
+
*/
|
|
7558
|
+
ImageEditor.prototype.isEmpty = function () {
|
|
7559
|
+
return _super.prototype.isEmpty.call(this);
|
|
7560
|
+
};
|
|
7561
|
+
/**
|
|
7562
|
+
* To load the signature with the given base 64 string, height and width.
|
|
7563
|
+
*
|
|
7564
|
+
* @param {string} signature - specify the url/base 64 string to be drawn as signature.
|
|
7565
|
+
* @param {number} width - specify the width of the loaded signature image.
|
|
7566
|
+
* @param {number} height - specify the height of the loaded signature image.
|
|
7567
|
+
* @returns {void}.
|
|
7568
|
+
* @private
|
|
7569
|
+
*/
|
|
7570
|
+
ImageEditor.prototype.load = function (signature, width, height) {
|
|
7571
|
+
_super.prototype.load.call(this, signature, width, height);
|
|
7572
|
+
};
|
|
7573
|
+
/**
|
|
7574
|
+
* Undo the last user action.
|
|
7575
|
+
*
|
|
7576
|
+
* @returns {void}.
|
|
7577
|
+
* @private
|
|
7578
|
+
*/
|
|
7579
|
+
ImageEditor.prototype.undo = function () {
|
|
7580
|
+
_super.prototype.undo.call(this);
|
|
7581
|
+
};
|
|
7582
|
+
/**
|
|
7583
|
+
* Redo the last user action.
|
|
7584
|
+
*
|
|
7585
|
+
* @returns {void}.
|
|
7586
|
+
* @private
|
|
7587
|
+
*/
|
|
7588
|
+
ImageEditor.prototype.redo = function () {
|
|
7589
|
+
_super.prototype.redo.call(this);
|
|
7590
|
+
};
|
|
7591
|
+
/**
|
|
7592
|
+
* To save the signature with the given file type and file name.
|
|
7593
|
+
*
|
|
7594
|
+
* @param {SignatureFileType} type - specify type of the file to be saved a signature.
|
|
7595
|
+
* @param {string} fileName - specify name of the file to be saved a signature.
|
|
7596
|
+
*
|
|
7597
|
+
* @returns {void}.
|
|
7598
|
+
* @private
|
|
7599
|
+
*/
|
|
7600
|
+
ImageEditor.prototype.save = function (type, fileName) {
|
|
7601
|
+
_super.prototype.save.call(this, type, fileName);
|
|
7602
|
+
};
|
|
7603
|
+
/**
|
|
7604
|
+
* To save the signature as Blob.
|
|
7605
|
+
*
|
|
7606
|
+
* @returns {Blob}.
|
|
7607
|
+
* @private
|
|
7608
|
+
*/
|
|
7609
|
+
ImageEditor.prototype.saveAsBlob = function () {
|
|
7610
|
+
return _super.prototype.saveAsBlob.call(this);
|
|
7611
|
+
};
|
|
7612
|
+
/**
|
|
7613
|
+
* Returns the persistence data for component.
|
|
7614
|
+
*
|
|
7615
|
+
* @returns any.
|
|
7616
|
+
* @private
|
|
7617
|
+
*/
|
|
7618
|
+
ImageEditor.prototype.getLocalData = function () {
|
|
7619
|
+
return _super.prototype.getLocalData.call(this);
|
|
7620
|
+
};
|
|
7473
7621
|
var ImageEditor_1;
|
|
7474
7622
|
__decorate([
|
|
7475
7623
|
Property('')
|
|
@@ -7492,6 +7640,36 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
7492
7640
|
__decorate([
|
|
7493
7641
|
Property('100%')
|
|
7494
7642
|
], ImageEditor.prototype, "width", void 0);
|
|
7643
|
+
__decorate([
|
|
7644
|
+
Property('')
|
|
7645
|
+
], ImageEditor.prototype, "backgroundColor", void 0);
|
|
7646
|
+
__decorate([
|
|
7647
|
+
Property('')
|
|
7648
|
+
], ImageEditor.prototype, "backgroundImage", void 0);
|
|
7649
|
+
__decorate([
|
|
7650
|
+
Property(false)
|
|
7651
|
+
], ImageEditor.prototype, "isReadOnly", void 0);
|
|
7652
|
+
__decorate([
|
|
7653
|
+
Property(true)
|
|
7654
|
+
], ImageEditor.prototype, "saveWithBackground", void 0);
|
|
7655
|
+
__decorate([
|
|
7656
|
+
Property('#000000')
|
|
7657
|
+
], ImageEditor.prototype, "strokeColor", void 0);
|
|
7658
|
+
__decorate([
|
|
7659
|
+
Property(0.5)
|
|
7660
|
+
], ImageEditor.prototype, "minStrokeWidth", void 0);
|
|
7661
|
+
__decorate([
|
|
7662
|
+
Property(2)
|
|
7663
|
+
], ImageEditor.prototype, "maxStrokeWidth", void 0);
|
|
7664
|
+
__decorate([
|
|
7665
|
+
Property(0.7)
|
|
7666
|
+
], ImageEditor.prototype, "velocity", void 0);
|
|
7667
|
+
__decorate([
|
|
7668
|
+
Property(false)
|
|
7669
|
+
], ImageEditor.prototype, "enableRtl", void 0);
|
|
7670
|
+
__decorate([
|
|
7671
|
+
Property(false)
|
|
7672
|
+
], ImageEditor.prototype, "enablePersistence", void 0);
|
|
7495
7673
|
__decorate([
|
|
7496
7674
|
Event()
|
|
7497
7675
|
], ImageEditor.prototype, "beforeSave", void 0);
|