@syncfusion/ej2-image-editor 22.1.34 → 22.1.37
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 +1018 -1064
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +1016 -1066
- 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 +9 -9
- package/src/image-editor/action/crop.d.ts +1 -0
- package/src/image-editor/action/crop.js +12 -1
- package/src/image-editor/action/draw.d.ts +4 -1
- package/src/image-editor/action/draw.js +137 -127
- package/src/image-editor/action/filter.js +1 -1
- package/src/image-editor/action/freehand-draw.js +9 -9
- package/src/image-editor/action/selection.d.ts +1 -1
- package/src/image-editor/action/selection.js +64 -226
- package/src/image-editor/action/shape.d.ts +1 -0
- package/src/image-editor/action/shape.js +97 -9
- package/src/image-editor/action/transform.js +211 -22
- package/src/image-editor/action/undo-redo.js +9 -7
- package/src/image-editor/base/image-editor-model.d.ts +2 -2
- package/src/image-editor/base/image-editor.d.ts +0 -15
- package/src/image-editor/base/image-editor.js +35 -225
- package/src/image-editor/base/interface.d.ts +11 -3
- package/src/image-editor/renderer/toolbar.js +362 -363
- package/styles/highcontrast-light.css +2 -2
- package/styles/highcontrast.css +6 -1
- package/styles/image-editor/_highcontrast-definition.scss +1 -1
- package/styles/image-editor/_highcontrast-light-definition.scss +1 -1
- package/styles/image-editor/_theme.scss +2 -4
- package/styles/image-editor/highcontrast-light.css +2 -2
- package/styles/image-editor/highcontrast.css +6 -1
|
@@ -9,6 +9,7 @@ class Crop {
|
|
|
9
9
|
this.croppedDegree = 0; // Specifies the degree when crop is performed
|
|
10
10
|
this.cropDestPoints = { startX: 0, startY: 0, width: 0, height: 0 }; // To redraw old image when navigate to crop tab
|
|
11
11
|
this.tempFlipPanPoint = { x: 0, y: 0 };
|
|
12
|
+
this.isPreventScaling = false;
|
|
12
13
|
this.parent = parent;
|
|
13
14
|
this.addEventListener();
|
|
14
15
|
}
|
|
@@ -71,6 +72,9 @@ class Crop {
|
|
|
71
72
|
this.tempFlipPanPoint.y += args.value['point'].y;
|
|
72
73
|
}
|
|
73
74
|
break;
|
|
75
|
+
case 'getPreventScaling':
|
|
76
|
+
args.value['obj']['bool'] = this.isPreventScaling;
|
|
77
|
+
break;
|
|
74
78
|
case 'reset':
|
|
75
79
|
this.reset();
|
|
76
80
|
break;
|
|
@@ -93,6 +97,7 @@ class Crop {
|
|
|
93
97
|
this.croppedDegree = 0;
|
|
94
98
|
this.cropDestPoints = { startX: 0, startY: 0, width: 0, height: 0 };
|
|
95
99
|
this.tempFlipPanPoint = { x: 0, y: 0 };
|
|
100
|
+
this.isPreventScaling = false;
|
|
96
101
|
}
|
|
97
102
|
cropImg(isRotateCrop) {
|
|
98
103
|
const parent = this.parent;
|
|
@@ -709,7 +714,7 @@ class Crop {
|
|
|
709
714
|
}
|
|
710
715
|
const transitionArgs = { cancel: false, startPoint: { x: parent.activeObj.activePoint.startX,
|
|
711
716
|
y: parent.activeObj.activePoint.startY }, endPoint: { x: parent.activeObj.activePoint.endX,
|
|
712
|
-
y: parent.activeObj.activePoint.endY } };
|
|
717
|
+
y: parent.activeObj.activePoint.endY }, preventScaling: false };
|
|
713
718
|
if (!object['isCropToolbar'] && isBlazor() && parent.events && parent.events.cropping.hasDelegate === true) {
|
|
714
719
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
715
720
|
parent.dotNetRef.invokeMethodAsync('CropEventAsync', 'OnCrop', transitionArgs).then((args) => {
|
|
@@ -735,6 +740,12 @@ class Crop {
|
|
|
735
740
|
obj.isCrop = true;
|
|
736
741
|
const prevCropObj = extend({}, parent.cropObj, {}, true);
|
|
737
742
|
const prevObj = extend({}, this.prevCropCurrObj, {}, true);
|
|
743
|
+
if (transitionArgs.preventScaling) {
|
|
744
|
+
this.isPreventScaling = true;
|
|
745
|
+
}
|
|
746
|
+
else {
|
|
747
|
+
this.isPreventScaling = false;
|
|
748
|
+
}
|
|
738
749
|
this.cropImg();
|
|
739
750
|
parent.transform.zoomFactor = 0;
|
|
740
751
|
parent.zoomSettings.zoomFactor = 1;
|
|
@@ -992,10 +1003,6 @@ class Draw {
|
|
|
992
1003
|
case 'setPrevActObj':
|
|
993
1004
|
this.prevActObj = args.value['prevActObj'];
|
|
994
1005
|
break;
|
|
995
|
-
case 'getZoomCrop':
|
|
996
|
-
args.value['obj']['width'] = this.zoomCrop.width;
|
|
997
|
-
args.value['obj']['height'] = this.zoomCrop.height;
|
|
998
|
-
break;
|
|
999
1006
|
case 'setZoomCropWidth':
|
|
1000
1007
|
this.zoomCrop.width = args.value['width'];
|
|
1001
1008
|
this.zoomCrop.height = args.value['height'];
|
|
@@ -1024,6 +1031,9 @@ class Draw {
|
|
|
1024
1031
|
case 'setArrowDimension':
|
|
1025
1032
|
this.arrowDimension = args.value['arrowDimension'];
|
|
1026
1033
|
break;
|
|
1034
|
+
case 'moveToSelectionRange':
|
|
1035
|
+
this.moveToSelectionRange(args.value['type'], args.value['activeObj']);
|
|
1036
|
+
break;
|
|
1027
1037
|
}
|
|
1028
1038
|
}
|
|
1029
1039
|
getModuleName() {
|
|
@@ -1311,8 +1321,10 @@ class Draw {
|
|
|
1311
1321
|
}
|
|
1312
1322
|
adjToCenter() {
|
|
1313
1323
|
const parent = this.parent;
|
|
1314
|
-
const diffX = ((parent.lowerCanvas.width) / 2) - (parent.activeObj.activePoint.endX -
|
|
1315
|
-
|
|
1324
|
+
const diffX = ((parent.lowerCanvas.width) / 2) - (parent.activeObj.activePoint.endX -
|
|
1325
|
+
parent.activeObj.activePoint.width / 2);
|
|
1326
|
+
const diffY = ((parent.lowerCanvas.height) / 2) - (parent.activeObj.activePoint.endY -
|
|
1327
|
+
parent.activeObj.activePoint.height / 2);
|
|
1316
1328
|
parent.activeObj.activePoint.startX += diffX;
|
|
1317
1329
|
parent.activeObj.activePoint.endX += diffX;
|
|
1318
1330
|
parent.activeObj.activePoint.startY += diffY;
|
|
@@ -2758,11 +2770,22 @@ class Draw {
|
|
|
2758
2770
|
// proxy.reset();
|
|
2759
2771
|
// proxy.parent.baseImg.src = proxy.baseImgSrc;
|
|
2760
2772
|
proxy.isErrorImage = true;
|
|
2773
|
+
proxy.errorLoading();
|
|
2761
2774
|
};
|
|
2762
2775
|
}
|
|
2776
|
+
errorLoading() {
|
|
2777
|
+
const parent = this.parent;
|
|
2778
|
+
const fileOpened = { fileName: null, fileType: null, isValidImage: false };
|
|
2779
|
+
if (isBlazor() && parent.events && parent.events.fileOpened.hasDelegate === true) {
|
|
2780
|
+
parent.dotNetRef.invokeMethodAsync('FileOpenEventAsync', 'FileOpened', fileOpened);
|
|
2781
|
+
}
|
|
2782
|
+
else {
|
|
2783
|
+
parent.trigger('fileOpened', fileOpened);
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2763
2786
|
updateCanvas() {
|
|
2764
2787
|
const parent = this.parent;
|
|
2765
|
-
const fileOpened = { fileName: this.fileName, fileType: this.fileType };
|
|
2788
|
+
const fileOpened = { fileName: this.fileName, fileType: this.fileType, isValidImage: true };
|
|
2766
2789
|
parent.img.srcWidth = parent.baseImg.width;
|
|
2767
2790
|
parent.img.srcHeight = parent.baseImg.height;
|
|
2768
2791
|
const obj = { width: 0, height: 0 };
|
|
@@ -2941,10 +2964,6 @@ class Draw {
|
|
|
2941
2964
|
else if (isCropSelection) {
|
|
2942
2965
|
this.cancelSelection();
|
|
2943
2966
|
}
|
|
2944
|
-
else if ((parent.transform.zoomFactor !== this.tempZoomFactor) || isCropSelection &&
|
|
2945
|
-
isNullOrUndefined(parent.currSelectionPoint)) {
|
|
2946
|
-
this.cancelZoom();
|
|
2947
|
-
}
|
|
2948
2967
|
else {
|
|
2949
2968
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
2950
2969
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
@@ -3086,114 +3105,6 @@ class Draw {
|
|
|
3086
3105
|
}
|
|
3087
3106
|
}
|
|
3088
3107
|
}
|
|
3089
|
-
cancelZoom() {
|
|
3090
|
-
const parent = this.parent;
|
|
3091
|
-
const length = parent.transform.cropZoomFactor - this.tempZoomFactor;
|
|
3092
|
-
parent.transform.zoomFactor = parent.transform.cropZoomFactor;
|
|
3093
|
-
if (isNullOrUndefined(parent.cropObj.activeObj.shape)) {
|
|
3094
|
-
if ((parent.transform.degree === 0 && parent.panPoint.totalPannedPoint.x === 0 && parent.panPoint.totalPannedPoint.y === 0)
|
|
3095
|
-
|| (parent.transform.degree !== 0 && parent.panPoint.totalPannedInternalPoint.x === 0 &&
|
|
3096
|
-
parent.panPoint.totalPannedInternalPoint.y === 0 && parent.panPoint.totalPannedClientPoint.x === 0 &&
|
|
3097
|
-
parent.panPoint.totalPannedClientPoint.y === 0)) {
|
|
3098
|
-
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
3099
|
-
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
3100
|
-
if (length > 0) {
|
|
3101
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3102
|
-
value: { zoomFactor: -length, zoomPoint: null } });
|
|
3103
|
-
}
|
|
3104
|
-
else {
|
|
3105
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3106
|
-
value: { zoomFactor: Math.abs(length), zoomPoint: null } });
|
|
3107
|
-
}
|
|
3108
|
-
parent.transform.cropZoomFactor = this.tempZoomFactor;
|
|
3109
|
-
parent.currObjType.isCustomCrop = false;
|
|
3110
|
-
parent.upperCanvas.style.cursor = parent.cursor = 'default';
|
|
3111
|
-
parent.currObjType.isCustomCrop = false;
|
|
3112
|
-
this.tempStrokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null };
|
|
3113
|
-
const eventargs = { type: 'main', isApplyBtn: null, isCropping: false, isZooming: null };
|
|
3114
|
-
if (!isBlazor()) {
|
|
3115
|
-
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: eventargs });
|
|
3116
|
-
}
|
|
3117
|
-
else {
|
|
3118
|
-
parent.updateToolbar(parent.element, 'imageLoaded');
|
|
3119
|
-
}
|
|
3120
|
-
return;
|
|
3121
|
-
}
|
|
3122
|
-
}
|
|
3123
|
-
if (isNullOrUndefined(parent.cropObj.activeObj.shape)) {
|
|
3124
|
-
if (parent.transform.degree === 0) {
|
|
3125
|
-
const activeObj = extend({}, parent.activeObj, {});
|
|
3126
|
-
parent.img.destLeft += (-parent.panPoint.totalPannedPoint.x);
|
|
3127
|
-
parent.img.destTop += (-parent.panPoint.totalPannedPoint.y);
|
|
3128
|
-
parent.notify('transform', { prop: 'drawPannImage', onPropertyChange: false,
|
|
3129
|
-
value: { point: { x: -parent.panPoint.totalPannedPoint.x, y: -parent.panPoint.totalPannedPoint.y } } });
|
|
3130
|
-
this.updateFlipPan(activeObj);
|
|
3131
|
-
parent.panPoint.totalPannedPoint = { x: 0, y: 0 };
|
|
3132
|
-
}
|
|
3133
|
-
else {
|
|
3134
|
-
parent.panPoint.totalPannedClientPoint = { x: -parent.panPoint.totalPannedClientPoint.x,
|
|
3135
|
-
y: -parent.panPoint.totalPannedClientPoint.y };
|
|
3136
|
-
parent.panPoint.totalPannedInternalPoint = { x: -parent.panPoint.totalPannedInternalPoint.x,
|
|
3137
|
-
y: -parent.panPoint.totalPannedInternalPoint.y };
|
|
3138
|
-
parent.notify('transform', { prop: 'rotatePan', onPropertyChange: false,
|
|
3139
|
-
value: { isCropSelection: true, isDefaultZoom: null } });
|
|
3140
|
-
parent.panPoint.totalPannedClientPoint = { x: 0, y: 0 };
|
|
3141
|
-
parent.panPoint.totalPannedInternalPoint = { x: 0, y: 0 };
|
|
3142
|
-
parent.panPoint.currentPannedPoint = { x: 0, y: 0 };
|
|
3143
|
-
}
|
|
3144
|
-
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
3145
|
-
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
3146
|
-
if (length > 0) {
|
|
3147
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3148
|
-
value: { zoomFactor: -length, zoomPoint: null } });
|
|
3149
|
-
}
|
|
3150
|
-
else {
|
|
3151
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3152
|
-
value: { zoomFactor: Math.abs(length), zoomPoint: null } });
|
|
3153
|
-
}
|
|
3154
|
-
parent.transform.cropZoomFactor = this.tempZoomFactor;
|
|
3155
|
-
}
|
|
3156
|
-
else {
|
|
3157
|
-
this.isCancelAction = true;
|
|
3158
|
-
parent.objColl = [];
|
|
3159
|
-
parent.pointColl = [];
|
|
3160
|
-
const freehandCounter = parent.freehandCounter;
|
|
3161
|
-
parent.freehandCounter = 0;
|
|
3162
|
-
const object = { selPointColl: null };
|
|
3163
|
-
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
3164
|
-
value: { obj: object } });
|
|
3165
|
-
const cropSelPointColl = object['selPointColl'];
|
|
3166
|
-
parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
|
|
3167
|
-
value: { obj: { selPointColl: [] } } });
|
|
3168
|
-
const cropObj = extend({}, parent.cropObj, {});
|
|
3169
|
-
const afterCropActions = extend([], parent.afterCropActions, {}, true);
|
|
3170
|
-
this.setCurrentObj();
|
|
3171
|
-
parent.notify('crop', { prop: 'cropImg', onPropertyChange: false, value: { isRotateCrop: null } });
|
|
3172
|
-
parent.cropObj = cropObj;
|
|
3173
|
-
parent.afterCropActions = afterCropActions;
|
|
3174
|
-
parent.objColl = extend([], this.cancelObjColl, [], true);
|
|
3175
|
-
parent.pointColl = extend([], this.cancelPointColl, [], true);
|
|
3176
|
-
parent.freehandCounter = freehandCounter;
|
|
3177
|
-
parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
|
|
3178
|
-
value: { obj: { selPointColl: cropSelPointColl } } });
|
|
3179
|
-
parent.notify('shape', { prop: 'iterateObjColl', onPropertyChange: false });
|
|
3180
|
-
parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
|
|
3181
|
-
value: { context: this.lowerContext, points: null } });
|
|
3182
|
-
this.clearOuterCanvas(this.lowerContext);
|
|
3183
|
-
if (parent.isCircleCrop) {
|
|
3184
|
-
parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
|
|
3185
|
-
value: { context: this.lowerContext, isSave: null, isFlip: null } });
|
|
3186
|
-
}
|
|
3187
|
-
this.isCancelAction = false;
|
|
3188
|
-
}
|
|
3189
|
-
parent.transform.zoomFactor = parent.transform.defaultZoomFactor;
|
|
3190
|
-
if (!isBlazor()) {
|
|
3191
|
-
parent.notify('toolbar', { prop: 'enable-disable-btns', onPropertyChange: false });
|
|
3192
|
-
}
|
|
3193
|
-
else {
|
|
3194
|
-
parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
|
|
3195
|
-
}
|
|
3196
|
-
}
|
|
3197
3108
|
updateFlipPan(tempSelectionObj) {
|
|
3198
3109
|
const parent = this.parent;
|
|
3199
3110
|
if (parent.transform.currFlipState !== '') {
|
|
@@ -3854,13 +3765,8 @@ class Draw {
|
|
|
3854
3765
|
parent.notify('toolbar', { prop: 'getDefToolbarItems', value: { obj: obj } });
|
|
3855
3766
|
if (obj['defToolbarItems'].length === 0 &&
|
|
3856
3767
|
(isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar')))) {
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
}
|
|
3860
|
-
else if (parent.element.querySelector('#' + parent.element.id + '_toolbarArea')) {
|
|
3861
|
-
const height = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
|
|
3862
|
-
parent.notify('toolbar', { prop: 'setToolbarHeight', value: { height: height } });
|
|
3863
|
-
}
|
|
3768
|
+
const height = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
|
|
3769
|
+
parent.notify('toolbar', { prop: 'setToolbarHeight', value: { height: height } });
|
|
3864
3770
|
}
|
|
3865
3771
|
}
|
|
3866
3772
|
else {
|
|
@@ -4017,6 +3923,7 @@ class Draw {
|
|
|
4017
3923
|
const fileData = filesData;
|
|
4018
3924
|
let fileExtension = fileData.name && fileData.name.split('.')[1].toLowerCase();
|
|
4019
3925
|
if (fileExtension && ['jpg', 'jpeg', 'png', 'svg'].indexOf(fileExtension) === -1) {
|
|
3926
|
+
this.errorLoading();
|
|
4020
3927
|
return;
|
|
4021
3928
|
}
|
|
4022
3929
|
showSpinner(parent.element);
|
|
@@ -4064,6 +3971,121 @@ class Draw {
|
|
|
4064
3971
|
this.imageOnLoad(url.toString());
|
|
4065
3972
|
inputElement.value = '';
|
|
4066
3973
|
}
|
|
3974
|
+
moveToSelectionRange(type, activeObj) {
|
|
3975
|
+
const parent = this.parent;
|
|
3976
|
+
if (parent.activeObj.shape) {
|
|
3977
|
+
if (type === 'rotateleft' || type === 'rotateright') {
|
|
3978
|
+
let zoomFactor = parent.transform.zoomFactor;
|
|
3979
|
+
parent.objColl.push(parent.activeObj);
|
|
3980
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
3981
|
+
if (parent.transform.degree % 90 === 0 && parent.transform.degree % 180 !== 0) {
|
|
3982
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.width < activeObj.activePoint.height) {
|
|
3983
|
+
for (let i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
3984
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
|
|
3985
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
3986
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
3987
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
3988
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3989
|
+
value: { zoomFactor: -0.1, zoomPoint: null } });
|
|
3990
|
+
}
|
|
3991
|
+
break;
|
|
3992
|
+
}
|
|
3993
|
+
zoomFactor += 0.1;
|
|
3994
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3995
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
3996
|
+
}
|
|
3997
|
+
}
|
|
3998
|
+
else {
|
|
3999
|
+
for (let i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
4000
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
|
|
4001
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
4002
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
4003
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
4004
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4005
|
+
value: { zoomFactor: 0.1, zoomPoint: null } });
|
|
4006
|
+
}
|
|
4007
|
+
break;
|
|
4008
|
+
}
|
|
4009
|
+
zoomFactor -= .1;
|
|
4010
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4011
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4012
|
+
}
|
|
4013
|
+
}
|
|
4014
|
+
}
|
|
4015
|
+
else {
|
|
4016
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.height < activeObj.activePoint.width) {
|
|
4017
|
+
for (let i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
4018
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
|
|
4019
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
4020
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
4021
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
4022
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4023
|
+
value: { zoomFactor: -0.1, zoomPoint: null } });
|
|
4024
|
+
}
|
|
4025
|
+
break;
|
|
4026
|
+
}
|
|
4027
|
+
zoomFactor += 0.1;
|
|
4028
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4029
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4030
|
+
}
|
|
4031
|
+
}
|
|
4032
|
+
else {
|
|
4033
|
+
for (let i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
4034
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
|
|
4035
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
4036
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
4037
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
4038
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4039
|
+
value: { zoomFactor: 0.1, zoomPoint: null } });
|
|
4040
|
+
}
|
|
4041
|
+
break;
|
|
4042
|
+
}
|
|
4043
|
+
zoomFactor -= .1;
|
|
4044
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4045
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4046
|
+
}
|
|
4047
|
+
}
|
|
4048
|
+
}
|
|
4049
|
+
const panX = (parent.lowerCanvas.clientWidth / 2) - (parent.objColl[parent.objColl.length - 1].activePoint.startX +
|
|
4050
|
+
(parent.objColl[parent.objColl.length - 1].activePoint.width / 2));
|
|
4051
|
+
const panY = (parent.lowerCanvas.clientHeight / 2) - (parent.objColl[parent.objColl.length - 1].activePoint.startY +
|
|
4052
|
+
(parent.objColl[parent.objColl.length - 1].activePoint.height / 2));
|
|
4053
|
+
if (parent.transform.degree === 0) {
|
|
4054
|
+
parent.img.destLeft += panX;
|
|
4055
|
+
parent.img.destTop += panY;
|
|
4056
|
+
parent.notify('transform', { prop: 'drawPannImage', value: { point: { x: panX, y: panY } } });
|
|
4057
|
+
}
|
|
4058
|
+
else {
|
|
4059
|
+
parent.panPoint.currentPannedPoint = { x: panX, y: panY };
|
|
4060
|
+
parent.notify('transform', { prop: 'drawPannedImage', value: { xDiff: panX, yDiff: panY } });
|
|
4061
|
+
parent.panPoint.currentPannedPoint = { x: 0, y: 0 };
|
|
4062
|
+
}
|
|
4063
|
+
parent.notify('transform', { prop: 'setTempPanMove', onPropertyChange: false,
|
|
4064
|
+
value: { point: null } });
|
|
4065
|
+
parent.activeObj = extend({}, parent.objColl[parent.objColl.length - 1]);
|
|
4066
|
+
parent.objColl.pop();
|
|
4067
|
+
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj } });
|
|
4068
|
+
}
|
|
4069
|
+
}
|
|
4070
|
+
}
|
|
4071
|
+
isSelectionBiggerThanCanvas(obj) {
|
|
4072
|
+
let isBigger = false;
|
|
4073
|
+
if (obj.activePoint.startX <= this.parent.img.destLeft ||
|
|
4074
|
+
obj.activePoint.startY <= this.parent.img.destTop ||
|
|
4075
|
+
obj.activePoint.endX >= this.parent.img.destLeft + this.parent.img.destWidth ||
|
|
4076
|
+
obj.activePoint.endY >= this.parent.img.destTop + this.parent.img.destHeight) {
|
|
4077
|
+
isBigger = true;
|
|
4078
|
+
}
|
|
4079
|
+
return isBigger;
|
|
4080
|
+
}
|
|
4081
|
+
isSelectionOutsideCanvas(obj) {
|
|
4082
|
+
let isOutside = false;
|
|
4083
|
+
if ((obj.activePoint.height < this.parent.lowerCanvas.height - this.parent.toolbarHeight) ||
|
|
4084
|
+
(obj.activePoint.width < this.parent.lowerCanvas.width)) {
|
|
4085
|
+
isOutside = true;
|
|
4086
|
+
}
|
|
4087
|
+
return isOutside;
|
|
4088
|
+
}
|
|
4067
4089
|
}
|
|
4068
4090
|
|
|
4069
4091
|
class Export {
|
|
@@ -4516,7 +4538,7 @@ class Filter {
|
|
|
4516
4538
|
}
|
|
4517
4539
|
updatePrivateVariables() {
|
|
4518
4540
|
const parent = this.parent;
|
|
4519
|
-
if (
|
|
4541
|
+
if (parent.lowerCanvas) {
|
|
4520
4542
|
this.lowerContext = parent.lowerCanvas.getContext('2d');
|
|
4521
4543
|
}
|
|
4522
4544
|
}
|
|
@@ -5825,7 +5847,7 @@ class FreehandDrawing {
|
|
|
5825
5847
|
updateFHDCurPts() {
|
|
5826
5848
|
const parent = this.parent;
|
|
5827
5849
|
for (let n = 0; n < parent.freehandCounter; n++) {
|
|
5828
|
-
if (
|
|
5850
|
+
if (this.selPointColl[n]) {
|
|
5829
5851
|
this.selPoints = extend([], this.selPointColl[n].points, []);
|
|
5830
5852
|
this.pointCounter = 0;
|
|
5831
5853
|
const len = this.selPoints.length;
|
|
@@ -5853,7 +5875,7 @@ class FreehandDrawing {
|
|
|
5853
5875
|
}
|
|
5854
5876
|
// Update rotation points for each point for cursor styles
|
|
5855
5877
|
for (let n = 0; n < parent.freehandCounter; n++) {
|
|
5856
|
-
if (
|
|
5878
|
+
if (this.selPointColl[n]) {
|
|
5857
5879
|
this.selPoints = extend([], this.selPointColl[n].points, []);
|
|
5858
5880
|
this.pointCounter = 0;
|
|
5859
5881
|
const len = this.selPoints.length;
|
|
@@ -5909,7 +5931,7 @@ class FreehandDrawing {
|
|
|
5909
5931
|
}
|
|
5910
5932
|
// Update flip value for each points for cursor styles
|
|
5911
5933
|
for (let n = 0; n < parent.freehandCounter; n++) {
|
|
5912
|
-
if (
|
|
5934
|
+
if (this.selPointColl[n]) {
|
|
5913
5935
|
if (this.selPointColl[n].shapeFlip !== parent.transform.currFlipState) {
|
|
5914
5936
|
this.selPoints = extend([], this.selPointColl[n].points, []);
|
|
5915
5937
|
this.pointCounter = 0;
|
|
@@ -5956,7 +5978,7 @@ class FreehandDrawing {
|
|
|
5956
5978
|
}
|
|
5957
5979
|
// Update flip value for each points for cursor styles
|
|
5958
5980
|
for (let n = 0; n < parent.freehandCounter; n++) {
|
|
5959
|
-
if (
|
|
5981
|
+
if (this.selPointColl[n]) {
|
|
5960
5982
|
if (this.selPointColl[n].shapeFlip !== parent.transform.currFlipState) {
|
|
5961
5983
|
this.selPoints = extend([], this.selPointColl[n].points, []);
|
|
5962
5984
|
this.pointCounter = 0;
|
|
@@ -6007,7 +6029,7 @@ class FreehandDrawing {
|
|
|
6007
6029
|
}
|
|
6008
6030
|
}
|
|
6009
6031
|
for (let n = 0; n < parent.freehandCounter; n++) {
|
|
6010
|
-
if (
|
|
6032
|
+
if (this.selPointColl[n]) {
|
|
6011
6033
|
this.selPoints = extend([], this.selPointColl[n].points, []);
|
|
6012
6034
|
this.pointCounter = 0;
|
|
6013
6035
|
const len = this.selPoints.length;
|
|
@@ -6042,7 +6064,7 @@ class FreehandDrawing {
|
|
|
6042
6064
|
}
|
|
6043
6065
|
// Updating each points for cursor styles for panning
|
|
6044
6066
|
for (let n = 0; n < parent.freehandCounter; n++) {
|
|
6045
|
-
if (
|
|
6067
|
+
if (this.selPointColl[n]) {
|
|
6046
6068
|
this.selPoints = extend([], this.selPointColl[n].points, []);
|
|
6047
6069
|
this.pointCounter = 0;
|
|
6048
6070
|
const len = this.selPoints.length;
|
|
@@ -6105,13 +6127,13 @@ class FreehandDrawing {
|
|
|
6105
6127
|
isFHDIdx(index, obj) {
|
|
6106
6128
|
let isIndex = false;
|
|
6107
6129
|
for (let i = 0; i < this.parent.freehandCounter; i++) {
|
|
6108
|
-
if (
|
|
6130
|
+
if (this.parent.pointColl[i].id &&
|
|
6109
6131
|
parseInt(this.parent.pointColl[i].id.split('_')[1], 10) - 1 === index) {
|
|
6110
6132
|
isIndex = true;
|
|
6111
6133
|
break;
|
|
6112
6134
|
}
|
|
6113
6135
|
}
|
|
6114
|
-
if (
|
|
6136
|
+
if (obj) {
|
|
6115
6137
|
obj['isIndex'] = isIndex;
|
|
6116
6138
|
}
|
|
6117
6139
|
return isIndex;
|
|
@@ -6120,7 +6142,7 @@ class FreehandDrawing {
|
|
|
6120
6142
|
const parent = this.parent;
|
|
6121
6143
|
for (let n = 0; n < parent.freehandCounter; n++) {
|
|
6122
6144
|
const obj = { selPointColl: extend([], this.selPointColl) };
|
|
6123
|
-
if (
|
|
6145
|
+
if (obj['selPointColl'][n]) {
|
|
6124
6146
|
this.selPoints = extend([], obj['selPointColl'][n].points, []);
|
|
6125
6147
|
this.pointCounter = 0;
|
|
6126
6148
|
const len = this.selPoints.length;
|
|
@@ -6265,9 +6287,6 @@ class Selection {
|
|
|
6265
6287
|
case 'handleScroll':
|
|
6266
6288
|
this.handleScroll(args.value['e']);
|
|
6267
6289
|
break;
|
|
6268
|
-
case 'adjustToScreen':
|
|
6269
|
-
this.adjustToScreen();
|
|
6270
|
-
break;
|
|
6271
6290
|
case 'textKeyDown':
|
|
6272
6291
|
setTimeout(this.textKeyDown.bind(this), 1, args.value['e']);
|
|
6273
6292
|
break;
|
|
@@ -6359,9 +6378,24 @@ class Selection {
|
|
|
6359
6378
|
case 'getTransRotationPoint':
|
|
6360
6379
|
this.getTransRotationPoint(args.value['obj'], args.value['object']);
|
|
6361
6380
|
break;
|
|
6381
|
+
case 'adjustNEPoints':
|
|
6382
|
+
this.adjustNEPoints(args.value['rectangle'], args.value['x'], args.value['y'], args.value['angle']);
|
|
6383
|
+
break;
|
|
6384
|
+
case 'adjustRotationPoints':
|
|
6385
|
+
this.adjustRotationPoints(args.value['rectangle'], args.value['x'], args.value['y'], args.value['angle']);
|
|
6386
|
+
break;
|
|
6387
|
+
case 'getResizeDirection':
|
|
6388
|
+
this.getResizeDirection(args.value['rectangle'], args.value['x'], args.value['y'], args.value['angle']);
|
|
6389
|
+
break;
|
|
6390
|
+
case 'setResizedElement':
|
|
6391
|
+
this.resizedElement = args.value['value'];
|
|
6392
|
+
break;
|
|
6362
6393
|
case 'reset':
|
|
6363
6394
|
this.reset();
|
|
6364
6395
|
break;
|
|
6396
|
+
case 'unWireEvent':
|
|
6397
|
+
this.unwireEvent();
|
|
6398
|
+
break;
|
|
6365
6399
|
}
|
|
6366
6400
|
}
|
|
6367
6401
|
getModuleName() {
|
|
@@ -6369,10 +6403,10 @@ class Selection {
|
|
|
6369
6403
|
}
|
|
6370
6404
|
updatePrivateVariables() {
|
|
6371
6405
|
const parent = this.parent;
|
|
6372
|
-
if (
|
|
6406
|
+
if (parent.lowerCanvas) {
|
|
6373
6407
|
this.lowerContext = parent.lowerCanvas.getContext('2d');
|
|
6374
6408
|
}
|
|
6375
|
-
if (
|
|
6409
|
+
if (parent.upperCanvas) {
|
|
6376
6410
|
this.upperContext = parent.upperCanvas.getContext('2d');
|
|
6377
6411
|
}
|
|
6378
6412
|
}
|
|
@@ -6483,7 +6517,7 @@ class Selection {
|
|
|
6483
6517
|
cursor = 'move';
|
|
6484
6518
|
}
|
|
6485
6519
|
}
|
|
6486
|
-
else if (
|
|
6520
|
+
else if (rotationCirclePoint && !isApply &&
|
|
6487
6521
|
x >= (rotationCirclePoint.x - (actObj.bottomCenterCircle.radius + 2)) &&
|
|
6488
6522
|
x <= rotationCirclePoint.x + (actObj.bottomCenterCircle.radius + 2) &&
|
|
6489
6523
|
y >= rotationCirclePoint.y - (actObj.bottomCenterCircle.radius + 2) &&
|
|
@@ -6585,7 +6619,7 @@ class Selection {
|
|
|
6585
6619
|
}
|
|
6586
6620
|
}
|
|
6587
6621
|
if ((parent.cursor === 'default' || parent.cursor === 'grab')
|
|
6588
|
-
&&
|
|
6622
|
+
&& parent.pointColl[0] && (parent.cursor !== 'grab' || !isCropSelection)
|
|
6589
6623
|
&& !parent.currObjType.isDragging && !parent.currObjType.isResize) {
|
|
6590
6624
|
this.setCursorForFreehandDrawing(x, y, upperCanvas);
|
|
6591
6625
|
}
|
|
@@ -6703,7 +6737,7 @@ class Selection {
|
|
|
6703
6737
|
(actObj.bottomCenterCircle.radius + 2))) {
|
|
6704
6738
|
upperCanvas.style.cursor = parent.cursor = 'se-resize';
|
|
6705
6739
|
}
|
|
6706
|
-
else if (
|
|
6740
|
+
else if (actObj.rotationCirclePointColl &&
|
|
6707
6741
|
x >= (actObj.rotationCirclePointColl.x - (actObj.bottomCenterCircle.radius + 2)) &&
|
|
6708
6742
|
x <= actObj.rotationCirclePointColl.x + (actObj.bottomCenterCircle.radius + 2) &&
|
|
6709
6743
|
y >= actObj.rotationCirclePointColl.y - (actObj.bottomCenterCircle.radius + 2) &&
|
|
@@ -6771,7 +6805,7 @@ class Selection {
|
|
|
6771
6805
|
if ((length >= 92 && length <= 182) || (length >= -178 && length <= -88)) {
|
|
6772
6806
|
const cursorMap = { 'nw-resize': 'ne-resize', 'n-resize': 's-resize',
|
|
6773
6807
|
'ne-resize': 'nw-resize', 'w-resize': 'e-resize', 'e-resize': 'w-resize',
|
|
6774
|
-
'sw-resize': 'se-resize', 's-resize': 'n-resize', 'se-resize': 'sw-resize'
|
|
6808
|
+
'sw-resize': 'se-resize', 's-resize': 'n-resize', 'se-resize': 'sw-resize'
|
|
6775
6809
|
};
|
|
6776
6810
|
if (parent.cursor in cursorMap) {
|
|
6777
6811
|
parent.cursor = cursorMap[parent.cursor];
|
|
@@ -6915,7 +6949,7 @@ class Selection {
|
|
|
6915
6949
|
else if (!this.isFhdEditing || parent.pointColl[n].isSelected) {
|
|
6916
6950
|
if (this.isFhdPoint || this.isFhdEditing) {
|
|
6917
6951
|
upperContext.clearRect(0, 0, upperCanvas.width, upperCanvas.height);
|
|
6918
|
-
if (
|
|
6952
|
+
if (parent.activeObj.shape && textArea.style.display === 'none') {
|
|
6919
6953
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj } });
|
|
6920
6954
|
}
|
|
6921
6955
|
}
|
|
@@ -7191,7 +7225,7 @@ class Selection {
|
|
|
7191
7225
|
if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
7192
7226
|
this.isCropSelection = true;
|
|
7193
7227
|
}
|
|
7194
|
-
if (!this.isCropSelection && this.parent.eventType !== 'resize' && isBlazor() &&
|
|
7228
|
+
if (!this.isCropSelection && this.parent.eventType !== 'resize' && isBlazor() && parent.events && this.parent.events.onShapeResizeStart.hasDelegate === true) {
|
|
7195
7229
|
shapeResizingArgs.action = 'resize-start';
|
|
7196
7230
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
7197
7231
|
parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShapeResizeStart', shapeResizingArgs).then((shapeResizingArgs) => {
|
|
@@ -8401,7 +8435,7 @@ class Selection {
|
|
|
8401
8435
|
isResize = true;
|
|
8402
8436
|
this.dragElement = parent.upperCanvas.style.cursor;
|
|
8403
8437
|
}
|
|
8404
|
-
else if (
|
|
8438
|
+
else if (rotationCirclePoint &&
|
|
8405
8439
|
x >= rotationCirclePoint.x - (actObj.topLeftCircle.radius * 2) &&
|
|
8406
8440
|
x <= rotationCirclePoint.x + (actObj.topLeftCircle.radius * 2) &&
|
|
8407
8441
|
y >= rotationCirclePoint.y - (actObj.topLeftCircle.radius * 2) &&
|
|
@@ -8711,7 +8745,7 @@ class Selection {
|
|
|
8711
8745
|
this.dragCanvas = parent.togglePan = true;
|
|
8712
8746
|
}
|
|
8713
8747
|
const imageEditorClickEventArgs = { point: this.setXYPoints(e) };
|
|
8714
|
-
if (isBlazor() &&
|
|
8748
|
+
if (isBlazor() && parent.events && parent.events.clicked.hasDelegate === true) {
|
|
8715
8749
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
8716
8750
|
parent.dotNetRef.invokeMethodAsync('ClickEventAsync', 'click', imageEditorClickEventArgs).then((imageEditorClickEventArgs) => {
|
|
8717
8751
|
this.clickEvent(imageEditorClickEventArgs, e);
|
|
@@ -8742,7 +8776,7 @@ class Selection {
|
|
|
8742
8776
|
const parent = this.parent;
|
|
8743
8777
|
const x = imageEditorClickEventArgs.point.x;
|
|
8744
8778
|
const y = imageEditorClickEventArgs.point.y;
|
|
8745
|
-
const cursor =
|
|
8779
|
+
const cursor = parent.activeObj.shape && parent.activeObj.shape === 'text' ?
|
|
8746
8780
|
parent.cursor : 'default';
|
|
8747
8781
|
if (this.currentDrawingShape !== '') {
|
|
8748
8782
|
const object = { currObj: {} };
|
|
@@ -8778,7 +8812,7 @@ class Selection {
|
|
|
8778
8812
|
this.isPan = false;
|
|
8779
8813
|
}
|
|
8780
8814
|
}
|
|
8781
|
-
if (
|
|
8815
|
+
if (parent.activeObj.shape) {
|
|
8782
8816
|
this.isObjSelected = true;
|
|
8783
8817
|
}
|
|
8784
8818
|
else {
|
|
@@ -8792,7 +8826,7 @@ class Selection {
|
|
|
8792
8826
|
const isFreehandDraw = this.isFreehandDrawTouch(e, this.isCropSelection);
|
|
8793
8827
|
const isShapeClick = isShape ? isShape : this.isShapeClick(e, this.isCropSelection);
|
|
8794
8828
|
const allowUndoRedoPush = this.applyCurrShape(isShapeClick);
|
|
8795
|
-
if (this.isTouch && !isShape &&
|
|
8829
|
+
if (this.isTouch && !isShape && activeObj.shape && !this.isCropSelection) {
|
|
8796
8830
|
if (this.applyObj(x, y)) {
|
|
8797
8831
|
parent.okBtn(true);
|
|
8798
8832
|
parent.notify('draw', { prop: 'setPrevActObj', onPropertyChange: false, value: { prevActObj: null } });
|
|
@@ -8827,11 +8861,12 @@ class Selection {
|
|
|
8827
8861
|
}
|
|
8828
8862
|
if (this.isFhdEditing) {
|
|
8829
8863
|
parent.notify('freehand-draw', { prop: 'applyFhd', onPropertyChange: false });
|
|
8864
|
+
this.isFhdCustomized = false;
|
|
8830
8865
|
if (!isBlazor()) {
|
|
8831
8866
|
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
8832
8867
|
}
|
|
8833
8868
|
}
|
|
8834
|
-
if (
|
|
8869
|
+
if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' ||
|
|
8835
8870
|
parent.activeObj.shape === 'ellipse' || parent.activeObj.shape === 'line' ||
|
|
8836
8871
|
parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path' || parent.activeObj.shape === 'text')) {
|
|
8837
8872
|
parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
|
|
@@ -8849,7 +8884,7 @@ class Selection {
|
|
|
8849
8884
|
}
|
|
8850
8885
|
else {
|
|
8851
8886
|
let isLineArrow = false;
|
|
8852
|
-
if (
|
|
8887
|
+
if (parent.activeObj.shape && (parent.activeObj.shape === 'line' ||
|
|
8853
8888
|
parent.activeObj.shape === 'arrow')) {
|
|
8854
8889
|
isLineArrow = true;
|
|
8855
8890
|
}
|
|
@@ -8905,7 +8940,7 @@ class Selection {
|
|
|
8905
8940
|
else {
|
|
8906
8941
|
if (this.isFhdEditing) {
|
|
8907
8942
|
parent.notify('freehand-draw', { prop: 'cancelFhd', value: { type: 'ok' } });
|
|
8908
|
-
if (
|
|
8943
|
+
if (document.getElementById(parent.element.id + '_quickAccessToolbarArea')) {
|
|
8909
8944
|
document.getElementById(parent.element.id + '_quickAccessToolbarArea').style.display = 'none';
|
|
8910
8945
|
}
|
|
8911
8946
|
}
|
|
@@ -9043,7 +9078,7 @@ class Selection {
|
|
|
9043
9078
|
!this.dragCanvas || parent.activeObj.activePoint !== undefined) {
|
|
9044
9079
|
if (this.dragElement === '') {
|
|
9045
9080
|
this.setCursor(x, y);
|
|
9046
|
-
if ((
|
|
9081
|
+
if ((parent.activeObj.activePoint &&
|
|
9047
9082
|
(parent.activeObj.activePoint.width === 0 || (!isNullOrUndefined(parent.activeObj.currIndex) &&
|
|
9048
9083
|
this.cursorTargetId !== parent.activeObj.currIndex)))
|
|
9049
9084
|
&& parent.cursor !== 'default' &&
|
|
@@ -9117,15 +9152,14 @@ class Selection {
|
|
|
9117
9152
|
if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
9118
9153
|
isCropSelection = true;
|
|
9119
9154
|
}
|
|
9120
|
-
if (isBlazor() &&
|
|
9155
|
+
if (isBlazor() && this.parent.eventType) {
|
|
9121
9156
|
if (this.parent.eventType === 'pan') {
|
|
9122
|
-
if (
|
|
9123
|
-
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
9157
|
+
if (parent.events && parent.events.onPanEnd.hasDelegate === true) {
|
|
9124
9158
|
parent.dotNetRef.invokeMethodAsync('PanEventAsync', 'OnPanEnd', this.parent.panEventArgs);
|
|
9125
9159
|
}
|
|
9126
9160
|
}
|
|
9127
9161
|
else if (this.parent.eventType === 'resize') {
|
|
9128
|
-
if (!this.isCropSelection &&
|
|
9162
|
+
if (!this.isCropSelection && this.parent.events && this.parent.events.onShapeResizeEnd.hasDelegate === true) {
|
|
9129
9163
|
this.shapeResizingArgs.currentShapeSettings = this.updatePrevShapeSettings();
|
|
9130
9164
|
this.shapeResizingArgs.action = 'resize-end';
|
|
9131
9165
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
@@ -9134,7 +9168,8 @@ class Selection {
|
|
|
9134
9168
|
value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
|
|
9135
9169
|
});
|
|
9136
9170
|
}
|
|
9137
|
-
else if (
|
|
9171
|
+
else if (this.shapeResizingArgs && this.selectionResizingArgs && this.parent.events &&
|
|
9172
|
+
this.parent.events.onSelectionResizeEnd.hasDelegate === true) {
|
|
9138
9173
|
const currentSelectionSettings = { type: this.parent.activeObj.shape,
|
|
9139
9174
|
startX: this.shapeResizingArgs.currentShapeSettings.startX,
|
|
9140
9175
|
startY: this.shapeResizingArgs.currentShapeSettings.startY,
|
|
@@ -9150,7 +9185,7 @@ class Selection {
|
|
|
9150
9185
|
}
|
|
9151
9186
|
}
|
|
9152
9187
|
else {
|
|
9153
|
-
if (
|
|
9188
|
+
if (this.shapeMovingArgs && this.parent.events && this.parent.events.onShapeDragEnd.hasDelegate === true) {
|
|
9154
9189
|
this.shapeMovingArgs.currentShapeSettings = this.updatePrevShapeSettings();
|
|
9155
9190
|
this.shapeMovingArgs.action = 'drag-end';
|
|
9156
9191
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
@@ -9203,7 +9238,7 @@ class Selection {
|
|
|
9203
9238
|
value: { obj: selPointCollObj } });
|
|
9204
9239
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
9205
9240
|
if (!parent.togglePen && !isCropSelection) {
|
|
9206
|
-
if (
|
|
9241
|
+
if (this.tempObjColl && parent.activeObj.activePoint.width !== 0) {
|
|
9207
9242
|
parent.objColl.push(parent.activeObj);
|
|
9208
9243
|
if (JSON.stringify(parent.activeObj.activePoint) !== JSON.stringify(this.tempActiveObj.activePoint)) {
|
|
9209
9244
|
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
@@ -9220,7 +9255,7 @@ class Selection {
|
|
|
9220
9255
|
parent.currObjType.isResize = false;
|
|
9221
9256
|
}
|
|
9222
9257
|
}
|
|
9223
|
-
if (
|
|
9258
|
+
if (parent.activeObj) {
|
|
9224
9259
|
let isCropSelection = false;
|
|
9225
9260
|
let splitWords;
|
|
9226
9261
|
if (parent.activeObj.shape !== undefined) {
|
|
@@ -9269,7 +9304,7 @@ class Selection {
|
|
|
9269
9304
|
if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
9270
9305
|
isCropSelection = true;
|
|
9271
9306
|
}
|
|
9272
|
-
if (
|
|
9307
|
+
if (parent.activeObj.shape && !isCropSelection && e.currentTarget === parent.upperCanvas &&
|
|
9273
9308
|
parent.textArea.style.display === 'none') {
|
|
9274
9309
|
if (parent.activeObj.shape === 'text') {
|
|
9275
9310
|
if (!isBlazor()) {
|
|
@@ -9306,7 +9341,7 @@ class Selection {
|
|
|
9306
9341
|
let isAdjusted = false;
|
|
9307
9342
|
const parent = this.parent;
|
|
9308
9343
|
obj = obj ? obj : parent.activeObj;
|
|
9309
|
-
if (
|
|
9344
|
+
if (obj.shape && (obj.shape === 'line' || parent.activeObj.shape === 'arrow')) {
|
|
9310
9345
|
let temp;
|
|
9311
9346
|
if ((this.dragElement === 'e-resize' && obj.activePoint.endX < obj.activePoint.startX) ||
|
|
9312
9347
|
(this.dragElement === 'w-resize' && obj.activePoint.startX > obj.activePoint.endX)) {
|
|
@@ -9337,7 +9372,7 @@ class Selection {
|
|
|
9337
9372
|
updPtCollForShpRot(obj) {
|
|
9338
9373
|
const parent = this.parent;
|
|
9339
9374
|
obj = obj ? obj : parent.activeObj;
|
|
9340
|
-
if (
|
|
9375
|
+
if (obj.shape && obj.rotatedAngle !== 0) {
|
|
9341
9376
|
parent.notify('shape', { prop: 'setPointCollForShapeRotation', onPropertyChange: false,
|
|
9342
9377
|
value: { obj: obj } });
|
|
9343
9378
|
// Updating ratio for point collection
|
|
@@ -9401,7 +9436,7 @@ class Selection {
|
|
|
9401
9436
|
if (parent.togglePen) {
|
|
9402
9437
|
return isShape;
|
|
9403
9438
|
}
|
|
9404
|
-
if (
|
|
9439
|
+
if (parent.activeObj.shape && parent.activeObj.shape === 'text' && this.isShapeInserted) {
|
|
9405
9440
|
const isTextArea = parent.textArea.style.display === 'block' ? true : false;
|
|
9406
9441
|
const activeObj = extend({}, parent.activeObj, null, true);
|
|
9407
9442
|
parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
|
|
@@ -9425,7 +9460,7 @@ class Selection {
|
|
|
9425
9460
|
parent.objColl.splice(index, 1);
|
|
9426
9461
|
}
|
|
9427
9462
|
}
|
|
9428
|
-
else if (!isShape &&
|
|
9463
|
+
else if (!isShape && activeObj.shape) {
|
|
9429
9464
|
parent.activeObj = activeObj;
|
|
9430
9465
|
const index = this.getCurrentIndex();
|
|
9431
9466
|
if ((!isNullOrUndefined(index) &&
|
|
@@ -9443,7 +9478,7 @@ class Selection {
|
|
|
9443
9478
|
const parent = this.parent;
|
|
9444
9479
|
let isShape = false;
|
|
9445
9480
|
if (e.type === 'touchstart' && !parent.togglePen) {
|
|
9446
|
-
if (
|
|
9481
|
+
if (parent.activeObj && parent.activeObj.shape === 'text') {
|
|
9447
9482
|
this.timer = setTimeout(this.setTimer.bind(this), 1000, e);
|
|
9448
9483
|
}
|
|
9449
9484
|
const isTextArea = parent.textArea.style.display === 'block' ? true : false;
|
|
@@ -9513,7 +9548,7 @@ class Selection {
|
|
|
9513
9548
|
parent.objColl.splice(index, 1);
|
|
9514
9549
|
}
|
|
9515
9550
|
}
|
|
9516
|
-
else if (
|
|
9551
|
+
else if (activeObj.shape) {
|
|
9517
9552
|
parent.activeObj = activeObj;
|
|
9518
9553
|
const index = this.getCurrentIndex();
|
|
9519
9554
|
if (!isCropSelection) {
|
|
@@ -9532,7 +9567,7 @@ class Selection {
|
|
|
9532
9567
|
applyObj(x, y) {
|
|
9533
9568
|
const parent = this.parent;
|
|
9534
9569
|
let isApply = false;
|
|
9535
|
-
if (
|
|
9570
|
+
if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse' ||
|
|
9536
9571
|
parent.activeObj.shape === 'text' || parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' ||
|
|
9537
9572
|
parent.activeObj.shape === 'path')) {
|
|
9538
9573
|
if (x >= (parent.activeObj.activePoint.startX - (parent.activeObj.topLeftCircle.radius * 2)) &&
|
|
@@ -9700,6 +9735,12 @@ class Selection {
|
|
|
9700
9735
|
EventHandler.add(this.parent.upperCanvas, 'touchend', this.mouseUpEventHandler, this);
|
|
9701
9736
|
EventHandler.add(this.parent.upperCanvas, 'touchmove', this.mouseMoveEventHandler, this);
|
|
9702
9737
|
}
|
|
9738
|
+
unwireEvent() {
|
|
9739
|
+
EventHandler.remove(this.parent.lowerCanvas, 'touchend', this.mouseUpEventHandler);
|
|
9740
|
+
EventHandler.remove(this.parent.lowerCanvas, 'touchmove', this.mouseMoveEventHandler);
|
|
9741
|
+
EventHandler.remove(this.parent.upperCanvas, 'touchend', this.mouseUpEventHandler);
|
|
9742
|
+
EventHandler.remove(this.parent.upperCanvas, 'touchmove', this.mouseMoveEventHandler);
|
|
9743
|
+
}
|
|
9703
9744
|
keyDownEventHandler(e) {
|
|
9704
9745
|
const parent = this.parent;
|
|
9705
9746
|
if (e.ctrlKey && (e.key === '+' || e.key === '-')) {
|
|
@@ -9711,7 +9752,7 @@ class Selection {
|
|
|
9711
9752
|
let splitWords;
|
|
9712
9753
|
switch (e.key) {
|
|
9713
9754
|
case (e.ctrlKey && 's'):
|
|
9714
|
-
if (isBlazor() &&
|
|
9755
|
+
if (isBlazor() && parent.events && parent.events.saving.hasDelegate === true) {
|
|
9715
9756
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
9716
9757
|
parent.dotNetRef.invokeMethodAsync('BeforeSaveEventAsync', 'BeforeSave', beforeSave).then((args) => {
|
|
9717
9758
|
this.beforeSaveEvent(args, e);
|
|
@@ -9809,7 +9850,7 @@ class Selection {
|
|
|
9809
9850
|
e.stopPropagation();
|
|
9810
9851
|
if (e.ctrlKey === true && isInsideCanvas) {
|
|
9811
9852
|
e.preventDefault();
|
|
9812
|
-
if (!parent.isCropTab && (
|
|
9853
|
+
if (!parent.isCropTab && (parent.activeObj.shape && parent.activeObj.shape.split('-')[0] !== 'crop')) {
|
|
9813
9854
|
parent.okBtn();
|
|
9814
9855
|
if (!isBlazor()) {
|
|
9815
9856
|
parent.notify('toolbar', { prop: 'close-contextual-toolbar', onPropertyChange: false });
|
|
@@ -9832,265 +9873,85 @@ class Selection {
|
|
|
9832
9873
|
}
|
|
9833
9874
|
}
|
|
9834
9875
|
}
|
|
9835
|
-
|
|
9876
|
+
textKeyDown(e) {
|
|
9836
9877
|
const parent = this.parent;
|
|
9837
|
-
if (
|
|
9838
|
-
|
|
9878
|
+
if (String.fromCharCode(e.which) === '\r') {
|
|
9879
|
+
this.textRow += 1;
|
|
9839
9880
|
}
|
|
9840
|
-
|
|
9841
|
-
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
parent.
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9881
|
+
parent.textArea.setAttribute('rows', this.textRow.toString());
|
|
9882
|
+
parent.textArea.style.height = 'auto';
|
|
9883
|
+
parent.textArea.style.height = parent.textArea.scrollHeight + 'px';
|
|
9884
|
+
parent.notify('shape', { prop: 'setTextBoxWidth', onPropertyChange: false, value: { e: e } });
|
|
9885
|
+
if (Browser.isDevice) {
|
|
9886
|
+
parent.textArea.style.width = parseFloat(parent.textArea.style.width) + parent.textArea.style.fontSize + 'px';
|
|
9887
|
+
}
|
|
9888
|
+
const rows = parent.textArea.value.split('\n');
|
|
9889
|
+
this.textRow = rows.length;
|
|
9890
|
+
parent.textArea.setAttribute('rows', this.textRow.toString());
|
|
9891
|
+
this.isInitialTextEdited = false;
|
|
9892
|
+
}
|
|
9893
|
+
clearSelection() {
|
|
9894
|
+
const parent = this.parent;
|
|
9895
|
+
if (!parent.disabled && parent.isImageLoaded) {
|
|
9896
|
+
parent.togglePen = false;
|
|
9897
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
9898
|
+
this.dragElement = '';
|
|
9899
|
+
this.dragPoint.startX = this.dragPoint.startY = this.dragPoint.endX = this.dragPoint.endY = 0;
|
|
9900
|
+
parent.currObjType.shape = '';
|
|
9901
|
+
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
9902
|
+
parent.currObjType.isActiveObj = true;
|
|
9903
|
+
parent.currObjType.isCustomCrop = false;
|
|
9904
|
+
parent.upperCanvas.style.cursor = parent.cursor = 'default';
|
|
9905
|
+
}
|
|
9906
|
+
}
|
|
9907
|
+
setDragDirection(width, height) {
|
|
9908
|
+
const arcRadius = (7.5);
|
|
9909
|
+
const parent = this.parent;
|
|
9910
|
+
if (parent.img.destWidth > parent.img.destHeight) {
|
|
9911
|
+
parent.activeObj.activePoint.startX = this.dragPoint.startX = ((width / 2) - (height / 2))
|
|
9912
|
+
+ arcRadius;
|
|
9913
|
+
parent.activeObj.activePoint.startY = this.dragPoint.startY = ((height / 2) - (height / 2))
|
|
9914
|
+
+ arcRadius;
|
|
9915
|
+
parent.activeObj.activePoint.endX = ((width / 2) + (height / 2)) - arcRadius;
|
|
9916
|
+
parent.activeObj.activePoint.endY = ((height / 2) + (height / 2)) - arcRadius;
|
|
9917
|
+
}
|
|
9918
|
+
else {
|
|
9919
|
+
parent.activeObj.activePoint.startY = this.dragPoint.startX = ((height / 2) - (width) / 2)
|
|
9920
|
+
+ arcRadius;
|
|
9921
|
+
parent.activeObj.activePoint.endY = ((height / 2) + (width) / 2) - arcRadius;
|
|
9922
|
+
parent.activeObj.activePoint.startX = this.dragPoint.startX = arcRadius;
|
|
9923
|
+
parent.activeObj.activePoint.endX = width - arcRadius;
|
|
9924
|
+
}
|
|
9925
|
+
}
|
|
9926
|
+
calcShapeRatio(x, y, imgWidth, imgHeight) {
|
|
9927
|
+
const parent = this.parent;
|
|
9928
|
+
const arcRadius = (7.5);
|
|
9929
|
+
const originalWidth = imgWidth;
|
|
9930
|
+
const originalHeight = imgHeight;
|
|
9931
|
+
const presetRatio = x / y;
|
|
9932
|
+
const standardSize = originalWidth >= originalHeight ? originalWidth : originalHeight;
|
|
9933
|
+
let width = standardSize * presetRatio;
|
|
9934
|
+
let height = standardSize;
|
|
9935
|
+
const scaleWidth = this.getScale(width, originalWidth);
|
|
9936
|
+
const snippetArray = [];
|
|
9937
|
+
for (let i = 0; i < 2; i++) {
|
|
9938
|
+
if (i === 0) {
|
|
9939
|
+
snippetArray.push(width * scaleWidth);
|
|
9849
9940
|
}
|
|
9850
9941
|
else {
|
|
9851
|
-
|
|
9942
|
+
snippetArray.push(height * scaleWidth);
|
|
9852
9943
|
}
|
|
9853
9944
|
}
|
|
9854
|
-
|
|
9855
|
-
|
|
9856
|
-
|
|
9945
|
+
width = snippetArray[0];
|
|
9946
|
+
height = snippetArray[1];
|
|
9947
|
+
const scaleHeight = this.getScale(height, originalHeight);
|
|
9948
|
+
const snippetArray1 = [];
|
|
9949
|
+
for (let i = 0; i < 2; i++) {
|
|
9950
|
+
if (i === 0) {
|
|
9951
|
+
snippetArray1.push(width * scaleHeight);
|
|
9857
9952
|
}
|
|
9858
9953
|
else {
|
|
9859
|
-
|
|
9860
|
-
}
|
|
9861
|
-
}
|
|
9862
|
-
let isActiveObj = false;
|
|
9863
|
-
if (parent.activeObj.shape !== undefined) {
|
|
9864
|
-
isActiveObj = true;
|
|
9865
|
-
if (parent.textArea.style.display === 'block') {
|
|
9866
|
-
parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
|
|
9867
|
-
value: { x: null, y: null, isMouseDown: null } });
|
|
9868
|
-
if (!isBlazor()) {
|
|
9869
|
-
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
9870
|
-
}
|
|
9871
|
-
else {
|
|
9872
|
-
parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
|
|
9873
|
-
}
|
|
9874
|
-
}
|
|
9875
|
-
else {
|
|
9876
|
-
parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
|
|
9877
|
-
parent.objColl.push(parent.activeObj);
|
|
9878
|
-
}
|
|
9879
|
-
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
9880
|
-
}
|
|
9881
|
-
const tempFilter = this.lowerContext.filter;
|
|
9882
|
-
parent.update();
|
|
9883
|
-
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: null } });
|
|
9884
|
-
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
9885
|
-
this.lowerContext.filter = tempFilter;
|
|
9886
|
-
parent.initialAdjustmentValue = tempFilter;
|
|
9887
|
-
if (parent.isImageLoaded) {
|
|
9888
|
-
showSpinner(parent.element);
|
|
9889
|
-
parent.element.style.opacity = '0.5';
|
|
9890
|
-
}
|
|
9891
|
-
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
9892
|
-
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
9893
|
-
const canvasWrapper = document.querySelector('#' + parent.element.id + '_canvasWrapper');
|
|
9894
|
-
if (!isNullOrUndefined(canvasWrapper)) {
|
|
9895
|
-
canvasWrapper.style.width = parent.element.offsetWidth - 2 + 'px';
|
|
9896
|
-
canvasWrapper.style.height = parent.element.offsetHeight + 'px';
|
|
9897
|
-
const obj = { toolbarHeight: !isBlazor() ? 0 : parent.toolbarHeight };
|
|
9898
|
-
if (!isBlazor()) {
|
|
9899
|
-
parent.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: obj } });
|
|
9900
|
-
}
|
|
9901
|
-
if (Browser.isDevice) {
|
|
9902
|
-
canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - (2 * obj['toolbarHeight'])) - 3 + 'px';
|
|
9903
|
-
}
|
|
9904
|
-
else {
|
|
9905
|
-
canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - obj['toolbarHeight']) - 3 + 'px';
|
|
9906
|
-
}
|
|
9907
|
-
}
|
|
9908
|
-
const obj = { width: 0, height: 0 };
|
|
9909
|
-
parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
|
|
9910
|
-
value: { width: parent.img.srcWidth, height: parent.img.srcHeight, obj: obj } });
|
|
9911
|
-
const maxDimension = obj;
|
|
9912
|
-
if (parent.transform.defaultZoomFactor > 0) {
|
|
9913
|
-
maxDimension.width += (maxDimension.width * parent.transform.defaultZoomFactor);
|
|
9914
|
-
maxDimension.height += (maxDimension.height * parent.transform.defaultZoomFactor);
|
|
9915
|
-
}
|
|
9916
|
-
parent.img.destLeft = (parent.lowerCanvas.clientWidth - maxDimension.width) / 2;
|
|
9917
|
-
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height) / 2;
|
|
9918
|
-
if (parent.transform.degree === 0 && parent.transform.currFlipState === '') {
|
|
9919
|
-
if (parent.transform.defaultZoomFactor > 0) {
|
|
9920
|
-
parent.img.destLeft += parent.panPoint.totalPannedPoint.x;
|
|
9921
|
-
parent.img.destTop += parent.panPoint.totalPannedPoint.y;
|
|
9922
|
-
}
|
|
9923
|
-
parent.notify('draw', { prop: 'draw-image-to-canvas', value: { dimension: maxDimension } });
|
|
9924
|
-
}
|
|
9925
|
-
else {
|
|
9926
|
-
parent.notify('draw', { prop: 'draw-image-to-canvas', value: { dimension: maxDimension } });
|
|
9927
|
-
parent.notify('draw', { prop: 'updateCurrTransState', onPropertyChange: false,
|
|
9928
|
-
value: { type: 'initial', isPreventDestination: null, isRotatePan: null } });
|
|
9929
|
-
const temp = this.lowerContext.filter;
|
|
9930
|
-
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
9931
|
-
this.lowerContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, parent.img.destLeft, parent.img.destTop, parent.img.destWidth, parent.img.destHeight);
|
|
9932
|
-
this.lowerContext.filter = temp;
|
|
9933
|
-
parent.notify('draw', { prop: 'updateCurrTransState', onPropertyChange: false,
|
|
9934
|
-
value: { type: 'reverse', isPreventDestination: null, isRotatePan: null } });
|
|
9935
|
-
}
|
|
9936
|
-
parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
9937
|
-
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
9938
|
-
if (parent.isCircleCrop) {
|
|
9939
|
-
parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
|
|
9940
|
-
value: { context: this.lowerContext, isSave: null, isFlip: null } });
|
|
9941
|
-
}
|
|
9942
|
-
hideSpinner(parent.element);
|
|
9943
|
-
parent.element.style.opacity = '1';
|
|
9944
|
-
const obj1 = { defToolbarItems: null };
|
|
9945
|
-
if (!isBlazor()) {
|
|
9946
|
-
parent.notify('toolbar', { prop: 'getDefToolbarItems', value: { obj: obj1 } });
|
|
9947
|
-
if (obj1['defToolbarItems'] && obj1['defToolbarItems'].length > 0 && (!isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar')))) {
|
|
9948
|
-
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
9949
|
-
const toolbar = getComponent(parent.element.id + '_toolbar', 'toolbar');
|
|
9950
|
-
toolbar.refreshOverflow();
|
|
9951
|
-
if (!isNullOrUndefined(parent.element.querySelector('.e-contextual-toolbar-wrapper'))) {
|
|
9952
|
-
parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
9953
|
-
}
|
|
9954
|
-
}
|
|
9955
|
-
}
|
|
9956
|
-
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
9957
|
-
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
9958
|
-
if (isActiveObj) {
|
|
9959
|
-
parent.activeObj = extend({}, parent.objColl[parent.objColl.length - 1], null, true);
|
|
9960
|
-
parent.objColl.pop();
|
|
9961
|
-
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj } });
|
|
9962
|
-
if (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse' || parent.activeObj.shape === 'text' ||
|
|
9963
|
-
parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path') {
|
|
9964
|
-
if (!isBlazor()) {
|
|
9965
|
-
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
9966
|
-
}
|
|
9967
|
-
else {
|
|
9968
|
-
parent.updateToolbar(parent.element, 'quickAccessToolbar', parent.activeObj.shape);
|
|
9969
|
-
}
|
|
9970
|
-
}
|
|
9971
|
-
}
|
|
9972
|
-
if (this.isFhdEditing) {
|
|
9973
|
-
if (!isBlazor()) {
|
|
9974
|
-
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
|
|
9975
|
-
}
|
|
9976
|
-
else {
|
|
9977
|
-
parent.updateToolbar(parent.element, 'quickAccessToolbar', 'pen');
|
|
9978
|
-
}
|
|
9979
|
-
}
|
|
9980
|
-
if ((parent.transform.degree !== 0 || parent.transform.currFlipState !== '') && parent.transform.defaultZoomFactor > 0) {
|
|
9981
|
-
const totalPannedPoint = extend({}, parent.panPoint.totalPannedPoint, null, true);
|
|
9982
|
-
const totalPannedInternalPoint = extend({}, parent.panPoint.totalPannedInternalPoint, null, true);
|
|
9983
|
-
const totalPannedClientPoint = extend({}, parent.panPoint.totalPannedClientPoint, null, true);
|
|
9984
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
9985
|
-
value: { zoomFactor: .1, zoomPoint: null } });
|
|
9986
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
9987
|
-
value: { zoomFactor: -.1, zoomPoint: null } });
|
|
9988
|
-
if (parent.transform.degree === 0) {
|
|
9989
|
-
parent.img.destLeft += totalPannedPoint.x;
|
|
9990
|
-
parent.img.destTop += totalPannedPoint.y;
|
|
9991
|
-
parent.panPoint.totalPannedPoint = totalPannedPoint;
|
|
9992
|
-
parent.notify('draw', { prop: 'updateFlipPan', value: { tempSelectionObj: null } });
|
|
9993
|
-
}
|
|
9994
|
-
else {
|
|
9995
|
-
parent.panPoint.totalPannedInternalPoint = totalPannedInternalPoint;
|
|
9996
|
-
parent.panPoint.totalPannedClientPoint = totalPannedClientPoint;
|
|
9997
|
-
parent.panPoint.currentPannedPoint = { x: 0, y: 0 };
|
|
9998
|
-
parent.isCropTab = true;
|
|
9999
|
-
parent.notify('transform', { prop: 'rotatePan', onPropertyChange: false,
|
|
10000
|
-
value: { isCropSelection: null, isDefaultZoom: null } });
|
|
10001
|
-
parent.isCropTab = false;
|
|
10002
|
-
}
|
|
10003
|
-
}
|
|
10004
|
-
else if (parent.transform.degree !== 0 && parent.transform.cropZoomFactor > 0) {
|
|
10005
|
-
parent.transform.zoomFactor = 0;
|
|
10006
|
-
parent.transform.cropZoomFactor = null;
|
|
10007
|
-
if (!isBlazor()) {
|
|
10008
|
-
parent.notify('toolbar', { prop: 'enable-disable-btns', onPropertyChange: false });
|
|
10009
|
-
}
|
|
10010
|
-
else {
|
|
10011
|
-
parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
|
|
10012
|
-
}
|
|
10013
|
-
}
|
|
10014
|
-
}
|
|
10015
|
-
textKeyDown(e) {
|
|
10016
|
-
const parent = this.parent;
|
|
10017
|
-
if (String.fromCharCode(e.which) === '\r') {
|
|
10018
|
-
this.textRow += 1;
|
|
10019
|
-
}
|
|
10020
|
-
parent.textArea.setAttribute('rows', this.textRow.toString());
|
|
10021
|
-
parent.textArea.style.height = 'auto';
|
|
10022
|
-
parent.textArea.style.height = parent.textArea.scrollHeight + 'px';
|
|
10023
|
-
parent.notify('shape', { prop: 'setTextBoxWidth', onPropertyChange: false, value: { e: e } });
|
|
10024
|
-
if (Browser.isDevice) {
|
|
10025
|
-
parent.textArea.style.width = parseFloat(parent.textArea.style.width) + parent.textArea.style.fontSize + 'px';
|
|
10026
|
-
}
|
|
10027
|
-
const rows = parent.textArea.value.split('\n');
|
|
10028
|
-
this.textRow = rows.length;
|
|
10029
|
-
parent.textArea.setAttribute('rows', this.textRow.toString());
|
|
10030
|
-
this.isInitialTextEdited = false;
|
|
10031
|
-
}
|
|
10032
|
-
clearSelection() {
|
|
10033
|
-
const parent = this.parent;
|
|
10034
|
-
if (!parent.disabled && parent.isImageLoaded) {
|
|
10035
|
-
parent.togglePen = false;
|
|
10036
|
-
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
10037
|
-
this.dragElement = '';
|
|
10038
|
-
this.dragPoint.startX = this.dragPoint.startY = this.dragPoint.endX = this.dragPoint.endY = 0;
|
|
10039
|
-
parent.currObjType.shape = '';
|
|
10040
|
-
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
10041
|
-
parent.currObjType.isActiveObj = true;
|
|
10042
|
-
parent.currObjType.isCustomCrop = false;
|
|
10043
|
-
parent.upperCanvas.style.cursor = parent.cursor = 'default';
|
|
10044
|
-
}
|
|
10045
|
-
}
|
|
10046
|
-
setDragDirection(width, height) {
|
|
10047
|
-
const arcRadius = (7.5);
|
|
10048
|
-
const parent = this.parent;
|
|
10049
|
-
if (parent.img.destWidth > parent.img.destHeight) {
|
|
10050
|
-
parent.activeObj.activePoint.startX = this.dragPoint.startX = ((width / 2) - (height / 2))
|
|
10051
|
-
+ arcRadius;
|
|
10052
|
-
parent.activeObj.activePoint.startY = this.dragPoint.startY = ((height / 2) - (height / 2))
|
|
10053
|
-
+ arcRadius;
|
|
10054
|
-
parent.activeObj.activePoint.endX = ((width / 2) + (height / 2)) - arcRadius;
|
|
10055
|
-
parent.activeObj.activePoint.endY = ((height / 2) + (height / 2)) - arcRadius;
|
|
10056
|
-
}
|
|
10057
|
-
else {
|
|
10058
|
-
parent.activeObj.activePoint.startY = this.dragPoint.startX = ((height / 2) - (width) / 2)
|
|
10059
|
-
+ arcRadius;
|
|
10060
|
-
parent.activeObj.activePoint.endY = ((height / 2) + (width) / 2) - arcRadius;
|
|
10061
|
-
parent.activeObj.activePoint.startX = this.dragPoint.startX = arcRadius;
|
|
10062
|
-
parent.activeObj.activePoint.endX = width - arcRadius;
|
|
10063
|
-
}
|
|
10064
|
-
}
|
|
10065
|
-
calcShapeRatio(x, y, imgWidth, imgHeight) {
|
|
10066
|
-
const parent = this.parent;
|
|
10067
|
-
const arcRadius = (7.5);
|
|
10068
|
-
const originalWidth = imgWidth;
|
|
10069
|
-
const originalHeight = imgHeight;
|
|
10070
|
-
const presetRatio = x / y;
|
|
10071
|
-
const standardSize = originalWidth >= originalHeight ? originalWidth : originalHeight;
|
|
10072
|
-
let width = standardSize * presetRatio;
|
|
10073
|
-
let height = standardSize;
|
|
10074
|
-
const scaleWidth = this.getScale(width, originalWidth);
|
|
10075
|
-
const snippetArray = [];
|
|
10076
|
-
for (let i = 0; i < 2; i++) {
|
|
10077
|
-
if (i === 0) {
|
|
10078
|
-
snippetArray.push(width * scaleWidth);
|
|
10079
|
-
}
|
|
10080
|
-
else {
|
|
10081
|
-
snippetArray.push(height * scaleWidth);
|
|
10082
|
-
}
|
|
10083
|
-
}
|
|
10084
|
-
width = snippetArray[0];
|
|
10085
|
-
height = snippetArray[1];
|
|
10086
|
-
const scaleHeight = this.getScale(height, originalHeight);
|
|
10087
|
-
const snippetArray1 = [];
|
|
10088
|
-
for (let i = 0; i < 2; i++) {
|
|
10089
|
-
if (i === 0) {
|
|
10090
|
-
snippetArray1.push(width * scaleHeight);
|
|
10091
|
-
}
|
|
10092
|
-
else {
|
|
10093
|
-
snippetArray1.push(height * scaleHeight);
|
|
9954
|
+
snippetArray1.push(height * scaleHeight);
|
|
10094
9955
|
}
|
|
10095
9956
|
}
|
|
10096
9957
|
width = snippetArray1[0];
|
|
@@ -10240,7 +10101,7 @@ class Selection {
|
|
|
10240
10101
|
x <= (actObj.activePoint.endX + (actObj.topLeftCircle.radius * 2)) &&
|
|
10241
10102
|
y >= (actObj.activePoint.startY - (actObj.topLeftCircle.radius * 2)) &&
|
|
10242
10103
|
y <= (actObj.activePoint.endY + (actObj.topLeftCircle.radius * 2))) ||
|
|
10243
|
-
(
|
|
10104
|
+
(rotationCirclePoint &&
|
|
10244
10105
|
x >= (rotationCirclePoint.x - (actObj.topLeftCircle.radius * 2)) &&
|
|
10245
10106
|
x <= (rotationCirclePoint.x + (actObj.topLeftCircle.radius * 2)) &&
|
|
10246
10107
|
y >= (rotationCirclePoint.y - (actObj.topLeftCircle.radius * 2)) &&
|
|
@@ -10287,7 +10148,7 @@ class Selection {
|
|
|
10287
10148
|
value: { context: this.lowerContext, points: null } });
|
|
10288
10149
|
}
|
|
10289
10150
|
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
10290
|
-
if ((
|
|
10151
|
+
if ((parent.currSelectionPoint && parent.currSelectionPoint.shape === 'crop-circle') || parent.isCircleCrop) {
|
|
10291
10152
|
parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
|
|
10292
10153
|
value: { context: this.lowerContext, isSave: null, isFlip: null } });
|
|
10293
10154
|
}
|
|
@@ -10314,7 +10175,7 @@ class Selection {
|
|
|
10314
10175
|
this.isCropSelection = true;
|
|
10315
10176
|
}
|
|
10316
10177
|
if (!this.isCropSelection && isBlazor() && isNullOrUndefined(this.parent.eventType) &&
|
|
10317
|
-
|
|
10178
|
+
parent.events && parent.events.shapeChanging.hasDelegate === true) {
|
|
10318
10179
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
10319
10180
|
parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs).then((shapeChangingArgs) => {
|
|
10320
10181
|
this.shapeEvent(shapeChangingArgs);
|
|
@@ -10336,7 +10197,7 @@ class Selection {
|
|
|
10336
10197
|
startY: shapeChangingArgs.currentShapeSettings.startY,
|
|
10337
10198
|
width: shapeChangingArgs.currentShapeSettings.width,
|
|
10338
10199
|
height: shapeChangingArgs.currentShapeSettings.height } };
|
|
10339
|
-
if (isBlazor() &&
|
|
10200
|
+
if (isBlazor() && parent.events && parent.events.onSelectionResizeStart.hasDelegate === true) {
|
|
10340
10201
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
10341
10202
|
parent.dotNetRef.invokeMethodAsync('SelectionEventAsync', 'OnSelectionResizeStart', selectionChangingArgs).then((selectionChangingArgs) => {
|
|
10342
10203
|
shapeChangingArgs.currentShapeSettings.startX = selectionChangingArgs.currentSelectionSettings.startX;
|
|
@@ -10405,7 +10266,7 @@ class Selection {
|
|
|
10405
10266
|
getDistance(a, b) {
|
|
10406
10267
|
let x = 0;
|
|
10407
10268
|
let y = 0;
|
|
10408
|
-
if (
|
|
10269
|
+
if (a && b) {
|
|
10409
10270
|
x = a.x - b.x;
|
|
10410
10271
|
y = a.y - b.y;
|
|
10411
10272
|
}
|
|
@@ -10523,7 +10384,7 @@ class Selection {
|
|
|
10523
10384
|
}
|
|
10524
10385
|
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
10525
10386
|
this.lowerContext.filter = tempFilter;
|
|
10526
|
-
if (
|
|
10387
|
+
if (parent.activeObj.shape) {
|
|
10527
10388
|
parent.notify('shape', { prop: 'apply', onPropertyChange: false,
|
|
10528
10389
|
value: { shape: null, obj: null, canvas: null } });
|
|
10529
10390
|
}
|
|
@@ -11018,6 +10879,9 @@ class Shape {
|
|
|
11018
10879
|
case 'updateArrowRatio':
|
|
11019
10880
|
this.updateArrowRatio(args.value['obj']);
|
|
11020
10881
|
break;
|
|
10882
|
+
case 'getSquarePointForRotatedShape':
|
|
10883
|
+
this.getSquarePointForRotatedShape(args.value['obj'], args.value['object']);
|
|
10884
|
+
break;
|
|
11021
10885
|
case 'reset':
|
|
11022
10886
|
this.reset();
|
|
11023
10887
|
break;
|
|
@@ -11041,30 +10905,41 @@ class Shape {
|
|
|
11041
10905
|
}
|
|
11042
10906
|
drawEllipse(x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor) {
|
|
11043
10907
|
this.initializeShape('ellipse');
|
|
11044
|
-
const start = { x: x, y: y };
|
|
10908
|
+
const start = x && y ? { x: x, y: y } : null;
|
|
11045
10909
|
this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY);
|
|
11046
10910
|
}
|
|
11047
10911
|
drawLine(startX, startY, endX, endY, strokeWidth, strokeColor) {
|
|
11048
10912
|
this.initializeShape('line');
|
|
11049
|
-
const start = { x: startX, y: startY };
|
|
10913
|
+
const start = startX && startY ? { x: startX, y: startY } : null;
|
|
11050
10914
|
const width = endX - startX;
|
|
11051
10915
|
const height = endY - startY;
|
|
11052
10916
|
this.drawShape('line', strokeWidth, strokeColor, null, start, width, height);
|
|
11053
10917
|
}
|
|
11054
10918
|
drawPath(pointColl, strokeWidth, strokeColor) {
|
|
11055
10919
|
this.initializeShape('path');
|
|
11056
|
-
|
|
10920
|
+
if (pointColl) {
|
|
10921
|
+
this.drawShape('path', strokeWidth, strokeColor, null, null, null, null, pointColl);
|
|
10922
|
+
}
|
|
10923
|
+
else {
|
|
10924
|
+
this.drawShape('line', strokeWidth, strokeColor, null, null, null, null);
|
|
10925
|
+
const obj = extend({}, this.parent.objColl[this.parent.objColl.length - 1], null, true);
|
|
10926
|
+
obj.shape = 'path';
|
|
10927
|
+
obj.lineDraw = null;
|
|
10928
|
+
obj.pointColl = [{ x: obj.activePoint.startX, y: obj.activePoint.startY },
|
|
10929
|
+
{ x: obj.activePoint.endX, y: obj.activePoint.endY }];
|
|
10930
|
+
this.parent.objColl[this.parent.objColl.length - 1] = obj;
|
|
10931
|
+
}
|
|
11057
10932
|
}
|
|
11058
10933
|
drawArrow(startX, startY, endX, endY, strokeWidth, strokeColor, arrowStart, arrowEnd) {
|
|
11059
10934
|
this.initializeShape('arrow');
|
|
11060
|
-
const start = { x: startX, y: startY };
|
|
10935
|
+
const start = startX && startY ? { x: startX, y: startY } : null;
|
|
11061
10936
|
const width = endX - startX;
|
|
11062
10937
|
const height = endY - startY;
|
|
11063
10938
|
this.drawShape('arrow', strokeWidth, strokeColor, null, start, width, height, null, arrowStart, arrowEnd);
|
|
11064
10939
|
}
|
|
11065
10940
|
drawRectangle(x, y, width, height, strokeWidth, strokeColor, fillColor) {
|
|
11066
10941
|
this.initializeShape('rectangle');
|
|
11067
|
-
const start = { x: x, y: y };
|
|
10942
|
+
const start = x && y ? { x: x, y: y } : null;
|
|
11068
10943
|
this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height);
|
|
11069
10944
|
}
|
|
11070
10945
|
drawText(x, y, text, fontFamily, fontSize, bold, italic, color) {
|
|
@@ -11225,7 +11100,7 @@ class Shape {
|
|
|
11225
11100
|
const parent = this.parent;
|
|
11226
11101
|
if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow') {
|
|
11227
11102
|
parent.activeObj.pointColl = this.getLinePoints(parent.activeObj.activePoint.startX, parent.activeObj.activePoint.startY, parent.activeObj.activePoint.endX, parent.activeObj.activePoint.endY);
|
|
11228
|
-
if (
|
|
11103
|
+
if (parent.activeObj.pointColl) {
|
|
11229
11104
|
for (let i = 0, len = parent.activeObj.pointColl.length; i < len; i++) {
|
|
11230
11105
|
parent.activeObj.pointColl[i].ratioX = (parent.activeObj.pointColl[i].x -
|
|
11231
11106
|
parent.img.destLeft) / parent.img.destWidth;
|
|
@@ -12347,7 +12222,7 @@ class Shape {
|
|
|
12347
12222
|
this.upperContext.clearRect(0, 0, this.parent.upperCanvas.width, this.parent.upperCanvas.height);
|
|
12348
12223
|
this.lowerContext.clearRect(0, 0, this.parent.upperCanvas.width, this.parent.upperCanvas.height);
|
|
12349
12224
|
parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
|
|
12350
|
-
if ((
|
|
12225
|
+
if ((parent.currSelectionPoint && parent.currSelectionPoint.shape === 'crop-circle') || parent.isCircleCrop) {
|
|
12351
12226
|
parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
|
|
12352
12227
|
value: { context: this.lowerContext, isSave: null, isFlip: null } });
|
|
12353
12228
|
}
|
|
@@ -13063,8 +12938,8 @@ class Shape {
|
|
|
13063
12938
|
}
|
|
13064
12939
|
isPointsInRange(x, y, obj) {
|
|
13065
12940
|
let inRange = false;
|
|
13066
|
-
if (!isNullOrUndefined(x) && !isNullOrUndefined(y) && x >=
|
|
13067
|
-
x <= this.parent.
|
|
12941
|
+
if (!isNullOrUndefined(x) && !isNullOrUndefined(y) && x >= this.parent.img.destLeft && y >= this.parent.img.destTop &&
|
|
12942
|
+
x <= this.parent.img.destLeft + this.parent.img.destWidth && y <= this.parent.img.destTop + this.parent.img.destHeight) {
|
|
13068
12943
|
inRange = true;
|
|
13069
12944
|
}
|
|
13070
12945
|
obj['inRange'] = inRange;
|
|
@@ -13221,8 +13096,10 @@ class Shape {
|
|
|
13221
13096
|
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
13222
13097
|
}
|
|
13223
13098
|
parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
|
|
13099
|
+
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
13224
13100
|
}
|
|
13225
13101
|
else {
|
|
13102
|
+
parent.updateToolbar(parent.element, parent.activeObj.shape);
|
|
13226
13103
|
if (parent.activeObj.shape === 'path') {
|
|
13227
13104
|
parent.updateToolbar(this.parent.element, 'path', 'pathQuickAccessToolbar');
|
|
13228
13105
|
}
|
|
@@ -13244,8 +13121,13 @@ class Shape {
|
|
|
13244
13121
|
isSelected = true;
|
|
13245
13122
|
parent.notify('freehand-draw', { prop: 'selectFhd', value: { id: id } });
|
|
13246
13123
|
if (!isBlazor()) {
|
|
13124
|
+
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
|
|
13247
13125
|
parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
|
|
13248
13126
|
}
|
|
13127
|
+
else {
|
|
13128
|
+
parent.updateToolbar(parent.element, 'pen');
|
|
13129
|
+
parent.updateToolbar(parent.element, 'quickAccessToolbar', 'pen');
|
|
13130
|
+
}
|
|
13249
13131
|
}
|
|
13250
13132
|
else {
|
|
13251
13133
|
isSelected = false;
|
|
@@ -13461,6 +13343,73 @@ class Shape {
|
|
|
13461
13343
|
}
|
|
13462
13344
|
}
|
|
13463
13345
|
}
|
|
13346
|
+
getSquarePointForRotatedShape(obj, object) {
|
|
13347
|
+
const point = { startX: 0, startY: 0, endX: 0, endY: 0, width: 0, height: 0 };
|
|
13348
|
+
const center = { x: obj.activePoint.startX + (obj.activePoint.width / 2), y: obj.activePoint.startY +
|
|
13349
|
+
(obj.activePoint.height / 2) };
|
|
13350
|
+
const p1 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.startX - center.x) - Math.sin(obj.rotatedAngle)
|
|
13351
|
+
* (obj.activePoint.startY - center.y) + center.x,
|
|
13352
|
+
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.startX - center.x) + Math.cos(obj.rotatedAngle) * (obj.activePoint.startY
|
|
13353
|
+
- center.y) + center.y };
|
|
13354
|
+
const p2 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.endX - center.x) - Math.sin(obj.rotatedAngle) *
|
|
13355
|
+
(obj.activePoint.startY - center.y) + center.x,
|
|
13356
|
+
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.endX - center.x) + Math.cos(obj.rotatedAngle) * (obj.activePoint.startY
|
|
13357
|
+
- center.y) + center.y };
|
|
13358
|
+
const p3 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.startX - center.x) - Math.sin(obj.rotatedAngle) *
|
|
13359
|
+
(obj.activePoint.endY - center.y) + center.x,
|
|
13360
|
+
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.startX - center.x) + Math.cos(obj.rotatedAngle) * (obj.activePoint.endY
|
|
13361
|
+
- center.y) + center.y };
|
|
13362
|
+
const p4 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.endX - center.x) - Math.sin(obj.rotatedAngle) *
|
|
13363
|
+
(obj.activePoint.endY - center.y) + center.x,
|
|
13364
|
+
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.endX - center.x) + Math.cos(obj.rotatedAngle) *
|
|
13365
|
+
(obj.activePoint.endY - center.y) + center.y };
|
|
13366
|
+
point.startX = p1.x;
|
|
13367
|
+
point.startY = p1.y;
|
|
13368
|
+
point.endX = p1.x;
|
|
13369
|
+
point.endY = p1.y;
|
|
13370
|
+
if (point.startX > p2.x) {
|
|
13371
|
+
point.startX = p2.x;
|
|
13372
|
+
}
|
|
13373
|
+
if (point.startX > p3.x) {
|
|
13374
|
+
point.startX = p3.x;
|
|
13375
|
+
}
|
|
13376
|
+
if (point.startX > p4.x) {
|
|
13377
|
+
point.startX = p4.x;
|
|
13378
|
+
}
|
|
13379
|
+
if (point.startY > p2.y) {
|
|
13380
|
+
point.startY = p2.y;
|
|
13381
|
+
}
|
|
13382
|
+
if (point.startY > p3.y) {
|
|
13383
|
+
point.startY = p3.y;
|
|
13384
|
+
}
|
|
13385
|
+
if (point.startY > p4.y) {
|
|
13386
|
+
point.startY = p4.y;
|
|
13387
|
+
}
|
|
13388
|
+
if (point.endX < p2.x) {
|
|
13389
|
+
point.endX = p2.x;
|
|
13390
|
+
}
|
|
13391
|
+
if (point.endX < p3.x) {
|
|
13392
|
+
point.endX = p3.x;
|
|
13393
|
+
}
|
|
13394
|
+
if (point.endX < p4.x) {
|
|
13395
|
+
point.endX = p4.x;
|
|
13396
|
+
}
|
|
13397
|
+
if (point.endY < p2.y) {
|
|
13398
|
+
point.endY = p2.y;
|
|
13399
|
+
}
|
|
13400
|
+
if (point.endY < p3.y) {
|
|
13401
|
+
point.endY = p3.y;
|
|
13402
|
+
}
|
|
13403
|
+
if (point.endY < p4.y) {
|
|
13404
|
+
point.endY = p4.y;
|
|
13405
|
+
}
|
|
13406
|
+
point.width = point.endX - point.startX;
|
|
13407
|
+
point.height = point.endY - point.startY;
|
|
13408
|
+
if (object) {
|
|
13409
|
+
object['activePoint'] = point;
|
|
13410
|
+
}
|
|
13411
|
+
return point;
|
|
13412
|
+
}
|
|
13464
13413
|
}
|
|
13465
13414
|
|
|
13466
13415
|
class Transform {
|
|
@@ -13638,7 +13587,7 @@ class Transform {
|
|
|
13638
13587
|
const parent = this.parent;
|
|
13639
13588
|
const transitionArgs = { cancel: false, previousDegree: parent.transform.degree,
|
|
13640
13589
|
currentDegree: Math.abs(parent.transform.degree + degree) === 360 ? 0 : parent.transform.degree + degree };
|
|
13641
|
-
if (!this.isPreventSelect && isBlazor() &&
|
|
13590
|
+
if (!this.isPreventSelect && isBlazor() && parent.events && parent.events.rotating.hasDelegate === true) {
|
|
13642
13591
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
13643
13592
|
parent.dotNetRef.invokeMethodAsync('RotateEventAsync', 'OnRotate', transitionArgs).then((args) => {
|
|
13644
13593
|
this.rotateEvent(args, degree);
|
|
@@ -13670,7 +13619,7 @@ class Transform {
|
|
|
13670
13619
|
parent.afterCropActions.push(degree === 90 ? 'rotateRight' : 'rotateLeft');
|
|
13671
13620
|
let splitWords = [];
|
|
13672
13621
|
let activeObjShape;
|
|
13673
|
-
if (
|
|
13622
|
+
if (parent.activeObj.activePoint && parent.activeObj.shape) {
|
|
13674
13623
|
if (parent.activeObj.shape !== undefined) {
|
|
13675
13624
|
splitWords = parent.activeObj.shape.split('-');
|
|
13676
13625
|
}
|
|
@@ -13823,7 +13772,7 @@ class Transform {
|
|
|
13823
13772
|
const parent = this.parent;
|
|
13824
13773
|
const transitionArgs = { direction: direction, cancel: false,
|
|
13825
13774
|
previousDirection: parent.toPascalCase(parent.transform.currFlipState) };
|
|
13826
|
-
if (!this.isPreventSelect && isBlazor() &&
|
|
13775
|
+
if (!this.isPreventSelect && isBlazor() && parent.events && parent.events.flipping.hasDelegate === true) {
|
|
13827
13776
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
13828
13777
|
parent.dotNetRef.invokeMethodAsync('FlipEventAsync', 'OnFlip', transitionArgs).then((args) => {
|
|
13829
13778
|
this.flipEvent(args, direction);
|
|
@@ -13961,7 +13910,7 @@ class Transform {
|
|
|
13961
13910
|
parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
|
|
13962
13911
|
value: { context: this.lowerContext, isSave: null, isFlip: null } });
|
|
13963
13912
|
}
|
|
13964
|
-
if (
|
|
13913
|
+
if (activeObjShape) {
|
|
13965
13914
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
13966
13915
|
parent.activeObj = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
|
|
13967
13916
|
parent.objColl.pop();
|
|
@@ -14092,13 +14041,13 @@ class Transform {
|
|
|
14092
14041
|
this.tempActiveObj = extend({}, parent.activeObj, {}, true);
|
|
14093
14042
|
parent.isCropTab = true;
|
|
14094
14043
|
}
|
|
14095
|
-
else if (
|
|
14044
|
+
else if (parent.activeObj.shape && splitWords[0] !== 'crop') {
|
|
14096
14045
|
this.isShape = true;
|
|
14097
14046
|
}
|
|
14098
14047
|
const obj = { zoomType: null };
|
|
14099
14048
|
parent.notify('selection', { prop: 'getZoomType', onPropertyChange: false, value: { obj: obj } });
|
|
14100
14049
|
if (isNullOrUndefined(zoomPoint)) {
|
|
14101
|
-
if (parent.isCropTab &&
|
|
14050
|
+
if (parent.isCropTab && this.tempActiveObj) {
|
|
14102
14051
|
zoomPoint = { x: parent.activeObj.activePoint.startX + (parent.activeObj.activePoint.width / 2),
|
|
14103
14052
|
y: parent.activeObj.activePoint.startY + (parent.activeObj.activePoint.height / 2) };
|
|
14104
14053
|
}
|
|
@@ -14112,7 +14061,7 @@ class Transform {
|
|
|
14112
14061
|
const previousZoomFactor = parent.zoomSettings.zoomFactor - (zoomFactor * 10);
|
|
14113
14062
|
const zoomEventArgs = { zoomPoint: zoomPoint, cancel: false, previousZoomFactor: previousZoomFactor,
|
|
14114
14063
|
currentZoomFactor: parent.zoomSettings.zoomFactor, zoomTrigger: obj['zoomType'] };
|
|
14115
|
-
if (!parent.isCropToolbar && isBlazor() &&
|
|
14064
|
+
if (!parent.isCropToolbar && isBlazor() && parent.events && parent.events.zooming.hasDelegate === true) {
|
|
14116
14065
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
14117
14066
|
parent.dotNetRef.invokeMethodAsync('ZoomEventAsync', 'OnZoom', zoomEventArgs).then((args) => {
|
|
14118
14067
|
this.zoomEvent(args, zoomFactor);
|
|
@@ -14249,7 +14198,7 @@ class Transform {
|
|
|
14249
14198
|
}
|
|
14250
14199
|
}
|
|
14251
14200
|
this.autoEnablePan();
|
|
14252
|
-
if (
|
|
14201
|
+
if (this.tempActiveObj) {
|
|
14253
14202
|
parent.activeObj = extend({}, this.tempActiveObj, {}, true);
|
|
14254
14203
|
}
|
|
14255
14204
|
if (parent.activeObj.shape === 'crop-custom') {
|
|
@@ -14555,7 +14504,7 @@ class Transform {
|
|
|
14555
14504
|
const obj = { panDown: null };
|
|
14556
14505
|
parent.notify('selection', { prop: 'getPanDown', onPropertyChange: false, value: { obj: obj } });
|
|
14557
14506
|
const panEventArgs = { startPoint: obj['panDown'], endPoint: this.panMove, cancel: false };
|
|
14558
|
-
if (isBlazor() && isNullOrUndefined(this.parent.eventType) &&
|
|
14507
|
+
if (isBlazor() && isNullOrUndefined(this.parent.eventType) && parent.events && parent.events.onPanStart.hasDelegate === true) {
|
|
14559
14508
|
this.parent.eventType = 'pan';
|
|
14560
14509
|
this.parent.panEventArgs = panEventArgs;
|
|
14561
14510
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
@@ -14769,7 +14718,7 @@ class Transform {
|
|
|
14769
14718
|
const tempDegree = parent.transform.degree;
|
|
14770
14719
|
let rotatePanActiveObj;
|
|
14771
14720
|
const object = { selPointColl: null };
|
|
14772
|
-
if (
|
|
14721
|
+
if (parent.activeObj.activePoint && parent.activeObj.shape) {
|
|
14773
14722
|
rotatePanActiveObj = extend({}, parent.activeObj, {}, true);
|
|
14774
14723
|
}
|
|
14775
14724
|
const tempObjColl = extend([], parent.objColl, [], true);
|
|
@@ -14840,7 +14789,7 @@ class Transform {
|
|
|
14840
14789
|
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
14841
14790
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
14842
14791
|
parent.activeObj = extend({}, rotatePanActiveObj, {}, true);
|
|
14843
|
-
if (
|
|
14792
|
+
if (parent.activeObj.activePoint) {
|
|
14844
14793
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj, isCropRatio: null,
|
|
14845
14794
|
points: null, isPreventDrag: true, saveContext: null, isPreventSelection: null } });
|
|
14846
14795
|
}
|
|
@@ -15008,38 +14957,218 @@ class Transform {
|
|
|
15008
14957
|
update() {
|
|
15009
14958
|
const parent = this.parent;
|
|
15010
14959
|
let toolbarHeight = 0;
|
|
14960
|
+
let isActiveObj = false;
|
|
14961
|
+
const freehandObj = { bool: false };
|
|
14962
|
+
if (parent.isImageLoaded) {
|
|
14963
|
+
if ((parent.element.querySelector('#' + parent.element.id + '_contextualToolbar') &&
|
|
14964
|
+
!parent.element.querySelector('#' + parent.element.id + '_contextualToolbar').parentElement.classList.contains('e-hide')) ||
|
|
14965
|
+
(parent.element.querySelector('#' + parent.element.id + '_headWrapper')
|
|
14966
|
+
&& !parent.element.querySelector('#' + parent.element.id + '_headWrapper').parentElement.classList.contains('e-hide'))) {
|
|
14967
|
+
parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
14968
|
+
parent.okBtn();
|
|
14969
|
+
if (!isBlazor()) {
|
|
14970
|
+
parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
|
|
14971
|
+
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
14972
|
+
}
|
|
14973
|
+
else {
|
|
14974
|
+
parent.updateToolbar(parent.element, 'imageLoaded');
|
|
14975
|
+
}
|
|
14976
|
+
}
|
|
14977
|
+
parent.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: freehandObj } });
|
|
14978
|
+
if (freehandObj['bool']) {
|
|
14979
|
+
if (!isBlazor()) {
|
|
14980
|
+
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
14981
|
+
}
|
|
14982
|
+
else {
|
|
14983
|
+
parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
|
|
14984
|
+
}
|
|
14985
|
+
}
|
|
14986
|
+
if (parent.activeObj.shape !== undefined) {
|
|
14987
|
+
isActiveObj = true;
|
|
14988
|
+
if (parent.textArea.style.display === 'block') {
|
|
14989
|
+
parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
|
|
14990
|
+
value: { x: null, y: null, isMouseDown: null } });
|
|
14991
|
+
if (!isBlazor()) {
|
|
14992
|
+
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
14993
|
+
}
|
|
14994
|
+
else {
|
|
14995
|
+
parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
|
|
14996
|
+
}
|
|
14997
|
+
}
|
|
14998
|
+
else {
|
|
14999
|
+
parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
|
|
15000
|
+
parent.objColl.push(parent.activeObj);
|
|
15001
|
+
}
|
|
15002
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
15003
|
+
}
|
|
15004
|
+
}
|
|
15005
|
+
const tempFilter = this.lowerContext.filter;
|
|
15011
15006
|
const canvasWrapper = document.querySelector('#' + parent.element.id + '_canvasWrapper');
|
|
15012
|
-
if (
|
|
15007
|
+
if (canvasWrapper) {
|
|
15013
15008
|
canvasWrapper.style.width = parent.element.offsetWidth - 2 + 'px';
|
|
15014
15009
|
}
|
|
15015
15010
|
parent.lowerCanvas.width = parent.upperCanvas.width = parent.element.offsetWidth - 2;
|
|
15016
|
-
if (
|
|
15017
|
-
parent.
|
|
15011
|
+
if (parent.toolbarTemplate) {
|
|
15012
|
+
toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
|
|
15018
15013
|
}
|
|
15019
15014
|
else if (parent.element.querySelector('#' + parent.element.id + '_toolbar')) {
|
|
15020
15015
|
toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbar').clientHeight;
|
|
15021
|
-
parent.notify('toolbar', { prop: 'setToolbarHeight', value: { height: toolbarHeight } });
|
|
15022
15016
|
}
|
|
15017
|
+
parent.notify('toolbar', { prop: 'setToolbarHeight', value: { height: toolbarHeight } });
|
|
15023
15018
|
if (Browser.isDevice) {
|
|
15024
|
-
if (
|
|
15019
|
+
if (canvasWrapper) {
|
|
15025
15020
|
canvasWrapper.style.height = parent.element.offsetHeight - (2 * toolbarHeight) - 5 + 'px';
|
|
15026
15021
|
}
|
|
15027
|
-
parent.lowerCanvas.height = parent.upperCanvas.height = parent.element.offsetHeight - (2 * toolbarHeight) - 5;
|
|
15028
|
-
}
|
|
15029
|
-
else {
|
|
15030
|
-
if (
|
|
15031
|
-
canvasWrapper.style.height = parent.element.offsetHeight - toolbarHeight - 3 + 'px';
|
|
15022
|
+
parent.lowerCanvas.height = parent.upperCanvas.height = parent.element.offsetHeight - (2 * toolbarHeight) - 5;
|
|
15023
|
+
}
|
|
15024
|
+
else {
|
|
15025
|
+
if (canvasWrapper) {
|
|
15026
|
+
canvasWrapper.style.height = parent.element.offsetHeight - toolbarHeight - 3 + 'px';
|
|
15027
|
+
}
|
|
15028
|
+
parent.lowerCanvas.height = parent.upperCanvas.height = parent.element.offsetHeight - toolbarHeight - 3;
|
|
15029
|
+
}
|
|
15030
|
+
this.lowerContext.filter =
|
|
15031
|
+
'brightness(' + 1 + ') ' + 'contrast(' + 100 + '%) ' + 'hue-rotate(' + 0 + 'deg) ' +
|
|
15032
|
+
'saturate(' + 100 + '%) ' + 'opacity(' + 1 + ') ' + 'blur(' + 0 + 'px) ' + 'sepia(0%) ' + 'grayscale(0%) ' + 'invert(0%)';
|
|
15033
|
+
parent.notify('filter', { prop: 'setAdjustmentValue', onPropertyChange: false, value: { adjustmentValue: this.lowerContext.filter } });
|
|
15034
|
+
parent.canvasFilter = this.lowerContext.filter;
|
|
15035
|
+
this.parent.initialAdjustmentValue = this.lowerContext.filter;
|
|
15036
|
+
parent.clearContext(this.lowerContext);
|
|
15037
|
+
this.parent.clearContext(this.upperContext);
|
|
15038
|
+
if (parent.isImageLoaded) {
|
|
15039
|
+
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: null } });
|
|
15040
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
15041
|
+
this.lowerContext.filter = tempFilter;
|
|
15042
|
+
parent.initialAdjustmentValue = tempFilter;
|
|
15043
|
+
if (parent.isImageLoaded) {
|
|
15044
|
+
showSpinner(parent.element);
|
|
15045
|
+
parent.element.style.opacity = '0.5';
|
|
15046
|
+
}
|
|
15047
|
+
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
15048
|
+
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
15049
|
+
if (canvasWrapper) {
|
|
15050
|
+
canvasWrapper.style.width = parent.element.offsetWidth - 2 + 'px';
|
|
15051
|
+
canvasWrapper.style.height = parent.element.offsetHeight + 'px';
|
|
15052
|
+
const obj = { toolbarHeight: !isBlazor() ? 0 : parent.toolbarHeight };
|
|
15053
|
+
if (!isBlazor()) {
|
|
15054
|
+
parent.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: obj } });
|
|
15055
|
+
}
|
|
15056
|
+
if (Browser.isDevice) {
|
|
15057
|
+
canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - (2 * obj['toolbarHeight'])) - 3 + 'px';
|
|
15058
|
+
}
|
|
15059
|
+
else {
|
|
15060
|
+
canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - obj['toolbarHeight']) - 3 + 'px';
|
|
15061
|
+
}
|
|
15062
|
+
}
|
|
15063
|
+
const obj = { width: 0, height: 0 };
|
|
15064
|
+
parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
|
|
15065
|
+
value: { width: parent.img.srcWidth, height: parent.img.srcHeight, obj: obj } });
|
|
15066
|
+
const maxDimension = obj;
|
|
15067
|
+
if (parent.transform.defaultZoomFactor > 0) {
|
|
15068
|
+
maxDimension.width += (maxDimension.width * parent.transform.defaultZoomFactor);
|
|
15069
|
+
maxDimension.height += (maxDimension.height * parent.transform.defaultZoomFactor);
|
|
15070
|
+
}
|
|
15071
|
+
parent.img.destLeft = (parent.lowerCanvas.clientWidth - maxDimension.width) / 2;
|
|
15072
|
+
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height) / 2;
|
|
15073
|
+
if (parent.transform.degree === 0 && parent.transform.currFlipState === '') {
|
|
15074
|
+
if (parent.transform.defaultZoomFactor > 0) {
|
|
15075
|
+
parent.img.destLeft += parent.panPoint.totalPannedPoint.x;
|
|
15076
|
+
parent.img.destTop += parent.panPoint.totalPannedPoint.y;
|
|
15077
|
+
}
|
|
15078
|
+
parent.notify('draw', { prop: 'draw-image-to-canvas', value: { dimension: maxDimension } });
|
|
15079
|
+
}
|
|
15080
|
+
else {
|
|
15081
|
+
parent.notify('draw', { prop: 'draw-image-to-canvas', value: { dimension: maxDimension } });
|
|
15082
|
+
parent.notify('draw', { prop: 'updateCurrTransState', onPropertyChange: false,
|
|
15083
|
+
value: { type: 'initial', isPreventDestination: null, isRotatePan: null } });
|
|
15084
|
+
const temp = this.lowerContext.filter;
|
|
15085
|
+
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
15086
|
+
this.lowerContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, parent.img.destLeft, parent.img.destTop, parent.img.destWidth, parent.img.destHeight);
|
|
15087
|
+
this.lowerContext.filter = temp;
|
|
15088
|
+
parent.notify('draw', { prop: 'updateCurrTransState', onPropertyChange: false,
|
|
15089
|
+
value: { type: 'reverse', isPreventDestination: null, isRotatePan: null } });
|
|
15090
|
+
}
|
|
15091
|
+
parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
15092
|
+
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
15093
|
+
if (parent.isCircleCrop) {
|
|
15094
|
+
parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
|
|
15095
|
+
value: { context: this.lowerContext, isSave: null, isFlip: null } });
|
|
15096
|
+
}
|
|
15097
|
+
hideSpinner(parent.element);
|
|
15098
|
+
parent.element.style.opacity = '1';
|
|
15099
|
+
const obj1 = { defToolbarItems: null };
|
|
15100
|
+
if (!isBlazor()) {
|
|
15101
|
+
parent.notify('toolbar', { prop: 'getDefToolbarItems', value: { obj: obj1 } });
|
|
15102
|
+
if (obj1['defToolbarItems'] && obj1['defToolbarItems'].length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
15103
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
15104
|
+
const toolbar = getComponent(parent.element.id + '_toolbar', 'toolbar');
|
|
15105
|
+
toolbar.refreshOverflow();
|
|
15106
|
+
if (parent.element.querySelector('.e-contextual-toolbar-wrapper')) {
|
|
15107
|
+
parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
15108
|
+
}
|
|
15109
|
+
}
|
|
15110
|
+
}
|
|
15111
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
15112
|
+
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
15113
|
+
if (isActiveObj) {
|
|
15114
|
+
parent.activeObj = extend({}, parent.objColl[parent.objColl.length - 1], null, true);
|
|
15115
|
+
parent.objColl.pop();
|
|
15116
|
+
if (parent.activeObj.activePoint.width !== 0 && parent.activeObj.activePoint.height !== 0) {
|
|
15117
|
+
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj } });
|
|
15118
|
+
if (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse' || parent.activeObj.shape === 'text' ||
|
|
15119
|
+
parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path') {
|
|
15120
|
+
if (!isBlazor()) {
|
|
15121
|
+
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
15122
|
+
}
|
|
15123
|
+
else {
|
|
15124
|
+
parent.updateToolbar(parent.element, 'quickAccessToolbar', parent.activeObj.shape);
|
|
15125
|
+
}
|
|
15126
|
+
}
|
|
15127
|
+
}
|
|
15128
|
+
}
|
|
15129
|
+
if (freehandObj['bool']) {
|
|
15130
|
+
if (!isBlazor()) {
|
|
15131
|
+
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
|
|
15132
|
+
}
|
|
15133
|
+
else {
|
|
15134
|
+
parent.updateToolbar(parent.element, 'quickAccessToolbar', 'pen');
|
|
15135
|
+
}
|
|
15136
|
+
}
|
|
15137
|
+
if ((parent.transform.degree !== 0 || parent.transform.currFlipState !== '') && parent.transform.defaultZoomFactor > 0) {
|
|
15138
|
+
const totalPannedPoint = extend({}, parent.panPoint.totalPannedPoint, null, true);
|
|
15139
|
+
const totalPannedInternalPoint = extend({}, parent.panPoint.totalPannedInternalPoint, null, true);
|
|
15140
|
+
const totalPannedClientPoint = extend({}, parent.panPoint.totalPannedClientPoint, null, true);
|
|
15141
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
15142
|
+
value: { zoomFactor: .1, zoomPoint: null } });
|
|
15143
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
15144
|
+
value: { zoomFactor: -.1, zoomPoint: null } });
|
|
15145
|
+
if (parent.transform.degree === 0) {
|
|
15146
|
+
parent.img.destLeft += totalPannedPoint.x;
|
|
15147
|
+
parent.img.destTop += totalPannedPoint.y;
|
|
15148
|
+
parent.panPoint.totalPannedPoint = totalPannedPoint;
|
|
15149
|
+
parent.notify('draw', { prop: 'updateFlipPan', value: { tempSelectionObj: null } });
|
|
15150
|
+
}
|
|
15151
|
+
else {
|
|
15152
|
+
parent.panPoint.totalPannedInternalPoint = totalPannedInternalPoint;
|
|
15153
|
+
parent.panPoint.totalPannedClientPoint = totalPannedClientPoint;
|
|
15154
|
+
parent.panPoint.currentPannedPoint = { x: 0, y: 0 };
|
|
15155
|
+
parent.isCropTab = true;
|
|
15156
|
+
parent.notify('transform', { prop: 'rotatePan', onPropertyChange: false,
|
|
15157
|
+
value: { isCropSelection: null, isDefaultZoom: null } });
|
|
15158
|
+
parent.isCropTab = false;
|
|
15159
|
+
}
|
|
15160
|
+
}
|
|
15161
|
+
else if (parent.transform.degree !== 0 && parent.transform.cropZoomFactor > 0) {
|
|
15162
|
+
parent.transform.zoomFactor = 0;
|
|
15163
|
+
parent.transform.cropZoomFactor = null;
|
|
15164
|
+
if (!isBlazor()) {
|
|
15165
|
+
parent.notify('toolbar', { prop: 'enable-disable-btns', onPropertyChange: false });
|
|
15166
|
+
}
|
|
15167
|
+
else {
|
|
15168
|
+
parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
|
|
15169
|
+
}
|
|
15032
15170
|
}
|
|
15033
|
-
parent.lowerCanvas.height = parent.upperCanvas.height = parent.element.offsetHeight - toolbarHeight - 3;
|
|
15034
15171
|
}
|
|
15035
|
-
this.lowerContext.filter =
|
|
15036
|
-
'brightness(' + 1 + ') ' + 'contrast(' + 100 + '%) ' + 'hue-rotate(' + 0 + 'deg) ' +
|
|
15037
|
-
'saturate(' + 100 + '%) ' + 'opacity(' + 1 + ') ' + 'blur(' + 0 + 'px) ' + 'sepia(0%) ' + 'grayscale(0%) ' + 'invert(0%)';
|
|
15038
|
-
parent.notify('filter', { prop: 'setAdjustmentValue', onPropertyChange: false, value: { adjustmentValue: this.lowerContext.filter } });
|
|
15039
|
-
this.parent.canvasFilter = this.lowerContext.filter;
|
|
15040
|
-
this.parent.initialAdjustmentValue = this.lowerContext.filter;
|
|
15041
|
-
this.parent.clearContext(this.lowerContext);
|
|
15042
|
-
this.parent.clearContext(this.upperContext);
|
|
15043
15172
|
}
|
|
15044
15173
|
calcMaxDimension(width, height, obj) {
|
|
15045
15174
|
const object = { toolbarHeight: 0 };
|
|
@@ -15070,7 +15199,15 @@ class Transform {
|
|
|
15070
15199
|
cssMaxWidth = width * heightScale;
|
|
15071
15200
|
cssMaxHeight = height * heightScale;
|
|
15072
15201
|
}
|
|
15073
|
-
|
|
15202
|
+
const cropObj = { bool: null };
|
|
15203
|
+
this.parent.notify('crop', { prop: 'getPreventScaling', onPropertyChange: false,
|
|
15204
|
+
value: { obj: cropObj } });
|
|
15205
|
+
if (cropObj['bool'] && this.parent.cropObj.activeObj.activePoint &&
|
|
15206
|
+
this.parent.cropObj.activeObj.activePoint.width !== 0 && this.parent.cropObj.activeObj.activePoint.height !== 0) {
|
|
15207
|
+
cssMaxWidth = this.parent.cropObj.activeObj.activePoint.width;
|
|
15208
|
+
cssMaxHeight = this.parent.cropObj.activeObj.activePoint.height;
|
|
15209
|
+
}
|
|
15210
|
+
if (obj) {
|
|
15074
15211
|
obj['width'] = cssMaxWidth;
|
|
15075
15212
|
obj['height'] = cssMaxHeight;
|
|
15076
15213
|
}
|
|
@@ -15118,7 +15255,7 @@ class Transform {
|
|
|
15118
15255
|
}
|
|
15119
15256
|
this.limitPan();
|
|
15120
15257
|
parent.activeObj = tempActObj;
|
|
15121
|
-
if (
|
|
15258
|
+
if (obj) {
|
|
15122
15259
|
obj['x'] = parent.img.destLeft - tempDestLeft;
|
|
15123
15260
|
obj['y'] = parent.img.destTop - tempDestTop;
|
|
15124
15261
|
}
|
|
@@ -15151,10 +15288,10 @@ class UndoRedo {
|
|
|
15151
15288
|
this.parent.off('destroyed', this.destroy);
|
|
15152
15289
|
}
|
|
15153
15290
|
initializeUrPvtProp() {
|
|
15154
|
-
if (
|
|
15291
|
+
if (this.parent.lowerCanvas) {
|
|
15155
15292
|
this.lowerContext = this.parent.lowerCanvas.getContext('2d');
|
|
15156
15293
|
}
|
|
15157
|
-
if (
|
|
15294
|
+
if (this.parent.upperCanvas) {
|
|
15158
15295
|
this.upperContext = this.parent.upperCanvas.getContext('2d');
|
|
15159
15296
|
}
|
|
15160
15297
|
}
|
|
@@ -15374,14 +15511,16 @@ class UndoRedo {
|
|
|
15374
15511
|
if (!parent.disabled && parent.isImageLoaded) {
|
|
15375
15512
|
if (this.undoRedoStep > 0) {
|
|
15376
15513
|
this.refreshToolbarActions();
|
|
15377
|
-
if (
|
|
15514
|
+
if (parent.activeObj.activePoint && parent.activeObj.activePoint.width !== 0) {
|
|
15378
15515
|
this.tempActObj = parent.activeObj;
|
|
15379
15516
|
}
|
|
15380
15517
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
15381
15518
|
this.undoRedoStep--;
|
|
15382
15519
|
if (!isBlazor()) {
|
|
15383
15520
|
parent.notify('toolbar', { prop: 'enable-disable-btns' });
|
|
15384
|
-
parent.element.querySelector('.e-contextual-toolbar-wrapper')
|
|
15521
|
+
if (parent.element.querySelector('.e-contextual-toolbar-wrapper')) {
|
|
15522
|
+
parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
15523
|
+
}
|
|
15385
15524
|
}
|
|
15386
15525
|
else {
|
|
15387
15526
|
parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
|
|
@@ -15484,7 +15623,7 @@ class UndoRedo {
|
|
|
15484
15623
|
parent.cropObj = extend({}, obj.currentCropObj, {}, true);
|
|
15485
15624
|
parent.afterCropActions = obj.currentObj.afterCropActions;
|
|
15486
15625
|
this.lowerContext.filter = obj.currentObj.filter;
|
|
15487
|
-
if (!isBlazor()) {
|
|
15626
|
+
if (!isBlazor() && parent.element.querySelector('.e-contextual-toolbar-wrapper')) {
|
|
15488
15627
|
parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
15489
15628
|
}
|
|
15490
15629
|
parent.canvasFilter = this.lowerContext.filter;
|
|
@@ -15546,10 +15685,10 @@ class UndoRedo {
|
|
|
15546
15685
|
if (obj.operation === 'crop' && !obj.isCircleCrop) {
|
|
15547
15686
|
parent.isCircleCrop = false;
|
|
15548
15687
|
}
|
|
15549
|
-
if (obj.operation === 'crop' &&
|
|
15688
|
+
if (obj.operation === 'crop' && obj.currentObj.currSelectionPoint) {
|
|
15550
15689
|
parent.currSelectionPoint = extend({}, obj.currentObj.currSelectionPoint, {}, true);
|
|
15551
15690
|
}
|
|
15552
|
-
if (
|
|
15691
|
+
if (parent.currSelectionPoint && isNullOrUndefined(parent.currSelectionPoint.shape)) {
|
|
15553
15692
|
parent.currSelectionPoint = null;
|
|
15554
15693
|
}
|
|
15555
15694
|
this.endUndoRedo(obj.operation, false);
|
|
@@ -15687,7 +15826,7 @@ class UndoRedo {
|
|
|
15687
15826
|
}
|
|
15688
15827
|
undoDefault(obj) {
|
|
15689
15828
|
this.lowerContext.filter = obj.previousObj.filter;
|
|
15690
|
-
|
|
15829
|
+
const parent = this.parent;
|
|
15691
15830
|
parent.objColl = [];
|
|
15692
15831
|
parent.pointColl = [];
|
|
15693
15832
|
parent.freehandCounter = 0;
|
|
@@ -16195,7 +16334,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16195
16334
|
break;
|
|
16196
16335
|
case 'theme':
|
|
16197
16336
|
if (newProperties.theme) {
|
|
16198
|
-
if (
|
|
16337
|
+
if (this.theme && this.theme !== '') {
|
|
16199
16338
|
this.theme = this.toPascalCase(this.theme);
|
|
16200
16339
|
}
|
|
16201
16340
|
else {
|
|
@@ -16257,7 +16396,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16257
16396
|
case 'selectionSettings':
|
|
16258
16397
|
if (newProperties.selectionSettings) {
|
|
16259
16398
|
this.selectionSettings = newProperties.selectionSettings;
|
|
16260
|
-
if (
|
|
16399
|
+
if (this.activeObj.shape) {
|
|
16261
16400
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
16262
16401
|
this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: this.activeObj } });
|
|
16263
16402
|
}
|
|
@@ -16277,9 +16416,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16277
16416
|
this.element.removeAttribute('class');
|
|
16278
16417
|
}
|
|
16279
16418
|
if (!isBlazor()) {
|
|
16280
|
-
this.notify('toolbar', {
|
|
16281
|
-
prop: 'destroySubComponents', onPropertyChange: false
|
|
16282
|
-
});
|
|
16419
|
+
this.notify('toolbar', { prop: 'destroySubComponents', onPropertyChange: false });
|
|
16283
16420
|
this.notify('destroyed', null);
|
|
16284
16421
|
super.destroy();
|
|
16285
16422
|
}
|
|
@@ -16290,7 +16427,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16290
16427
|
this.element.innerHTML = '';
|
|
16291
16428
|
}
|
|
16292
16429
|
initialize() {
|
|
16293
|
-
if (
|
|
16430
|
+
if (this.toolbarTemplate) {
|
|
16294
16431
|
this.element.appendChild(this.createElement('div', {
|
|
16295
16432
|
id: this.element.id + '_toolbarArea', className: 'e-toolbar-area'
|
|
16296
16433
|
}));
|
|
@@ -16309,13 +16446,13 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16309
16446
|
const quickAccessToolbar = document.getElementById(this.element.id + '_quickAccessToolbarArea');
|
|
16310
16447
|
quickAccessToolbar.style.position = 'absolute';
|
|
16311
16448
|
quickAccessToolbar.style.display = 'none';
|
|
16312
|
-
if (
|
|
16449
|
+
if (this.activeObj) {
|
|
16313
16450
|
quickAccessToolbar.style.left = this.activeObj.activePoint.startX + 'px';
|
|
16314
16451
|
quickAccessToolbar.style.top = this.activeObj.activePoint.startY + 'px';
|
|
16315
16452
|
}
|
|
16316
16453
|
quickAccessToolbar.style.width = '100%';
|
|
16317
16454
|
}
|
|
16318
|
-
if (
|
|
16455
|
+
if (this.quickAccessToolbarTemplate) {
|
|
16319
16456
|
this.quickAccessToolbarTemplateFn();
|
|
16320
16457
|
}
|
|
16321
16458
|
else {
|
|
@@ -16392,6 +16529,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16392
16529
|
screen.orientation.removeEventListener('change', this.screenOrientation.bind(this));
|
|
16393
16530
|
}
|
|
16394
16531
|
this.notify('shape', { prop: 'unWireEvent', onPropertyChange: false });
|
|
16532
|
+
this.notify('selection', { prop: 'unWireEvent', onPropertyChange: false });
|
|
16395
16533
|
}
|
|
16396
16534
|
createCanvas() {
|
|
16397
16535
|
this.element.style.boxSizing = 'border-box';
|
|
@@ -16471,7 +16609,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16471
16609
|
this.notify('selection', { prop: 'handleScroll', onPropertyChange: false, value: { e: e } });
|
|
16472
16610
|
}
|
|
16473
16611
|
adjustToScreen() {
|
|
16474
|
-
this.
|
|
16612
|
+
this.update();
|
|
16475
16613
|
}
|
|
16476
16614
|
screenOrientation() {
|
|
16477
16615
|
if (Browser.isDevice) {
|
|
@@ -16628,10 +16766,10 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16628
16766
|
this.currentFilter = '';
|
|
16629
16767
|
const obj = { initialZoomValue: false };
|
|
16630
16768
|
this.notify('draw', { prop: 'getInitialZoomValue', onPropertyChange: false, value: { obj: obj } });
|
|
16631
|
-
if (
|
|
16769
|
+
if (obj['initialZoomValue']) {
|
|
16632
16770
|
this.setProperties({ zoomSettings: { zoomFactor: obj['initialZoomValue'] } }, true);
|
|
16633
16771
|
}
|
|
16634
|
-
if (
|
|
16772
|
+
if (document.getElementById(this.element.id + '_quickAccessToolbarArea')) {
|
|
16635
16773
|
document.getElementById(this.element.id + '_quickAccessToolbarArea').style.display = 'none';
|
|
16636
16774
|
}
|
|
16637
16775
|
this.notifyResetForAllModules();
|
|
@@ -16640,7 +16778,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16640
16778
|
this.notify('draw', { prop: 'update-canvas', onPropertyChange: false });
|
|
16641
16779
|
this.isImageLoaded = true;
|
|
16642
16780
|
if (!isBlazor()) {
|
|
16643
|
-
if (
|
|
16781
|
+
if (this.element.querySelector('.e-contextual-toolbar-wrapper')) {
|
|
16644
16782
|
this.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
16645
16783
|
}
|
|
16646
16784
|
this.notify('toolbar', { prop: 'refresh-dropdown-btn', value: { isDisabled: false } });
|
|
@@ -16776,7 +16914,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16776
16914
|
drawEllipse(x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor) {
|
|
16777
16915
|
let isEllipse = false;
|
|
16778
16916
|
const isPointsInRange = this.allowShape(x, y);
|
|
16779
|
-
if (!this.disabled && this.isImageLoaded && isPointsInRange) {
|
|
16917
|
+
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
16780
16918
|
isEllipse = true;
|
|
16781
16919
|
this.notify('shape', { prop: 'drawEllipse', onPropertyChange: false, value: { x: x, y: y, radiusX: radiusX, radiusY: radiusY,
|
|
16782
16920
|
strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor } });
|
|
@@ -16797,7 +16935,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16797
16935
|
drawLine(startX, startY, endX, endY, strokeWidth, strokeColor) {
|
|
16798
16936
|
let isLine = false;
|
|
16799
16937
|
const isPointsInRange = this.allowShape(startX, startY);
|
|
16800
|
-
if (!this.disabled && this.isImageLoaded && isPointsInRange) {
|
|
16938
|
+
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(startX) && isNullOrUndefined(startY)))) {
|
|
16801
16939
|
isLine = true;
|
|
16802
16940
|
this.notify('shape', { prop: 'drawLine', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
|
|
16803
16941
|
endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor } });
|
|
@@ -16815,14 +16953,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16815
16953
|
* @param {string} strokeColor - Specifies the stroke color of arrow.
|
|
16816
16954
|
* @param {ArrowheadType} arrowStart – Specifies the type of arrowhead for start position. The default value is ‘None’.
|
|
16817
16955
|
* @param {ArrowheadType} arrowEnd – Specifies the type of arrowhead for end position. The default value is ‘SolidArrow’.
|
|
16818
|
-
|
|
16819
16956
|
* @returns {boolean}.
|
|
16820
|
-
* @private
|
|
16821
16957
|
*/
|
|
16822
16958
|
drawArrow(startX, startY, endX, endY, strokeWidth, strokeColor, arrowStart, arrowEnd) {
|
|
16823
16959
|
let isArrow = false;
|
|
16824
16960
|
const isPointsInRange = this.allowShape(startX, startY);
|
|
16825
|
-
if (!this.disabled && this.isImageLoaded && isPointsInRange) {
|
|
16961
|
+
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(startX) && isNullOrUndefined(startY)))) {
|
|
16826
16962
|
isArrow = true;
|
|
16827
16963
|
this.notify('shape', { prop: 'drawArrow', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
|
|
16828
16964
|
endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, arrowStart: arrowStart, arrowEnd: arrowEnd } });
|
|
@@ -16841,7 +16977,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16841
16977
|
this.isPublicMethod = true;
|
|
16842
16978
|
const obj = { inRange: false };
|
|
16843
16979
|
let isPath = false;
|
|
16844
|
-
if (pointColl.length > 0) {
|
|
16980
|
+
if (pointColl && pointColl.length > 0) {
|
|
16845
16981
|
for (let i = 0; i < pointColl.length; i++) {
|
|
16846
16982
|
if (obj['inRange']) {
|
|
16847
16983
|
break;
|
|
@@ -16850,7 +16986,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16850
16986
|
value: { x: pointColl[i].x, y: pointColl[i].y, obj: obj } });
|
|
16851
16987
|
}
|
|
16852
16988
|
}
|
|
16853
|
-
if (!this.disabled && this.isImageLoaded && obj['inRange']) {
|
|
16989
|
+
if (!this.disabled && this.isImageLoaded && (obj['inRange'] || isNullOrUndefined(pointColl))) {
|
|
16854
16990
|
isPath = true;
|
|
16855
16991
|
this.notify('shape', { prop: 'drawPath', onPropertyChange: false, value: { pointColl: pointColl,
|
|
16856
16992
|
strokeWidth: strokeWidth, strokeColor: strokeColor } });
|
|
@@ -16872,7 +17008,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16872
17008
|
drawRectangle(x, y, width, height, strokeWidth, strokeColor, fillColor) {
|
|
16873
17009
|
let isRectangle = false;
|
|
16874
17010
|
const isPointsInRange = this.allowShape(x, y);
|
|
16875
|
-
if (!this.disabled && this.isImageLoaded && isPointsInRange) {
|
|
17011
|
+
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
16876
17012
|
isRectangle = true;
|
|
16877
17013
|
this.notify('shape', { prop: 'drawRectangle', onPropertyChange: false, value: { x: x, y: y, width: width, height: height,
|
|
16878
17014
|
strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor } });
|
|
@@ -16898,7 +17034,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16898
17034
|
drawText(x, y, text, fontFamily, fontSize, bold, italic, color) {
|
|
16899
17035
|
let isText = false;
|
|
16900
17036
|
const isPointsInRange = this.allowShape(x, y);
|
|
16901
|
-
if (!this.disabled && this.isImageLoaded && isPointsInRange) {
|
|
17037
|
+
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
16902
17038
|
isText = true;
|
|
16903
17039
|
this.notify('shape', { prop: 'drawText', onPropertyChange: false, value: { x: x, y: y, text: text, fontFamily: fontFamily,
|
|
16904
17040
|
fontSize: fontSize, bold: bold, italic: italic, color: color } });
|
|
@@ -17050,6 +17186,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17050
17186
|
template = this.toolbarFn({ type: 'toolbar' }, this, 'Template', templateID)[0];
|
|
17051
17187
|
}
|
|
17052
17188
|
toolbarArea.appendChild(template);
|
|
17189
|
+
this.toolbarHeight = toolbarArea.clientHeight;
|
|
17190
|
+
this.notify('toolbar', { prop: 'setToolbarHeight', value: { height: this.toolbarHeight } });
|
|
17053
17191
|
this['renderReactTemplates']();
|
|
17054
17192
|
}
|
|
17055
17193
|
}
|
|
@@ -17117,7 +17255,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17117
17255
|
const isUndoRedo = this.isUndoRedo;
|
|
17118
17256
|
this.isCropTab = false;
|
|
17119
17257
|
this.isUndoRedo = true;
|
|
17120
|
-
if (
|
|
17258
|
+
if (this.transform.cropZoomFactor && this.transform.cropZoomFactor > 0) {
|
|
17121
17259
|
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
17122
17260
|
value: { zoomFactor: -this.transform.cropZoomFactor, zoomPoint: null } });
|
|
17123
17261
|
}
|
|
@@ -17134,120 +17272,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17134
17272
|
this.isCropTab = true;
|
|
17135
17273
|
this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: this.activeObj } });
|
|
17136
17274
|
}
|
|
17137
|
-
moveToSelectionRange(type, activeObj) {
|
|
17138
|
-
if (!isNullOrUndefined(this.activeObj.shape)) {
|
|
17139
|
-
if (type === 'rotateleft' || type === 'rotateright') {
|
|
17140
|
-
let zoomFactor = this.transform.zoomFactor;
|
|
17141
|
-
this.objColl.push(this.activeObj);
|
|
17142
|
-
this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
17143
|
-
if (this.transform.degree % 90 === 0 && this.transform.degree % 180 !== 0) {
|
|
17144
|
-
if (this.objColl[this.objColl.length - 1].activePoint.width < activeObj.activePoint.height) {
|
|
17145
|
-
for (let i = 2; i < this.zoomSettings.maxZoomFactor; i++) {
|
|
17146
|
-
if (this.objColl[this.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
|
|
17147
|
-
this.isSelectionBiggerThanCanvas(this.objColl[this.objColl.length - 1]) ||
|
|
17148
|
-
this.isSelectionOutsideCanvas(this.objColl[this.objColl.length - 1])) {
|
|
17149
|
-
if (!isNullOrUndefined(zoomFactor)) {
|
|
17150
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
17151
|
-
value: { zoomFactor: -0.1, zoomPoint: null } });
|
|
17152
|
-
}
|
|
17153
|
-
break;
|
|
17154
|
-
}
|
|
17155
|
-
zoomFactor += .1;
|
|
17156
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
17157
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
17158
|
-
}
|
|
17159
|
-
}
|
|
17160
|
-
else {
|
|
17161
|
-
for (let i = 2; i < this.zoomSettings.maxZoomFactor; i++) {
|
|
17162
|
-
if (this.objColl[this.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
|
|
17163
|
-
this.isSelectionBiggerThanCanvas(this.objColl[this.objColl.length - 1]) ||
|
|
17164
|
-
this.isSelectionOutsideCanvas(this.objColl[this.objColl.length - 1])) {
|
|
17165
|
-
if (!isNullOrUndefined(zoomFactor)) {
|
|
17166
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
17167
|
-
value: { zoomFactor: 0.1, zoomPoint: null } });
|
|
17168
|
-
}
|
|
17169
|
-
break;
|
|
17170
|
-
}
|
|
17171
|
-
zoomFactor -= .1;
|
|
17172
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
17173
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
17174
|
-
}
|
|
17175
|
-
}
|
|
17176
|
-
}
|
|
17177
|
-
else {
|
|
17178
|
-
if (this.objColl[this.objColl.length - 1].activePoint.height < activeObj.activePoint.width) {
|
|
17179
|
-
for (let i = 2; i < this.zoomSettings.maxZoomFactor; i++) {
|
|
17180
|
-
if (this.objColl[this.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
|
|
17181
|
-
this.isSelectionBiggerThanCanvas(this.objColl[this.objColl.length - 1]) ||
|
|
17182
|
-
this.isSelectionOutsideCanvas(this.objColl[this.objColl.length - 1])) {
|
|
17183
|
-
if (!isNullOrUndefined(zoomFactor)) {
|
|
17184
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
17185
|
-
value: { zoomFactor: -0.1, zoomPoint: null } });
|
|
17186
|
-
}
|
|
17187
|
-
break;
|
|
17188
|
-
}
|
|
17189
|
-
zoomFactor += .1;
|
|
17190
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
17191
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
17192
|
-
}
|
|
17193
|
-
}
|
|
17194
|
-
else {
|
|
17195
|
-
for (let i = 2; i < this.zoomSettings.maxZoomFactor; i++) {
|
|
17196
|
-
if (this.objColl[this.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
|
|
17197
|
-
this.isSelectionBiggerThanCanvas(this.objColl[this.objColl.length - 1]) ||
|
|
17198
|
-
this.isSelectionOutsideCanvas(this.objColl[this.objColl.length - 1])) {
|
|
17199
|
-
if (!isNullOrUndefined(zoomFactor)) {
|
|
17200
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
17201
|
-
value: { zoomFactor: 0.1, zoomPoint: null } });
|
|
17202
|
-
}
|
|
17203
|
-
break;
|
|
17204
|
-
}
|
|
17205
|
-
zoomFactor -= .1;
|
|
17206
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
17207
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
17208
|
-
}
|
|
17209
|
-
}
|
|
17210
|
-
}
|
|
17211
|
-
const panX = (this.lowerCanvas.clientWidth / 2) - (this.objColl[this.objColl.length - 1].activePoint.startX +
|
|
17212
|
-
(this.objColl[this.objColl.length - 1].activePoint.width / 2));
|
|
17213
|
-
const panY = (this.lowerCanvas.clientHeight / 2) - (this.objColl[this.objColl.length - 1].activePoint.startY +
|
|
17214
|
-
(this.objColl[this.objColl.length - 1].activePoint.height / 2));
|
|
17215
|
-
if (this.transform.degree === 0) {
|
|
17216
|
-
this.img.destLeft += panX;
|
|
17217
|
-
this.img.destTop += panY;
|
|
17218
|
-
this.notify('transform', { prop: 'drawPannImage', value: { point: { x: panX, y: panY } } });
|
|
17219
|
-
}
|
|
17220
|
-
else {
|
|
17221
|
-
this.panPoint.currentPannedPoint = { x: panX, y: panY };
|
|
17222
|
-
this.notify('transform', { prop: 'drawPannedImage', value: { xDiff: panX, yDiff: panY } });
|
|
17223
|
-
this.panPoint.currentPannedPoint = { x: 0, y: 0 };
|
|
17224
|
-
}
|
|
17225
|
-
this.notify('transform', { prop: 'setTempPanMove', onPropertyChange: false,
|
|
17226
|
-
value: { point: null } });
|
|
17227
|
-
this.activeObj = extend({}, this.objColl[this.objColl.length - 1]);
|
|
17228
|
-
this.objColl.pop();
|
|
17229
|
-
this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: this.activeObj } });
|
|
17230
|
-
}
|
|
17231
|
-
}
|
|
17232
|
-
}
|
|
17233
|
-
isSelectionBiggerThanCanvas(obj) {
|
|
17234
|
-
let isBigger = false;
|
|
17235
|
-
if (obj.activePoint.startX <= this.img.destLeft ||
|
|
17236
|
-
obj.activePoint.startY <= this.img.destTop ||
|
|
17237
|
-
obj.activePoint.endX >= this.img.destLeft + this.img.destWidth ||
|
|
17238
|
-
obj.activePoint.endY >= this.img.destTop + this.img.destHeight) {
|
|
17239
|
-
isBigger = true;
|
|
17240
|
-
}
|
|
17241
|
-
return isBigger;
|
|
17242
|
-
}
|
|
17243
|
-
isSelectionOutsideCanvas(obj) {
|
|
17244
|
-
let isOutside = false;
|
|
17245
|
-
if ((obj.activePoint.height < this.lowerCanvas.height - this.toolbarHeight) ||
|
|
17246
|
-
(obj.activePoint.width < this.lowerCanvas.width)) {
|
|
17247
|
-
isOutside = true;
|
|
17248
|
-
}
|
|
17249
|
-
return isOutside;
|
|
17250
|
-
}
|
|
17251
17275
|
/**
|
|
17252
17276
|
* Set the old item Transform item state.
|
|
17253
17277
|
*
|
|
@@ -17291,7 +17315,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17291
17315
|
for (let i = 0; i < strArr.length; i++) {
|
|
17292
17316
|
strArr[i] = strArr[i].charAt(0).toUpperCase() + strArr[i].slice(1);
|
|
17293
17317
|
}
|
|
17294
|
-
if (
|
|
17318
|
+
if (obj) {
|
|
17295
17319
|
obj['maxText'] = strArr.join('');
|
|
17296
17320
|
}
|
|
17297
17321
|
return strArr.join('');
|
|
@@ -17358,7 +17382,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17358
17382
|
this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
17359
17383
|
}
|
|
17360
17384
|
}
|
|
17361
|
-
else if ((!isBlazor() &&
|
|
17385
|
+
else if ((!isBlazor() && document.querySelector('#' + this.element.id + '_sliderWrapper')) || (isBlazor() && !this.element.querySelector('.e-ie-contextual-slider').classList.contains('e-hidden')) ||
|
|
17362
17386
|
this.currObjType.isFiltered) {
|
|
17363
17387
|
this.initialAdjustmentValue = this.canvasFilter = this.lowerContext.filter;
|
|
17364
17388
|
this.currObjType.isFiltered = false;
|
|
@@ -17420,7 +17444,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17420
17444
|
* @returns {void}.
|
|
17421
17445
|
*/
|
|
17422
17446
|
cropSelectedState() {
|
|
17423
|
-
if (
|
|
17447
|
+
if (this.activeObj.shape && this.activeObj.shape.split('-')[0] === 'crop') {
|
|
17424
17448
|
this.okBtn();
|
|
17425
17449
|
}
|
|
17426
17450
|
}
|
|
@@ -17435,7 +17459,10 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17435
17459
|
const tempFilter = this.lowerContext.filter;
|
|
17436
17460
|
this.lowerContext.filter = this.canvasFilter = 'none';
|
|
17437
17461
|
const objColl = extend([], this.objColl, null, true);
|
|
17462
|
+
const pointColl = extend([], this.pointColl, null, true);
|
|
17438
17463
|
this.objColl = [];
|
|
17464
|
+
this.pointColl = [];
|
|
17465
|
+
this.freehandCounter = 0;
|
|
17439
17466
|
this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
|
|
17440
17467
|
const data = this.getImageData();
|
|
17441
17468
|
if (!isBlazor()) {
|
|
@@ -17444,6 +17471,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17444
17471
|
this.element.querySelector('#' + this.element.id + '_contextualToolbarArea').classList.remove('e-hide');
|
|
17445
17472
|
}
|
|
17446
17473
|
this.objColl = objColl;
|
|
17474
|
+
this.pointColl = pointColl;
|
|
17475
|
+
this.freehandCounter = pointColl.length;
|
|
17447
17476
|
this.notify('shape', { prop: 'iterateObjColl', onPropertyChange: false });
|
|
17448
17477
|
this.lowerContext.filter = this.canvasFilter = tempFilter;
|
|
17449
17478
|
return data;
|
|
@@ -17459,7 +17488,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17459
17488
|
setCurrAdjustmentValue(type, value) {
|
|
17460
17489
|
const finetuneValueChanging = { finetune: this.getFinetuneOption(type),
|
|
17461
17490
|
value: value, cancel: false };
|
|
17462
|
-
if (isBlazor() &&
|
|
17491
|
+
if (isBlazor() && this.events && this.events.finetuneValueChanging.hasDelegate === true) {
|
|
17463
17492
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
17464
17493
|
this.dotNetRef.invokeMethodAsync('OnFinetuneValueChangeAsync', finetuneValueChanging).then((finetuneValueChanging) => {
|
|
17465
17494
|
if (finetuneValueChanging.cancel) {
|
|
@@ -17476,82 +17505,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17476
17505
|
this.notify('filter', { prop: 'setCurrAdjValue', value: { type: type.toLowerCase(), value: value } });
|
|
17477
17506
|
}
|
|
17478
17507
|
}
|
|
17479
|
-
/**
|
|
17480
|
-
* Get the square point for rotated shape.
|
|
17481
|
-
*
|
|
17482
|
-
* @param { SelectionPoint } obj - Specifies the selection point.
|
|
17483
|
-
* @param { Object } object - Specifies the object.
|
|
17484
|
-
* @hidden
|
|
17485
|
-
* @returns {ActivePoint}.
|
|
17486
|
-
* An ActivePoint object which returns the square point.
|
|
17487
|
-
*/
|
|
17488
|
-
getSquarePointForRotatedShape(obj, object) {
|
|
17489
|
-
const point = { startX: 0, startY: 0, endX: 0, endY: 0, width: 0, height: 0 };
|
|
17490
|
-
const center = { x: obj.activePoint.startX + (obj.activePoint.width / 2), y: obj.activePoint.startY +
|
|
17491
|
-
(obj.activePoint.height / 2) };
|
|
17492
|
-
const p1 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.startX - center.x) - Math.sin(obj.rotatedAngle)
|
|
17493
|
-
* (obj.activePoint.startY - center.y) + center.x,
|
|
17494
|
-
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.startX - center.x) + Math.cos(obj.rotatedAngle) * (obj.activePoint.startY
|
|
17495
|
-
- center.y) + center.y };
|
|
17496
|
-
const p2 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.endX - center.x) - Math.sin(obj.rotatedAngle) *
|
|
17497
|
-
(obj.activePoint.startY - center.y) + center.x,
|
|
17498
|
-
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.endX - center.x) + Math.cos(obj.rotatedAngle) * (obj.activePoint.startY
|
|
17499
|
-
- center.y) + center.y };
|
|
17500
|
-
const p3 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.startX - center.x) - Math.sin(obj.rotatedAngle) *
|
|
17501
|
-
(obj.activePoint.endY - center.y) + center.x,
|
|
17502
|
-
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.startX - center.x) + Math.cos(obj.rotatedAngle) * (obj.activePoint.endY
|
|
17503
|
-
- center.y) + center.y };
|
|
17504
|
-
const p4 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.endX - center.x) - Math.sin(obj.rotatedAngle) *
|
|
17505
|
-
(obj.activePoint.endY - center.y) + center.x,
|
|
17506
|
-
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.endX - center.x) + Math.cos(obj.rotatedAngle) *
|
|
17507
|
-
(obj.activePoint.endY - center.y) + center.y };
|
|
17508
|
-
point.startX = p1.x;
|
|
17509
|
-
point.startY = p1.y;
|
|
17510
|
-
point.endX = p1.x;
|
|
17511
|
-
point.endY = p1.y;
|
|
17512
|
-
if (point.startX > p2.x) {
|
|
17513
|
-
point.startX = p2.x;
|
|
17514
|
-
}
|
|
17515
|
-
if (point.startX > p3.x) {
|
|
17516
|
-
point.startX = p3.x;
|
|
17517
|
-
}
|
|
17518
|
-
if (point.startX > p4.x) {
|
|
17519
|
-
point.startX = p4.x;
|
|
17520
|
-
}
|
|
17521
|
-
if (point.startY > p2.y) {
|
|
17522
|
-
point.startY = p2.y;
|
|
17523
|
-
}
|
|
17524
|
-
if (point.startY > p3.y) {
|
|
17525
|
-
point.startY = p3.y;
|
|
17526
|
-
}
|
|
17527
|
-
if (point.startY > p4.y) {
|
|
17528
|
-
point.startY = p4.y;
|
|
17529
|
-
}
|
|
17530
|
-
if (point.endX < p2.x) {
|
|
17531
|
-
point.endX = p2.x;
|
|
17532
|
-
}
|
|
17533
|
-
if (point.endX < p3.x) {
|
|
17534
|
-
point.endX = p3.x;
|
|
17535
|
-
}
|
|
17536
|
-
if (point.endX < p4.x) {
|
|
17537
|
-
point.endX = p4.x;
|
|
17538
|
-
}
|
|
17539
|
-
if (point.endY < p2.y) {
|
|
17540
|
-
point.endY = p2.y;
|
|
17541
|
-
}
|
|
17542
|
-
if (point.endY < p3.y) {
|
|
17543
|
-
point.endY = p3.y;
|
|
17544
|
-
}
|
|
17545
|
-
if (point.endY < p4.y) {
|
|
17546
|
-
point.endY = p4.y;
|
|
17547
|
-
}
|
|
17548
|
-
point.width = point.endX - point.startX;
|
|
17549
|
-
point.height = point.endY - point.startY;
|
|
17550
|
-
if (!isNullOrUndefined(object)) {
|
|
17551
|
-
object['activePoint'] = point;
|
|
17552
|
-
}
|
|
17553
|
-
return point;
|
|
17554
|
-
}
|
|
17555
17508
|
/**
|
|
17556
17509
|
* Get the square point for path.
|
|
17557
17510
|
*
|
|
@@ -17640,14 +17593,14 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17640
17593
|
this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
|
|
17641
17594
|
if (!isBlazor()) {
|
|
17642
17595
|
if (Browser.isDevice) {
|
|
17643
|
-
if (
|
|
17596
|
+
if (document.getElementById(this.element.id + '_bottomToolbar')) {
|
|
17644
17597
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
17645
17598
|
const toolbar = getComponent(this.element.id + '_bottomToolbar', 'toolbar');
|
|
17646
17599
|
toolbar.refreshOverflow();
|
|
17647
17600
|
}
|
|
17648
17601
|
}
|
|
17649
17602
|
else {
|
|
17650
|
-
if (
|
|
17603
|
+
if (document.getElementById(this.element.id + '_toolbar')) {
|
|
17651
17604
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
17652
17605
|
const toolbar = getComponent(this.element.id + '_toolbar', 'toolbar');
|
|
17653
17606
|
toolbar.refreshOverflow();
|
|
@@ -18067,7 +18020,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
18067
18020
|
return str;
|
|
18068
18021
|
}
|
|
18069
18022
|
else {
|
|
18070
|
-
return splitStr.map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
|
|
18023
|
+
return splitStr.map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
|
|
18071
18024
|
}
|
|
18072
18025
|
}
|
|
18073
18026
|
/**
|
|
@@ -18081,9 +18034,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
18081
18034
|
const obj = { adjustmentLevel: null };
|
|
18082
18035
|
this.notify('filter', { prop: 'getAdjustmentLevel', onPropertyChange: false,
|
|
18083
18036
|
value: { obj: obj } });
|
|
18084
|
-
let value;
|
|
18085
18037
|
const typeToAdjustmentLevel = { 'brightness': obj['adjustmentLevel'].brightness,
|
|
18086
|
-
'contrast':
|
|
18038
|
+
'contrast': obj['adjustmentLevel'].contrast, 'hue': obj['adjustmentLevel'].hue,
|
|
18087
18039
|
'saturation': obj['adjustmentLevel'].saturation, 'opacity': obj['adjustmentLevel'].opacity,
|
|
18088
18040
|
'blur': obj['adjustmentLevel'].blur, 'exposure': obj['adjustmentLevel'].exposure };
|
|
18089
18041
|
return typeToAdjustmentLevel[`${type}`];
|
|
@@ -18102,7 +18054,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
18102
18054
|
this.cropSelectedState();
|
|
18103
18055
|
this.notify('draw', { prop: 'resetCurrentSelectionPoint' });
|
|
18104
18056
|
this.notify('transform', { prop: 'performTransformation', value: { text: type } });
|
|
18105
|
-
this.moveToSelectionRange
|
|
18057
|
+
this.notify('draw', { prop: 'moveToSelectionRange', value: { type: type, activeObj: activeObj } });
|
|
18106
18058
|
this.isCropToolbar = false;
|
|
18107
18059
|
}
|
|
18108
18060
|
/**
|
|
@@ -18129,7 +18081,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
18129
18081
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
18130
18082
|
this.element = element;
|
|
18131
18083
|
const canvasWrapper = this.element.querySelector('.e-canvas-wrapper');
|
|
18132
|
-
if (
|
|
18084
|
+
if (this.element.querySelector('#' + this.element.id + '_toolbar')) {
|
|
18133
18085
|
this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbar').clientHeight;
|
|
18134
18086
|
}
|
|
18135
18087
|
else {
|
|
@@ -18147,9 +18099,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
18147
18099
|
});
|
|
18148
18100
|
this.upperCanvas.width = this.lowerCanvas.width = this.inMemoryCanvas.width = this.element.offsetWidth;
|
|
18149
18101
|
this.upperCanvas.height = this.lowerCanvas.height = this.inMemoryCanvas.height = (this.element.offsetHeight - this.toolbarHeight);
|
|
18150
|
-
this.baseImg = this.createElement('img', {
|
|
18151
|
-
id: this.element.id + '_orgImg', attrs: { name: 'Image', crossorigin: 'anonymous' }
|
|
18152
|
-
});
|
|
18153
18102
|
this.lowerContext = this.lowerCanvas.getContext('2d');
|
|
18154
18103
|
this.baseImg = this.createElement('img', {
|
|
18155
18104
|
id: this.element.id + '_orgImg', attrs: { name: 'Image', crossorigin: 'anonymous' }
|
|
@@ -18647,6 +18596,7 @@ class ToolbarModule {
|
|
|
18647
18596
|
this.l10n = new L10n('image-editor', this.defaultLocale, this.parent.locale);
|
|
18648
18597
|
}
|
|
18649
18598
|
toolbar(args) {
|
|
18599
|
+
const parent = this.parent;
|
|
18650
18600
|
this.updatePrivateVariables();
|
|
18651
18601
|
switch (args.prop) {
|
|
18652
18602
|
case 'create-toolbar':
|
|
@@ -18719,19 +18669,19 @@ class ToolbarModule {
|
|
|
18719
18669
|
this.selFhdColor = args.value['color'];
|
|
18720
18670
|
break;
|
|
18721
18671
|
case 'getCurrentFilter':
|
|
18722
|
-
args.value['obj']['currentFilter'] =
|
|
18672
|
+
args.value['obj']['currentFilter'] = parent.currentFilter;
|
|
18723
18673
|
break;
|
|
18724
18674
|
case 'setCurrentFilter':
|
|
18725
|
-
|
|
18675
|
+
parent.currentFilter = args.value['filter'];
|
|
18726
18676
|
break;
|
|
18727
18677
|
case 'setInitialAdjustmentValue':
|
|
18728
|
-
|
|
18678
|
+
parent.initialAdjustmentValue = args.value['value'];
|
|
18729
18679
|
break;
|
|
18730
18680
|
case 'getCanvasFilter':
|
|
18731
|
-
args.value['obj']['canvasFilter'] =
|
|
18681
|
+
args.value['obj']['canvasFilter'] = parent.canvasFilter;
|
|
18732
18682
|
break;
|
|
18733
18683
|
case 'setCanvasFilter':
|
|
18734
|
-
|
|
18684
|
+
parent.canvasFilter = args.value['filter'];
|
|
18735
18685
|
break;
|
|
18736
18686
|
case 'getDefToolbarItems':
|
|
18737
18687
|
args.value['obj']['defToolbarItems'] = this.defToolbarItems;
|
|
@@ -18743,7 +18693,7 @@ class ToolbarModule {
|
|
|
18743
18693
|
this.performDefTbrClick(args.value['type'], args.value['isContextualToolbar'], args.value['isDisabledAdjustment'], args.value['isDisabledFilter'], args.value['isFilterFinetune']);
|
|
18744
18694
|
break;
|
|
18745
18695
|
case 'setTempFilterProperties':
|
|
18746
|
-
|
|
18696
|
+
parent.setTempFilterProperties();
|
|
18747
18697
|
break;
|
|
18748
18698
|
case 'refreshSlider':
|
|
18749
18699
|
this.refreshSlider();
|
|
@@ -18752,28 +18702,25 @@ class ToolbarModule {
|
|
|
18752
18702
|
this.renderSlider(args.value['type']);
|
|
18753
18703
|
break;
|
|
18754
18704
|
case 'getCurrAdjustmentValue':
|
|
18755
|
-
|
|
18705
|
+
parent.getCurrAdjustmentValue(args.value['type']);
|
|
18756
18706
|
break;
|
|
18757
18707
|
case 'setCurrAdjustmentValue':
|
|
18758
|
-
|
|
18708
|
+
parent.setCurrAdjustmentValue(args.value['type'], args.value['value']);
|
|
18759
18709
|
break;
|
|
18760
18710
|
case 'refreshShapeDrawing':
|
|
18761
18711
|
this.refreshShapeDrawing();
|
|
18762
18712
|
break;
|
|
18763
|
-
case 'getSquarePointForRotatedShape':
|
|
18764
|
-
this.parent.getSquarePointForRotatedShape(args.value['obj'], args.value['object']);
|
|
18765
|
-
break;
|
|
18766
18713
|
case 'getCropToolbar':
|
|
18767
|
-
args.value['obj']['isCropToolbar'] =
|
|
18714
|
+
args.value['obj']['isCropToolbar'] = parent.isCropToolbar;
|
|
18768
18715
|
break;
|
|
18769
18716
|
case 'getPrevCurrSelectionPoint':
|
|
18770
|
-
args.value['obj']['prevCurrSelectionPoint'] =
|
|
18717
|
+
args.value['obj']['prevCurrSelectionPoint'] = parent.prevCurrSelectionPoint;
|
|
18771
18718
|
break;
|
|
18772
18719
|
case 'setPrevCurrSelectionPoint':
|
|
18773
|
-
|
|
18720
|
+
parent.prevCurrSelectionPoint = args.value['point'];
|
|
18774
18721
|
break;
|
|
18775
18722
|
case 'updateCropTransformItems':
|
|
18776
|
-
|
|
18723
|
+
parent.updateCropTransformItems();
|
|
18777
18724
|
break;
|
|
18778
18725
|
case 'setEnableDisableUndoRedo':
|
|
18779
18726
|
this.preventEnableDisableUr = args.value['isPrevent'];
|
|
@@ -18786,51 +18733,53 @@ class ToolbarModule {
|
|
|
18786
18733
|
updatePrivateVariables() {
|
|
18787
18734
|
const parent = this.parent;
|
|
18788
18735
|
this.inMemoryCanvas = parent.inMemoryCanvas;
|
|
18789
|
-
if (
|
|
18736
|
+
if (parent.lowerCanvas) {
|
|
18790
18737
|
this.lowerContext = parent.lowerCanvas.getContext('2d');
|
|
18791
18738
|
}
|
|
18792
|
-
if (
|
|
18739
|
+
if (parent.upperCanvas) {
|
|
18793
18740
|
this.upperContext = parent.upperCanvas.getContext('2d');
|
|
18794
18741
|
}
|
|
18795
|
-
if (
|
|
18742
|
+
if (this.inMemoryCanvas) {
|
|
18796
18743
|
this.inMemoryContext = this.inMemoryCanvas.getContext('2d');
|
|
18797
18744
|
}
|
|
18798
18745
|
}
|
|
18799
18746
|
reset() {
|
|
18747
|
+
const parent = this.parent;
|
|
18800
18748
|
this.defToolbarItems = [];
|
|
18801
18749
|
this.toolbarHeight = 46;
|
|
18802
|
-
|
|
18750
|
+
parent.prevCurrSelectionPoint = null;
|
|
18803
18751
|
this.zoomBtnHold = null;
|
|
18804
18752
|
this.currToolbar = '';
|
|
18805
18753
|
this.currentToolbar = 'main';
|
|
18806
18754
|
this.selFhdColor = '#42a5f5';
|
|
18807
|
-
|
|
18808
|
-
this.preventZoomBtn =
|
|
18809
|
-
|
|
18755
|
+
parent.currentFilter = '';
|
|
18756
|
+
this.preventZoomBtn = parent.isCropToolbar = this.preventEnableDisableUr = false;
|
|
18757
|
+
parent.initialAdjustmentValue = parent.canvasFilter =
|
|
18810
18758
|
'brightness(' + 1 + ') ' + 'contrast(' + 100 + '%) ' + 'hue-rotate(' + 0 + 'deg) ' +
|
|
18811
18759
|
'saturate(' + 100 + '%) ' + 'opacity(' + 1 + ') ' + 'blur(' + 0 + 'px) ' + 'sepia(0%) ' + 'grayscale(0%) ' + 'invert(0%)';
|
|
18812
18760
|
}
|
|
18813
18761
|
destroyTopToolbar() {
|
|
18814
18762
|
const parent = this.parent;
|
|
18815
|
-
|
|
18816
|
-
|
|
18763
|
+
const toolbar = document.getElementById(parent.element.id + '_toolbar');
|
|
18764
|
+
if (this.isToolbar() && toolbar && toolbar.classList.contains('e-control')) {
|
|
18817
18765
|
getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
|
|
18818
18766
|
}
|
|
18819
18767
|
}
|
|
18820
18768
|
destroyBottomToolbar() {
|
|
18821
18769
|
const parent = this.parent;
|
|
18822
|
-
|
|
18823
|
-
|
|
18770
|
+
const toolbar = document.getElementById(parent.element.id + '_bottomToolbar');
|
|
18771
|
+
if (toolbar && toolbar.classList.contains('e-control')) {
|
|
18824
18772
|
getComponent(document.getElementById(parent.element.id + '_bottomToolbar'), 'toolbar').destroy();
|
|
18825
18773
|
}
|
|
18826
18774
|
}
|
|
18827
18775
|
isToolbar() {
|
|
18828
|
-
|
|
18829
|
-
|
|
18776
|
+
const parent = this.parent;
|
|
18777
|
+
return (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)
|
|
18778
|
+
|| !isNullOrUndefined(parent.toolbarTemplate));
|
|
18830
18779
|
}
|
|
18831
18780
|
createToolbar() {
|
|
18832
18781
|
const parent = this.parent;
|
|
18833
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18782
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)) {
|
|
18834
18783
|
parent.element.appendChild(parent.createElement('div', {
|
|
18835
18784
|
id: parent.element.id + '_toolbarArea', className: 'e-toolbar-area'
|
|
18836
18785
|
}));
|
|
@@ -18856,10 +18805,10 @@ class ToolbarModule {
|
|
|
18856
18805
|
if (!parent.disabled) {
|
|
18857
18806
|
if (Browser.isDevice) {
|
|
18858
18807
|
if (this.defToolbarItems.length > 0 &&
|
|
18859
|
-
|
|
18808
|
+
document.getElementById(parent.element.id + '_toolbar')) {
|
|
18860
18809
|
getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
|
|
18861
18810
|
}
|
|
18862
|
-
if (
|
|
18811
|
+
if (document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
18863
18812
|
getComponent(document.getElementById(parent.element.id + '_bottomToolbar'), 'toolbar').destroy();
|
|
18864
18813
|
}
|
|
18865
18814
|
this.initMainToolbar(false, Browser.isDevice, null);
|
|
@@ -18867,7 +18816,7 @@ class ToolbarModule {
|
|
|
18867
18816
|
}
|
|
18868
18817
|
else {
|
|
18869
18818
|
if (this.defToolbarItems.length > 0 &&
|
|
18870
|
-
|
|
18819
|
+
document.getElementById(parent.element.id + '_toolbar')) {
|
|
18871
18820
|
getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
|
|
18872
18821
|
}
|
|
18873
18822
|
this.initMainToolbar(false, false, null);
|
|
@@ -18884,7 +18833,7 @@ class ToolbarModule {
|
|
|
18884
18833
|
clicked: this.defToolbarClicked.bind(this) });
|
|
18885
18834
|
toolbarObj.appendTo('#' + parent.element.id + '_toolbar');
|
|
18886
18835
|
this.createLeftToolbarControls();
|
|
18887
|
-
if (
|
|
18836
|
+
if (document.getElementById(parent.element.id + '_toolbar')) {
|
|
18888
18837
|
this.toolbarHeight = document.getElementById(parent.element.id + '_toolbar').clientHeight;
|
|
18889
18838
|
}
|
|
18890
18839
|
}
|
|
@@ -18894,7 +18843,7 @@ class ToolbarModule {
|
|
|
18894
18843
|
}
|
|
18895
18844
|
createContextualToolbar() {
|
|
18896
18845
|
const parent = this.parent;
|
|
18897
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18846
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)) {
|
|
18898
18847
|
parent.element.appendChild(parent.createElement('div', { id: parent.element.id + '_contextualToolbarArea',
|
|
18899
18848
|
className: 'e-contextual-toolbar-wrapper e-hide', attrs: { style: 'position: absolute;' }
|
|
18900
18849
|
}));
|
|
@@ -18905,7 +18854,7 @@ class ToolbarModule {
|
|
|
18905
18854
|
}
|
|
18906
18855
|
createBottomToolbar() {
|
|
18907
18856
|
const parent = this.parent;
|
|
18908
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18857
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)) {
|
|
18909
18858
|
parent.element.appendChild(parent.createElement('div', {
|
|
18910
18859
|
id: parent.element.id + '_bottomToolbarArea', className: 'e-bottom-toolbar'
|
|
18911
18860
|
}));
|
|
@@ -18968,7 +18917,7 @@ class ToolbarModule {
|
|
|
18968
18917
|
toolbarObj.appendTo('#' + parent.element.id + '_toolbar');
|
|
18969
18918
|
this.createLeftToolbarControls();
|
|
18970
18919
|
this.enableDisableTbrBtn();
|
|
18971
|
-
if (this.isToolbar() &&
|
|
18920
|
+
if (this.isToolbar() && document.getElementById(parent.element.id + '_toolbar')) {
|
|
18972
18921
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
18973
18922
|
const toolbar = getComponent(parent.element.id + '_toolbar', 'toolbar');
|
|
18974
18923
|
toolbar.refreshOverflow();
|
|
@@ -18977,7 +18926,7 @@ class ToolbarModule {
|
|
|
18977
18926
|
}
|
|
18978
18927
|
initBottomToolbar() {
|
|
18979
18928
|
const parent = this.parent;
|
|
18980
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18929
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)) {
|
|
18981
18930
|
const items = this.getMainToolbarItem();
|
|
18982
18931
|
const toolbarObj = new Toolbar({ items: items, width: '100%',
|
|
18983
18932
|
created: () => {
|
|
@@ -18989,7 +18938,7 @@ class ToolbarModule {
|
|
|
18989
18938
|
clicked: this.defToolbarClicked.bind(this)
|
|
18990
18939
|
});
|
|
18991
18940
|
toolbarObj.appendTo('#' + parent.element.id + '_bottomToolbar');
|
|
18992
|
-
if (this.defToolbarItems.length > 0 &&
|
|
18941
|
+
if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
18993
18942
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
18994
18943
|
const toolbar = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
|
|
18995
18944
|
toolbar.refreshOverflow();
|
|
@@ -19004,21 +18953,21 @@ class ToolbarModule {
|
|
|
19004
18953
|
toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
|
|
19005
18954
|
}
|
|
19006
18955
|
if (parent.allowUndoRedo) {
|
|
19007
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18956
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Undo') > -1)) {
|
|
19008
18957
|
toolbarItems.push({ id: parent.element.id + '_undo', prefixIcon: 'e-icons e-undo', cssClass: 'top-icon e-undo',
|
|
19009
18958
|
tooltipText: this.l10n.getConstant('Undo'), align: 'Left' });
|
|
19010
18959
|
}
|
|
19011
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18960
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Redo') > -1)) {
|
|
19012
18961
|
toolbarItems.push({ id: parent.element.id + '_redo', prefixIcon: 'e-icons e-redo', cssClass: 'top-icon e-redo',
|
|
19013
18962
|
tooltipText: this.l10n.getConstant('Redo'), align: 'Left' });
|
|
19014
18963
|
}
|
|
19015
18964
|
}
|
|
19016
18965
|
if (!this.preventZoomBtn && (parent.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
|
|
19017
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18966
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('ZoomOut') > -1)) {
|
|
19018
18967
|
toolbarItems.push({ id: parent.element.id + '_zoomOut', prefixIcon: 'e-icons e-zoom-out', cssClass: 'top-icon e-dec-zoom',
|
|
19019
18968
|
tooltipText: this.l10n.getConstant('ZoomOut'), align: 'Left' });
|
|
19020
18969
|
}
|
|
19021
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18970
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('ZoomIn') > -1)) {
|
|
19022
18971
|
toolbarItems.push({ id: parent.element.id + '_zoomIn', prefixIcon: 'e-icons e-zoom-in', cssClass: 'top-icon e-inc-zoom',
|
|
19023
18972
|
tooltipText: this.l10n.getConstant('ZoomIn'), align: 'Left' });
|
|
19024
18973
|
}
|
|
@@ -19038,12 +18987,12 @@ class ToolbarModule {
|
|
|
19038
18987
|
toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
19039
18988
|
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
19040
18989
|
}
|
|
19041
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18990
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Reset') > -1)) {
|
|
19042
18991
|
toolbarItems.push({ id: parent.element.id + '_reset', prefixIcon: 'e-icons e-btn-reset', cssClass: 'top-icon e-img-reset',
|
|
19043
18992
|
tooltipText: this.l10n.getConstant('Reset'), align: 'Right' });
|
|
19044
18993
|
}
|
|
19045
18994
|
if (!isOkBtn) {
|
|
19046
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18995
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Save') > -1)) {
|
|
19047
18996
|
toolbarItems.push({ id: parent.element.id + '_save', prefixIcon: 'e-icons e-btn-save', cssClass: 'top-icon e-save',
|
|
19048
18997
|
tooltipText: this.l10n.getConstant('Save'), align: 'Right', template: '<button id="' + parent.element.id + '_saveBtn"></button>' });
|
|
19049
18998
|
}
|
|
@@ -19057,19 +19006,19 @@ class ToolbarModule {
|
|
|
19057
19006
|
getMainToolbarItem(isApplyOption) {
|
|
19058
19007
|
const parent = this.parent;
|
|
19059
19008
|
const toolbarItems = [];
|
|
19060
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19009
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Crop') > -1)) {
|
|
19061
19010
|
toolbarItems.push({ id: parent.element.id + '_cropTransform', prefixIcon: 'e-icons e-crop', cssClass: 'top-icon e-crop',
|
|
19062
19011
|
tooltipText: this.l10n.getConstant('CropAndTransform'), align: 'Center' });
|
|
19063
19012
|
}
|
|
19064
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19013
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Annotate') > -1)) {
|
|
19065
19014
|
toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
|
|
19066
|
-
template: '<button id="' +
|
|
19015
|
+
template: '<button id="' + parent.element.id + '_annotationBtn"></button>' });
|
|
19067
19016
|
}
|
|
19068
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19017
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Finetune') > -1)) {
|
|
19069
19018
|
toolbarItems.push({ id: parent.element.id + '_adjustment', prefixIcon: 'e-icons e-adjustment', cssClass: 'top-icon e-adjustment',
|
|
19070
19019
|
tooltipText: this.l10n.getConstant('Finetune'), align: 'Center' });
|
|
19071
19020
|
}
|
|
19072
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19021
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Filter') > -1)) {
|
|
19073
19022
|
toolbarItems.push({ id: parent.element.id + '_filter', prefixIcon: 'e-icons e-filters', cssClass: 'top-icon e-filters',
|
|
19074
19023
|
tooltipText: this.l10n.getConstant('Filter'), align: 'Center' });
|
|
19075
19024
|
}
|
|
@@ -19132,7 +19081,7 @@ class ToolbarModule {
|
|
|
19132
19081
|
if (typeof (parent.toolbar[i]) === 'object') {
|
|
19133
19082
|
if (isNullOrUndefined(parent.toolbar[i].align)) {
|
|
19134
19083
|
if (position === 'left') {
|
|
19135
|
-
toolbarItems.push(
|
|
19084
|
+
toolbarItems.push(parent.toolbar[i]);
|
|
19136
19085
|
}
|
|
19137
19086
|
}
|
|
19138
19087
|
else if (parent.toolbar[i].align.toLowerCase() === position) {
|
|
@@ -19158,13 +19107,13 @@ class ToolbarModule {
|
|
|
19158
19107
|
wireZoomBtnEvents() {
|
|
19159
19108
|
const zoomIn = document.querySelector('#' + this.parent.element.id + '_zoomIn');
|
|
19160
19109
|
const zoomOut = document.querySelector('#' + this.parent.element.id + '_zoomOut');
|
|
19161
|
-
if (
|
|
19110
|
+
if (zoomIn) {
|
|
19162
19111
|
zoomIn.addEventListener('mousedown', this.zoomInBtnMouseDownHandler.bind(this));
|
|
19163
19112
|
zoomIn.addEventListener('mouseup', this.zoomBtnMouseUpHandler.bind(this));
|
|
19164
19113
|
zoomIn.addEventListener('click', this.zoomInBtnClickHandler.bind(this));
|
|
19165
19114
|
zoomIn.addEventListener('touchstart', this.zoomInBtnClickHandler.bind(this));
|
|
19166
19115
|
}
|
|
19167
|
-
if (
|
|
19116
|
+
if (zoomOut) {
|
|
19168
19117
|
zoomOut.addEventListener('mousedown', this.zoomOutBtnMouseDownHandler.bind(this));
|
|
19169
19118
|
zoomOut.addEventListener('mouseup', this.zoomBtnMouseUpHandler.bind(this));
|
|
19170
19119
|
zoomOut.addEventListener('click', this.zoomOutBtnClickHandler.bind(this));
|
|
@@ -19179,58 +19128,58 @@ class ToolbarModule {
|
|
|
19179
19128
|
const undoRedoObj = { undoRedoStep: null };
|
|
19180
19129
|
parent.notify('undo-redo', { prop: 'getUndoRedoStep', value: { obj: undoRedoObj } });
|
|
19181
19130
|
const undo = document.querySelector('#' + parent.element.id + '_undo');
|
|
19182
|
-
if (
|
|
19131
|
+
if (undo && undoRedoObj['undoRedoStep'] === 0) {
|
|
19183
19132
|
undo.classList.add('e-disabled');
|
|
19184
19133
|
undo.parentElement.classList.add('e-overlay');
|
|
19185
19134
|
}
|
|
19186
|
-
else if (
|
|
19135
|
+
else if (undo && undoRedoObj['undoRedoStep'] > 0) {
|
|
19187
19136
|
undo.classList.remove('e-disabled');
|
|
19188
19137
|
undo.parentElement.classList.remove('e-overlay');
|
|
19189
19138
|
}
|
|
19190
19139
|
const redo = document.querySelector('#' + parent.element.id + '_redo');
|
|
19191
|
-
if (
|
|
19140
|
+
if (redo && (undoRedoObj['undoRedoStep'] === object['appliedUndoRedoColl'].length)) {
|
|
19192
19141
|
redo.classList.add('e-disabled');
|
|
19193
19142
|
redo.parentElement.classList.add('e-overlay');
|
|
19194
19143
|
}
|
|
19195
|
-
else if (
|
|
19144
|
+
else if (redo && (undoRedoObj['undoRedoStep'] === 0 && object['appliedUndoRedoColl'].length > 0)) {
|
|
19196
19145
|
redo.classList.remove('e-disabled');
|
|
19197
19146
|
redo.parentElement.classList.remove('e-overlay');
|
|
19198
19147
|
}
|
|
19199
|
-
else if (
|
|
19148
|
+
else if (redo && undoRedoObj['undoRedoStep'] > 0) {
|
|
19200
19149
|
redo.classList.remove('e-disabled');
|
|
19201
19150
|
redo.parentElement.classList.remove('e-overlay');
|
|
19202
19151
|
}
|
|
19203
19152
|
}
|
|
19204
19153
|
const zoomIn = document.querySelector('#' + parent.element.id + '_zoomIn');
|
|
19205
|
-
if (
|
|
19154
|
+
if (zoomIn && parent.zoomSettings.zoomFactor >= parent.zoomSettings.maxZoomFactor) {
|
|
19206
19155
|
zoomIn.classList.add('e-disabled');
|
|
19207
19156
|
zoomIn.parentElement.classList.add('e-overlay');
|
|
19208
19157
|
}
|
|
19209
|
-
else if (
|
|
19158
|
+
else if (zoomIn) {
|
|
19210
19159
|
zoomIn.classList.remove('e-disabled');
|
|
19211
19160
|
zoomIn.parentElement.classList.remove('e-overlay');
|
|
19212
19161
|
}
|
|
19213
19162
|
const zoomOut = document.querySelector('#' + parent.element.id + '_zoomOut');
|
|
19214
|
-
if (
|
|
19163
|
+
if (zoomOut && parent.zoomSettings.zoomFactor <= parent.zoomSettings.minZoomFactor) {
|
|
19215
19164
|
zoomOut.classList.add('e-disabled');
|
|
19216
19165
|
zoomOut.parentElement.classList.add('e-overlay');
|
|
19217
19166
|
}
|
|
19218
|
-
else if (
|
|
19167
|
+
else if (zoomOut) {
|
|
19219
19168
|
zoomOut.classList.remove('e-disabled');
|
|
19220
19169
|
zoomOut.parentElement.classList.remove('e-overlay');
|
|
19221
19170
|
}
|
|
19222
19171
|
const pan = document.querySelector('#' + parent.element.id + '_pan');
|
|
19223
|
-
if (
|
|
19172
|
+
if (pan && parent.zoomSettings.zoomFactor <= parent.zoomSettings.minZoomFactor) {
|
|
19224
19173
|
pan.style.display = 'none';
|
|
19225
19174
|
}
|
|
19226
|
-
else if (
|
|
19175
|
+
else if (pan) {
|
|
19227
19176
|
pan.style.display = 'block';
|
|
19228
19177
|
}
|
|
19229
19178
|
}
|
|
19230
19179
|
createLeftToolbarControls() {
|
|
19231
19180
|
const parent = this.parent;
|
|
19232
19181
|
if (this.defToolbarItems !== undefined && this.defToolbarItems.length > 0 &&
|
|
19233
|
-
(
|
|
19182
|
+
(document.getElementById(parent.element.id + '_toolbar'))) {
|
|
19234
19183
|
const uploadDiv = document.getElementById(parent.element.id + '_toolbar')
|
|
19235
19184
|
.querySelector('.e-image-upload');
|
|
19236
19185
|
if (uploadDiv) {
|
|
@@ -19251,25 +19200,25 @@ class ToolbarModule {
|
|
|
19251
19200
|
renderAnnotationBtn(isContextualToolbar) {
|
|
19252
19201
|
const parent = this.parent;
|
|
19253
19202
|
const items = [];
|
|
19254
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19203
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Pen') > -1)) {
|
|
19255
19204
|
items.push({ text: this.l10n.getConstant('Pen'), id: 'pen', iconCss: 'e-icons e-free-pen' });
|
|
19256
19205
|
}
|
|
19257
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19206
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Line') > -1)) {
|
|
19258
19207
|
items.push({ text: this.l10n.getConstant('Line'), id: 'line', iconCss: 'e-icons e-line' });
|
|
19259
19208
|
}
|
|
19260
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19209
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Rectangle') > -1)) {
|
|
19261
19210
|
items.push({ text: this.l10n.getConstant('Rectangle'), id: 'rectangle', iconCss: 'e-icons e-rectangle' });
|
|
19262
19211
|
}
|
|
19263
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19212
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Ellipse') > -1)) {
|
|
19264
19213
|
items.push({ text: this.l10n.getConstant('Ellipse'), id: 'ellipse', iconCss: 'e-icons e-circle' });
|
|
19265
19214
|
}
|
|
19266
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19215
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Arrow') > -1)) {
|
|
19267
19216
|
items.push({ text: this.l10n.getConstant('Arrow'), id: 'arrow', iconCss: 'e-icons e-arrow-right-up' });
|
|
19268
19217
|
}
|
|
19269
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19218
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Path') > -1)) {
|
|
19270
19219
|
items.push({ text: this.l10n.getConstant('Path'), id: 'path', iconCss: 'e-icons e-critical-path' });
|
|
19271
19220
|
}
|
|
19272
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19221
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Text') > -1)) {
|
|
19273
19222
|
items.push({ text: this.l10n.getConstant('Text'), id: 'text', iconCss: 'e-icons e-add-text' });
|
|
19274
19223
|
}
|
|
19275
19224
|
const obj = { freehandDrawSelectedId: null };
|
|
@@ -19278,7 +19227,7 @@ class ToolbarModule {
|
|
|
19278
19227
|
const removeElement = document.querySelector('#' + parent.element.id + '_remove');
|
|
19279
19228
|
const editTextElement = document.querySelector('#' + parent.element.id + '_editText');
|
|
19280
19229
|
if ((parent.activeObj.activePoint.width === 0 && parent.activeObj.activePoint.height === 0) &&
|
|
19281
|
-
(isNullOrUndefined(parent.activeObj.pointColl) || (
|
|
19230
|
+
(isNullOrUndefined(parent.activeObj.pointColl) || (parent.activeObj.pointColl
|
|
19282
19231
|
&& parent.activeObj.pointColl.length === 0)) &&
|
|
19283
19232
|
isNullOrUndefined(obj['freehandDrawSelectedId'])) {
|
|
19284
19233
|
if (duplicateElement) {
|
|
@@ -19310,10 +19259,10 @@ class ToolbarModule {
|
|
|
19310
19259
|
args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
|
|
19311
19260
|
args.element.parentElement.offsetHeight + 'px';
|
|
19312
19261
|
}
|
|
19313
|
-
if (
|
|
19314
|
-
document.getElementById(
|
|
19262
|
+
if (parent.activeObj.shape) {
|
|
19263
|
+
document.getElementById(parent.activeObj.shape).classList.add('e-selected');
|
|
19315
19264
|
}
|
|
19316
|
-
else if (
|
|
19265
|
+
else if (parent.togglePen) {
|
|
19317
19266
|
document.getElementById('pen').classList.add('e-selected');
|
|
19318
19267
|
}
|
|
19319
19268
|
},
|
|
@@ -19368,21 +19317,21 @@ class ToolbarModule {
|
|
|
19368
19317
|
}
|
|
19369
19318
|
});
|
|
19370
19319
|
// Render initialized DropDownButton.
|
|
19371
|
-
drpDownBtn.appendTo('#' +
|
|
19320
|
+
drpDownBtn.appendTo('#' + parent.element.id + '_annotationBtn');
|
|
19372
19321
|
}
|
|
19373
19322
|
renderCropBtn() {
|
|
19374
19323
|
const parent = this.parent;
|
|
19375
19324
|
const items = [];
|
|
19376
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19325
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('CustomSelection') > -1)) {
|
|
19377
19326
|
items.push({ text: this.l10n.getConstant('Custom'), id: 'custom', iconCss: 'e-icons e-custom' });
|
|
19378
19327
|
}
|
|
19379
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19328
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('CircleSelection') > -1)) {
|
|
19380
19329
|
items.push({ text: this.l10n.getConstant('Circle'), id: 'circle', iconCss: 'e-icons e-circle' });
|
|
19381
19330
|
}
|
|
19382
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19331
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('SquareSelection') > -1)) {
|
|
19383
19332
|
items.push({ text: this.l10n.getConstant('Square'), id: 'square', iconCss: 'e-icons e-square' });
|
|
19384
19333
|
}
|
|
19385
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19334
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('RatioSelection') > -1)) {
|
|
19386
19335
|
items.push({ text: '3:2', id: '3:2', iconCss: 'e-icons e-custom-a' });
|
|
19387
19336
|
items.push({ text: '4:3', id: '4:3', iconCss: 'e-icons e-custom-b' });
|
|
19388
19337
|
items.push({ text: '5:4', id: '5:4', iconCss: 'e-icons e-custom-c' });
|
|
@@ -19391,11 +19340,11 @@ class ToolbarModule {
|
|
|
19391
19340
|
}
|
|
19392
19341
|
let iconCss;
|
|
19393
19342
|
let shape;
|
|
19394
|
-
if (
|
|
19343
|
+
if (parent.activeObj.shape) {
|
|
19395
19344
|
iconCss = this.getCurrentShapeIcon(parent.activeObj.shape);
|
|
19396
19345
|
shape = parent.activeObj.shape;
|
|
19397
19346
|
}
|
|
19398
|
-
else if (
|
|
19347
|
+
else if (parent.currSelectionPoint) {
|
|
19399
19348
|
iconCss = this.getCurrentShapeIcon(parent.currSelectionPoint.shape);
|
|
19400
19349
|
shape = parent.currSelectionPoint.shape;
|
|
19401
19350
|
}
|
|
@@ -19412,8 +19361,8 @@ class ToolbarModule {
|
|
|
19412
19361
|
args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
|
|
19413
19362
|
args.element.parentElement.offsetHeight + 'px';
|
|
19414
19363
|
}
|
|
19415
|
-
if (
|
|
19416
|
-
document.getElementById(
|
|
19364
|
+
if (parent.activeObj.shape && parent.activeObj.shape.split('-').length > 1) {
|
|
19365
|
+
document.getElementById(parent.activeObj.shape.split('-')[1]).classList.add('e-selected');
|
|
19417
19366
|
}
|
|
19418
19367
|
parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
|
|
19419
19368
|
},
|
|
@@ -19426,21 +19375,21 @@ class ToolbarModule {
|
|
|
19426
19375
|
iconCss: 'e-icons ' + iconCss, cssClass: 'e-image-popup',
|
|
19427
19376
|
content: parent.toPascalCase(shape.replace('crop-', ''))
|
|
19428
19377
|
});
|
|
19429
|
-
drpDownBtn.appendTo('#' +
|
|
19378
|
+
drpDownBtn.appendTo('#' + parent.element.id + '_cropBtn');
|
|
19430
19379
|
}
|
|
19431
19380
|
renderTransformBtn() {
|
|
19432
19381
|
const parent = this.parent;
|
|
19433
19382
|
const items = [];
|
|
19434
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19383
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('RotateLeft') > -1)) {
|
|
19435
19384
|
items.push({ text: this.l10n.getConstant('RotateLeft'), id: 'rotateleft', iconCss: 'e-icons e-anti-clock-wise' });
|
|
19436
19385
|
}
|
|
19437
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19386
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('RotateRight') > -1)) {
|
|
19438
19387
|
items.push({ text: this.l10n.getConstant('RotateRight'), id: 'rotateright', iconCss: 'e-icons e-clock-wise' });
|
|
19439
19388
|
}
|
|
19440
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19389
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('FlipHorizontal') > -1)) {
|
|
19441
19390
|
items.push({ text: this.l10n.getConstant('HorizontalFlip'), id: 'horizontalflip', iconCss: 'e-icons e-horizontal-flip' });
|
|
19442
19391
|
}
|
|
19443
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19392
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('FlipVertical') > -1)) {
|
|
19444
19393
|
items.push({ text: this.l10n.getConstant('VerticalFlip'), id: 'verticalflip', iconCss: 'e-icons e-vertical-flip' });
|
|
19445
19394
|
}
|
|
19446
19395
|
const drpDownBtn = new DropDownButton({
|
|
@@ -19453,27 +19402,27 @@ class ToolbarModule {
|
|
|
19453
19402
|
args.element.parentElement.style.display = 'block';
|
|
19454
19403
|
}
|
|
19455
19404
|
},
|
|
19456
|
-
items: items, select:
|
|
19405
|
+
items: items, select: parent.transformSelect.bind(this),
|
|
19457
19406
|
iconCss: 'e-icons e-transform', cssClass: 'e-image-popup'
|
|
19458
19407
|
});
|
|
19459
19408
|
drpDownBtn.appendTo('#' + parent.element.id + '_transformBtn');
|
|
19460
19409
|
}
|
|
19461
19410
|
renderSaveBtn() {
|
|
19462
|
-
const
|
|
19411
|
+
const parent = this.parent;
|
|
19463
19412
|
const saveItems = [
|
|
19464
19413
|
{ text: 'JPEG', id: 'jpeg' },
|
|
19465
19414
|
{ text: 'PNG', id: 'png' },
|
|
19466
19415
|
{ text: 'SVG', id: 'svg' }
|
|
19467
19416
|
];
|
|
19468
|
-
const ddbElem = document.getElementById(
|
|
19417
|
+
const ddbElem = document.getElementById(parent.element.id + '_saveBtn');
|
|
19469
19418
|
if (ddbElem) {
|
|
19470
19419
|
// Initialize the DropDownButton component.
|
|
19471
19420
|
const saveDrpDownBtn = new DropDownButton({ items: saveItems, cssClass: 'e-caret-hide e-image-popup', iconCss: 'e-icons e-save',
|
|
19472
19421
|
select: (args) => {
|
|
19473
|
-
|
|
19422
|
+
parent.export(args.item.text);
|
|
19474
19423
|
}
|
|
19475
19424
|
});
|
|
19476
|
-
saveDrpDownBtn.appendTo('#' +
|
|
19425
|
+
saveDrpDownBtn.appendTo('#' + parent.element.id + '_saveBtn');
|
|
19477
19426
|
}
|
|
19478
19427
|
}
|
|
19479
19428
|
getCropTransformToolbarItem() {
|
|
@@ -19483,19 +19432,19 @@ class ToolbarModule {
|
|
|
19483
19432
|
template: '<button id="' + parent.element.id + '_cropBtn"></button>'
|
|
19484
19433
|
});
|
|
19485
19434
|
toolbarItems.push({ align: 'Center', type: 'Separator' });
|
|
19486
|
-
toolbarItems.push({ id:
|
|
19435
|
+
toolbarItems.push({ id: parent.element.id + '_rotateLeft', prefixIcon: 'e-icons e-anti-clock-wise',
|
|
19487
19436
|
tooltipText: this.l10n.getConstant('RotateLeft'), align: 'Center' });
|
|
19488
|
-
toolbarItems.push({ id:
|
|
19437
|
+
toolbarItems.push({ id: parent.element.id + '_rotateRight', prefixIcon: 'e-icons e-clock-wise',
|
|
19489
19438
|
tooltipText: this.l10n.getConstant('RotateRight'), align: 'Center' });
|
|
19490
19439
|
toolbarItems.push({ align: 'Center', type: 'Separator' });
|
|
19491
|
-
toolbarItems.push({ id:
|
|
19440
|
+
toolbarItems.push({ id: parent.element.id + '_horizontalFlip', prefixIcon: 'e-icons e-horizontal-flip',
|
|
19492
19441
|
tooltipText: this.l10n.getConstant('HorizontalFlip'), align: 'Center' });
|
|
19493
|
-
toolbarItems.push({ id:
|
|
19442
|
+
toolbarItems.push({ id: parent.element.id + '_verticalFlip', prefixIcon: 'e-icons e-vertical-flip',
|
|
19494
19443
|
tooltipText: this.l10n.getConstant('VerticalFlip'), align: 'Center' });
|
|
19495
19444
|
if (!Browser.isDevice) {
|
|
19496
|
-
toolbarItems.push({ id:
|
|
19445
|
+
toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
19497
19446
|
tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
|
|
19498
|
-
toolbarItems.push({ id:
|
|
19447
|
+
toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
19499
19448
|
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
19500
19449
|
}
|
|
19501
19450
|
return toolbarItems;
|
|
@@ -19503,31 +19452,31 @@ class ToolbarModule {
|
|
|
19503
19452
|
getShapesToolbarItem(items) {
|
|
19504
19453
|
const parent = this.parent;
|
|
19505
19454
|
const toolbarItems = [];
|
|
19506
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19455
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar)) {
|
|
19507
19456
|
toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
|
|
19508
|
-
template: '<button id="' +
|
|
19457
|
+
template: '<button id="' + parent.element.id + '_annotationBtn"></button>' });
|
|
19509
19458
|
}
|
|
19510
19459
|
if (items.indexOf('fillColor') > -1) {
|
|
19511
|
-
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id:
|
|
19460
|
+
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: parent.element.id + '_fillcolor',
|
|
19512
19461
|
cssClass: 'top-icon e-fill', tooltipText: this.l10n.getConstant('FillColor'), align: 'Center', type: 'Input',
|
|
19513
|
-
template: '<button id="' +
|
|
19462
|
+
template: '<button id="' + parent.element.id + '_fillColorBtn"></button>' });
|
|
19514
19463
|
}
|
|
19515
19464
|
if (items.indexOf('strokeColor') > -1) {
|
|
19516
|
-
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id:
|
|
19465
|
+
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: parent.element.id + '_strokecolor',
|
|
19517
19466
|
cssClass: 'top-icon e-stroke', tooltipText: this.l10n.getConstant('StrokeColor'), align: 'Center', type: 'Input',
|
|
19518
|
-
template: '<button id="' +
|
|
19467
|
+
template: '<button id="' + parent.element.id + '_borderColorBtn"></button>' });
|
|
19519
19468
|
}
|
|
19520
19469
|
if (items.indexOf('strokeWidth') > -1) {
|
|
19521
|
-
toolbarItems.push({ id:
|
|
19522
|
-
type: 'Input', template: '<button id="' +
|
|
19470
|
+
toolbarItems.push({ id: parent.element.id + '_strokeWidth', cssClass: 'top-icon e-size', tooltipText: 'Stroke Width', align: 'Center',
|
|
19471
|
+
type: 'Input', template: '<button id="' + parent.element.id + '_borderWidthBtn"></button>' });
|
|
19523
19472
|
}
|
|
19524
19473
|
if (items.indexOf('start') > -1) {
|
|
19525
|
-
toolbarItems.push({ id:
|
|
19526
|
-
type: 'Input', template: '<button id="' +
|
|
19474
|
+
toolbarItems.push({ id: parent.element.id + '_start', cssClass: 'top-icon e-size', tooltipText: 'Start', align: 'Center',
|
|
19475
|
+
type: 'Input', template: '<button id="' + parent.element.id + '_startBtn"></button>' });
|
|
19527
19476
|
}
|
|
19528
19477
|
if (items.indexOf('end') > -1) {
|
|
19529
|
-
toolbarItems.push({ id:
|
|
19530
|
-
type: 'Input', template: '<button id="' +
|
|
19478
|
+
toolbarItems.push({ id: parent.element.id + '_end', cssClass: 'top-icon e-size', tooltipText: 'End', align: 'Center',
|
|
19479
|
+
type: 'Input', template: '<button id="' + parent.element.id + '_endBtn"></button>' });
|
|
19531
19480
|
}
|
|
19532
19481
|
toolbarItems.push({ align: 'Center', type: 'Separator' });
|
|
19533
19482
|
if (items.indexOf('duplicate') > -1) {
|
|
@@ -19550,15 +19499,16 @@ class ToolbarModule {
|
|
|
19550
19499
|
const obj = { shape: null };
|
|
19551
19500
|
parent.notify('selection', { prop: 'getCurrentDrawingShape', value: { obj: obj } });
|
|
19552
19501
|
if (obj['shape'] !== 'path') {
|
|
19553
|
-
toolbarItems.push({ id:
|
|
19502
|
+
toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
19554
19503
|
tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
|
|
19555
|
-
toolbarItems.push({ id:
|
|
19504
|
+
toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
19556
19505
|
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
19557
19506
|
}
|
|
19558
19507
|
}
|
|
19559
19508
|
return toolbarItems;
|
|
19560
19509
|
}
|
|
19561
19510
|
initCropTransformToolbar() {
|
|
19511
|
+
const parent = this.parent;
|
|
19562
19512
|
const leftItem = this.getLeftToolbarItem();
|
|
19563
19513
|
const rightItem = this.getRightToolbarItem();
|
|
19564
19514
|
const mainItem = this.getCropTransformToolbarItem();
|
|
@@ -19579,9 +19529,9 @@ class ToolbarModule {
|
|
|
19579
19529
|
if (!Browser.isDevice) {
|
|
19580
19530
|
this.renderSaveBtn();
|
|
19581
19531
|
}
|
|
19582
|
-
|
|
19532
|
+
parent.trigger('toolbarCreated', { toolbarType: 'shapes' });
|
|
19583
19533
|
if (Browser.isDevice) {
|
|
19584
|
-
if (this.defToolbarItems.length > 0 &&
|
|
19534
|
+
if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
19585
19535
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
19586
19536
|
toolbar.refreshOverflow();
|
|
19587
19537
|
toolbar.refreshOverflow();
|
|
@@ -19590,22 +19540,22 @@ class ToolbarModule {
|
|
|
19590
19540
|
}
|
|
19591
19541
|
else {
|
|
19592
19542
|
this.createLeftToolbarControls();
|
|
19593
|
-
if (this.defToolbarItems.length > 0 &&
|
|
19543
|
+
if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
19594
19544
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
19595
19545
|
toolbar.refreshOverflow();
|
|
19596
19546
|
}
|
|
19597
19547
|
}
|
|
19598
|
-
|
|
19548
|
+
parent.select('custom');
|
|
19599
19549
|
}
|
|
19600
19550
|
});
|
|
19601
19551
|
if (Browser.isDevice) {
|
|
19602
|
-
toolbar.appendTo('#' +
|
|
19552
|
+
toolbar.appendTo('#' + parent.element.id + '_bottomToolbar');
|
|
19603
19553
|
}
|
|
19604
19554
|
else {
|
|
19605
|
-
toolbar.appendTo('#' +
|
|
19555
|
+
toolbar.appendTo('#' + parent.element.id + '_toolbar');
|
|
19606
19556
|
}
|
|
19607
19557
|
this.enableDisableTbrBtn();
|
|
19608
|
-
|
|
19558
|
+
parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
|
|
19609
19559
|
}
|
|
19610
19560
|
getCurrentShapeIcon(shape) {
|
|
19611
19561
|
let icon = '';
|
|
@@ -19616,9 +19566,6 @@ class ToolbarModule {
|
|
|
19616
19566
|
case 'ellipse':
|
|
19617
19567
|
icon = 'e-circle';
|
|
19618
19568
|
break;
|
|
19619
|
-
case 'triangle':
|
|
19620
|
-
icon = 'e-triangle';
|
|
19621
|
-
break;
|
|
19622
19569
|
case 'line':
|
|
19623
19570
|
icon = 'e-line';
|
|
19624
19571
|
break;
|
|
@@ -19665,6 +19612,7 @@ class ToolbarModule {
|
|
|
19665
19612
|
return icon;
|
|
19666
19613
|
}
|
|
19667
19614
|
initShapesToolbarItem(items) {
|
|
19615
|
+
const parent = this.parent;
|
|
19668
19616
|
const leftItem = this.getLeftToolbarItem();
|
|
19669
19617
|
const rightItem = this.getRightToolbarItem();
|
|
19670
19618
|
const mainItem = this.getShapesToolbarItem(items);
|
|
@@ -19683,7 +19631,7 @@ class ToolbarModule {
|
|
|
19683
19631
|
this.renderAnnotationBtn(true);
|
|
19684
19632
|
this.createShapeColor(items);
|
|
19685
19633
|
this.createShapeBtn(items);
|
|
19686
|
-
if (
|
|
19634
|
+
if (parent.activeObj.shape === 'arrow') {
|
|
19687
19635
|
this.createStartBtn();
|
|
19688
19636
|
this.createEndBtn();
|
|
19689
19637
|
}
|
|
@@ -19691,9 +19639,9 @@ class ToolbarModule {
|
|
|
19691
19639
|
if (!Browser.isDevice) {
|
|
19692
19640
|
this.renderSaveBtn();
|
|
19693
19641
|
}
|
|
19694
|
-
|
|
19642
|
+
parent.trigger('toolbarCreated', { toolbarType: 'shapes' });
|
|
19695
19643
|
if (Browser.isDevice) {
|
|
19696
|
-
if (this.defToolbarItems.length > 0 &&
|
|
19644
|
+
if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
19697
19645
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
19698
19646
|
toolbar.refreshOverflow();
|
|
19699
19647
|
toolbar.refreshOverflow();
|
|
@@ -19702,7 +19650,7 @@ class ToolbarModule {
|
|
|
19702
19650
|
}
|
|
19703
19651
|
else {
|
|
19704
19652
|
this.createLeftToolbarControls();
|
|
19705
|
-
if (this.defToolbarItems.length > 0 &&
|
|
19653
|
+
if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
19706
19654
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
19707
19655
|
toolbar.refreshOverflow();
|
|
19708
19656
|
}
|
|
@@ -19710,10 +19658,10 @@ class ToolbarModule {
|
|
|
19710
19658
|
}
|
|
19711
19659
|
});
|
|
19712
19660
|
if (Browser.isDevice) {
|
|
19713
|
-
toolbar.appendTo('#' +
|
|
19661
|
+
toolbar.appendTo('#' + parent.element.id + '_bottomToolbar');
|
|
19714
19662
|
}
|
|
19715
19663
|
else {
|
|
19716
|
-
toolbar.appendTo('#' +
|
|
19664
|
+
toolbar.appendTo('#' + parent.element.id + '_toolbar');
|
|
19717
19665
|
}
|
|
19718
19666
|
this.enableDisableTbrBtn();
|
|
19719
19667
|
}
|
|
@@ -19727,7 +19675,7 @@ class ToolbarModule {
|
|
|
19727
19675
|
modeSwitcher: false, noColor: true, value: '',
|
|
19728
19676
|
showButtons: false, mode: 'Palette', cssClass: 'e-shape-fill-color',
|
|
19729
19677
|
change: (args) => {
|
|
19730
|
-
|
|
19678
|
+
parent.updateFillColor(args.currentValue.hex);
|
|
19731
19679
|
if (args.currentValue.rgba === '') {
|
|
19732
19680
|
fillDDB.element.children[0].classList.add('e-nocolor-item');
|
|
19733
19681
|
}
|
|
@@ -19748,7 +19696,7 @@ class ToolbarModule {
|
|
|
19748
19696
|
},
|
|
19749
19697
|
target: '.e-shape-fill-color',
|
|
19750
19698
|
iconCss: 'e-dropdownbtn-preview'
|
|
19751
|
-
}, '#' +
|
|
19699
|
+
}, '#' + parent.element.id + '_fillColorBtn');
|
|
19752
19700
|
fillColor.inline = true;
|
|
19753
19701
|
parent.element.querySelector('.e-fill.e-template .e-dropdownbtn-preview').classList.add('e-nocolor-item');
|
|
19754
19702
|
}
|
|
@@ -19760,7 +19708,7 @@ class ToolbarModule {
|
|
|
19760
19708
|
modeSwitcher: false, noColor: false, value: '#fff',
|
|
19761
19709
|
showButtons: false, mode: 'Palette', cssClass: 'e-shape-stroke-color',
|
|
19762
19710
|
change: (args) => {
|
|
19763
|
-
|
|
19711
|
+
parent.updateStrokeColor(args.currentValue.hex);
|
|
19764
19712
|
strokeDDB.element.children[0].style.backgroundColor = args.currentValue.rgba;
|
|
19765
19713
|
strokeDDB.toggle();
|
|
19766
19714
|
}
|
|
@@ -19770,7 +19718,7 @@ class ToolbarModule {
|
|
|
19770
19718
|
if (Browser.isDevice) {
|
|
19771
19719
|
args.element.parentElement.style.top = strokeDDB.element.getBoundingClientRect().top -
|
|
19772
19720
|
args.element.parentElement.offsetHeight + 'px';
|
|
19773
|
-
args.element.parentElement.style.left =
|
|
19721
|
+
args.element.parentElement.style.left = parent.element.offsetLeft + 'px';
|
|
19774
19722
|
}
|
|
19775
19723
|
},
|
|
19776
19724
|
target: '.e-shape-stroke-color',
|
|
@@ -19809,18 +19757,18 @@ class ToolbarModule {
|
|
|
19809
19757
|
},
|
|
19810
19758
|
select: (args) => {
|
|
19811
19759
|
spanElem.textContent = args.item.text;
|
|
19812
|
-
|
|
19760
|
+
parent.updateStrokeWidth(args.item.id);
|
|
19813
19761
|
if (Browser.isDevice) {
|
|
19814
|
-
if (
|
|
19762
|
+
if (document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
19815
19763
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
19816
|
-
const toolbar = getComponent(
|
|
19764
|
+
const toolbar = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
|
|
19817
19765
|
toolbar.refreshOverflow();
|
|
19818
19766
|
}
|
|
19819
19767
|
}
|
|
19820
19768
|
else {
|
|
19821
|
-
if (
|
|
19769
|
+
if (document.getElementById(parent.element.id + '_toolbar')) {
|
|
19822
19770
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
19823
|
-
const toolbar = getComponent(
|
|
19771
|
+
const toolbar = getComponent(parent.element.id + '_toolbar', 'toolbar');
|
|
19824
19772
|
toolbar.refreshOverflow();
|
|
19825
19773
|
}
|
|
19826
19774
|
}
|
|
@@ -19844,10 +19792,10 @@ class ToolbarModule {
|
|
|
19844
19792
|
];
|
|
19845
19793
|
const strokeWidthBtn = document.getElementById(parent.element.id + '_startBtn');
|
|
19846
19794
|
const spanElem = document.createElement('span');
|
|
19847
|
-
if (isNullOrUndefined(
|
|
19848
|
-
|
|
19795
|
+
if (isNullOrUndefined(parent.activeObj.start)) {
|
|
19796
|
+
parent.activeObj.start = 'none';
|
|
19849
19797
|
}
|
|
19850
|
-
spanElem.innerHTML =
|
|
19798
|
+
spanElem.innerHTML = parent.pascalToSplitWords(parent.activeObj.start);
|
|
19851
19799
|
spanElem.className = 'e-shape-start';
|
|
19852
19800
|
strokeWidthBtn.appendChild(spanElem);
|
|
19853
19801
|
// Initialize the DropDownButton component.
|
|
@@ -19884,10 +19832,10 @@ class ToolbarModule {
|
|
|
19884
19832
|
];
|
|
19885
19833
|
const strokeEndBtn = document.getElementById(parent.element.id + '_endBtn');
|
|
19886
19834
|
const spanElem = document.createElement('span');
|
|
19887
|
-
if (isNullOrUndefined(
|
|
19888
|
-
|
|
19835
|
+
if (isNullOrUndefined(parent.activeObj.end)) {
|
|
19836
|
+
parent.activeObj.end = 'arrowSolid';
|
|
19889
19837
|
}
|
|
19890
|
-
spanElem.innerHTML =
|
|
19838
|
+
spanElem.innerHTML = parent.pascalToSplitWords(parent.activeObj.end);
|
|
19891
19839
|
spanElem.className = 'e-shape-end';
|
|
19892
19840
|
strokeEndBtn.appendChild(spanElem);
|
|
19893
19841
|
// Initialize the DropDownButton component.
|
|
@@ -19913,9 +19861,9 @@ class ToolbarModule {
|
|
|
19913
19861
|
getTextToolbarItem(items) {
|
|
19914
19862
|
const parent = this.parent;
|
|
19915
19863
|
const toolbarItems = [];
|
|
19916
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19864
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar)) {
|
|
19917
19865
|
toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
|
|
19918
|
-
template: '<button id="' +
|
|
19866
|
+
template: '<button id="' + parent.element.id + '_annotationBtn"></button>' });
|
|
19919
19867
|
}
|
|
19920
19868
|
if (items.indexOf('fontFamily') > -1) {
|
|
19921
19869
|
toolbarItems.push({ id: parent.element.id + '_fontFamily', cssClass: 'top-icon e-img-font-family',
|
|
@@ -19999,7 +19947,7 @@ class ToolbarModule {
|
|
|
19999
19947
|
}
|
|
20000
19948
|
parent.trigger('toolbarCreated', { toolbarType: 'text' });
|
|
20001
19949
|
if (Browser.isDevice) {
|
|
20002
|
-
if (this.defToolbarItems.length > 0 &&
|
|
19950
|
+
if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
20003
19951
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20004
19952
|
toolbar.refreshOverflow();
|
|
20005
19953
|
toolbar.refreshOverflow();
|
|
@@ -20008,7 +19956,7 @@ class ToolbarModule {
|
|
|
20008
19956
|
}
|
|
20009
19957
|
else {
|
|
20010
19958
|
this.createLeftToolbarControls();
|
|
20011
|
-
if (this.defToolbarItems.length > 0 &&
|
|
19959
|
+
if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
20012
19960
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20013
19961
|
toolbar.refreshOverflow();
|
|
20014
19962
|
}
|
|
@@ -20025,7 +19973,7 @@ class ToolbarModule {
|
|
|
20025
19973
|
}
|
|
20026
19974
|
createTextColor(items) {
|
|
20027
19975
|
const parent = this.parent;
|
|
20028
|
-
if (items.indexOf('fontColor') > -1 &&
|
|
19976
|
+
if (items.indexOf('fontColor') > -1 && parent.element.querySelector('.e-template.e-text-font-color')) {
|
|
20029
19977
|
parent.element.querySelector('.e-template.e-text-font-color').appendChild(parent.createElement('input', {
|
|
20030
19978
|
id: parent.element.id + '_text_font'
|
|
20031
19979
|
}));
|
|
@@ -20033,7 +19981,7 @@ class ToolbarModule {
|
|
|
20033
19981
|
modeSwitcher: false, value: '#fff',
|
|
20034
19982
|
showButtons: false, mode: 'Palette', cssClass: 'e-text-fontt-color',
|
|
20035
19983
|
change: (args) => {
|
|
20036
|
-
|
|
19984
|
+
parent.updateFontColor(args.currentValue.hex);
|
|
20037
19985
|
strokeDDB.element.children[0].style.backgroundColor = args.currentValue.rgba;
|
|
20038
19986
|
strokeDDB.toggle();
|
|
20039
19987
|
}
|
|
@@ -20067,7 +20015,7 @@ class ToolbarModule {
|
|
|
20067
20015
|
spanElem.innerHTML = 'Arial';
|
|
20068
20016
|
}
|
|
20069
20017
|
spanElem.className = 'e-text-font-family';
|
|
20070
|
-
if (
|
|
20018
|
+
if (fontNameBtn) {
|
|
20071
20019
|
fontNameBtn.appendChild(spanElem);
|
|
20072
20020
|
}
|
|
20073
20021
|
const fontFamilyBtn = new DropDownButton({ items: this.getFontFamilyItems(),
|
|
@@ -20128,24 +20076,25 @@ class ToolbarModule {
|
|
|
20128
20076
|
}
|
|
20129
20077
|
}
|
|
20130
20078
|
refreshToolbar(type, isApplyBtn, isCropping, isZooming, cType) {
|
|
20131
|
-
|
|
20079
|
+
const parent = this.parent;
|
|
20080
|
+
if (!parent.isImageLoaded || parent.isCropToolbar) {
|
|
20132
20081
|
return;
|
|
20133
20082
|
}
|
|
20134
20083
|
const args = { toolbarType: type };
|
|
20135
20084
|
if (type !== 'filter' && type !== 'color') {
|
|
20136
|
-
if (document.getElementById(
|
|
20137
|
-
getComponent(document.getElementById(
|
|
20138
|
-
document.getElementById(
|
|
20085
|
+
if (document.getElementById(parent.element.id + '_toolbar') && this.defToolbarItems.length > 0) {
|
|
20086
|
+
getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
|
|
20087
|
+
document.getElementById(parent.element.id + '_toolbar').innerHTML = '';
|
|
20139
20088
|
}
|
|
20140
|
-
if (document.getElementById(
|
|
20141
|
-
if (document.getElementById(
|
|
20142
|
-
getComponent(document.getElementById(
|
|
20143
|
-
document.getElementById(
|
|
20089
|
+
if (document.getElementById(parent.element.id + '_bottomToolbar') && this.defToolbarItems.length > 0) {
|
|
20090
|
+
if (document.getElementById(parent.element.id + '_bottomToolbar').className.indexOf('e-control') > -1) {
|
|
20091
|
+
getComponent(document.getElementById(parent.element.id + '_bottomToolbar'), 'toolbar').destroy();
|
|
20092
|
+
document.getElementById(parent.element.id + '_bottomToolbar').innerHTML = '';
|
|
20144
20093
|
}
|
|
20145
20094
|
}
|
|
20146
20095
|
}
|
|
20147
20096
|
this.refreshSlider();
|
|
20148
|
-
|
|
20097
|
+
parent.isCropTab = false;
|
|
20149
20098
|
switch (type) {
|
|
20150
20099
|
case 'main':
|
|
20151
20100
|
if (Browser.isDevice) {
|
|
@@ -20172,16 +20121,16 @@ class ToolbarModule {
|
|
|
20172
20121
|
if (Browser.isDevice) {
|
|
20173
20122
|
this.initMainToolbar(false, true, true);
|
|
20174
20123
|
}
|
|
20175
|
-
if (
|
|
20124
|
+
if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'path') {
|
|
20176
20125
|
args.toolbarItems = ['strokeColor', 'strokeWidth', 'duplicate', 'remove'];
|
|
20177
20126
|
}
|
|
20178
|
-
else if (
|
|
20127
|
+
else if (parent.activeObj.shape === 'arrow') {
|
|
20179
20128
|
args.toolbarItems = ['strokeColor', 'strokeWidth', 'start', 'end', 'duplicate', 'remove'];
|
|
20180
20129
|
}
|
|
20181
20130
|
else {
|
|
20182
20131
|
args.toolbarItems = ['fillColor', 'strokeColor', 'strokeWidth', 'duplicate', 'remove'];
|
|
20183
20132
|
}
|
|
20184
|
-
|
|
20133
|
+
parent.trigger('toolbarUpdating', args);
|
|
20185
20134
|
this.initShapesToolbarItem(args.toolbarItems);
|
|
20186
20135
|
break;
|
|
20187
20136
|
case 'text':
|
|
@@ -20189,7 +20138,7 @@ class ToolbarModule {
|
|
|
20189
20138
|
this.initMainToolbar(false, true, true);
|
|
20190
20139
|
}
|
|
20191
20140
|
args.toolbarItems = ['fontFamily', 'fontSize', 'fontColor', 'bold', 'italic', 'duplicate', 'remove', 'text'];
|
|
20192
|
-
|
|
20141
|
+
parent.trigger('toolbarUpdating', args);
|
|
20193
20142
|
this.initTextToolbarItem(args.toolbarItems);
|
|
20194
20143
|
break;
|
|
20195
20144
|
case 'pen':
|
|
@@ -20197,7 +20146,7 @@ class ToolbarModule {
|
|
|
20197
20146
|
this.initMainToolbar(false, true, true);
|
|
20198
20147
|
}
|
|
20199
20148
|
args.toolbarItems = ['strokeColor', 'strokeWidth', 'remove'];
|
|
20200
|
-
|
|
20149
|
+
parent.trigger('toolbarUpdating', args);
|
|
20201
20150
|
this.initPenToolbarItem(args.toolbarItems);
|
|
20202
20151
|
break;
|
|
20203
20152
|
case 'adjustment':
|
|
@@ -20213,11 +20162,11 @@ class ToolbarModule {
|
|
|
20213
20162
|
this.updateContextualToolbar(type, cType);
|
|
20214
20163
|
break;
|
|
20215
20164
|
case 'croptransform':
|
|
20216
|
-
|
|
20165
|
+
parent.isCropTab = true;
|
|
20217
20166
|
if (Browser.isDevice) {
|
|
20218
20167
|
this.initMainToolbar(false, true, true);
|
|
20219
20168
|
}
|
|
20220
|
-
|
|
20169
|
+
parent.updateCropTransformItems();
|
|
20221
20170
|
this.initCropTransformToolbar();
|
|
20222
20171
|
break;
|
|
20223
20172
|
}
|
|
@@ -20226,32 +20175,33 @@ class ToolbarModule {
|
|
|
20226
20175
|
}
|
|
20227
20176
|
getAdjustmentToolbarItem() {
|
|
20228
20177
|
const toolbarItems = [];
|
|
20229
|
-
|
|
20230
|
-
|
|
20178
|
+
const parent = this.parent;
|
|
20179
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Brightness') > -1)) {
|
|
20180
|
+
toolbarItems.push({ id: parent.element.id + '_brightness', prefixIcon: 'e-icons e-brightness', cssClass: 'top-icon e-brightness',
|
|
20231
20181
|
tooltipText: this.l10n.getConstant('Brightness'), align: 'Center' });
|
|
20232
20182
|
}
|
|
20233
|
-
if (isNullOrUndefined(
|
|
20234
|
-
toolbarItems.push({ id:
|
|
20183
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Contrast') > -1)) {
|
|
20184
|
+
toolbarItems.push({ id: parent.element.id + '_contrast', prefixIcon: 'e-icons e-contrast', cssClass: 'top-icon e-contrast',
|
|
20235
20185
|
tooltipText: this.l10n.getConstant('Contrast'), align: 'Center' });
|
|
20236
20186
|
}
|
|
20237
|
-
if (isNullOrUndefined(
|
|
20238
|
-
toolbarItems.push({ id:
|
|
20187
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Hue') > -1)) {
|
|
20188
|
+
toolbarItems.push({ id: parent.element.id + '_hue', prefixIcon: 'e-icons e-fade', cssClass: 'top-icon e-fade',
|
|
20239
20189
|
tooltipText: this.l10n.getConstant('Hue'), align: 'Center' });
|
|
20240
20190
|
}
|
|
20241
|
-
if (isNullOrUndefined(
|
|
20242
|
-
toolbarItems.push({ id:
|
|
20191
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Saturation') > -1)) {
|
|
20192
|
+
toolbarItems.push({ id: parent.element.id + '_saturation', prefixIcon: 'e-icons e-saturation', cssClass: 'top-icon e-saturation',
|
|
20243
20193
|
tooltipText: this.l10n.getConstant('Saturation'), align: 'Center' });
|
|
20244
20194
|
}
|
|
20245
|
-
if (isNullOrUndefined(
|
|
20246
|
-
toolbarItems.push({ id:
|
|
20195
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Exposure') > -1)) {
|
|
20196
|
+
toolbarItems.push({ id: parent.element.id + '_exposure', prefixIcon: 'e-icons e-grain', cssClass: 'top-icon e-grain',
|
|
20247
20197
|
tooltipText: this.l10n.getConstant('Exposure'), align: 'Center' });
|
|
20248
20198
|
}
|
|
20249
|
-
if (isNullOrUndefined(
|
|
20250
|
-
toolbarItems.push({ id:
|
|
20199
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Opacity') > -1)) {
|
|
20200
|
+
toolbarItems.push({ id: parent.element.id + '_opacity', prefixIcon: 'e-icons e-opacity', cssClass: 'top-icon e-opacity',
|
|
20251
20201
|
tooltipText: this.l10n.getConstant('Opacity'), align: 'Center' });
|
|
20252
20202
|
}
|
|
20253
|
-
if (isNullOrUndefined(
|
|
20254
|
-
toolbarItems.push({ id:
|
|
20203
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Blur') > -1)) {
|
|
20204
|
+
toolbarItems.push({ id: parent.element.id + '_blur', prefixIcon: 'e-icons e-tint', cssClass: 'top-icon e-tint',
|
|
20255
20205
|
tooltipText: this.l10n.getConstant('Blur'), align: 'Center' });
|
|
20256
20206
|
}
|
|
20257
20207
|
const tempToolbarItems = this.processToolbar('center');
|
|
@@ -20259,49 +20209,50 @@ class ToolbarModule {
|
|
|
20259
20209
|
toolbarItems.push(tempToolbarItems[i]);
|
|
20260
20210
|
}
|
|
20261
20211
|
if (!Browser.isDevice) {
|
|
20262
|
-
toolbarItems.push({ id:
|
|
20212
|
+
toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
20263
20213
|
tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
|
|
20264
|
-
toolbarItems.push({ id:
|
|
20214
|
+
toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
20265
20215
|
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
20266
20216
|
}
|
|
20267
20217
|
return toolbarItems;
|
|
20268
20218
|
}
|
|
20269
20219
|
getFilterToolbarItem() {
|
|
20270
20220
|
const toolbarItems = [];
|
|
20271
|
-
|
|
20272
|
-
|
|
20221
|
+
const parent = this.parent;
|
|
20222
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Default') > -1)) {
|
|
20223
|
+
toolbarItems.push({ id: parent.element.id + '_default', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
20273
20224
|
tooltipText: this.l10n.getConstant('Default'), align: 'Center',
|
|
20274
|
-
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' +
|
|
20225
|
+
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + parent.element.id + '_defaultCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Default') + '</span></div></div>' });
|
|
20275
20226
|
}
|
|
20276
|
-
if (isNullOrUndefined(
|
|
20277
|
-
toolbarItems.push({ id:
|
|
20227
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Chrome') > -1)) {
|
|
20228
|
+
toolbarItems.push({ id: parent.element.id + '_chrome', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
20278
20229
|
tooltipText: this.l10n.getConstant('Chrome'), align: 'Center',
|
|
20279
|
-
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' +
|
|
20230
|
+
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + parent.element.id + '_chromeCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Chrome') + '</span></div></div>' });
|
|
20280
20231
|
}
|
|
20281
|
-
if (isNullOrUndefined(
|
|
20282
|
-
toolbarItems.push({ id:
|
|
20232
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Cold') > -1)) {
|
|
20233
|
+
toolbarItems.push({ id: parent.element.id + '_cold', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
20283
20234
|
tooltipText: this.l10n.getConstant('Cold'), align: 'Center',
|
|
20284
|
-
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' +
|
|
20235
|
+
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + parent.element.id + '_coldCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Cold') + '</span></div></div>' });
|
|
20285
20236
|
}
|
|
20286
|
-
if (isNullOrUndefined(
|
|
20287
|
-
toolbarItems.push({ id:
|
|
20237
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Warm') > -1)) {
|
|
20238
|
+
toolbarItems.push({ id: parent.element.id + '_warm', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
20288
20239
|
tooltipText: this.l10n.getConstant('Warm'), align: 'Center',
|
|
20289
|
-
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' +
|
|
20240
|
+
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + parent.element.id + '_warmCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Warm') + '</span></div></div>' });
|
|
20290
20241
|
}
|
|
20291
|
-
if (isNullOrUndefined(
|
|
20292
|
-
toolbarItems.push({ id:
|
|
20242
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Grayscale') > -1)) {
|
|
20243
|
+
toolbarItems.push({ id: parent.element.id + '_grayscale', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
20293
20244
|
tooltipText: this.l10n.getConstant('Grayscale'), align: 'Center',
|
|
20294
|
-
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' +
|
|
20245
|
+
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + parent.element.id + '_grayscaleCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Grayscale') + '</span></div></div>' });
|
|
20295
20246
|
}
|
|
20296
|
-
if (isNullOrUndefined(
|
|
20297
|
-
toolbarItems.push({ id:
|
|
20247
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Sepia') > -1)) {
|
|
20248
|
+
toolbarItems.push({ id: parent.element.id + '_sepia', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
20298
20249
|
tooltipText: this.l10n.getConstant('Sepia'), align: 'Center',
|
|
20299
|
-
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' +
|
|
20250
|
+
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + parent.element.id + '_sepiaCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Sepia') + '</span></div></div>' });
|
|
20300
20251
|
}
|
|
20301
|
-
if (isNullOrUndefined(
|
|
20302
|
-
toolbarItems.push({ id:
|
|
20252
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Invert') > -1)) {
|
|
20253
|
+
toolbarItems.push({ id: parent.element.id + '_invert', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
20303
20254
|
tooltipText: this.l10n.getConstant('Invert'), align: 'Center',
|
|
20304
|
-
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' +
|
|
20255
|
+
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + parent.element.id + '_invertCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Invert') + '</span></div></div>' });
|
|
20305
20256
|
}
|
|
20306
20257
|
const tempToolbarItems = this.processToolbar('center');
|
|
20307
20258
|
for (let i = 0, len = tempToolbarItems.length; i < len; i++) {
|
|
@@ -20312,20 +20263,20 @@ class ToolbarModule {
|
|
|
20312
20263
|
getPenToolbarItem(items) {
|
|
20313
20264
|
const parent = this.parent;
|
|
20314
20265
|
const toolbarItems = [];
|
|
20315
|
-
if (isNullOrUndefined(parent.toolbar) ||
|
|
20266
|
+
if (isNullOrUndefined(parent.toolbar) || parent.toolbar) {
|
|
20316
20267
|
toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
|
|
20317
|
-
template: '<button id="' +
|
|
20268
|
+
template: '<button id="' + parent.element.id + '_annotationBtn"></button>' });
|
|
20318
20269
|
}
|
|
20319
20270
|
if (items.indexOf('strokeColor') > -1) {
|
|
20320
|
-
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id:
|
|
20271
|
+
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: parent.element.id + '_pen_strokecolor',
|
|
20321
20272
|
cssClass: 'top-icon e-pen-stroke-color',
|
|
20322
20273
|
tooltipText: this.l10n.getConstant('StrokeColor'), align: 'Center', type: 'Input',
|
|
20323
|
-
template: '<button id="' +
|
|
20274
|
+
template: '<button id="' + parent.element.id + '_penColorBtn"></button>' });
|
|
20324
20275
|
}
|
|
20325
20276
|
if (items.indexOf('strokeWidth') > -1) {
|
|
20326
20277
|
toolbarItems.push({ prefixIcon: 'e-icons e-copy', cssClass: 'top-icon e-size',
|
|
20327
20278
|
tooltipText: this.l10n.getConstant('StrokeWidth'),
|
|
20328
|
-
align: 'Center', type: 'Input', template: '<button id="' +
|
|
20279
|
+
align: 'Center', type: 'Input', template: '<button id="' + parent.element.id + '_penStrokeWidth"></button>' });
|
|
20329
20280
|
}
|
|
20330
20281
|
toolbarItems.push({ align: 'Center', type: 'Separator' });
|
|
20331
20282
|
if (items.indexOf('remove') > -1) {
|
|
@@ -20337,14 +20288,15 @@ class ToolbarModule {
|
|
|
20337
20288
|
toolbarItems.push(tempToolbarItems[i]);
|
|
20338
20289
|
}
|
|
20339
20290
|
if (!Browser.isDevice) {
|
|
20340
|
-
toolbarItems.push({ id:
|
|
20291
|
+
toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
20341
20292
|
tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
|
|
20342
|
-
toolbarItems.push({ id:
|
|
20293
|
+
toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
20343
20294
|
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
20344
20295
|
}
|
|
20345
20296
|
return toolbarItems;
|
|
20346
20297
|
}
|
|
20347
20298
|
initPenToolbarItem(items) {
|
|
20299
|
+
const parent = this.parent;
|
|
20348
20300
|
const leftItem = this.getLeftToolbarItem();
|
|
20349
20301
|
const rightItem = this.getRightToolbarItem();
|
|
20350
20302
|
const mainItem = this.getPenToolbarItem(items);
|
|
@@ -20367,9 +20319,9 @@ class ToolbarModule {
|
|
|
20367
20319
|
if (!Browser.isDevice) {
|
|
20368
20320
|
this.renderSaveBtn();
|
|
20369
20321
|
}
|
|
20370
|
-
|
|
20322
|
+
parent.trigger('toolbarCreated', { toolbarType: 'pen' });
|
|
20371
20323
|
if (Browser.isDevice) {
|
|
20372
|
-
if (this.defToolbarItems.length > 0 &&
|
|
20324
|
+
if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
20373
20325
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20374
20326
|
toolbar.refreshOverflow();
|
|
20375
20327
|
toolbar.refreshOverflow();
|
|
@@ -20377,7 +20329,7 @@ class ToolbarModule {
|
|
|
20377
20329
|
}
|
|
20378
20330
|
else {
|
|
20379
20331
|
this.createLeftToolbarControls();
|
|
20380
|
-
if (this.defToolbarItems.length > 0 &&
|
|
20332
|
+
if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
20381
20333
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20382
20334
|
toolbar.refreshOverflow();
|
|
20383
20335
|
}
|
|
@@ -20385,16 +20337,15 @@ class ToolbarModule {
|
|
|
20385
20337
|
}
|
|
20386
20338
|
});
|
|
20387
20339
|
if (Browser.isDevice) {
|
|
20388
|
-
toolbar.appendTo('#' +
|
|
20340
|
+
toolbar.appendTo('#' + parent.element.id + '_bottomToolbar');
|
|
20389
20341
|
}
|
|
20390
20342
|
else {
|
|
20391
|
-
toolbar.appendTo('#' +
|
|
20343
|
+
toolbar.appendTo('#' + parent.element.id + '_toolbar');
|
|
20392
20344
|
}
|
|
20393
20345
|
this.enableDisableTbrBtn();
|
|
20394
20346
|
}
|
|
20395
20347
|
createPenColor(items) {
|
|
20396
20348
|
const parent = this.parent;
|
|
20397
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
20398
20349
|
if (items.indexOf('strokeColor') > -1) {
|
|
20399
20350
|
parent.element.querySelector('.e-template.e-pen-stroke-color').appendChild(parent.createElement('input', {
|
|
20400
20351
|
id: parent.element.id + '_pen_stroke'
|
|
@@ -20403,7 +20354,7 @@ class ToolbarModule {
|
|
|
20403
20354
|
modeSwitcher: false, value: '#fff',
|
|
20404
20355
|
showButtons: false, mode: 'Palette', cssClass: 'e-pen-color',
|
|
20405
20356
|
change: (args) => {
|
|
20406
|
-
|
|
20357
|
+
parent.updatePenStrokeColor(args.currentValue.hex);
|
|
20407
20358
|
this.selFhdColor = args.currentValue.hex;
|
|
20408
20359
|
strokeDDB.element.children[0].style.backgroundColor = args.currentValue.rgba;
|
|
20409
20360
|
strokeDDB.toggle();
|
|
@@ -20426,7 +20377,7 @@ class ToolbarModule {
|
|
|
20426
20377
|
const indexObj = { freehandSelectedIndex: null };
|
|
20427
20378
|
parent.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
|
|
20428
20379
|
if (!isNullOrUndefined(indexObj['freehandSelectedIndex']) && indexObj['freehandSelectedIndex'] > -1) {
|
|
20429
|
-
|
|
20380
|
+
parent.element.querySelector('.e-pen-stroke-color.e-template .e-dropdownbtn-preview').style.background
|
|
20430
20381
|
= this.selFhdColor === '#42a5f5' ? obj['tempFreeHandDrawEditingStyles'].strokeColor :
|
|
20431
20382
|
parent.pointColl[indexObj['freehandSelectedIndex']].strokeColor;
|
|
20432
20383
|
}
|
|
@@ -20470,16 +20421,16 @@ class ToolbarModule {
|
|
|
20470
20421
|
},
|
|
20471
20422
|
select: (args) => {
|
|
20472
20423
|
spanElem.textContent = args.item.text;
|
|
20473
|
-
|
|
20424
|
+
parent.updatePenStrokeWidth(args.item.id);
|
|
20474
20425
|
if (Browser.isDevice) {
|
|
20475
|
-
if (
|
|
20426
|
+
if (document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
20476
20427
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20477
20428
|
const toolbar = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
|
|
20478
20429
|
toolbar.refreshOverflow();
|
|
20479
20430
|
}
|
|
20480
20431
|
}
|
|
20481
20432
|
else {
|
|
20482
|
-
if (
|
|
20433
|
+
if (document.getElementById(parent.element.id + '_toolbar')) {
|
|
20483
20434
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20484
20435
|
const toolbar = getComponent(parent.element.id + '_toolbar', 'toolbar');
|
|
20485
20436
|
toolbar.refreshOverflow();
|
|
@@ -20527,14 +20478,14 @@ class ToolbarModule {
|
|
|
20527
20478
|
this.renderSaveBtn();
|
|
20528
20479
|
}
|
|
20529
20480
|
if (Browser.isDevice) {
|
|
20530
|
-
if (this.defToolbarItems.length > 0 &&
|
|
20481
|
+
if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
20531
20482
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20532
20483
|
toolbar.refreshOverflow();
|
|
20533
20484
|
}
|
|
20534
20485
|
}
|
|
20535
20486
|
else {
|
|
20536
20487
|
this.createLeftToolbarControls();
|
|
20537
|
-
if (this.defToolbarItems.length > 0 &&
|
|
20488
|
+
if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
20538
20489
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20539
20490
|
toolbar.refreshOverflow();
|
|
20540
20491
|
}
|
|
@@ -20552,8 +20503,8 @@ class ToolbarModule {
|
|
|
20552
20503
|
initFilterToolbarItem() {
|
|
20553
20504
|
const parent = this.parent;
|
|
20554
20505
|
const mainItem = this.getFilterToolbarItem();
|
|
20555
|
-
if (document.querySelector('#' +
|
|
20556
|
-
getComponent(document.getElementById(
|
|
20506
|
+
if (document.querySelector('#' + parent.element.id + '_contextualToolbar').classList.contains('e-control')) {
|
|
20507
|
+
getComponent(document.getElementById(parent.element.id + '_contextualToolbar'), 'toolbar').destroy();
|
|
20557
20508
|
}
|
|
20558
20509
|
const toolbar = new Toolbar({
|
|
20559
20510
|
width: '100%',
|
|
@@ -20563,7 +20514,7 @@ class ToolbarModule {
|
|
|
20563
20514
|
this.updatePrivateVariables();
|
|
20564
20515
|
this.createCanvasFilter();
|
|
20565
20516
|
if (parent.currentFilter === '') {
|
|
20566
|
-
parent.currentFilter =
|
|
20517
|
+
parent.currentFilter = parent.element.id + '_default';
|
|
20567
20518
|
}
|
|
20568
20519
|
const hdrWrapper = document.querySelector('#' + parent.element.id + '_headWrapper');
|
|
20569
20520
|
if (hdrWrapper) {
|
|
@@ -20574,10 +20525,12 @@ class ToolbarModule {
|
|
|
20574
20525
|
toolbar.refreshOverflow();
|
|
20575
20526
|
}
|
|
20576
20527
|
});
|
|
20577
|
-
toolbar.appendTo('#' +
|
|
20528
|
+
toolbar.appendTo('#' + parent.element.id + '_contextualToolbar');
|
|
20578
20529
|
}
|
|
20579
20530
|
createCanvasFilter() {
|
|
20580
20531
|
const parent = this.parent;
|
|
20532
|
+
showSpinner(parent.element);
|
|
20533
|
+
parent.element.style.opacity = '0.5';
|
|
20581
20534
|
const imageData = parent.getCurrentCanvasData();
|
|
20582
20535
|
this.inMemoryCanvas.width = imageData.width;
|
|
20583
20536
|
this.inMemoryCanvas.height = imageData.height;
|
|
@@ -20589,16 +20542,19 @@ class ToolbarModule {
|
|
|
20589
20542
|
this.updateFilterCanvas('_grayscaleCanvas', 'grayscale');
|
|
20590
20543
|
this.updateFilterCanvas('_sepiaCanvas', 'sepia');
|
|
20591
20544
|
this.updateFilterCanvas('_invertCanvas', 'invert');
|
|
20545
|
+
hideSpinner(parent.element);
|
|
20546
|
+
parent.element.style.opacity = '1';
|
|
20592
20547
|
parent.initialAdjustmentValue = this.lowerContext.filter;
|
|
20593
20548
|
}
|
|
20594
20549
|
updateFilterCanvas(selector, type) {
|
|
20595
|
-
const
|
|
20596
|
-
|
|
20550
|
+
const parent = this.parent;
|
|
20551
|
+
const filter = parent.element.querySelector('#' + parent.element.id + selector);
|
|
20552
|
+
if (filter) {
|
|
20597
20553
|
let ctx = filter.getContext('2d');
|
|
20598
20554
|
ctx = filter.getContext('2d');
|
|
20599
20555
|
filter.style.width = '100px';
|
|
20600
20556
|
filter.style.height = '100px';
|
|
20601
|
-
|
|
20557
|
+
parent.notify('filter', { prop: 'updateAdj', value: { type: type, value: null, isPreview: true, ctx: ctx } });
|
|
20602
20558
|
ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
|
|
20603
20559
|
}
|
|
20604
20560
|
}
|
|
@@ -20648,47 +20604,51 @@ class ToolbarModule {
|
|
|
20648
20604
|
return orgToolbarItems;
|
|
20649
20605
|
}
|
|
20650
20606
|
renderQAT(isPenEdit) {
|
|
20651
|
-
|
|
20652
|
-
|
|
20653
|
-
|
|
20607
|
+
const parent = this.parent;
|
|
20608
|
+
if (parent.activeObj && parent.showQuickAccessToolbar) {
|
|
20609
|
+
const qtArea = document.getElementById(parent.element.id + '_quickAccessToolbarArea');
|
|
20610
|
+
if (qtArea) {
|
|
20654
20611
|
this.destroyQuickAccessToolbar();
|
|
20655
|
-
|
|
20612
|
+
qtArea.style.display = 'block';
|
|
20656
20613
|
}
|
|
20657
20614
|
const items = this.getQuickAccessToolbarItem(isPenEdit);
|
|
20658
20615
|
if (items.length === 0) {
|
|
20659
20616
|
return;
|
|
20660
20617
|
}
|
|
20661
|
-
if (isNullOrUndefined(
|
|
20618
|
+
if (isNullOrUndefined(parent.quickAccessToolbarTemplate)) {
|
|
20662
20619
|
const toolbarObj = new Toolbar({
|
|
20663
20620
|
items: items,
|
|
20664
20621
|
clicked: this.quickAccessToolbarClicked.bind(this)
|
|
20665
20622
|
});
|
|
20666
|
-
toolbarObj.appendTo('#' +
|
|
20623
|
+
toolbarObj.appendTo('#' + parent.element.id + '_quickAccessToolbar');
|
|
20667
20624
|
}
|
|
20668
20625
|
if (isNullOrUndefined(isPenEdit)) {
|
|
20669
20626
|
qtArea.style.width = 'auto';
|
|
20670
|
-
|
|
20671
|
-
|
|
20672
|
-
let x =
|
|
20673
|
-
|
|
20674
|
-
let y =
|
|
20675
|
-
|
|
20676
|
-
let width =
|
|
20677
|
-
if (
|
|
20678
|
-
const
|
|
20627
|
+
parent.activeObj.activePoint.width = Math.abs(parent.activeObj.activePoint.width);
|
|
20628
|
+
parent.activeObj.activePoint.height = Math.abs(parent.activeObj.activePoint.height);
|
|
20629
|
+
let x = parent.activeObj.activePoint.startX < parent.activeObj.activePoint.endX ?
|
|
20630
|
+
parent.activeObj.activePoint.startX : parent.activeObj.activePoint.endX;
|
|
20631
|
+
let y = parent.activeObj.activePoint.startY < parent.activeObj.activePoint.endY ?
|
|
20632
|
+
parent.activeObj.activePoint.startY : parent.activeObj.activePoint.endY;
|
|
20633
|
+
let width = parent.activeObj.activePoint.width;
|
|
20634
|
+
if (parent.activeObj.rotatedAngle !== 0 && parent.activeObj.shape !== 'arrow') {
|
|
20635
|
+
const object = { activePoint: null };
|
|
20636
|
+
parent.notify('shape', { prop: 'getSquarePointForRotatedShape', onPropertyChange: false,
|
|
20637
|
+
value: { obj: parent.activeObj, object: object } });
|
|
20638
|
+
const point = object['activePoint'];
|
|
20679
20639
|
x = point.startX;
|
|
20680
20640
|
y = point.startY;
|
|
20681
20641
|
width = point.width;
|
|
20682
20642
|
}
|
|
20683
|
-
else if (
|
|
20684
|
-
const path =
|
|
20643
|
+
else if (parent.activeObj.shape === 'path') {
|
|
20644
|
+
const path = parent.getSquarePointForPath(parent.activeObj);
|
|
20685
20645
|
x = path.startX;
|
|
20686
20646
|
y = path.startY;
|
|
20687
20647
|
width = path.width;
|
|
20688
20648
|
}
|
|
20689
20649
|
qtArea.style.left = (x + (width / 2)) - (items.length * 25) + 'px';
|
|
20690
|
-
if (y - 60 <
|
|
20691
|
-
qtArea.style.top =
|
|
20650
|
+
if (y - 60 < parent.img.destTop) {
|
|
20651
|
+
qtArea.style.top = parent.img.destTop + 'px';
|
|
20692
20652
|
}
|
|
20693
20653
|
else {
|
|
20694
20654
|
qtArea.style.top = y - 60 + 'px';
|
|
@@ -20697,14 +20657,14 @@ class ToolbarModule {
|
|
|
20697
20657
|
else if (isPenEdit) {
|
|
20698
20658
|
const obj = { activePoint: null };
|
|
20699
20659
|
const indexObj = { freehandSelectedIndex: null };
|
|
20700
|
-
|
|
20701
|
-
|
|
20660
|
+
parent.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
|
|
20661
|
+
parent.notify('freehand-draw', { prop: 'getSqPtFD',
|
|
20702
20662
|
value: { idx: indexObj['freehandSelectedIndex'], obj: obj } });
|
|
20703
20663
|
const point = obj['activePoint'];
|
|
20704
20664
|
qtArea.style.width = 'auto';
|
|
20705
20665
|
qtArea.style.left = (point.startX + (point.width / 2)) - (items.length * 27) + 'px';
|
|
20706
|
-
if (point.startY - 60 <
|
|
20707
|
-
qtArea.style.top =
|
|
20666
|
+
if (point.startY - 60 < parent.img.destTop) {
|
|
20667
|
+
qtArea.style.top = parent.img.destTop + 'px';
|
|
20708
20668
|
}
|
|
20709
20669
|
else {
|
|
20710
20670
|
qtArea.style.top = point.startY - 60 + 'px';
|
|
@@ -20716,8 +20676,9 @@ class ToolbarModule {
|
|
|
20716
20676
|
if (isNullOrUndefined(isDisabled)) {
|
|
20717
20677
|
return;
|
|
20718
20678
|
}
|
|
20719
|
-
const
|
|
20720
|
-
|
|
20679
|
+
const parent = this.parent;
|
|
20680
|
+
const annotation = document.querySelector('#' + parent.element.id + '_annotationBtn');
|
|
20681
|
+
if (annotation) {
|
|
20721
20682
|
if (isDisabled) {
|
|
20722
20683
|
annotation.classList.add('e-disabled');
|
|
20723
20684
|
annotation.parentElement.classList.add('e-overlay');
|
|
@@ -20728,8 +20689,8 @@ class ToolbarModule {
|
|
|
20728
20689
|
}
|
|
20729
20690
|
getComponent(annotation, 'dropdown-btn').disabled = isDisabled;
|
|
20730
20691
|
}
|
|
20731
|
-
const transform = document.querySelector('#' +
|
|
20732
|
-
if (
|
|
20692
|
+
const transform = document.querySelector('#' + parent.element.id + '_transformBtn');
|
|
20693
|
+
if (transform) {
|
|
20733
20694
|
if (isDisabled) {
|
|
20734
20695
|
transform.classList.add('e-disabled');
|
|
20735
20696
|
transform.parentElement.classList.add('e-overlay');
|
|
@@ -20740,8 +20701,8 @@ class ToolbarModule {
|
|
|
20740
20701
|
}
|
|
20741
20702
|
getComponent(transform, 'dropdown-btn').disabled = isDisabled;
|
|
20742
20703
|
}
|
|
20743
|
-
const adjustment = document.querySelector('#' +
|
|
20744
|
-
if (
|
|
20704
|
+
const adjustment = document.querySelector('#' + parent.element.id + '_adjustment');
|
|
20705
|
+
if (adjustment) {
|
|
20745
20706
|
if (isDisabled) {
|
|
20746
20707
|
adjustment.classList.add('e-disabled');
|
|
20747
20708
|
adjustment.parentElement.classList.add('e-overlay');
|
|
@@ -20752,8 +20713,8 @@ class ToolbarModule {
|
|
|
20752
20713
|
}
|
|
20753
20714
|
getComponent(adjustment, 'btn').disabled = isDisabled;
|
|
20754
20715
|
}
|
|
20755
|
-
const filter = document.querySelector('#' +
|
|
20756
|
-
if (
|
|
20716
|
+
const filter = document.querySelector('#' + parent.element.id + '_filter');
|
|
20717
|
+
if (filter) {
|
|
20757
20718
|
if (isDisabled) {
|
|
20758
20719
|
filter.classList.add('e-disabled');
|
|
20759
20720
|
filter.parentElement.classList.add('e-overlay');
|
|
@@ -20783,7 +20744,7 @@ class ToolbarModule {
|
|
|
20783
20744
|
quickAccessToolbarClicked(args, isContextualToolbar) {
|
|
20784
20745
|
const parent = this.parent;
|
|
20785
20746
|
const points = { x: parent.activeObj.activePoint.startX, y: parent.activeObj.activePoint.startY };
|
|
20786
|
-
if (
|
|
20747
|
+
if (args.item) {
|
|
20787
20748
|
let duplicateObj;
|
|
20788
20749
|
let objColl;
|
|
20789
20750
|
let isPreventUndoRedo = null;
|
|
@@ -20796,7 +20757,7 @@ class ToolbarModule {
|
|
|
20796
20757
|
parent.notify('draw', { prop: 'getNewPath', value: { obj: pathObject } });
|
|
20797
20758
|
switch (args.item.id.replace(parent.element.id + '_', '').toLowerCase()) {
|
|
20798
20759
|
case 'duplicate':
|
|
20799
|
-
if (!
|
|
20760
|
+
if (!parent.element.querySelector('#' + parent.element.id + '_duplicate').classList.contains('e-disabled')) {
|
|
20800
20761
|
if (!pathObject['isNewPath'] && JSON.stringify(object['tempObj']) === JSON.stringify(parent.activeObj)) {
|
|
20801
20762
|
isPreventUndoRedo = true;
|
|
20802
20763
|
}
|
|
@@ -20804,7 +20765,7 @@ class ToolbarModule {
|
|
|
20804
20765
|
if (isNullOrUndefined(parent.activeObj.currIndex)) {
|
|
20805
20766
|
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: isPreventUndoRedo } });
|
|
20806
20767
|
}
|
|
20807
|
-
else if (
|
|
20768
|
+
else if (obj['prevActObj']) {
|
|
20808
20769
|
parent.activeObj.currIndex = null;
|
|
20809
20770
|
duplicateObj.currIndex = null;
|
|
20810
20771
|
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: isPreventUndoRedo } });
|
|
@@ -20831,19 +20792,19 @@ class ToolbarModule {
|
|
|
20831
20792
|
parent.notify('shape', { prop: 'setPointCollForLineArrow', onPropertyChange: false,
|
|
20832
20793
|
value: { obj: parent.activeObj } });
|
|
20833
20794
|
}
|
|
20834
|
-
// parent.updateTrianglePoints(
|
|
20795
|
+
// parent.updateTrianglePoints(parent.activeObj); Invoke
|
|
20835
20796
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj } });
|
|
20836
20797
|
parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
|
|
20837
20798
|
this.renderQAT();
|
|
20838
20799
|
}
|
|
20839
20800
|
break;
|
|
20840
20801
|
case 'remove':
|
|
20841
|
-
if (!
|
|
20802
|
+
if (!parent.element.querySelector('#' + parent.element.id + '_remove').classList.contains('e-disabled')) {
|
|
20842
20803
|
parent.notify('selection', { prop: 'deleteItem', onPropertyChange: false });
|
|
20843
20804
|
}
|
|
20844
20805
|
break;
|
|
20845
20806
|
case 'edittext':
|
|
20846
|
-
if (!
|
|
20807
|
+
if (!parent.element.querySelector('#' + parent.element.id + '_editText').classList.contains('e-disabled')) {
|
|
20847
20808
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
20848
20809
|
parent.notify('selection', { prop: 'setTempActObj', onPropertyChange: false,
|
|
20849
20810
|
value: { obj: extend({}, parent.activeObj, {}, true) } });
|
|
@@ -20860,10 +20821,10 @@ class ToolbarModule {
|
|
|
20860
20821
|
if (isNullOrUndefined(parent.activeObj.currIndex)) {
|
|
20861
20822
|
parent.notify('draw', { prop: 'setShapeTextInsert', onPropertyChange: false, value: { bool: true } });
|
|
20862
20823
|
}
|
|
20863
|
-
else if (
|
|
20824
|
+
else if (obj['prevActObj']) {
|
|
20864
20825
|
parent.notify('draw', { prop: 'setShapeTextInsert', onPropertyChange: false, value: { bool: true } });
|
|
20865
20826
|
}
|
|
20866
|
-
if (
|
|
20827
|
+
if (document.getElementById(parent.element.id + '_quickAccessToolbarArea')) {
|
|
20867
20828
|
document.getElementById(parent.element.id + '_quickAccessToolbarArea').style.display = 'none';
|
|
20868
20829
|
}
|
|
20869
20830
|
}
|
|
@@ -20884,7 +20845,7 @@ class ToolbarModule {
|
|
|
20884
20845
|
}
|
|
20885
20846
|
parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
20886
20847
|
}
|
|
20887
|
-
if (
|
|
20848
|
+
if (args.item) {
|
|
20888
20849
|
const type = args.item.id.replace(parent.element.id + '_', '').toLowerCase();
|
|
20889
20850
|
if (type === 'duplicate' || type === 'remove' || type === 'edittext') {
|
|
20890
20851
|
this.quickAccessToolbarClicked(args, true);
|
|
@@ -20894,11 +20855,11 @@ class ToolbarModule {
|
|
|
20894
20855
|
let isDisabledFilter = false;
|
|
20895
20856
|
let isDisabledAdjustment = false;
|
|
20896
20857
|
const adjustment = document.querySelector('#' + parent.element.id + '_adjustment');
|
|
20897
|
-
if (
|
|
20858
|
+
if (adjustment && adjustment.classList.contains('e-disabled')) {
|
|
20898
20859
|
isDisabledAdjustment = true;
|
|
20899
20860
|
}
|
|
20900
20861
|
const filter = document.querySelector('#' + parent.element.id + '_filter');
|
|
20901
|
-
if (
|
|
20862
|
+
if (filter && filter.classList.contains('e-disabled')) {
|
|
20902
20863
|
isDisabledFilter = true;
|
|
20903
20864
|
}
|
|
20904
20865
|
this.enableDisableTbrBtn();
|
|
@@ -20943,18 +20904,18 @@ class ToolbarModule {
|
|
|
20943
20904
|
}
|
|
20944
20905
|
}
|
|
20945
20906
|
else {
|
|
20946
|
-
panBtn =
|
|
20947
|
-
if (
|
|
20907
|
+
panBtn = parent.element.querySelector('.e-img-pan .e-btn');
|
|
20908
|
+
if (panBtn) {
|
|
20948
20909
|
panBtn.classList.add('e-selected-btn');
|
|
20949
20910
|
}
|
|
20950
20911
|
parent.pan(true);
|
|
20951
20912
|
parent.notify('transform', { prop: 'setDisablePan', onPropertyChange: false, value: { bool: false } });
|
|
20952
20913
|
}
|
|
20953
|
-
if (
|
|
20914
|
+
if (zoomIn && parent.zoomSettings.zoomFactor >= parent.zoomSettings.maxZoomFactor) {
|
|
20954
20915
|
zoomIn.classList.add('e-disabled');
|
|
20955
20916
|
zoomIn.parentElement.classList.add('e-overlay');
|
|
20956
20917
|
}
|
|
20957
|
-
else if (
|
|
20918
|
+
else if (zoomIn) {
|
|
20958
20919
|
zoomIn.classList.remove('e-disabled');
|
|
20959
20920
|
zoomIn.parentElement.classList.remove('e-overlay');
|
|
20960
20921
|
}
|
|
@@ -20969,19 +20930,6 @@ class ToolbarModule {
|
|
|
20969
20930
|
this.currentToolbar = 'main';
|
|
20970
20931
|
break;
|
|
20971
20932
|
case 'crop':
|
|
20972
|
-
if (!isNullOrUndefined(parent.currSelectionPoint)) {
|
|
20973
|
-
if (parent.currObjType.isUndoAction) {
|
|
20974
|
-
parent.notify('undo-redo', { prop: 'refreshUrc', value: { bool: null } });
|
|
20975
|
-
}
|
|
20976
|
-
if (!isNullOrUndefined(parent.cropObj.activeObj.shape)) {
|
|
20977
|
-
parent.select(parent.activeObj.shape);
|
|
20978
|
-
}
|
|
20979
|
-
this.refreshToolbar('main', true, true);
|
|
20980
|
-
getComponent(parent.element.querySelector('#' + this.parent.element.id + '_cropBtn'), 'dropdown-btn').toggle();
|
|
20981
|
-
if (!isNullOrUndefined(parent.activeObj.shape)) {
|
|
20982
|
-
document.getElementById(parent.activeObj.shape.split('-')[1]).classList.add('e-selected');
|
|
20983
|
-
}
|
|
20984
|
-
}
|
|
20985
20933
|
parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
|
|
20986
20934
|
break;
|
|
20987
20935
|
case 'reset':
|
|
@@ -21095,7 +21043,7 @@ class ToolbarModule {
|
|
|
21095
21043
|
case 'rotateright':
|
|
21096
21044
|
case 'horizontalflip':
|
|
21097
21045
|
case 'verticalflip':
|
|
21098
|
-
|
|
21046
|
+
parent.transformSelect(type);
|
|
21099
21047
|
parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
|
|
21100
21048
|
break;
|
|
21101
21049
|
case 'save':
|
|
@@ -21120,7 +21068,7 @@ class ToolbarModule {
|
|
|
21120
21068
|
}
|
|
21121
21069
|
const type = args.item.id.replace(parent.element.id, '').split('_')[1];
|
|
21122
21070
|
const imageFiltering = { filter: parent.toPascalCase(type), cancel: false };
|
|
21123
|
-
|
|
21071
|
+
parent.trigger('imageFiltering', imageFiltering);
|
|
21124
21072
|
if (imageFiltering.cancel) {
|
|
21125
21073
|
return;
|
|
21126
21074
|
}
|
|
@@ -21131,11 +21079,12 @@ class ToolbarModule {
|
|
|
21131
21079
|
this.enableDisableTbrBtn();
|
|
21132
21080
|
}
|
|
21133
21081
|
refreshShapeDrawing() {
|
|
21082
|
+
const parent = this.parent;
|
|
21134
21083
|
const object = { shape: '' };
|
|
21135
|
-
|
|
21084
|
+
parent.notify('selection', { prop: 'getCurrentDrawingShape', onPropertyChange: false, value: { obj: object } });
|
|
21136
21085
|
if (object['shape'] !== '') {
|
|
21137
|
-
|
|
21138
|
-
|
|
21086
|
+
parent.notify('selection', { prop: 'setCurrentDrawingShape', onPropertyChange: false, value: { value: '' } });
|
|
21087
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
21139
21088
|
this.refreshToolbar('main', false);
|
|
21140
21089
|
}
|
|
21141
21090
|
}
|
|
@@ -21214,9 +21163,9 @@ class ToolbarModule {
|
|
|
21214
21163
|
closeContextualToolbar() {
|
|
21215
21164
|
const parent = this.parent;
|
|
21216
21165
|
let isContextualToolbar = false;
|
|
21217
|
-
if ((
|
|
21166
|
+
if ((parent.element.querySelector('#' + parent.element.id + '_contextualToolbar') &&
|
|
21218
21167
|
!parent.element.querySelector('#' + parent.element.id + '_contextualToolbar').parentElement.classList.contains('e-hide')) ||
|
|
21219
|
-
(
|
|
21168
|
+
(parent.element.querySelector('#' + parent.element.id + '_headWrapper')
|
|
21220
21169
|
&& !parent.element.querySelector('#' + parent.element.id + '_headWrapper').parentElement.classList.contains('e-hide'))) {
|
|
21221
21170
|
parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
21222
21171
|
parent.okBtn();
|
|
@@ -21227,12 +21176,13 @@ class ToolbarModule {
|
|
|
21227
21176
|
}
|
|
21228
21177
|
destroyQuickAccessToolbar() {
|
|
21229
21178
|
const parent = this.parent;
|
|
21230
|
-
|
|
21231
|
-
|
|
21232
|
-
getComponent(
|
|
21179
|
+
const quickToolbar = document.getElementById(parent.element.id + '_quickAccessToolbar');
|
|
21180
|
+
if (quickToolbar && quickToolbar.classList.contains('e-control')) {
|
|
21181
|
+
getComponent(quickToolbar, 'toolbar').destroy();
|
|
21233
21182
|
}
|
|
21234
|
-
|
|
21235
|
-
|
|
21183
|
+
const qatArea = document.getElementById(parent.element.id + '_quickAccessToolbarArea');
|
|
21184
|
+
if (qatArea) {
|
|
21185
|
+
qatArea.style.display = 'none';
|
|
21236
21186
|
}
|
|
21237
21187
|
}
|
|
21238
21188
|
renderSlider(type) {
|
|
@@ -21245,7 +21195,7 @@ class ToolbarModule {
|
|
|
21245
21195
|
id: parent.element.id + '_headWrapper',
|
|
21246
21196
|
styles: 'position: relative'
|
|
21247
21197
|
}));
|
|
21248
|
-
labelWrapper = hdrWrapper.appendChild(
|
|
21198
|
+
labelWrapper = hdrWrapper.appendChild(parent.createElement('label', {
|
|
21249
21199
|
id: parent.element.id + '_labelWrapper',
|
|
21250
21200
|
styles: Browser.isDevice ? 'position: absolute; top: 25%; left: calc(50% - 150px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
|
|
21251
21201
|
: 'position: absolute; top: 25%; left: calc(50% - 226px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
|
|
@@ -21259,12 +21209,12 @@ class ToolbarModule {
|
|
|
21259
21209
|
id: parent.element.id + '_sliderWrapper',
|
|
21260
21210
|
styles: 'position: absolute'
|
|
21261
21211
|
}));
|
|
21262
|
-
const value =
|
|
21212
|
+
const value = parent.getCurrAdjustmentValue(type);
|
|
21263
21213
|
let min;
|
|
21264
21214
|
let max;
|
|
21265
21215
|
let slider;
|
|
21266
21216
|
if (type === 'brightness' || type === 'contrast' || type === 'saturation' || type === 'exposure') {
|
|
21267
|
-
if (
|
|
21217
|
+
if (parent.finetuneSettings) {
|
|
21268
21218
|
if (type === 'brightness' && parent.finetuneSettings.brightness) {
|
|
21269
21219
|
min = parent.finetuneSettings.brightness.min;
|
|
21270
21220
|
max = parent.finetuneSettings.brightness.max;
|
|
@@ -21277,7 +21227,7 @@ class ToolbarModule {
|
|
|
21277
21227
|
min = parent.finetuneSettings.saturation.min;
|
|
21278
21228
|
max = parent.finetuneSettings.saturation.max;
|
|
21279
21229
|
}
|
|
21280
|
-
else if (type === 'exposure' &&
|
|
21230
|
+
else if (type === 'exposure' && parent.finetuneSettings.exposure) {
|
|
21281
21231
|
min = parent.finetuneSettings.exposure.min;
|
|
21282
21232
|
max = parent.finetuneSettings.exposure.max;
|
|
21283
21233
|
}
|
|
@@ -21332,27 +21282,29 @@ class ToolbarModule {
|
|
|
21332
21282
|
width: Browser.isDevice ? '200px' : '300px',
|
|
21333
21283
|
cssClass: 'e-slider',
|
|
21334
21284
|
change: (args) => {
|
|
21335
|
-
|
|
21285
|
+
parent.setCurrAdjustmentValue(type, args.value);
|
|
21336
21286
|
this.enableDisableTbrBtn();
|
|
21337
21287
|
}
|
|
21338
21288
|
});
|
|
21339
21289
|
}
|
|
21340
21290
|
applyPreviewFilter() {
|
|
21341
|
-
|
|
21342
|
-
|
|
21343
|
-
|
|
21344
|
-
|
|
21291
|
+
const parent = this.parent;
|
|
21292
|
+
if (document.querySelector('#' + parent.element.id + '_sliderWrapper') ||
|
|
21293
|
+
parent.currObjType.isFiltered) {
|
|
21294
|
+
parent.initialAdjustmentValue = parent.canvasFilter = this.lowerContext.filter;
|
|
21295
|
+
parent.currObjType.isFiltered = false;
|
|
21345
21296
|
}
|
|
21346
21297
|
}
|
|
21347
21298
|
unselectBtn() {
|
|
21299
|
+
const parent = this.parent;
|
|
21348
21300
|
const selectors = [
|
|
21349
|
-
'#' +
|
|
21350
|
-
'#' +
|
|
21351
|
-
'#' +
|
|
21352
|
-
'#' +
|
|
21353
|
-
'#' +
|
|
21354
|
-
'#' +
|
|
21355
|
-
'#' +
|
|
21301
|
+
'#' + parent.element.id + '_brightness',
|
|
21302
|
+
'#' + parent.element.id + '_contrast',
|
|
21303
|
+
'#' + parent.element.id + '_hue',
|
|
21304
|
+
'#' + parent.element.id + '_saturation',
|
|
21305
|
+
'#' + parent.element.id + '_opacity',
|
|
21306
|
+
'#' + parent.element.id + '_blur',
|
|
21307
|
+
'#' + parent.element.id + '_exposure'
|
|
21356
21308
|
];
|
|
21357
21309
|
for (const selector of selectors) {
|
|
21358
21310
|
const element = document.querySelector(selector);
|
|
@@ -21376,68 +21328,69 @@ class ToolbarModule {
|
|
|
21376
21328
|
if (hdrWrapper) {
|
|
21377
21329
|
hdrWrapper.style.display = 'none';
|
|
21378
21330
|
}
|
|
21379
|
-
if (
|
|
21331
|
+
if (sliderWrapper && slider) {
|
|
21380
21332
|
slider.ej2_instances[0].destroy();
|
|
21381
21333
|
sliderWrapper.remove();
|
|
21382
21334
|
}
|
|
21383
21335
|
}
|
|
21384
21336
|
updateToolbarItems() {
|
|
21385
|
-
const
|
|
21386
|
-
const
|
|
21387
|
-
const
|
|
21388
|
-
const
|
|
21389
|
-
const
|
|
21390
|
-
const
|
|
21391
|
-
const
|
|
21392
|
-
const
|
|
21393
|
-
const
|
|
21394
|
-
|
|
21395
|
-
|
|
21337
|
+
const parent = this.parent;
|
|
21338
|
+
const selFillElem = parent.element.querySelector('.e-fill.e-template .e-dropdownbtn-preview');
|
|
21339
|
+
const selStrokeElem = parent.element.querySelector('.e-stroke.e-template .e-dropdownbtn-preview');
|
|
21340
|
+
const selTextStrokeElem = parent.element.querySelector('.e-text-font-color.e-template .e-dropdownbtn-preview');
|
|
21341
|
+
const selPenStrokeElem = parent.element.querySelector('.e-pen-stroke-color.e-template .e-dropdownbtn-preview');
|
|
21342
|
+
const strokeWidthElem = parent.element.querySelector('.e-shape-stroke-width');
|
|
21343
|
+
const fontFamilyElem = parent.element.querySelector('.e-text-font-family');
|
|
21344
|
+
const fontSizeElem = parent.element.querySelector('.e-text-font-size');
|
|
21345
|
+
const boldBtn = parent.element.querySelector('#' + parent.element.id + '_bold');
|
|
21346
|
+
const italicBtn = parent.element.querySelector('#' + parent.element.id + '_italic');
|
|
21347
|
+
if (isNullOrUndefined(parent.activeObj.strokeSettings.strokeWidth)) {
|
|
21348
|
+
parent.activeObj.strokeSettings.strokeWidth = 2;
|
|
21396
21349
|
}
|
|
21397
21350
|
if (selFillElem) {
|
|
21398
|
-
if (
|
|
21351
|
+
if (parent.activeObj.strokeSettings.fillColor === '') {
|
|
21399
21352
|
selFillElem.classList.add('e-nocolor-item');
|
|
21400
21353
|
}
|
|
21401
21354
|
else {
|
|
21402
21355
|
selFillElem.classList.remove('e-nocolor-item');
|
|
21403
|
-
selFillElem.style.background =
|
|
21356
|
+
selFillElem.style.background = parent.activeObj.strokeSettings.fillColor;
|
|
21404
21357
|
}
|
|
21405
|
-
getComponent(
|
|
21406
|
-
=
|
|
21358
|
+
getComponent(parent.element.id + '_shape_fill', 'colorpicker').value
|
|
21359
|
+
= parent.activeObj.strokeSettings.fillColor + 'ff';
|
|
21407
21360
|
}
|
|
21408
21361
|
if (selStrokeElem) {
|
|
21409
|
-
selStrokeElem.style.background =
|
|
21410
|
-
getComponent(
|
|
21411
|
-
=
|
|
21362
|
+
selStrokeElem.style.background = parent.activeObj.strokeSettings.strokeColor;
|
|
21363
|
+
getComponent(parent.element.id + '_shape_stroke', 'colorpicker').value
|
|
21364
|
+
= parent.activeObj.strokeSettings.strokeColor + 'ff';
|
|
21412
21365
|
}
|
|
21413
21366
|
if (selTextStrokeElem) {
|
|
21414
|
-
selTextStrokeElem.style.background =
|
|
21415
|
-
getComponent(
|
|
21416
|
-
=
|
|
21367
|
+
selTextStrokeElem.style.background = parent.activeObj.strokeSettings.strokeColor;
|
|
21368
|
+
getComponent(parent.element.id + '_text_font', 'colorpicker').value
|
|
21369
|
+
= parent.activeObj.strokeSettings.strokeColor + 'ff';
|
|
21417
21370
|
}
|
|
21418
21371
|
if (selPenStrokeElem) {
|
|
21419
|
-
selPenStrokeElem.style.background =
|
|
21420
|
-
getComponent(
|
|
21421
|
-
=
|
|
21372
|
+
selPenStrokeElem.style.background = parent.activeObj.strokeSettings.strokeColor;
|
|
21373
|
+
getComponent(parent.element.id + '_pen_stroke', 'colorpicker').value
|
|
21374
|
+
= parent.activeObj.strokeSettings.strokeColor + 'ff';
|
|
21422
21375
|
}
|
|
21423
21376
|
if (fontFamilyElem) {
|
|
21424
21377
|
if (Browser.isDevice) {
|
|
21425
|
-
fontFamilyElem.setAttribute('style', 'font-family:' +
|
|
21378
|
+
fontFamilyElem.setAttribute('style', 'font-family:' + parent.activeObj.textSettings.fontFamily.toLowerCase());
|
|
21426
21379
|
}
|
|
21427
21380
|
else {
|
|
21428
|
-
fontFamilyElem.textContent =
|
|
21381
|
+
fontFamilyElem.textContent = parent.activeObj.textSettings.fontFamily;
|
|
21429
21382
|
}
|
|
21430
21383
|
}
|
|
21431
21384
|
if (fontSizeElem) {
|
|
21432
|
-
for (let i = 0; i <
|
|
21433
|
-
if (parseInt(
|
|
21385
|
+
for (let i = 0; i < parent.fontSizeColl.length; i++) {
|
|
21386
|
+
if (parseInt(parent.fontSizeColl[i].text, 10) >= Math.round(parent.activeObj.textSettings.fontSize)) {
|
|
21434
21387
|
fontSizeElem.textContent = (i + 1).toString();
|
|
21435
21388
|
break;
|
|
21436
21389
|
}
|
|
21437
21390
|
}
|
|
21438
21391
|
}
|
|
21439
21392
|
if (boldBtn) {
|
|
21440
|
-
if (
|
|
21393
|
+
if (parent.activeObj.textSettings.bold) {
|
|
21441
21394
|
boldBtn.classList.add('e-selected-btn');
|
|
21442
21395
|
}
|
|
21443
21396
|
else {
|
|
@@ -21445,7 +21398,7 @@ class ToolbarModule {
|
|
|
21445
21398
|
}
|
|
21446
21399
|
}
|
|
21447
21400
|
if (italicBtn) {
|
|
21448
|
-
if (
|
|
21401
|
+
if (parent.activeObj.textSettings.italic) {
|
|
21449
21402
|
italicBtn.classList.add('e-selected-btn');
|
|
21450
21403
|
}
|
|
21451
21404
|
else {
|
|
@@ -21453,7 +21406,7 @@ class ToolbarModule {
|
|
|
21453
21406
|
}
|
|
21454
21407
|
}
|
|
21455
21408
|
if (strokeWidthElem) {
|
|
21456
|
-
const strokeWidth = Math.round((
|
|
21409
|
+
const strokeWidth = Math.round((parent.activeObj.strokeSettings.strokeWidth)).toString();
|
|
21457
21410
|
strokeWidthElem.textContent = this.getStrokeWidth(strokeWidth);
|
|
21458
21411
|
}
|
|
21459
21412
|
}
|
|
@@ -21483,7 +21436,7 @@ class ToolbarModule {
|
|
|
21483
21436
|
const parent = this.parent;
|
|
21484
21437
|
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: true } });
|
|
21485
21438
|
const panBtn = parent.element.querySelector('.e-img-pan .e-btn');
|
|
21486
|
-
if (
|
|
21439
|
+
if (panBtn) {
|
|
21487
21440
|
panBtn.classList.remove('e-selected-btn');
|
|
21488
21441
|
}
|
|
21489
21442
|
parent.pan(false);
|
|
@@ -21494,22 +21447,23 @@ class ToolbarModule {
|
|
|
21494
21447
|
}
|
|
21495
21448
|
}
|
|
21496
21449
|
destroySubComponents() {
|
|
21497
|
-
const
|
|
21498
|
-
const
|
|
21450
|
+
const parent = this.parent;
|
|
21451
|
+
const inputElement = parent.element.querySelectorAll('input.e-control');
|
|
21452
|
+
const btnElement = parent.element.querySelectorAll('button.e-control');
|
|
21499
21453
|
for (let i = 0, len = inputElement.length; i < len; i++) {
|
|
21500
21454
|
if (inputElement[i].classList.contains('e-color-picker')) {
|
|
21501
21455
|
getComponent(inputElement[i], 'color-picker').destroy();
|
|
21502
|
-
detach(select('input#' + inputElement[i].id,
|
|
21456
|
+
detach(select('input#' + inputElement[i].id, parent.element));
|
|
21503
21457
|
}
|
|
21504
21458
|
}
|
|
21505
21459
|
for (let i = 0, len = btnElement.length; i < len; i++) {
|
|
21506
21460
|
if (btnElement[i].classList.contains('e-dropdown-btn')) {
|
|
21507
21461
|
getComponent(btnElement[i], 'dropdown-btn').destroy();
|
|
21508
|
-
detach(select('button#' + btnElement[i].id,
|
|
21462
|
+
detach(select('button#' + btnElement[i].id, parent.element));
|
|
21509
21463
|
}
|
|
21510
21464
|
else if (btnElement[i].classList.contains('e-btn')) {
|
|
21511
21465
|
getComponent(btnElement[i], 'btn').destroy();
|
|
21512
|
-
detach(select('button#' + btnElement[i].id,
|
|
21466
|
+
detach(select('button#' + btnElement[i].id, parent.element));
|
|
21513
21467
|
}
|
|
21514
21468
|
}
|
|
21515
21469
|
}
|