@syncfusion/ej2-image-editor 24.2.3 → 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 +24 -2
- 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 +457 -262
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +457 -263
- 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 +3 -0
- package/src/image-editor/action/selection.js +260 -230
- package/src/image-editor/action/shape.js +56 -1
- package/src/image-editor/action/undo-redo.js +2 -0
- 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.d.ts +4 -0
- package/src/image-editor/renderer/toolbar.js +128 -25
|
@@ -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;
|
|
@@ -267,6 +267,7 @@ var UndoRedo = /** @class */ (function () {
|
|
|
267
267
|
UndoRedo.prototype.undo = function () {
|
|
268
268
|
var parent = this.parent;
|
|
269
269
|
this.cancelCropSelection();
|
|
270
|
+
parent.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: false } });
|
|
270
271
|
if (!parent.disabled && parent.isImageLoaded) {
|
|
271
272
|
if (this.undoRedoStep > 0) {
|
|
272
273
|
this.refreshToolbarActions();
|
|
@@ -405,6 +406,7 @@ var UndoRedo = /** @class */ (function () {
|
|
|
405
406
|
UndoRedo.prototype.redo = function () {
|
|
406
407
|
var parent = this.parent;
|
|
407
408
|
this.cancelCropSelection();
|
|
409
|
+
parent.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: false } });
|
|
408
410
|
if (!parent.disabled && parent.isImageLoaded) {
|
|
409
411
|
if (this.undoRedoStep < this.appliedUndoRedoColl.length) {
|
|
410
412
|
this.refreshToolbarActions();
|
|
@@ -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.
|
|
@@ -136,5 +136,9 @@ export declare class ToolbarModule {
|
|
|
136
136
|
private refreshMainToolbar;
|
|
137
137
|
private destroySubComponents;
|
|
138
138
|
private setInitialShapeSettings;
|
|
139
|
+
private isToolbarString;
|
|
140
|
+
private excludeItems;
|
|
141
|
+
private isSameIndex;
|
|
142
|
+
private getIndex;
|
|
139
143
|
getModuleName(): string;
|
|
140
144
|
}
|
|
@@ -1665,7 +1665,13 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
1665
1665
|
var args = { toolbarType: parent.activeObj.shape ? parent.activeObj.shape : 'shapes',
|
|
1666
1666
|
toolbarItems: this.defToolbarItems };
|
|
1667
1667
|
parent.trigger('toolbarUpdating', args);
|
|
1668
|
-
this.
|
|
1668
|
+
if (this.isToolbarString(args.toolbarItems)) {
|
|
1669
|
+
items = args.toolbarItems;
|
|
1670
|
+
this.excludeItems(args.toolbarItems);
|
|
1671
|
+
}
|
|
1672
|
+
else {
|
|
1673
|
+
this.defToolbarItems = args.toolbarItems;
|
|
1674
|
+
}
|
|
1669
1675
|
var toolbar = new Toolbar({
|
|
1670
1676
|
width: '100%',
|
|
1671
1677
|
items: this.defToolbarItems,
|
|
@@ -1675,8 +1681,12 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
1675
1681
|
_this.createShapeColor(items);
|
|
1676
1682
|
_this.createShapeBtn(items);
|
|
1677
1683
|
if (parent.activeObj.shape === 'arrow') {
|
|
1678
|
-
|
|
1679
|
-
|
|
1684
|
+
if (items.some(function (item) { return item.toLowerCase().indexOf('start') > -1; })) {
|
|
1685
|
+
_this.createStartBtn();
|
|
1686
|
+
}
|
|
1687
|
+
if (items.some(function (item) { return item.toLowerCase().indexOf('end') > -1; })) {
|
|
1688
|
+
_this.createEndBtn();
|
|
1689
|
+
}
|
|
1680
1690
|
}
|
|
1681
1691
|
_this.wireZoomBtnEvents();
|
|
1682
1692
|
if (!Browser.isDevice) {
|
|
@@ -1840,24 +1850,24 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
1840
1850
|
ToolbarModule.prototype.createShapeBtn = function (items) {
|
|
1841
1851
|
var parent = this.parent;
|
|
1842
1852
|
var id = parent.element.id;
|
|
1843
|
-
var strokeWidthItems = [
|
|
1844
|
-
{ id: '1', text: this.l10n.getConstant('XSmall') },
|
|
1845
|
-
{ id: '2', text: this.l10n.getConstant('Small') },
|
|
1846
|
-
{ id: '3', text: this.l10n.getConstant('Medium') },
|
|
1847
|
-
{ id: '4', text: this.l10n.getConstant('Large') },
|
|
1848
|
-
{ id: '5', text: this.l10n.getConstant('XLarge') }
|
|
1849
|
-
];
|
|
1850
|
-
if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse')) {
|
|
1851
|
-
strokeWidthItems = [
|
|
1852
|
-
{ id: '1', text: this.l10n.getConstant('NoOutline') },
|
|
1853
|
-
{ id: '2', text: this.l10n.getConstant('XSmall') },
|
|
1854
|
-
{ id: '3', text: this.l10n.getConstant('Small') },
|
|
1855
|
-
{ id: '4', text: this.l10n.getConstant('Medium') },
|
|
1856
|
-
{ id: '5', text: this.l10n.getConstant('Large') },
|
|
1857
|
-
{ id: '6', text: this.l10n.getConstant('XLarge') }
|
|
1858
|
-
];
|
|
1859
|
-
}
|
|
1860
1853
|
if (items.indexOf('strokeWidth') > -1) {
|
|
1854
|
+
var strokeWidthItems = [
|
|
1855
|
+
{ id: '1', text: this.l10n.getConstant('XSmall') },
|
|
1856
|
+
{ id: '2', text: this.l10n.getConstant('Small') },
|
|
1857
|
+
{ id: '3', text: this.l10n.getConstant('Medium') },
|
|
1858
|
+
{ id: '4', text: this.l10n.getConstant('Large') },
|
|
1859
|
+
{ id: '5', text: this.l10n.getConstant('XLarge') }
|
|
1860
|
+
];
|
|
1861
|
+
if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse')) {
|
|
1862
|
+
strokeWidthItems = [
|
|
1863
|
+
{ id: '1', text: this.l10n.getConstant('NoOutline') },
|
|
1864
|
+
{ id: '2', text: this.l10n.getConstant('XSmall') },
|
|
1865
|
+
{ id: '3', text: this.l10n.getConstant('Small') },
|
|
1866
|
+
{ id: '4', text: this.l10n.getConstant('Medium') },
|
|
1867
|
+
{ id: '5', text: this.l10n.getConstant('Large') },
|
|
1868
|
+
{ id: '6', text: this.l10n.getConstant('XLarge') }
|
|
1869
|
+
];
|
|
1870
|
+
}
|
|
1861
1871
|
var strokeWidthBtn = document.getElementById(id + '_borderWidthBtn');
|
|
1862
1872
|
var spanElem_1 = document.createElement('span');
|
|
1863
1873
|
spanElem_1.innerHTML = this.l10n.getConstant('XSmall');
|
|
@@ -2074,7 +2084,13 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2074
2084
|
}
|
|
2075
2085
|
var args = { toolbarType: 'text', toolbarItems: this.defToolbarItems };
|
|
2076
2086
|
parent.trigger('toolbarUpdating', args);
|
|
2077
|
-
this.
|
|
2087
|
+
if (this.isToolbarString(args.toolbarItems)) {
|
|
2088
|
+
items = args.toolbarItems;
|
|
2089
|
+
this.excludeItems(args.toolbarItems);
|
|
2090
|
+
}
|
|
2091
|
+
else {
|
|
2092
|
+
this.defToolbarItems = args.toolbarItems;
|
|
2093
|
+
}
|
|
2078
2094
|
var toolbar = new Toolbar({
|
|
2079
2095
|
width: '100%',
|
|
2080
2096
|
items: this.defToolbarItems,
|
|
@@ -2560,7 +2576,8 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2560
2576
|
template: '<button id="' + id + '_penColorBtn"></button>' });
|
|
2561
2577
|
}
|
|
2562
2578
|
if (items.indexOf('strokeWidth') > -1) {
|
|
2563
|
-
toolbarItems.push({ prefixIcon: 'e-icons e-copy',
|
|
2579
|
+
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: id + '_pen_strokewidth',
|
|
2580
|
+
cssClass: 'top-icon e-size',
|
|
2564
2581
|
tooltipText: this.l10n.getConstant('StrokeWidth'),
|
|
2565
2582
|
align: 'Center', type: 'Input', template: '<button id="' + id + '_penStrokeWidth"></button>' });
|
|
2566
2583
|
}
|
|
@@ -2597,7 +2614,13 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2597
2614
|
}
|
|
2598
2615
|
var args = { toolbarType: 'pen', toolbarItems: this.defToolbarItems };
|
|
2599
2616
|
parent.trigger('toolbarUpdating', args);
|
|
2600
|
-
this.
|
|
2617
|
+
if (this.isToolbarString(args.toolbarItems)) {
|
|
2618
|
+
items = args.toolbarItems;
|
|
2619
|
+
this.excludeItems(args.toolbarItems);
|
|
2620
|
+
}
|
|
2621
|
+
else {
|
|
2622
|
+
this.defToolbarItems = args.toolbarItems;
|
|
2623
|
+
}
|
|
2601
2624
|
var toolbar = new Toolbar({
|
|
2602
2625
|
width: '100%',
|
|
2603
2626
|
items: this.defToolbarItems,
|
|
@@ -3739,6 +3762,8 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
3739
3762
|
var ctx = void 0;
|
|
3740
3763
|
parent.notify('draw', { prop: 'getNewPath', value: { obj: pathObject } });
|
|
3741
3764
|
var type = args.item.id.replace(id + '_', '').toLowerCase();
|
|
3765
|
+
var left = void 0;
|
|
3766
|
+
var right = void 0;
|
|
3742
3767
|
switch (type) {
|
|
3743
3768
|
case 'duplicate':
|
|
3744
3769
|
if (!parent.element.querySelector('#' + id + '_duplicate').classList.contains('e-disabled')) {
|
|
@@ -3788,8 +3813,10 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
3788
3813
|
break;
|
|
3789
3814
|
case 'rotleft':
|
|
3790
3815
|
case 'rotright':
|
|
3791
|
-
|
|
3792
|
-
|
|
3816
|
+
left = parent.element.querySelector('#' + id + '_rotLeft');
|
|
3817
|
+
right = parent.element.querySelector('#' + id + '_rotRight');
|
|
3818
|
+
if ((left && !left.classList.contains('e-disabled')) ||
|
|
3819
|
+
(right && !right.classList.contains('e-disabled'))) {
|
|
3793
3820
|
parent.rotateImage(args.item.id.replace(id + '_', '').toLowerCase());
|
|
3794
3821
|
}
|
|
3795
3822
|
break;
|
|
@@ -4621,6 +4648,7 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
4621
4648
|
step: step, width: Browser.isDevice ? '180px' : (type === 'straighten' ? '200px' : '300px'),
|
|
4622
4649
|
cssClass: 'e-slider',
|
|
4623
4650
|
change: function (args) {
|
|
4651
|
+
parent.notify('selection', { prop: 'setSliderActive', onPropertyChange: false, value: { bool: true } });
|
|
4624
4652
|
if (type === 'transparency') {
|
|
4625
4653
|
if (parent.activeObj.shape) {
|
|
4626
4654
|
var prevCropObj = void 0;
|
|
@@ -4673,6 +4701,7 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
4673
4701
|
parent.notify('selection', { prop: 'setSliding', value: { bool: false } });
|
|
4674
4702
|
parent.notify('draw', { prop: 'redrawDownScale' });
|
|
4675
4703
|
}
|
|
4704
|
+
parent.notify('selection', { prop: 'setSliderActive', onPropertyChange: false, value: { bool: false } });
|
|
4676
4705
|
}
|
|
4677
4706
|
});
|
|
4678
4707
|
};
|
|
@@ -4919,6 +4948,80 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
4919
4948
|
parent.activeObj.textFlip = parent.transform.currFlipState;
|
|
4920
4949
|
parent.activeObj.flipObjColl = [];
|
|
4921
4950
|
};
|
|
4951
|
+
ToolbarModule.prototype.isToolbarString = function (items) {
|
|
4952
|
+
var isString = false;
|
|
4953
|
+
for (var i = 0; i < items.length; i++) {
|
|
4954
|
+
if (typeof (items[i]) === 'string') {
|
|
4955
|
+
isString = true;
|
|
4956
|
+
break;
|
|
4957
|
+
}
|
|
4958
|
+
}
|
|
4959
|
+
return isString;
|
|
4960
|
+
};
|
|
4961
|
+
ToolbarModule.prototype.excludeItems = function (items) {
|
|
4962
|
+
var indexArr = [];
|
|
4963
|
+
for (var i = 0; i < items.length; i++) {
|
|
4964
|
+
var index = this.getIndex(items[i]);
|
|
4965
|
+
if (index !== -1) {
|
|
4966
|
+
indexArr.push(index);
|
|
4967
|
+
}
|
|
4968
|
+
}
|
|
4969
|
+
var negativeIndexArr = [];
|
|
4970
|
+
for (var i = 0; i < this.defToolbarItems.length; i++) {
|
|
4971
|
+
if (this.defToolbarItems[i].align === 'Center' && !this.isSameIndex(indexArr, i) &&
|
|
4972
|
+
this.defToolbarItems[i].id !== this.parent.element.id + '_' + 'annotation') {
|
|
4973
|
+
negativeIndexArr.push(i);
|
|
4974
|
+
}
|
|
4975
|
+
}
|
|
4976
|
+
for (var i = negativeIndexArr.length - 1; i >= 0; i--) {
|
|
4977
|
+
this.defToolbarItems.splice(negativeIndexArr[i], 1);
|
|
4978
|
+
}
|
|
4979
|
+
};
|
|
4980
|
+
ToolbarModule.prototype.isSameIndex = function (indexArr, index) {
|
|
4981
|
+
for (var i = 0; i < indexArr.length; i++) {
|
|
4982
|
+
if (indexArr[i] === index) {
|
|
4983
|
+
return true;
|
|
4984
|
+
}
|
|
4985
|
+
}
|
|
4986
|
+
return false;
|
|
4987
|
+
};
|
|
4988
|
+
ToolbarModule.prototype.getIndex = function (item) {
|
|
4989
|
+
var index = -1;
|
|
4990
|
+
var isFontColor = false;
|
|
4991
|
+
if (item === 'rotateLeft') {
|
|
4992
|
+
item = 'rotLeft';
|
|
4993
|
+
}
|
|
4994
|
+
if (item === 'rotateRight') {
|
|
4995
|
+
item = 'rotRight';
|
|
4996
|
+
}
|
|
4997
|
+
if (item === 'horizontalFlip') {
|
|
4998
|
+
item = 'hflip';
|
|
4999
|
+
}
|
|
5000
|
+
if (item === 'verticalFlip') {
|
|
5001
|
+
item = 'vflip';
|
|
5002
|
+
}
|
|
5003
|
+
if (item === 'arrowStart') {
|
|
5004
|
+
item = 'start';
|
|
5005
|
+
}
|
|
5006
|
+
if (item === 'arrowEnd') {
|
|
5007
|
+
item = 'end';
|
|
5008
|
+
}
|
|
5009
|
+
if (item === 'fontColor') {
|
|
5010
|
+
item = 'strokeColor';
|
|
5011
|
+
isFontColor = true;
|
|
5012
|
+
}
|
|
5013
|
+
for (var i = 0; i < this.defToolbarItems.length; i++) {
|
|
5014
|
+
var id = this.defToolbarItems[i].id;
|
|
5015
|
+
if (id && id.toLowerCase().indexOf(item.toLowerCase()) !== -1) {
|
|
5016
|
+
index = i;
|
|
5017
|
+
break;
|
|
5018
|
+
}
|
|
5019
|
+
}
|
|
5020
|
+
if (isFontColor) {
|
|
5021
|
+
item = 'fontColor';
|
|
5022
|
+
}
|
|
5023
|
+
return index;
|
|
5024
|
+
};
|
|
4922
5025
|
ToolbarModule.prototype.getModuleName = function () {
|
|
4923
5026
|
return 'toolbar-module';
|
|
4924
5027
|
};
|