@syncfusion/ej2-image-editor 24.2.4 → 24.2.5
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 +12 -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 +325 -242
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +325 -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 +10 -10
- 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 +9 -6
- package/src/image-editor/base/interface.d.ts +26 -2
- package/src/image-editor/renderer/toolbar.js +2 -0
|
@@ -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 } });
|
|
@@ -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
|
};
|