@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
|
@@ -46,7 +46,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
|
|
|
46
46
|
this.dragPoint = { startX: 0, startY: 0, endX: 0, endY: 0 }; // updates drag start and end points in mousedown and mousemove
|
|
47
47
|
this.diffPoint = { x: 0, y: 0 }; // updates resize points
|
|
48
48
|
this.oldPoint = {};
|
|
49
|
-
this.zoomedImg = { startX: 0, startY: 0, endX: 0, endY: 0, width: 0, height: 0 }; // calculates zoomed image's points
|
|
50
49
|
this.objColl = []; // shapes, text obj collection
|
|
51
50
|
this.undoRedoColl = [];
|
|
52
51
|
this.imgDataColl = []; // collection of Image Data mainly used for reset state
|
|
@@ -2096,8 +2095,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
|
|
|
2096
2095
|
}
|
|
2097
2096
|
}
|
|
2098
2097
|
updateCanvas() {
|
|
2099
|
-
this.zoomedImg.width = this.baseImg.width;
|
|
2100
|
-
this.zoomedImg.height = this.baseImg.height;
|
|
2101
2098
|
this.lastX = this.baseImg.width / 2;
|
|
2102
2099
|
this.lastY = this.baseImg.height / 2;
|
|
2103
2100
|
let wrapperWidth;
|
|
@@ -2109,12 +2106,21 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
|
|
|
2109
2106
|
wrapperWidth = this.element.clientWidth;
|
|
2110
2107
|
}
|
|
2111
2108
|
const maxDimension = this.calcMaxDimension(this.baseImg.width, this.baseImg.height);
|
|
2109
|
+
let toolbarHeight = 0;
|
|
2110
|
+
if (!isNullOrUndefined(this.toolbarTemplate) && !isNullOrUndefined(document.querySelector('.e-toolbar'))) {
|
|
2111
|
+
toolbarHeight = document.querySelector('.e-toolbar').clientHeight;
|
|
2112
|
+
maxDimension.width -= toolbarHeight;
|
|
2113
|
+
maxDimension.height -= toolbarHeight;
|
|
2114
|
+
}
|
|
2112
2115
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
2113
2116
|
this.lowerCanvas.width = this.upperCanvas.width = this.inMemoryCanvas.width = this.baseImg.width;
|
|
2114
2117
|
this.lowerCanvas.height = this.upperCanvas.height = this.inMemoryCanvas.height = this.baseImg.height;
|
|
2115
2118
|
this.lowerCanvas.style.maxWidth = this.upperCanvas.style.maxWidth = maxDimension.width + 'px';
|
|
2116
2119
|
this.lowerCanvas.style.maxHeight = this.upperCanvas.style.maxHeight = maxDimension.height + 'px';
|
|
2117
2120
|
this.lowerCanvas.style.left = this.upperCanvas.style.left = (wrapperWidth - maxDimension.width) / 2 + 1 + 'px';
|
|
2121
|
+
if (!isNullOrUndefined(this.toolbarTemplate)) {
|
|
2122
|
+
this.lowerCanvas.style.left = parseFloat(this.lowerCanvas.style.left) + (toolbarHeight / 2) + 'px';
|
|
2123
|
+
}
|
|
2118
2124
|
if (canvasWrapper) {
|
|
2119
2125
|
this.lowerCanvas.style.top = this.upperCanvas.style.top = (parseFloat(canvasWrapper.style.height) - maxDimension.height - 1) / 2 + 'px';
|
|
2120
2126
|
}
|
|
@@ -2517,6 +2523,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
|
|
|
2517
2523
|
EventHandler.add(this.upperCanvas, 'touchmove', this.mouseMoveEventHandler, this); // Unbind mousedown to prevent double triggers from touch devices
|
|
2518
2524
|
}
|
|
2519
2525
|
mouseDownEventHandler(e) {
|
|
2526
|
+
if (e.type === 'touchstart' && e.currentTarget === this.lowerCanvas && this.imgDataColl.length === 0) {
|
|
2527
|
+
return;
|
|
2528
|
+
}
|
|
2520
2529
|
const ratio = this.calcRatio();
|
|
2521
2530
|
if (this.dragCanvas) {
|
|
2522
2531
|
this.canvasMouseDownHandler(e);
|
|
@@ -2827,6 +2836,17 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
|
|
|
2827
2836
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
2828
2837
|
this.lowerCanvas.width = this.upperCanvas.width = this.element.offsetWidth;
|
|
2829
2838
|
this.lowerCanvas.height = this.upperCanvas.height = this.element.offsetHeight;
|
|
2839
|
+
const canvasWrapper = document.querySelector('#' + this.element.id + '_canvasWrapper');
|
|
2840
|
+
if (!isNullOrUndefined(canvasWrapper)) {
|
|
2841
|
+
canvasWrapper.style.width = this.element.offsetWidth + 'px';
|
|
2842
|
+
canvasWrapper.style.height = this.element.offsetHeight + 'px';
|
|
2843
|
+
if (Browser.isDevice) {
|
|
2844
|
+
canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - (2 * this.toolbarHeight)) - 3 + 'px';
|
|
2845
|
+
}
|
|
2846
|
+
else {
|
|
2847
|
+
canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - this.toolbarHeight) - 3 + 'px';
|
|
2848
|
+
}
|
|
2849
|
+
}
|
|
2830
2850
|
this.redrawImg();
|
|
2831
2851
|
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
2832
2852
|
this.lowerCanvas.toBlob(function (blob) {
|
|
@@ -2841,7 +2861,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
|
|
|
2841
2861
|
screenOrientation() {
|
|
2842
2862
|
if (Browser.isDevice) {
|
|
2843
2863
|
this.isScreenOriented = true;
|
|
2844
|
-
this.adjustToScreen();
|
|
2864
|
+
setTimeout(this.adjustToScreen.bind(this), 100);
|
|
2845
2865
|
}
|
|
2846
2866
|
}
|
|
2847
2867
|
windowResizeHandler() {
|
|
@@ -3637,24 +3657,28 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
|
|
|
3637
3657
|
this.textBox.value = actObj.keyHistory;
|
|
3638
3658
|
this.textBox.style.overflow = 'hidden';
|
|
3639
3659
|
this.textBox.style.height = 'auto';
|
|
3640
|
-
this.setTextBoxWidth();
|
|
3641
|
-
this.setTextBoxHeight();
|
|
3642
3660
|
if (degree % 90 === 0 && degree % 180 !== 0 && degree !== 0) {
|
|
3643
3661
|
if (this.factor === 1) {
|
|
3662
|
+
this.textBox.style.width = (actObj.activePoint.height / ratio.height) + 'px';
|
|
3644
3663
|
this.textBox.style.height = (actObj.activePoint.width / ratio.width) + 'px';
|
|
3645
3664
|
}
|
|
3646
3665
|
else {
|
|
3666
|
+
this.textBox.style.width = actObj.activePoint.height + 'px';
|
|
3647
3667
|
this.textBox.style.height = actObj.activePoint.width + 'px';
|
|
3648
3668
|
}
|
|
3649
3669
|
}
|
|
3650
3670
|
else {
|
|
3651
3671
|
if (this.factor === 1) {
|
|
3672
|
+
this.textBox.style.width = (actObj.activePoint.width / ratio.width) + 'px';
|
|
3652
3673
|
this.textBox.style.height = (actObj.activePoint.height / ratio.height) + 'px';
|
|
3653
3674
|
}
|
|
3654
3675
|
else {
|
|
3676
|
+
this.textBox.style.width = actObj.activePoint.width + 'px';
|
|
3655
3677
|
this.textBox.style.height = actObj.activePoint.height + 'px';
|
|
3656
3678
|
}
|
|
3657
3679
|
}
|
|
3680
|
+
this.setTextBoxWidth();
|
|
3681
|
+
this.setTextBoxHeight();
|
|
3658
3682
|
}
|
|
3659
3683
|
else {
|
|
3660
3684
|
this.applyActObj();
|
|
@@ -3687,42 +3711,55 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
|
|
|
3687
3711
|
}
|
|
3688
3712
|
if (degree === 0) {
|
|
3689
3713
|
if (flip.toLowerCase() === 'vertical') {
|
|
3690
|
-
this.textBox.style.maxHeight = ((this.lowerCanvas.
|
|
3714
|
+
this.textBox.style.maxHeight = (parseFloat(this.lowerCanvas.style.maxHeight) - (parseFloat(this.lowerCanvas.style.maxHeight)
|
|
3715
|
+
- parseFloat(this.textBox.style.top))) + 'px';
|
|
3691
3716
|
}
|
|
3692
3717
|
else {
|
|
3693
3718
|
textBoxTop = parseFloat(this.textBox.style.top) - parseFloat(this.lowerCanvas.style.top);
|
|
3694
|
-
this.textBox.style.maxHeight = ((this.lowerCanvas.
|
|
3719
|
+
this.textBox.style.maxHeight = (parseFloat(this.lowerCanvas.style.maxHeight) - textBoxTop) + 'px';
|
|
3695
3720
|
}
|
|
3696
3721
|
}
|
|
3697
3722
|
else if (degree === 90) {
|
|
3698
3723
|
if (flip.toLowerCase() === 'horizontal') {
|
|
3699
|
-
this.textBox.style.maxHeight = ((this.lowerCanvas.
|
|
3724
|
+
this.textBox.style.maxHeight = (parseFloat(this.lowerCanvas.style.maxWidth) - (parseFloat(this.textBox.style.left)
|
|
3725
|
+
- parseFloat(this.lowerCanvas.style.left))) + 'px';
|
|
3700
3726
|
}
|
|
3701
3727
|
else {
|
|
3702
|
-
this.textBox.style.maxHeight = ((this.
|
|
3728
|
+
this.textBox.style.maxHeight = (parseFloat(this.textBox.style.left)
|
|
3729
|
+
- parseFloat(this.lowerCanvas.style.left)) + 'px';
|
|
3703
3730
|
}
|
|
3704
3731
|
}
|
|
3705
3732
|
else if (degree === 180) {
|
|
3706
3733
|
if (flip.toLowerCase() === 'vertical') {
|
|
3707
|
-
this.textBox.style.
|
|
3734
|
+
textBoxTop = parseFloat(this.textBox.style.top) - parseFloat(this.lowerCanvas.style.top);
|
|
3735
|
+
this.textBox.style.maxHeight = (parseFloat(this.lowerCanvas.style.maxHeight) - textBoxTop) + 'px';
|
|
3708
3736
|
}
|
|
3709
3737
|
else {
|
|
3710
|
-
this.textBox.style.maxHeight = ((this.
|
|
3738
|
+
this.textBox.style.maxHeight = (parseFloat(this.textBox.style.top)
|
|
3739
|
+
- parseFloat(this.lowerCanvas.style.top)) + 'px';
|
|
3711
3740
|
}
|
|
3712
3741
|
}
|
|
3713
3742
|
else if (degree === 270) {
|
|
3714
3743
|
if (flip.toLowerCase() === 'horizontal') {
|
|
3715
|
-
this.textBox.style.maxHeight = ((this.
|
|
3744
|
+
this.textBox.style.maxHeight = (parseFloat(this.textBox.style.left)
|
|
3745
|
+
- parseFloat(this.lowerCanvas.style.left)) + 'px';
|
|
3716
3746
|
}
|
|
3717
3747
|
else {
|
|
3718
|
-
this.textBox.style.maxHeight = (
|
|
3748
|
+
this.textBox.style.maxHeight = parseFloat(this.lowerCanvas.style.maxWidth) - (parseFloat(this.textBox.style.left)
|
|
3749
|
+
- parseFloat(this.lowerCanvas.style.left)) + 'px';
|
|
3719
3750
|
}
|
|
3720
3751
|
}
|
|
3721
|
-
this.textBox.style.maxHeight = ((parseFloat(this.textBox.style.maxHeight) - parseFloat(this.textBox.style.fontSize) * 0.5))
|
|
3752
|
+
this.textBox.style.maxHeight = ((parseFloat(this.textBox.style.maxHeight) - parseFloat(this.textBox.style.fontSize) * 0.5)) + 'px';
|
|
3722
3753
|
}
|
|
3723
3754
|
setTextBoxWidth(e) {
|
|
3724
3755
|
const ratio = this.calcRatio();
|
|
3725
3756
|
const text = this.getMaxText(true);
|
|
3757
|
+
if (this.textBox.style.display === 'block') {
|
|
3758
|
+
this.updateFontStyles(true);
|
|
3759
|
+
}
|
|
3760
|
+
else {
|
|
3761
|
+
this.updateFontStyles();
|
|
3762
|
+
}
|
|
3726
3763
|
let textBoxWidth = (this.upperContext.measureText(text).width + (parseFloat(this.textBox.style.fontSize) / 2));
|
|
3727
3764
|
let letterWidth = e ? this.upperContext.measureText(String.fromCharCode(e.which)).width : 0;
|
|
3728
3765
|
let actObj = extend({}, this.activeObj, {}, true);
|
|
@@ -3749,56 +3786,56 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
|
|
|
3749
3786
|
if ((!isNullOrUndefined(e) && parseFloat(this.textBox.style.width) < (textBoxWidth + letterWidth)) || isNullOrUndefined(e)) {
|
|
3750
3787
|
if (degree === 0) {
|
|
3751
3788
|
if (flip.toLowerCase() === 'horizontal') {
|
|
3752
|
-
if (
|
|
3753
|
-
this.textBox.style.width = (
|
|
3789
|
+
if ((parseFloat(this.textBox.style.left) - parseFloat(this.lowerCanvas.style.left)) - textBoxWidth - letterWidth > 0) {
|
|
3790
|
+
this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
|
|
3754
3791
|
}
|
|
3755
3792
|
}
|
|
3756
3793
|
else {
|
|
3757
|
-
if (
|
|
3758
|
-
this.
|
|
3794
|
+
if ((parseFloat(this.lowerCanvas.style.maxWidth) - (parseFloat(this.textBox.style.left)
|
|
3795
|
+
- parseFloat(this.lowerCanvas.style.left))) > (textBoxWidth + letterWidth)) {
|
|
3796
|
+
this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
|
|
3759
3797
|
}
|
|
3760
3798
|
}
|
|
3761
3799
|
}
|
|
3762
3800
|
else if (degree === 90) {
|
|
3763
3801
|
if (flip.toLowerCase() === 'vertical') {
|
|
3764
|
-
if (
|
|
3765
|
-
this.textBox.style.width = (
|
|
3802
|
+
if ((parseFloat(this.textBox.style.top) - parseFloat(this.lowerCanvas.style.top)) - textBoxWidth - letterWidth > 0) {
|
|
3803
|
+
this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
|
|
3766
3804
|
}
|
|
3767
3805
|
}
|
|
3768
3806
|
else {
|
|
3769
|
-
if (
|
|
3770
|
-
this.
|
|
3807
|
+
if ((parseFloat(this.lowerCanvas.style.maxHeight) - (parseFloat(this.textBox.style.top)
|
|
3808
|
+
- parseFloat(this.lowerCanvas.style.top))) > (textBoxWidth + letterWidth)) {
|
|
3809
|
+
this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
|
|
3771
3810
|
}
|
|
3772
3811
|
}
|
|
3773
3812
|
}
|
|
3774
3813
|
else if (degree === 180) {
|
|
3775
3814
|
if (flip.toLowerCase() === 'horizontal') {
|
|
3776
|
-
if (
|
|
3777
|
-
this.
|
|
3815
|
+
if ((parseFloat(this.lowerCanvas.style.maxWidth) - (parseFloat(this.textBox.style.left)
|
|
3816
|
+
- parseFloat(this.lowerCanvas.style.left))) > (textBoxWidth + letterWidth)) {
|
|
3817
|
+
this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
|
|
3778
3818
|
}
|
|
3779
3819
|
}
|
|
3780
3820
|
else {
|
|
3781
|
-
if (
|
|
3782
|
-
this.textBox.style.width = (
|
|
3821
|
+
if ((parseFloat(this.textBox.style.left) - parseFloat(this.lowerCanvas.style.left)) - textBoxWidth - letterWidth > 0) {
|
|
3822
|
+
this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
|
|
3783
3823
|
}
|
|
3784
3824
|
}
|
|
3785
3825
|
}
|
|
3786
3826
|
else if (degree === 270) {
|
|
3787
3827
|
if (flip.toLowerCase() === 'vertical') {
|
|
3788
|
-
if (
|
|
3789
|
-
this.
|
|
3828
|
+
if ((parseFloat(this.lowerCanvas.style.maxHeight) - (parseFloat(this.textBox.style.top)
|
|
3829
|
+
- parseFloat(this.lowerCanvas.style.top))) > (textBoxWidth + letterWidth)) {
|
|
3830
|
+
this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
|
|
3790
3831
|
}
|
|
3791
3832
|
}
|
|
3792
3833
|
else {
|
|
3793
|
-
if (
|
|
3794
|
-
this.textBox.style.width = (
|
|
3834
|
+
if ((parseFloat(this.textBox.style.top) - parseFloat(this.lowerCanvas.style.top)) - textBoxWidth - letterWidth > 0) {
|
|
3835
|
+
this.textBox.style.width = (textBoxWidth + letterWidth) + 'px';
|
|
3795
3836
|
}
|
|
3796
3837
|
}
|
|
3797
3838
|
}
|
|
3798
|
-
this.textBox.style.width = parseFloat(this.textBox.style.width) * this.factor + 'px';
|
|
3799
|
-
if (isNullOrUndefined(e)) {
|
|
3800
|
-
this.textBox.style.width = parseFloat(this.textBox.style.width) + parseFloat(this.textBox.style.fontSize) + 'px';
|
|
3801
|
-
}
|
|
3802
3839
|
}
|
|
3803
3840
|
}
|
|
3804
3841
|
setActivePoint(startX, startY) {
|
|
@@ -5764,7 +5801,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
|
|
|
5764
5801
|
this.setActivePoint(width, height);
|
|
5765
5802
|
}
|
|
5766
5803
|
}
|
|
5767
|
-
updateFontStyles() {
|
|
5804
|
+
updateFontStyles(isTextBox) {
|
|
5768
5805
|
this.upperContext.strokeStyle = this.activeObj.strokeSettings.strokeColor;
|
|
5769
5806
|
this.upperContext.fillStyle = this.activeObj.strokeSettings.strokeColor;
|
|
5770
5807
|
let textStyle = '';
|
|
@@ -5777,7 +5814,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
|
|
|
5777
5814
|
if (this.activeObj.textSettings.bold && this.activeObj.textSettings.italic) {
|
|
5778
5815
|
textStyle = 'italic bold ';
|
|
5779
5816
|
}
|
|
5780
|
-
const fontSize = this.activeObj.textSettings.fontSize;
|
|
5817
|
+
const fontSize = isTextBox ? parseFloat(this.textBox.style.fontSize) : this.activeObj.textSettings.fontSize;
|
|
5781
5818
|
const fontFamily = this.textBox.style.display === 'block' ? this.textBox.style.fontFamily : this.activeObj.textSettings.fontFamily;
|
|
5782
5819
|
this.upperContext.font = textStyle + fontSize + 'px' + ' ' + fontFamily;
|
|
5783
5820
|
}
|
|
@@ -5893,24 +5930,14 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
|
|
|
5893
5930
|
this.degree = 0;
|
|
5894
5931
|
}
|
|
5895
5932
|
}
|
|
5896
|
-
redrawSelection(
|
|
5933
|
+
redrawSelection() {
|
|
5897
5934
|
const ratio = this.calcRatio();
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
this.activeObj.activePoint.height = this.zoomedImg.height;
|
|
5905
|
-
}
|
|
5906
|
-
else {
|
|
5907
|
-
this.activeObj.activePoint.startX = 0;
|
|
5908
|
-
this.activeObj.activePoint.startY = 0;
|
|
5909
|
-
this.activeObj.activePoint.endX = this.lowerCanvas.width;
|
|
5910
|
-
this.activeObj.activePoint.endY = this.lowerCanvas.height;
|
|
5911
|
-
this.activeObj.activePoint.width = this.activeObj.activePoint.endX - this.activeObj.activePoint.startX;
|
|
5912
|
-
this.activeObj.activePoint.height = this.activeObj.activePoint.endY - this.activeObj.activePoint.startY;
|
|
5913
|
-
}
|
|
5935
|
+
this.activeObj.activePoint.startX = 0;
|
|
5936
|
+
this.activeObj.activePoint.startY = 0;
|
|
5937
|
+
this.activeObj.activePoint.endX = this.lowerCanvas.width;
|
|
5938
|
+
this.activeObj.activePoint.endY = this.lowerCanvas.height;
|
|
5939
|
+
this.activeObj.activePoint.width = this.activeObj.activePoint.endX - this.activeObj.activePoint.startX;
|
|
5940
|
+
this.activeObj.activePoint.height = this.activeObj.activePoint.endY - this.activeObj.activePoint.startY;
|
|
5914
5941
|
this.updateActiveObject(ratio, this.activeObj.activePoint, this.activeObj);
|
|
5915
5942
|
this.drawObject('duplicate', this.activeObj);
|
|
5916
5943
|
}
|
|
@@ -6720,7 +6747,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
|
|
|
6720
6747
|
(isNullOrUndefined(document.getElementById(this.element.id + '_toolbar')))) {
|
|
6721
6748
|
this.toolbarHeight = 0;
|
|
6722
6749
|
}
|
|
6723
|
-
this.
|
|
6750
|
+
if (isNullOrUndefined(this.toolbarTemplate)) {
|
|
6751
|
+
this.update();
|
|
6752
|
+
}
|
|
6724
6753
|
const type = typeof (data);
|
|
6725
6754
|
if (type === 'string') {
|
|
6726
6755
|
this.imageOnLoad(data);
|
|
@@ -7187,7 +7216,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
|
|
|
7187
7216
|
}
|
|
7188
7217
|
this.currObjType.isCustomCrop = false;
|
|
7189
7218
|
const start = { x: x, y: y };
|
|
7190
|
-
this.drawShape('
|
|
7219
|
+
this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY);
|
|
7191
7220
|
}
|
|
7192
7221
|
return isEllipse;
|
|
7193
7222
|
}
|
|
@@ -7431,6 +7460,125 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
|
|
|
7431
7460
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
7432
7461
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
7433
7462
|
}
|
|
7463
|
+
/**
|
|
7464
|
+
* To check whether the undo collection is empty or not.
|
|
7465
|
+
*
|
|
7466
|
+
* @returns {boolean}.
|
|
7467
|
+
* @private
|
|
7468
|
+
*/
|
|
7469
|
+
canUndo() {
|
|
7470
|
+
return super.canUndo();
|
|
7471
|
+
}
|
|
7472
|
+
/**
|
|
7473
|
+
* To check whether the redo collection is empty or not.
|
|
7474
|
+
*
|
|
7475
|
+
* @returns {boolean}.
|
|
7476
|
+
* @private
|
|
7477
|
+
*/
|
|
7478
|
+
canRedo() {
|
|
7479
|
+
return super.canRedo();
|
|
7480
|
+
}
|
|
7481
|
+
/**
|
|
7482
|
+
* Erases all the signature strokes signed by user.
|
|
7483
|
+
*
|
|
7484
|
+
* @returns {void}.
|
|
7485
|
+
* @private
|
|
7486
|
+
*/
|
|
7487
|
+
clear() {
|
|
7488
|
+
super.clear();
|
|
7489
|
+
}
|
|
7490
|
+
/**
|
|
7491
|
+
* To draw the signature based on the given text, with the font family and font size.
|
|
7492
|
+
*
|
|
7493
|
+
* @param {string} text - specify text to be drawn as signature.
|
|
7494
|
+
* @param {string} fontFamily - specify font family of a signature.
|
|
7495
|
+
* @param {number} fontSize - specify font size of a signature.
|
|
7496
|
+
*
|
|
7497
|
+
* @returns {void}.
|
|
7498
|
+
* @private
|
|
7499
|
+
*/
|
|
7500
|
+
draw(text, fontFamily, fontSize) {
|
|
7501
|
+
super.draw(text, fontFamily, fontSize);
|
|
7502
|
+
}
|
|
7503
|
+
/**
|
|
7504
|
+
* To get the signature as Blob.
|
|
7505
|
+
*
|
|
7506
|
+
* @param {string} url - specify the url/base 64 string to get blob of the signature.
|
|
7507
|
+
* @returns {Blob}.
|
|
7508
|
+
* @private
|
|
7509
|
+
*/
|
|
7510
|
+
getBlob(url) {
|
|
7511
|
+
return super.getBlob(url);
|
|
7512
|
+
}
|
|
7513
|
+
/**
|
|
7514
|
+
* To check whether the signature is empty or not.
|
|
7515
|
+
*
|
|
7516
|
+
* @returns {boolean}.
|
|
7517
|
+
* @private
|
|
7518
|
+
*/
|
|
7519
|
+
isEmpty() {
|
|
7520
|
+
return super.isEmpty();
|
|
7521
|
+
}
|
|
7522
|
+
/**
|
|
7523
|
+
* To load the signature with the given base 64 string, height and width.
|
|
7524
|
+
*
|
|
7525
|
+
* @param {string} signature - specify the url/base 64 string to be drawn as signature.
|
|
7526
|
+
* @param {number} width - specify the width of the loaded signature image.
|
|
7527
|
+
* @param {number} height - specify the height of the loaded signature image.
|
|
7528
|
+
* @returns {void}.
|
|
7529
|
+
* @private
|
|
7530
|
+
*/
|
|
7531
|
+
load(signature, width, height) {
|
|
7532
|
+
super.load(signature, width, height);
|
|
7533
|
+
}
|
|
7534
|
+
/**
|
|
7535
|
+
* Undo the last user action.
|
|
7536
|
+
*
|
|
7537
|
+
* @returns {void}.
|
|
7538
|
+
* @private
|
|
7539
|
+
*/
|
|
7540
|
+
undo() {
|
|
7541
|
+
super.undo();
|
|
7542
|
+
}
|
|
7543
|
+
/**
|
|
7544
|
+
* Redo the last user action.
|
|
7545
|
+
*
|
|
7546
|
+
* @returns {void}.
|
|
7547
|
+
* @private
|
|
7548
|
+
*/
|
|
7549
|
+
redo() {
|
|
7550
|
+
super.redo();
|
|
7551
|
+
}
|
|
7552
|
+
/**
|
|
7553
|
+
* To save the signature with the given file type and file name.
|
|
7554
|
+
*
|
|
7555
|
+
* @param {SignatureFileType} type - specify type of the file to be saved a signature.
|
|
7556
|
+
* @param {string} fileName - specify name of the file to be saved a signature.
|
|
7557
|
+
*
|
|
7558
|
+
* @returns {void}.
|
|
7559
|
+
* @private
|
|
7560
|
+
*/
|
|
7561
|
+
save(type, fileName) {
|
|
7562
|
+
super.save(type, fileName);
|
|
7563
|
+
}
|
|
7564
|
+
/**
|
|
7565
|
+
* To save the signature as Blob.
|
|
7566
|
+
*
|
|
7567
|
+
* @returns {Blob}.
|
|
7568
|
+
* @private
|
|
7569
|
+
*/
|
|
7570
|
+
saveAsBlob() {
|
|
7571
|
+
return super.saveAsBlob();
|
|
7572
|
+
}
|
|
7573
|
+
/**
|
|
7574
|
+
* Returns the persistence data for component.
|
|
7575
|
+
*
|
|
7576
|
+
* @returns any.
|
|
7577
|
+
* @private
|
|
7578
|
+
*/
|
|
7579
|
+
getLocalData() {
|
|
7580
|
+
return super.getLocalData();
|
|
7581
|
+
}
|
|
7434
7582
|
};
|
|
7435
7583
|
__decorate([
|
|
7436
7584
|
Property('')
|
|
@@ -7453,6 +7601,36 @@ __decorate([
|
|
|
7453
7601
|
__decorate([
|
|
7454
7602
|
Property('100%')
|
|
7455
7603
|
], ImageEditor.prototype, "width", void 0);
|
|
7604
|
+
__decorate([
|
|
7605
|
+
Property('')
|
|
7606
|
+
], ImageEditor.prototype, "backgroundColor", void 0);
|
|
7607
|
+
__decorate([
|
|
7608
|
+
Property('')
|
|
7609
|
+
], ImageEditor.prototype, "backgroundImage", void 0);
|
|
7610
|
+
__decorate([
|
|
7611
|
+
Property(false)
|
|
7612
|
+
], ImageEditor.prototype, "isReadOnly", void 0);
|
|
7613
|
+
__decorate([
|
|
7614
|
+
Property(true)
|
|
7615
|
+
], ImageEditor.prototype, "saveWithBackground", void 0);
|
|
7616
|
+
__decorate([
|
|
7617
|
+
Property('#000000')
|
|
7618
|
+
], ImageEditor.prototype, "strokeColor", void 0);
|
|
7619
|
+
__decorate([
|
|
7620
|
+
Property(0.5)
|
|
7621
|
+
], ImageEditor.prototype, "minStrokeWidth", void 0);
|
|
7622
|
+
__decorate([
|
|
7623
|
+
Property(2)
|
|
7624
|
+
], ImageEditor.prototype, "maxStrokeWidth", void 0);
|
|
7625
|
+
__decorate([
|
|
7626
|
+
Property(0.7)
|
|
7627
|
+
], ImageEditor.prototype, "velocity", void 0);
|
|
7628
|
+
__decorate([
|
|
7629
|
+
Property(false)
|
|
7630
|
+
], ImageEditor.prototype, "enableRtl", void 0);
|
|
7631
|
+
__decorate([
|
|
7632
|
+
Property(false)
|
|
7633
|
+
], ImageEditor.prototype, "enablePersistence", void 0);
|
|
7456
7634
|
__decorate([
|
|
7457
7635
|
Event()
|
|
7458
7636
|
], ImageEditor.prototype, "beforeSave", void 0);
|