@syncfusion/ej2-image-editor 24.2.4 → 24.2.8
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 +20 -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 +328 -242
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +328 -243
- 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 +11 -11
- package/src/image-editor/action/draw.js +2 -1
- package/src/image-editor/action/selection.d.ts +2 -0
- package/src/image-editor/action/selection.js +256 -235
- package/src/image-editor/action/shape.js +56 -1
- package/src/image-editor/base/image-editor.js +12 -6
- package/src/image-editor/base/interface.d.ts +26 -2
- package/src/image-editor/renderer/toolbar.js +2 -0
- package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -63
- package/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -39
|
@@ -793,13 +793,22 @@ var Shape = /** @class */ (function () {
|
|
|
793
793
|
}
|
|
794
794
|
parent.activeObj.strokeSettings.strokeColor = shapeSettings.strokeColor;
|
|
795
795
|
parent.activeObj.strokeSettings.fillColor = shapeSettings.fillColor;
|
|
796
|
+
parent.activeObj.strokeSettings.strokeWidth = shapeSettings.strokeWidth;
|
|
796
797
|
parent.activeObj.opacity = shapeSettings.opacity;
|
|
797
798
|
if (isNullOrUndefined(shapeSettings.degree)) {
|
|
798
799
|
shapeSettings.degree = 0;
|
|
799
800
|
}
|
|
800
801
|
switch (parent.activeObj.shape) {
|
|
801
802
|
case 'ellipse':
|
|
802
|
-
|
|
803
|
+
if (isBlazor()) {
|
|
804
|
+
parent.activeObj.activePoint.width = shapeSettings.radius;
|
|
805
|
+
}
|
|
806
|
+
else {
|
|
807
|
+
parent.activeObj.activePoint.width = shapeSettings.radiusX * 2;
|
|
808
|
+
parent.activeObj.activePoint.height = shapeSettings.radiusY * 2;
|
|
809
|
+
parent.activeObj.activePoint.endX = parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width;
|
|
810
|
+
parent.activeObj.activePoint.endY = parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height;
|
|
811
|
+
}
|
|
803
812
|
if (shapeSettings.degree) {
|
|
804
813
|
parent.activeObj.rotatedAngle = shapeSettings.degree * (Math.PI / 180);
|
|
805
814
|
}
|
|
@@ -807,18 +816,35 @@ var Shape = /** @class */ (function () {
|
|
|
807
816
|
case 'line':
|
|
808
817
|
case 'arrow':
|
|
809
818
|
parent.activeObj.activePoint.width = shapeSettings.length;
|
|
819
|
+
if (!isBlazor()) {
|
|
820
|
+
parent.activeObj.activePoint.endX = shapeSettings.endX;
|
|
821
|
+
parent.activeObj.activePoint.endY = shapeSettings.endY;
|
|
822
|
+
parent.activeObj.activePoint.width = parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width;
|
|
823
|
+
parent.activeObj.activePoint.height = parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height;
|
|
824
|
+
if (parent.activeObj.shape === 'arrow') {
|
|
825
|
+
parent.activeObj.start = this.getArrowType(shapeSettings.arrowHead);
|
|
826
|
+
parent.activeObj.end = this.getArrowType(shapeSettings.arrowTail);
|
|
827
|
+
}
|
|
828
|
+
}
|
|
810
829
|
break;
|
|
811
830
|
case 'text':
|
|
812
831
|
parent.activeObj.keyHistory = parent.activeObj.textSettings.text = shapeSettings.text;
|
|
813
832
|
parent.activeObj.textSettings.fontSize = shapeSettings.fontSize;
|
|
814
833
|
parent.activeObj.strokeSettings.strokeColor = shapeSettings.color;
|
|
815
834
|
parent.activeObj.textSettings.fontFamily = shapeSettings.fontFamily;
|
|
835
|
+
if (shapeSettings.degree) {
|
|
836
|
+
parent.activeObj.rotatedAngle = shapeSettings.degree * (Math.PI / 180);
|
|
837
|
+
}
|
|
816
838
|
break;
|
|
817
839
|
case 'rectangle':
|
|
818
840
|
case 'image':
|
|
819
841
|
if (shapeSettings.degree) {
|
|
820
842
|
parent.activeObj.rotatedAngle = shapeSettings.degree * (Math.PI / 180);
|
|
821
843
|
}
|
|
844
|
+
// Prevented setting image src as it cannot be set in canvas
|
|
845
|
+
break;
|
|
846
|
+
case 'path':
|
|
847
|
+
parent.activeObj.pointColl = shapeSettings.points;
|
|
822
848
|
break;
|
|
823
849
|
}
|
|
824
850
|
if (parent.activeObj.shape === 'text' && parent.activeObj.textSettings) {
|
|
@@ -2853,18 +2879,31 @@ var Shape = /** @class */ (function () {
|
|
|
2853
2879
|
shapeDetails.strokeColor = obj.strokeSettings.strokeColor;
|
|
2854
2880
|
shapeDetails.fillColor = obj.strokeSettings.fillColor;
|
|
2855
2881
|
shapeDetails.strokeWidth = obj.strokeSettings.strokeWidth;
|
|
2882
|
+
shapeDetails.degree = obj.rotatedAngle * (180 / Math.PI);
|
|
2856
2883
|
break;
|
|
2857
2884
|
case 'ellipse':
|
|
2858
2885
|
shapeDetails.radius = obj.activePoint.width / 2;
|
|
2859
2886
|
shapeDetails.strokeColor = obj.strokeSettings.strokeColor;
|
|
2860
2887
|
shapeDetails.fillColor = obj.strokeSettings.fillColor;
|
|
2861
2888
|
shapeDetails.strokeWidth = obj.strokeSettings.strokeWidth;
|
|
2889
|
+
shapeDetails.radiusX = obj.activePoint.width / 2;
|
|
2890
|
+
shapeDetails.radiusY = obj.activePoint.height / 2;
|
|
2891
|
+
shapeDetails.degree = obj.rotatedAngle * (180 / Math.PI);
|
|
2862
2892
|
break;
|
|
2863
2893
|
case 'line':
|
|
2864
2894
|
case 'arrow':
|
|
2865
2895
|
shapeDetails.length = obj.activePoint.width;
|
|
2866
2896
|
shapeDetails.strokeColor = obj.strokeSettings.strokeColor;
|
|
2867
2897
|
shapeDetails.strokeWidth = obj.strokeSettings.strokeWidth;
|
|
2898
|
+
shapeDetails.endX = obj.activePoint.endX;
|
|
2899
|
+
shapeDetails.endY = obj.activePoint.endY;
|
|
2900
|
+
if (obj.shape === 'arrow') {
|
|
2901
|
+
var arrowObj = { type: null };
|
|
2902
|
+
parent.notify('selection', { prop: 'getArrowType', onPropertyChange: false, value: { type: obj.start, obj: arrowObj } });
|
|
2903
|
+
shapeDetails.arrowHead = arrowObj['type'];
|
|
2904
|
+
parent.notify('selection', { prop: 'getArrowType', onPropertyChange: false, value: { type: obj.end, obj: arrowObj } });
|
|
2905
|
+
shapeDetails.arrowTail = arrowObj['type'];
|
|
2906
|
+
}
|
|
2868
2907
|
break;
|
|
2869
2908
|
case 'text':
|
|
2870
2909
|
shapeDetails.text = obj.keyHistory;
|
|
@@ -2878,10 +2917,26 @@ var Shape = /** @class */ (function () {
|
|
|
2878
2917
|
if (obj.textSettings.italic) {
|
|
2879
2918
|
shapeDetails.fontStyle.push('italic');
|
|
2880
2919
|
}
|
|
2920
|
+
shapeDetails.degree = obj.rotatedAngle * (180 / Math.PI);
|
|
2881
2921
|
break;
|
|
2882
2922
|
case 'path':
|
|
2883
2923
|
shapeDetails.strokeColor = obj.strokeSettings.strokeColor;
|
|
2884
2924
|
shapeDetails.strokeWidth = obj.strokeSettings.strokeWidth;
|
|
2925
|
+
shapeDetails.points = obj.pointColl;
|
|
2926
|
+
break;
|
|
2927
|
+
case 'image':
|
|
2928
|
+
shapeDetails.imageData = obj.imageCanvas.toDataURL();
|
|
2929
|
+
shapeDetails.degree = obj.rotatedAngle * (180 / Math.PI);
|
|
2930
|
+
shapeDetails.width = obj.activePoint.width;
|
|
2931
|
+
shapeDetails.height = obj.activePoint.height;
|
|
2932
|
+
shapeDetails.opacity = obj.opacity;
|
|
2933
|
+
break;
|
|
2934
|
+
case 'image':
|
|
2935
|
+
shapeDetails.imageData = obj.imageCanvas.toDataURL();
|
|
2936
|
+
shapeDetails.degree = obj.rotatedAngle * (180 / Math.PI);
|
|
2937
|
+
shapeDetails.width = obj.activePoint.width;
|
|
2938
|
+
shapeDetails.height = obj.activePoint.height;
|
|
2939
|
+
shapeDetails.opacity = obj.opacity;
|
|
2885
2940
|
break;
|
|
2886
2941
|
}
|
|
2887
2942
|
return shapeDetails;
|
|
@@ -695,7 +695,6 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
695
695
|
EventHandler.add(this.lowerCanvas, 'mousedown', this.canvasMouseDownHandler, this);
|
|
696
696
|
EventHandler.add(this.lowerCanvas, 'mousemove', this.canvasMouseMoveHandler, this);
|
|
697
697
|
EventHandler.add(this.lowerCanvas, 'mouseup', this.canvasMouseUpHandler, this);
|
|
698
|
-
EventHandler.add(document, 'mouseup', this.canvasMouseUpHandler, this);
|
|
699
698
|
EventHandler.add(this.upperCanvas, 'touchstart', this.touchStartHandler, this);
|
|
700
699
|
EventHandler.add(this.lowerCanvas, 'touchstart', this.touchStartHandler, this);
|
|
701
700
|
EventHandler.add(this.lowerCanvas, 'mousewheel DOMMouseScroll', this.handleScroll, this);
|
|
@@ -722,7 +721,6 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
722
721
|
EventHandler.remove(this.lowerCanvas, 'mousedown', this.canvasMouseDownHandler);
|
|
723
722
|
EventHandler.remove(this.lowerCanvas, 'mousemove', this.canvasMouseMoveHandler);
|
|
724
723
|
EventHandler.remove(this.lowerCanvas, 'mouseup', this.canvasMouseUpHandler);
|
|
725
|
-
EventHandler.remove(document, 'mouseup', this.canvasMouseUpHandler);
|
|
726
724
|
EventHandler.remove(this.upperCanvas, 'touchstart', this.touchStartHandler);
|
|
727
725
|
EventHandler.remove(this.lowerCanvas, 'touchstart', this.touchStartHandler);
|
|
728
726
|
EventHandler.remove(this.lowerCanvas, 'mousewheel DOMMouseScroll', this.handleScroll);
|
|
@@ -735,7 +733,6 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
735
733
|
this.notify('selection', { prop: 'unWireEvent', onPropertyChange: false });
|
|
736
734
|
};
|
|
737
735
|
ImageEditor.prototype.createCanvas = function () {
|
|
738
|
-
var _this = this;
|
|
739
736
|
this.element.style.boxSizing = 'border-box';
|
|
740
737
|
var obj = { toolbarHeight: 0 };
|
|
741
738
|
this.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: obj } });
|
|
@@ -821,10 +818,16 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
821
818
|
this.upperCanvas.style.cursor = this.cursor = 'default';
|
|
822
819
|
this.upperCanvas.style.display = 'block';
|
|
823
820
|
this.upperContext = this.upperCanvas.getContext('2d');
|
|
824
|
-
|
|
825
|
-
|
|
821
|
+
dropAnchorElement.addEventListener('click', function (e) {
|
|
822
|
+
e.preventDefault();
|
|
823
|
+
dropUploader.click();
|
|
826
824
|
return false;
|
|
827
|
-
};
|
|
825
|
+
});
|
|
826
|
+
minDropAnchorElem.addEventListener('click', function (e) {
|
|
827
|
+
e.preventDefault();
|
|
828
|
+
dropUploader.click();
|
|
829
|
+
return false;
|
|
830
|
+
});
|
|
828
831
|
};
|
|
829
832
|
ImageEditor.prototype.touchStartHandler = function (e) {
|
|
830
833
|
this.notify('selection', { prop: 'touchStartHandler', onPropertyChange: false, value: { e: e } });
|
|
@@ -952,6 +955,9 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
952
955
|
*/
|
|
953
956
|
ImageEditor.prototype.getImageData = function () {
|
|
954
957
|
var obj = { canvas: null };
|
|
958
|
+
if (this.textArea.style.display === 'block' || this.textArea.style.display === 'inline-block') {
|
|
959
|
+
this.okBtn();
|
|
960
|
+
}
|
|
955
961
|
this.notify('export', { prop: 'exportToCanvas', value: { object: obj } });
|
|
956
962
|
return obj['canvas'].getContext('2d').getImageData(0, 0, obj['canvas'].width, obj['canvas'].height);
|
|
957
963
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FileType, ShapeType, ImageFinetuneOption, ImageFilterOption, FrameType, FrameLineStyle } from '../index';
|
|
1
|
+
import { FileType, ShapeType, ImageFinetuneOption, ImageFilterOption, FrameType, FrameLineStyle, ArrowheadType } from '../index';
|
|
2
2
|
import { ItemModel } from '@syncfusion/ej2-navigations';
|
|
3
3
|
/**
|
|
4
4
|
* This interface is used to specify settings for image finetuning operations, including minimum and maximum values, as well as default values.
|
|
@@ -404,7 +404,7 @@ export interface ShapeSettings {
|
|
|
404
404
|
*/
|
|
405
405
|
color?: string;
|
|
406
406
|
/**
|
|
407
|
-
* Returns the points collection of freehand drawing.
|
|
407
|
+
* Returns the points collection of freehand drawing and path annotation.
|
|
408
408
|
*/
|
|
409
409
|
points?: Point[];
|
|
410
410
|
/**
|
|
@@ -415,6 +415,30 @@ export interface ShapeSettings {
|
|
|
415
415
|
* Returns the imageData of the image annotation.
|
|
416
416
|
*/
|
|
417
417
|
imageData?: string | ImageData;
|
|
418
|
+
/**
|
|
419
|
+
* Returns the width radius of the ellipse shape.
|
|
420
|
+
*/
|
|
421
|
+
radiusX?: number;
|
|
422
|
+
/**
|
|
423
|
+
* Returns the height radius of the ellipse shape.
|
|
424
|
+
*/
|
|
425
|
+
radiusY?: number;
|
|
426
|
+
/**
|
|
427
|
+
* Returns the end x position of line and arrow.
|
|
428
|
+
*/
|
|
429
|
+
endX?: number;
|
|
430
|
+
/**
|
|
431
|
+
* Returns the end y position of line and arrow.
|
|
432
|
+
*/
|
|
433
|
+
endY?: number;
|
|
434
|
+
/**
|
|
435
|
+
* Returns the head type of an arrow.
|
|
436
|
+
*/
|
|
437
|
+
arrowHead?: ArrowheadType;
|
|
438
|
+
/**
|
|
439
|
+
* Returns the tail type of an arrow.
|
|
440
|
+
*/
|
|
441
|
+
arrowTail?: ArrowheadType;
|
|
418
442
|
}
|
|
419
443
|
/**
|
|
420
444
|
* The interface which contains the properties for filter option for the image.
|
|
@@ -4648,6 +4648,7 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
4648
4648
|
step: step, width: Browser.isDevice ? '180px' : (type === 'straighten' ? '200px' : '300px'),
|
|
4649
4649
|
cssClass: 'e-slider',
|
|
4650
4650
|
change: function (args) {
|
|
4651
|
+
parent.notify('selection', { prop: 'setSliderActive', onPropertyChange: false, value: { bool: true } });
|
|
4651
4652
|
if (type === 'transparency') {
|
|
4652
4653
|
if (parent.activeObj.shape) {
|
|
4653
4654
|
var prevCropObj = void 0;
|
|
@@ -4700,6 +4701,7 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
4700
4701
|
parent.notify('selection', { prop: 'setSliding', value: { bool: false } });
|
|
4701
4702
|
parent.notify('draw', { prop: 'redrawDownScale' });
|
|
4702
4703
|
}
|
|
4704
|
+
parent.notify('selection', { prop: 'setSliderActive', onPropertyChange: false, value: { bool: false } });
|
|
4703
4705
|
}
|
|
4704
4706
|
});
|
|
4705
4707
|
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
### Bug description
|
|
2
|
-
|
|
3
|
-
Clearly and concisely describe the problem or feature (this cannot be empty).
|
|
4
|
-
|
|
5
|
-
### Root cause
|
|
6
|
-
|
|
7
|
-
Briefly describe the root cause and analysis of the problem.
|
|
8
|
-
If there is an internal discussion on the forum, provide the link.
|
|
9
|
-
|
|
10
|
-
### Reason for not identifying earlier
|
|
11
|
-
|
|
12
|
-
Find how it was missed in our earlier testing and development by analysing the below checklist. This will help prevent similar mistakes in the future.
|
|
13
|
-
|
|
14
|
-
- [ ] Guidelines/documents are not followed
|
|
15
|
-
|
|
16
|
-
- Common guidelines / Core team guideline
|
|
17
|
-
- Specification document
|
|
18
|
-
- Requirement document
|
|
19
|
-
|
|
20
|
-
- [ ] Guidelines/documents are not given
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
- Common guidelines / Core team guideline
|
|
24
|
-
- Specification document
|
|
25
|
-
- Requirement document
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
### Reason:
|
|
29
|
-
Mention any one or more reasons from the above points.
|
|
30
|
-
|
|
31
|
-
### Action taken:
|
|
32
|
-
|
|
33
|
-
What action did you take to avoid this in future?
|
|
34
|
-
|
|
35
|
-
### Related areas:
|
|
36
|
-
|
|
37
|
-
Is there any other related areas also to be addressed?
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
### Is it a breaking issue?
|
|
41
|
-
|
|
42
|
-
If it is a breaking issue, provide the commit detail which caused this break.
|
|
43
|
-
|
|
44
|
-
### Solution description
|
|
45
|
-
|
|
46
|
-
Describe your code changes in detail for reviewers.
|
|
47
|
-
|
|
48
|
-
### Output screenshots
|
|
49
|
-
|
|
50
|
-
Post the output screenshots if an UI is affected or added due to this bug.
|
|
51
|
-
|
|
52
|
-
### Areas affected and ensured
|
|
53
|
-
|
|
54
|
-
List the areas affected by your code changes.
|
|
55
|
-
|
|
56
|
-
### Additional checklist
|
|
57
|
-
|
|
58
|
-
- Did you run the automation against your fix?
|
|
59
|
-
- Is there any API name change?
|
|
60
|
-
- Is there any existing behavior change of other features due to this code change?
|
|
61
|
-
- Does your new code introduce new warnings or binding errors?
|
|
62
|
-
- Does your code pass all FxCop and StyleCop rules?
|
|
63
|
-
- Did you record this case in the unit test or UI test?
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
### Feature description
|
|
2
|
-
|
|
3
|
-
Clearly and concisely describe the problem or feature (this cannot be empty).
|
|
4
|
-
|
|
5
|
-
### Analysis and design
|
|
6
|
-
|
|
7
|
-
If there is an external design, link to its project documentation area.
|
|
8
|
-
If there is an internal discussion on the forum, provide the link.
|
|
9
|
-
|
|
10
|
-
### Solution description
|
|
11
|
-
|
|
12
|
-
Describe your code changes in detail for reviewers.
|
|
13
|
-
|
|
14
|
-
### Output screenshots
|
|
15
|
-
|
|
16
|
-
Post the output screenshots if an UI is affected or added due to this feature.
|
|
17
|
-
|
|
18
|
-
### Areas affected and ensured
|
|
19
|
-
|
|
20
|
-
List the areas are affected by your code changes.
|
|
21
|
-
|
|
22
|
-
### Test cases
|
|
23
|
-
|
|
24
|
-
Provide the unit testing written file details to understand the use cases considered in this implementation.
|
|
25
|
-
If there is no TDD (if it’s not possible to follow), provide the UI automation script location and the Excel file that contains the use cases considered in this implementation.
|
|
26
|
-
Provide the test cases Excel file alone if the feature cannot be automated in any case.
|
|
27
|
-
|
|
28
|
-
### Test bed sample location
|
|
29
|
-
|
|
30
|
-
Provide the test bed sample location where code reviewers can review the new feature’s behaviors. This depends on the CI process that your team follows. It can be from NPMCI, HockeyApp, staging site, local server, etc.
|
|
31
|
-
|
|
32
|
-
### Additional checklist
|
|
33
|
-
|
|
34
|
-
- Did you run the automation against your fix?
|
|
35
|
-
- Is there any API name change?
|
|
36
|
-
- Is there any existing behavior change of other features due to this code change?
|
|
37
|
-
- Does your new code introduce new warnings or binding errors?
|
|
38
|
-
- Does your code pass all FxCop and StyleCop rules?
|
|
39
|
-
- Did you record this case in the unit test or UI test?
|