@syncfusion/ej2-image-editor 22.1.34 → 22.1.36
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 +8 -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 +1004 -1059
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +1002 -1061
- 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 +8 -8
- 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 +0 -1
- package/src/image-editor/action/selection.js +55 -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 +5 -5
- 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 +34 -222
- 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,6 +6378,18 @@ 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;
|
|
@@ -6369,10 +6400,10 @@ class Selection {
|
|
|
6369
6400
|
}
|
|
6370
6401
|
updatePrivateVariables() {
|
|
6371
6402
|
const parent = this.parent;
|
|
6372
|
-
if (
|
|
6403
|
+
if (parent.lowerCanvas) {
|
|
6373
6404
|
this.lowerContext = parent.lowerCanvas.getContext('2d');
|
|
6374
6405
|
}
|
|
6375
|
-
if (
|
|
6406
|
+
if (parent.upperCanvas) {
|
|
6376
6407
|
this.upperContext = parent.upperCanvas.getContext('2d');
|
|
6377
6408
|
}
|
|
6378
6409
|
}
|
|
@@ -6483,7 +6514,7 @@ class Selection {
|
|
|
6483
6514
|
cursor = 'move';
|
|
6484
6515
|
}
|
|
6485
6516
|
}
|
|
6486
|
-
else if (
|
|
6517
|
+
else if (rotationCirclePoint && !isApply &&
|
|
6487
6518
|
x >= (rotationCirclePoint.x - (actObj.bottomCenterCircle.radius + 2)) &&
|
|
6488
6519
|
x <= rotationCirclePoint.x + (actObj.bottomCenterCircle.radius + 2) &&
|
|
6489
6520
|
y >= rotationCirclePoint.y - (actObj.bottomCenterCircle.radius + 2) &&
|
|
@@ -6585,7 +6616,7 @@ class Selection {
|
|
|
6585
6616
|
}
|
|
6586
6617
|
}
|
|
6587
6618
|
if ((parent.cursor === 'default' || parent.cursor === 'grab')
|
|
6588
|
-
&&
|
|
6619
|
+
&& parent.pointColl[0] && (parent.cursor !== 'grab' || !isCropSelection)
|
|
6589
6620
|
&& !parent.currObjType.isDragging && !parent.currObjType.isResize) {
|
|
6590
6621
|
this.setCursorForFreehandDrawing(x, y, upperCanvas);
|
|
6591
6622
|
}
|
|
@@ -6703,7 +6734,7 @@ class Selection {
|
|
|
6703
6734
|
(actObj.bottomCenterCircle.radius + 2))) {
|
|
6704
6735
|
upperCanvas.style.cursor = parent.cursor = 'se-resize';
|
|
6705
6736
|
}
|
|
6706
|
-
else if (
|
|
6737
|
+
else if (actObj.rotationCirclePointColl &&
|
|
6707
6738
|
x >= (actObj.rotationCirclePointColl.x - (actObj.bottomCenterCircle.radius + 2)) &&
|
|
6708
6739
|
x <= actObj.rotationCirclePointColl.x + (actObj.bottomCenterCircle.radius + 2) &&
|
|
6709
6740
|
y >= actObj.rotationCirclePointColl.y - (actObj.bottomCenterCircle.radius + 2) &&
|
|
@@ -6771,7 +6802,7 @@ class Selection {
|
|
|
6771
6802
|
if ((length >= 92 && length <= 182) || (length >= -178 && length <= -88)) {
|
|
6772
6803
|
const cursorMap = { 'nw-resize': 'ne-resize', 'n-resize': 's-resize',
|
|
6773
6804
|
'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'
|
|
6805
|
+
'sw-resize': 'se-resize', 's-resize': 'n-resize', 'se-resize': 'sw-resize'
|
|
6775
6806
|
};
|
|
6776
6807
|
if (parent.cursor in cursorMap) {
|
|
6777
6808
|
parent.cursor = cursorMap[parent.cursor];
|
|
@@ -6915,7 +6946,7 @@ class Selection {
|
|
|
6915
6946
|
else if (!this.isFhdEditing || parent.pointColl[n].isSelected) {
|
|
6916
6947
|
if (this.isFhdPoint || this.isFhdEditing) {
|
|
6917
6948
|
upperContext.clearRect(0, 0, upperCanvas.width, upperCanvas.height);
|
|
6918
|
-
if (
|
|
6949
|
+
if (parent.activeObj.shape && textArea.style.display === 'none') {
|
|
6919
6950
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj } });
|
|
6920
6951
|
}
|
|
6921
6952
|
}
|
|
@@ -7191,7 +7222,7 @@ class Selection {
|
|
|
7191
7222
|
if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
7192
7223
|
this.isCropSelection = true;
|
|
7193
7224
|
}
|
|
7194
|
-
if (!this.isCropSelection && this.parent.eventType !== 'resize' && isBlazor() &&
|
|
7225
|
+
if (!this.isCropSelection && this.parent.eventType !== 'resize' && isBlazor() && parent.events && this.parent.events.onShapeResizeStart.hasDelegate === true) {
|
|
7195
7226
|
shapeResizingArgs.action = 'resize-start';
|
|
7196
7227
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
7197
7228
|
parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShapeResizeStart', shapeResizingArgs).then((shapeResizingArgs) => {
|
|
@@ -8401,7 +8432,7 @@ class Selection {
|
|
|
8401
8432
|
isResize = true;
|
|
8402
8433
|
this.dragElement = parent.upperCanvas.style.cursor;
|
|
8403
8434
|
}
|
|
8404
|
-
else if (
|
|
8435
|
+
else if (rotationCirclePoint &&
|
|
8405
8436
|
x >= rotationCirclePoint.x - (actObj.topLeftCircle.radius * 2) &&
|
|
8406
8437
|
x <= rotationCirclePoint.x + (actObj.topLeftCircle.radius * 2) &&
|
|
8407
8438
|
y >= rotationCirclePoint.y - (actObj.topLeftCircle.radius * 2) &&
|
|
@@ -8711,7 +8742,7 @@ class Selection {
|
|
|
8711
8742
|
this.dragCanvas = parent.togglePan = true;
|
|
8712
8743
|
}
|
|
8713
8744
|
const imageEditorClickEventArgs = { point: this.setXYPoints(e) };
|
|
8714
|
-
if (isBlazor() &&
|
|
8745
|
+
if (isBlazor() && parent.events && parent.events.clicked.hasDelegate === true) {
|
|
8715
8746
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
8716
8747
|
parent.dotNetRef.invokeMethodAsync('ClickEventAsync', 'click', imageEditorClickEventArgs).then((imageEditorClickEventArgs) => {
|
|
8717
8748
|
this.clickEvent(imageEditorClickEventArgs, e);
|
|
@@ -8742,7 +8773,7 @@ class Selection {
|
|
|
8742
8773
|
const parent = this.parent;
|
|
8743
8774
|
const x = imageEditorClickEventArgs.point.x;
|
|
8744
8775
|
const y = imageEditorClickEventArgs.point.y;
|
|
8745
|
-
const cursor =
|
|
8776
|
+
const cursor = parent.activeObj.shape && parent.activeObj.shape === 'text' ?
|
|
8746
8777
|
parent.cursor : 'default';
|
|
8747
8778
|
if (this.currentDrawingShape !== '') {
|
|
8748
8779
|
const object = { currObj: {} };
|
|
@@ -8778,7 +8809,7 @@ class Selection {
|
|
|
8778
8809
|
this.isPan = false;
|
|
8779
8810
|
}
|
|
8780
8811
|
}
|
|
8781
|
-
if (
|
|
8812
|
+
if (parent.activeObj.shape) {
|
|
8782
8813
|
this.isObjSelected = true;
|
|
8783
8814
|
}
|
|
8784
8815
|
else {
|
|
@@ -8792,7 +8823,7 @@ class Selection {
|
|
|
8792
8823
|
const isFreehandDraw = this.isFreehandDrawTouch(e, this.isCropSelection);
|
|
8793
8824
|
const isShapeClick = isShape ? isShape : this.isShapeClick(e, this.isCropSelection);
|
|
8794
8825
|
const allowUndoRedoPush = this.applyCurrShape(isShapeClick);
|
|
8795
|
-
if (this.isTouch && !isShape &&
|
|
8826
|
+
if (this.isTouch && !isShape && activeObj.shape && !this.isCropSelection) {
|
|
8796
8827
|
if (this.applyObj(x, y)) {
|
|
8797
8828
|
parent.okBtn(true);
|
|
8798
8829
|
parent.notify('draw', { prop: 'setPrevActObj', onPropertyChange: false, value: { prevActObj: null } });
|
|
@@ -8827,11 +8858,12 @@ class Selection {
|
|
|
8827
8858
|
}
|
|
8828
8859
|
if (this.isFhdEditing) {
|
|
8829
8860
|
parent.notify('freehand-draw', { prop: 'applyFhd', onPropertyChange: false });
|
|
8861
|
+
this.isFhdCustomized = false;
|
|
8830
8862
|
if (!isBlazor()) {
|
|
8831
8863
|
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
8832
8864
|
}
|
|
8833
8865
|
}
|
|
8834
|
-
if (
|
|
8866
|
+
if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' ||
|
|
8835
8867
|
parent.activeObj.shape === 'ellipse' || parent.activeObj.shape === 'line' ||
|
|
8836
8868
|
parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path' || parent.activeObj.shape === 'text')) {
|
|
8837
8869
|
parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
|
|
@@ -8849,7 +8881,7 @@ class Selection {
|
|
|
8849
8881
|
}
|
|
8850
8882
|
else {
|
|
8851
8883
|
let isLineArrow = false;
|
|
8852
|
-
if (
|
|
8884
|
+
if (parent.activeObj.shape && (parent.activeObj.shape === 'line' ||
|
|
8853
8885
|
parent.activeObj.shape === 'arrow')) {
|
|
8854
8886
|
isLineArrow = true;
|
|
8855
8887
|
}
|
|
@@ -8905,7 +8937,7 @@ class Selection {
|
|
|
8905
8937
|
else {
|
|
8906
8938
|
if (this.isFhdEditing) {
|
|
8907
8939
|
parent.notify('freehand-draw', { prop: 'cancelFhd', value: { type: 'ok' } });
|
|
8908
|
-
if (
|
|
8940
|
+
if (document.getElementById(parent.element.id + '_quickAccessToolbarArea')) {
|
|
8909
8941
|
document.getElementById(parent.element.id + '_quickAccessToolbarArea').style.display = 'none';
|
|
8910
8942
|
}
|
|
8911
8943
|
}
|
|
@@ -9043,7 +9075,7 @@ class Selection {
|
|
|
9043
9075
|
!this.dragCanvas || parent.activeObj.activePoint !== undefined) {
|
|
9044
9076
|
if (this.dragElement === '') {
|
|
9045
9077
|
this.setCursor(x, y);
|
|
9046
|
-
if ((
|
|
9078
|
+
if ((parent.activeObj.activePoint &&
|
|
9047
9079
|
(parent.activeObj.activePoint.width === 0 || (!isNullOrUndefined(parent.activeObj.currIndex) &&
|
|
9048
9080
|
this.cursorTargetId !== parent.activeObj.currIndex)))
|
|
9049
9081
|
&& parent.cursor !== 'default' &&
|
|
@@ -9117,15 +9149,14 @@ class Selection {
|
|
|
9117
9149
|
if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
9118
9150
|
isCropSelection = true;
|
|
9119
9151
|
}
|
|
9120
|
-
if (isBlazor() &&
|
|
9152
|
+
if (isBlazor() && this.parent.eventType) {
|
|
9121
9153
|
if (this.parent.eventType === 'pan') {
|
|
9122
|
-
if (
|
|
9123
|
-
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
9154
|
+
if (parent.events && parent.events.onPanEnd.hasDelegate === true) {
|
|
9124
9155
|
parent.dotNetRef.invokeMethodAsync('PanEventAsync', 'OnPanEnd', this.parent.panEventArgs);
|
|
9125
9156
|
}
|
|
9126
9157
|
}
|
|
9127
9158
|
else if (this.parent.eventType === 'resize') {
|
|
9128
|
-
if (!this.isCropSelection &&
|
|
9159
|
+
if (!this.isCropSelection && this.parent.events && this.parent.events.onShapeResizeEnd.hasDelegate === true) {
|
|
9129
9160
|
this.shapeResizingArgs.currentShapeSettings = this.updatePrevShapeSettings();
|
|
9130
9161
|
this.shapeResizingArgs.action = 'resize-end';
|
|
9131
9162
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
@@ -9134,7 +9165,8 @@ class Selection {
|
|
|
9134
9165
|
value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
|
|
9135
9166
|
});
|
|
9136
9167
|
}
|
|
9137
|
-
else if (
|
|
9168
|
+
else if (this.shapeResizingArgs && this.selectionResizingArgs && this.parent.events &&
|
|
9169
|
+
this.parent.events.onSelectionResizeEnd.hasDelegate === true) {
|
|
9138
9170
|
const currentSelectionSettings = { type: this.parent.activeObj.shape,
|
|
9139
9171
|
startX: this.shapeResizingArgs.currentShapeSettings.startX,
|
|
9140
9172
|
startY: this.shapeResizingArgs.currentShapeSettings.startY,
|
|
@@ -9150,7 +9182,7 @@ class Selection {
|
|
|
9150
9182
|
}
|
|
9151
9183
|
}
|
|
9152
9184
|
else {
|
|
9153
|
-
if (
|
|
9185
|
+
if (this.shapeMovingArgs && this.parent.events && this.parent.events.onShapeDragEnd.hasDelegate === true) {
|
|
9154
9186
|
this.shapeMovingArgs.currentShapeSettings = this.updatePrevShapeSettings();
|
|
9155
9187
|
this.shapeMovingArgs.action = 'drag-end';
|
|
9156
9188
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
@@ -9203,7 +9235,7 @@ class Selection {
|
|
|
9203
9235
|
value: { obj: selPointCollObj } });
|
|
9204
9236
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
9205
9237
|
if (!parent.togglePen && !isCropSelection) {
|
|
9206
|
-
if (
|
|
9238
|
+
if (this.tempObjColl && parent.activeObj.activePoint.width !== 0) {
|
|
9207
9239
|
parent.objColl.push(parent.activeObj);
|
|
9208
9240
|
if (JSON.stringify(parent.activeObj.activePoint) !== JSON.stringify(this.tempActiveObj.activePoint)) {
|
|
9209
9241
|
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
@@ -9220,7 +9252,7 @@ class Selection {
|
|
|
9220
9252
|
parent.currObjType.isResize = false;
|
|
9221
9253
|
}
|
|
9222
9254
|
}
|
|
9223
|
-
if (
|
|
9255
|
+
if (parent.activeObj) {
|
|
9224
9256
|
let isCropSelection = false;
|
|
9225
9257
|
let splitWords;
|
|
9226
9258
|
if (parent.activeObj.shape !== undefined) {
|
|
@@ -9269,7 +9301,7 @@ class Selection {
|
|
|
9269
9301
|
if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
9270
9302
|
isCropSelection = true;
|
|
9271
9303
|
}
|
|
9272
|
-
if (
|
|
9304
|
+
if (parent.activeObj.shape && !isCropSelection && e.currentTarget === parent.upperCanvas &&
|
|
9273
9305
|
parent.textArea.style.display === 'none') {
|
|
9274
9306
|
if (parent.activeObj.shape === 'text') {
|
|
9275
9307
|
if (!isBlazor()) {
|
|
@@ -9306,7 +9338,7 @@ class Selection {
|
|
|
9306
9338
|
let isAdjusted = false;
|
|
9307
9339
|
const parent = this.parent;
|
|
9308
9340
|
obj = obj ? obj : parent.activeObj;
|
|
9309
|
-
if (
|
|
9341
|
+
if (obj.shape && (obj.shape === 'line' || parent.activeObj.shape === 'arrow')) {
|
|
9310
9342
|
let temp;
|
|
9311
9343
|
if ((this.dragElement === 'e-resize' && obj.activePoint.endX < obj.activePoint.startX) ||
|
|
9312
9344
|
(this.dragElement === 'w-resize' && obj.activePoint.startX > obj.activePoint.endX)) {
|
|
@@ -9337,7 +9369,7 @@ class Selection {
|
|
|
9337
9369
|
updPtCollForShpRot(obj) {
|
|
9338
9370
|
const parent = this.parent;
|
|
9339
9371
|
obj = obj ? obj : parent.activeObj;
|
|
9340
|
-
if (
|
|
9372
|
+
if (obj.shape && obj.rotatedAngle !== 0) {
|
|
9341
9373
|
parent.notify('shape', { prop: 'setPointCollForShapeRotation', onPropertyChange: false,
|
|
9342
9374
|
value: { obj: obj } });
|
|
9343
9375
|
// Updating ratio for point collection
|
|
@@ -9401,7 +9433,7 @@ class Selection {
|
|
|
9401
9433
|
if (parent.togglePen) {
|
|
9402
9434
|
return isShape;
|
|
9403
9435
|
}
|
|
9404
|
-
if (
|
|
9436
|
+
if (parent.activeObj.shape && parent.activeObj.shape === 'text' && this.isShapeInserted) {
|
|
9405
9437
|
const isTextArea = parent.textArea.style.display === 'block' ? true : false;
|
|
9406
9438
|
const activeObj = extend({}, parent.activeObj, null, true);
|
|
9407
9439
|
parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
|
|
@@ -9425,7 +9457,7 @@ class Selection {
|
|
|
9425
9457
|
parent.objColl.splice(index, 1);
|
|
9426
9458
|
}
|
|
9427
9459
|
}
|
|
9428
|
-
else if (!isShape &&
|
|
9460
|
+
else if (!isShape && activeObj.shape) {
|
|
9429
9461
|
parent.activeObj = activeObj;
|
|
9430
9462
|
const index = this.getCurrentIndex();
|
|
9431
9463
|
if ((!isNullOrUndefined(index) &&
|
|
@@ -9443,7 +9475,7 @@ class Selection {
|
|
|
9443
9475
|
const parent = this.parent;
|
|
9444
9476
|
let isShape = false;
|
|
9445
9477
|
if (e.type === 'touchstart' && !parent.togglePen) {
|
|
9446
|
-
if (
|
|
9478
|
+
if (parent.activeObj && parent.activeObj.shape === 'text') {
|
|
9447
9479
|
this.timer = setTimeout(this.setTimer.bind(this), 1000, e);
|
|
9448
9480
|
}
|
|
9449
9481
|
const isTextArea = parent.textArea.style.display === 'block' ? true : false;
|
|
@@ -9513,7 +9545,7 @@ class Selection {
|
|
|
9513
9545
|
parent.objColl.splice(index, 1);
|
|
9514
9546
|
}
|
|
9515
9547
|
}
|
|
9516
|
-
else if (
|
|
9548
|
+
else if (activeObj.shape) {
|
|
9517
9549
|
parent.activeObj = activeObj;
|
|
9518
9550
|
const index = this.getCurrentIndex();
|
|
9519
9551
|
if (!isCropSelection) {
|
|
@@ -9532,7 +9564,7 @@ class Selection {
|
|
|
9532
9564
|
applyObj(x, y) {
|
|
9533
9565
|
const parent = this.parent;
|
|
9534
9566
|
let isApply = false;
|
|
9535
|
-
if (
|
|
9567
|
+
if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse' ||
|
|
9536
9568
|
parent.activeObj.shape === 'text' || parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' ||
|
|
9537
9569
|
parent.activeObj.shape === 'path')) {
|
|
9538
9570
|
if (x >= (parent.activeObj.activePoint.startX - (parent.activeObj.topLeftCircle.radius * 2)) &&
|
|
@@ -9711,7 +9743,7 @@ class Selection {
|
|
|
9711
9743
|
let splitWords;
|
|
9712
9744
|
switch (e.key) {
|
|
9713
9745
|
case (e.ctrlKey && 's'):
|
|
9714
|
-
if (isBlazor() &&
|
|
9746
|
+
if (isBlazor() && parent.events && parent.events.saving.hasDelegate === true) {
|
|
9715
9747
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
9716
9748
|
parent.dotNetRef.invokeMethodAsync('BeforeSaveEventAsync', 'BeforeSave', beforeSave).then((args) => {
|
|
9717
9749
|
this.beforeSaveEvent(args, e);
|
|
@@ -9809,7 +9841,7 @@ class Selection {
|
|
|
9809
9841
|
e.stopPropagation();
|
|
9810
9842
|
if (e.ctrlKey === true && isInsideCanvas) {
|
|
9811
9843
|
e.preventDefault();
|
|
9812
|
-
if (!parent.isCropTab && (
|
|
9844
|
+
if (!parent.isCropTab && (parent.activeObj.shape && parent.activeObj.shape.split('-')[0] !== 'crop')) {
|
|
9813
9845
|
parent.okBtn();
|
|
9814
9846
|
if (!isBlazor()) {
|
|
9815
9847
|
parent.notify('toolbar', { prop: 'close-contextual-toolbar', onPropertyChange: false });
|
|
@@ -9832,265 +9864,85 @@ class Selection {
|
|
|
9832
9864
|
}
|
|
9833
9865
|
}
|
|
9834
9866
|
}
|
|
9835
|
-
|
|
9867
|
+
textKeyDown(e) {
|
|
9836
9868
|
const parent = this.parent;
|
|
9837
|
-
if (
|
|
9838
|
-
|
|
9869
|
+
if (String.fromCharCode(e.which) === '\r') {
|
|
9870
|
+
this.textRow += 1;
|
|
9839
9871
|
}
|
|
9840
|
-
|
|
9841
|
-
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
parent.
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9872
|
+
parent.textArea.setAttribute('rows', this.textRow.toString());
|
|
9873
|
+
parent.textArea.style.height = 'auto';
|
|
9874
|
+
parent.textArea.style.height = parent.textArea.scrollHeight + 'px';
|
|
9875
|
+
parent.notify('shape', { prop: 'setTextBoxWidth', onPropertyChange: false, value: { e: e } });
|
|
9876
|
+
if (Browser.isDevice) {
|
|
9877
|
+
parent.textArea.style.width = parseFloat(parent.textArea.style.width) + parent.textArea.style.fontSize + 'px';
|
|
9878
|
+
}
|
|
9879
|
+
const rows = parent.textArea.value.split('\n');
|
|
9880
|
+
this.textRow = rows.length;
|
|
9881
|
+
parent.textArea.setAttribute('rows', this.textRow.toString());
|
|
9882
|
+
this.isInitialTextEdited = false;
|
|
9883
|
+
}
|
|
9884
|
+
clearSelection() {
|
|
9885
|
+
const parent = this.parent;
|
|
9886
|
+
if (!parent.disabled && parent.isImageLoaded) {
|
|
9887
|
+
parent.togglePen = false;
|
|
9888
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
9889
|
+
this.dragElement = '';
|
|
9890
|
+
this.dragPoint.startX = this.dragPoint.startY = this.dragPoint.endX = this.dragPoint.endY = 0;
|
|
9891
|
+
parent.currObjType.shape = '';
|
|
9892
|
+
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
9893
|
+
parent.currObjType.isActiveObj = true;
|
|
9894
|
+
parent.currObjType.isCustomCrop = false;
|
|
9895
|
+
parent.upperCanvas.style.cursor = parent.cursor = 'default';
|
|
9896
|
+
}
|
|
9897
|
+
}
|
|
9898
|
+
setDragDirection(width, height) {
|
|
9899
|
+
const arcRadius = (7.5);
|
|
9900
|
+
const parent = this.parent;
|
|
9901
|
+
if (parent.img.destWidth > parent.img.destHeight) {
|
|
9902
|
+
parent.activeObj.activePoint.startX = this.dragPoint.startX = ((width / 2) - (height / 2))
|
|
9903
|
+
+ arcRadius;
|
|
9904
|
+
parent.activeObj.activePoint.startY = this.dragPoint.startY = ((height / 2) - (height / 2))
|
|
9905
|
+
+ arcRadius;
|
|
9906
|
+
parent.activeObj.activePoint.endX = ((width / 2) + (height / 2)) - arcRadius;
|
|
9907
|
+
parent.activeObj.activePoint.endY = ((height / 2) + (height / 2)) - arcRadius;
|
|
9908
|
+
}
|
|
9909
|
+
else {
|
|
9910
|
+
parent.activeObj.activePoint.startY = this.dragPoint.startX = ((height / 2) - (width) / 2)
|
|
9911
|
+
+ arcRadius;
|
|
9912
|
+
parent.activeObj.activePoint.endY = ((height / 2) + (width) / 2) - arcRadius;
|
|
9913
|
+
parent.activeObj.activePoint.startX = this.dragPoint.startX = arcRadius;
|
|
9914
|
+
parent.activeObj.activePoint.endX = width - arcRadius;
|
|
9915
|
+
}
|
|
9916
|
+
}
|
|
9917
|
+
calcShapeRatio(x, y, imgWidth, imgHeight) {
|
|
9918
|
+
const parent = this.parent;
|
|
9919
|
+
const arcRadius = (7.5);
|
|
9920
|
+
const originalWidth = imgWidth;
|
|
9921
|
+
const originalHeight = imgHeight;
|
|
9922
|
+
const presetRatio = x / y;
|
|
9923
|
+
const standardSize = originalWidth >= originalHeight ? originalWidth : originalHeight;
|
|
9924
|
+
let width = standardSize * presetRatio;
|
|
9925
|
+
let height = standardSize;
|
|
9926
|
+
const scaleWidth = this.getScale(width, originalWidth);
|
|
9927
|
+
const snippetArray = [];
|
|
9928
|
+
for (let i = 0; i < 2; i++) {
|
|
9929
|
+
if (i === 0) {
|
|
9930
|
+
snippetArray.push(width * scaleWidth);
|
|
9849
9931
|
}
|
|
9850
9932
|
else {
|
|
9851
|
-
|
|
9933
|
+
snippetArray.push(height * scaleWidth);
|
|
9852
9934
|
}
|
|
9853
9935
|
}
|
|
9854
|
-
|
|
9855
|
-
|
|
9856
|
-
|
|
9936
|
+
width = snippetArray[0];
|
|
9937
|
+
height = snippetArray[1];
|
|
9938
|
+
const scaleHeight = this.getScale(height, originalHeight);
|
|
9939
|
+
const snippetArray1 = [];
|
|
9940
|
+
for (let i = 0; i < 2; i++) {
|
|
9941
|
+
if (i === 0) {
|
|
9942
|
+
snippetArray1.push(width * scaleHeight);
|
|
9857
9943
|
}
|
|
9858
9944
|
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);
|
|
9945
|
+
snippetArray1.push(height * scaleHeight);
|
|
10094
9946
|
}
|
|
10095
9947
|
}
|
|
10096
9948
|
width = snippetArray1[0];
|
|
@@ -10240,7 +10092,7 @@ class Selection {
|
|
|
10240
10092
|
x <= (actObj.activePoint.endX + (actObj.topLeftCircle.radius * 2)) &&
|
|
10241
10093
|
y >= (actObj.activePoint.startY - (actObj.topLeftCircle.radius * 2)) &&
|
|
10242
10094
|
y <= (actObj.activePoint.endY + (actObj.topLeftCircle.radius * 2))) ||
|
|
10243
|
-
(
|
|
10095
|
+
(rotationCirclePoint &&
|
|
10244
10096
|
x >= (rotationCirclePoint.x - (actObj.topLeftCircle.radius * 2)) &&
|
|
10245
10097
|
x <= (rotationCirclePoint.x + (actObj.topLeftCircle.radius * 2)) &&
|
|
10246
10098
|
y >= (rotationCirclePoint.y - (actObj.topLeftCircle.radius * 2)) &&
|
|
@@ -10287,7 +10139,7 @@ class Selection {
|
|
|
10287
10139
|
value: { context: this.lowerContext, points: null } });
|
|
10288
10140
|
}
|
|
10289
10141
|
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
10290
|
-
if ((
|
|
10142
|
+
if ((parent.currSelectionPoint && parent.currSelectionPoint.shape === 'crop-circle') || parent.isCircleCrop) {
|
|
10291
10143
|
parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
|
|
10292
10144
|
value: { context: this.lowerContext, isSave: null, isFlip: null } });
|
|
10293
10145
|
}
|
|
@@ -10314,7 +10166,7 @@ class Selection {
|
|
|
10314
10166
|
this.isCropSelection = true;
|
|
10315
10167
|
}
|
|
10316
10168
|
if (!this.isCropSelection && isBlazor() && isNullOrUndefined(this.parent.eventType) &&
|
|
10317
|
-
|
|
10169
|
+
parent.events && parent.events.shapeChanging.hasDelegate === true) {
|
|
10318
10170
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
10319
10171
|
parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs).then((shapeChangingArgs) => {
|
|
10320
10172
|
this.shapeEvent(shapeChangingArgs);
|
|
@@ -10336,7 +10188,7 @@ class Selection {
|
|
|
10336
10188
|
startY: shapeChangingArgs.currentShapeSettings.startY,
|
|
10337
10189
|
width: shapeChangingArgs.currentShapeSettings.width,
|
|
10338
10190
|
height: shapeChangingArgs.currentShapeSettings.height } };
|
|
10339
|
-
if (isBlazor() &&
|
|
10191
|
+
if (isBlazor() && parent.events && parent.events.onSelectionResizeStart.hasDelegate === true) {
|
|
10340
10192
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
10341
10193
|
parent.dotNetRef.invokeMethodAsync('SelectionEventAsync', 'OnSelectionResizeStart', selectionChangingArgs).then((selectionChangingArgs) => {
|
|
10342
10194
|
shapeChangingArgs.currentShapeSettings.startX = selectionChangingArgs.currentSelectionSettings.startX;
|
|
@@ -10405,7 +10257,7 @@ class Selection {
|
|
|
10405
10257
|
getDistance(a, b) {
|
|
10406
10258
|
let x = 0;
|
|
10407
10259
|
let y = 0;
|
|
10408
|
-
if (
|
|
10260
|
+
if (a && b) {
|
|
10409
10261
|
x = a.x - b.x;
|
|
10410
10262
|
y = a.y - b.y;
|
|
10411
10263
|
}
|
|
@@ -10523,7 +10375,7 @@ class Selection {
|
|
|
10523
10375
|
}
|
|
10524
10376
|
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
10525
10377
|
this.lowerContext.filter = tempFilter;
|
|
10526
|
-
if (
|
|
10378
|
+
if (parent.activeObj.shape) {
|
|
10527
10379
|
parent.notify('shape', { prop: 'apply', onPropertyChange: false,
|
|
10528
10380
|
value: { shape: null, obj: null, canvas: null } });
|
|
10529
10381
|
}
|
|
@@ -11018,6 +10870,9 @@ class Shape {
|
|
|
11018
10870
|
case 'updateArrowRatio':
|
|
11019
10871
|
this.updateArrowRatio(args.value['obj']);
|
|
11020
10872
|
break;
|
|
10873
|
+
case 'getSquarePointForRotatedShape':
|
|
10874
|
+
this.getSquarePointForRotatedShape(args.value['obj'], args.value['object']);
|
|
10875
|
+
break;
|
|
11021
10876
|
case 'reset':
|
|
11022
10877
|
this.reset();
|
|
11023
10878
|
break;
|
|
@@ -11041,30 +10896,41 @@ class Shape {
|
|
|
11041
10896
|
}
|
|
11042
10897
|
drawEllipse(x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor) {
|
|
11043
10898
|
this.initializeShape('ellipse');
|
|
11044
|
-
const start = { x: x, y: y };
|
|
10899
|
+
const start = x && y ? { x: x, y: y } : null;
|
|
11045
10900
|
this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY);
|
|
11046
10901
|
}
|
|
11047
10902
|
drawLine(startX, startY, endX, endY, strokeWidth, strokeColor) {
|
|
11048
10903
|
this.initializeShape('line');
|
|
11049
|
-
const start = { x: startX, y: startY };
|
|
10904
|
+
const start = startX && startY ? { x: startX, y: startY } : null;
|
|
11050
10905
|
const width = endX - startX;
|
|
11051
10906
|
const height = endY - startY;
|
|
11052
10907
|
this.drawShape('line', strokeWidth, strokeColor, null, start, width, height);
|
|
11053
10908
|
}
|
|
11054
10909
|
drawPath(pointColl, strokeWidth, strokeColor) {
|
|
11055
10910
|
this.initializeShape('path');
|
|
11056
|
-
|
|
10911
|
+
if (pointColl) {
|
|
10912
|
+
this.drawShape('path', strokeWidth, strokeColor, null, null, null, null, pointColl);
|
|
10913
|
+
}
|
|
10914
|
+
else {
|
|
10915
|
+
this.drawShape('line', strokeWidth, strokeColor, null, null, null, null);
|
|
10916
|
+
const obj = extend({}, this.parent.objColl[this.parent.objColl.length - 1], null, true);
|
|
10917
|
+
obj.shape = 'path';
|
|
10918
|
+
obj.lineDraw = null;
|
|
10919
|
+
obj.pointColl = [{ x: obj.activePoint.startX, y: obj.activePoint.startY },
|
|
10920
|
+
{ x: obj.activePoint.endX, y: obj.activePoint.endY }];
|
|
10921
|
+
this.parent.objColl[this.parent.objColl.length - 1] = obj;
|
|
10922
|
+
}
|
|
11057
10923
|
}
|
|
11058
10924
|
drawArrow(startX, startY, endX, endY, strokeWidth, strokeColor, arrowStart, arrowEnd) {
|
|
11059
10925
|
this.initializeShape('arrow');
|
|
11060
|
-
const start = { x: startX, y: startY };
|
|
10926
|
+
const start = startX && startY ? { x: startX, y: startY } : null;
|
|
11061
10927
|
const width = endX - startX;
|
|
11062
10928
|
const height = endY - startY;
|
|
11063
10929
|
this.drawShape('arrow', strokeWidth, strokeColor, null, start, width, height, null, arrowStart, arrowEnd);
|
|
11064
10930
|
}
|
|
11065
10931
|
drawRectangle(x, y, width, height, strokeWidth, strokeColor, fillColor) {
|
|
11066
10932
|
this.initializeShape('rectangle');
|
|
11067
|
-
const start = { x: x, y: y };
|
|
10933
|
+
const start = x && y ? { x: x, y: y } : null;
|
|
11068
10934
|
this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height);
|
|
11069
10935
|
}
|
|
11070
10936
|
drawText(x, y, text, fontFamily, fontSize, bold, italic, color) {
|
|
@@ -11225,7 +11091,7 @@ class Shape {
|
|
|
11225
11091
|
const parent = this.parent;
|
|
11226
11092
|
if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow') {
|
|
11227
11093
|
parent.activeObj.pointColl = this.getLinePoints(parent.activeObj.activePoint.startX, parent.activeObj.activePoint.startY, parent.activeObj.activePoint.endX, parent.activeObj.activePoint.endY);
|
|
11228
|
-
if (
|
|
11094
|
+
if (parent.activeObj.pointColl) {
|
|
11229
11095
|
for (let i = 0, len = parent.activeObj.pointColl.length; i < len; i++) {
|
|
11230
11096
|
parent.activeObj.pointColl[i].ratioX = (parent.activeObj.pointColl[i].x -
|
|
11231
11097
|
parent.img.destLeft) / parent.img.destWidth;
|
|
@@ -12347,7 +12213,7 @@ class Shape {
|
|
|
12347
12213
|
this.upperContext.clearRect(0, 0, this.parent.upperCanvas.width, this.parent.upperCanvas.height);
|
|
12348
12214
|
this.lowerContext.clearRect(0, 0, this.parent.upperCanvas.width, this.parent.upperCanvas.height);
|
|
12349
12215
|
parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
|
|
12350
|
-
if ((
|
|
12216
|
+
if ((parent.currSelectionPoint && parent.currSelectionPoint.shape === 'crop-circle') || parent.isCircleCrop) {
|
|
12351
12217
|
parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
|
|
12352
12218
|
value: { context: this.lowerContext, isSave: null, isFlip: null } });
|
|
12353
12219
|
}
|
|
@@ -13063,8 +12929,8 @@ class Shape {
|
|
|
13063
12929
|
}
|
|
13064
12930
|
isPointsInRange(x, y, obj) {
|
|
13065
12931
|
let inRange = false;
|
|
13066
|
-
if (!isNullOrUndefined(x) && !isNullOrUndefined(y) && x >=
|
|
13067
|
-
x <= this.parent.
|
|
12932
|
+
if (!isNullOrUndefined(x) && !isNullOrUndefined(y) && x >= this.parent.img.destLeft && y >= this.parent.img.destTop &&
|
|
12933
|
+
x <= this.parent.img.destLeft + this.parent.img.destWidth && y <= this.parent.img.destTop + this.parent.img.destHeight) {
|
|
13068
12934
|
inRange = true;
|
|
13069
12935
|
}
|
|
13070
12936
|
obj['inRange'] = inRange;
|
|
@@ -13221,8 +13087,10 @@ class Shape {
|
|
|
13221
13087
|
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
13222
13088
|
}
|
|
13223
13089
|
parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
|
|
13090
|
+
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
13224
13091
|
}
|
|
13225
13092
|
else {
|
|
13093
|
+
parent.updateToolbar(parent.element, parent.activeObj.shape);
|
|
13226
13094
|
if (parent.activeObj.shape === 'path') {
|
|
13227
13095
|
parent.updateToolbar(this.parent.element, 'path', 'pathQuickAccessToolbar');
|
|
13228
13096
|
}
|
|
@@ -13244,8 +13112,13 @@ class Shape {
|
|
|
13244
13112
|
isSelected = true;
|
|
13245
13113
|
parent.notify('freehand-draw', { prop: 'selectFhd', value: { id: id } });
|
|
13246
13114
|
if (!isBlazor()) {
|
|
13115
|
+
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
|
|
13247
13116
|
parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
|
|
13248
13117
|
}
|
|
13118
|
+
else {
|
|
13119
|
+
parent.updateToolbar(parent.element, 'pen');
|
|
13120
|
+
parent.updateToolbar(parent.element, 'quickAccessToolbar', 'pen');
|
|
13121
|
+
}
|
|
13249
13122
|
}
|
|
13250
13123
|
else {
|
|
13251
13124
|
isSelected = false;
|
|
@@ -13461,6 +13334,73 @@ class Shape {
|
|
|
13461
13334
|
}
|
|
13462
13335
|
}
|
|
13463
13336
|
}
|
|
13337
|
+
getSquarePointForRotatedShape(obj, object) {
|
|
13338
|
+
const point = { startX: 0, startY: 0, endX: 0, endY: 0, width: 0, height: 0 };
|
|
13339
|
+
const center = { x: obj.activePoint.startX + (obj.activePoint.width / 2), y: obj.activePoint.startY +
|
|
13340
|
+
(obj.activePoint.height / 2) };
|
|
13341
|
+
const p1 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.startX - center.x) - Math.sin(obj.rotatedAngle)
|
|
13342
|
+
* (obj.activePoint.startY - center.y) + center.x,
|
|
13343
|
+
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.startX - center.x) + Math.cos(obj.rotatedAngle) * (obj.activePoint.startY
|
|
13344
|
+
- center.y) + center.y };
|
|
13345
|
+
const p2 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.endX - center.x) - Math.sin(obj.rotatedAngle) *
|
|
13346
|
+
(obj.activePoint.startY - center.y) + center.x,
|
|
13347
|
+
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.endX - center.x) + Math.cos(obj.rotatedAngle) * (obj.activePoint.startY
|
|
13348
|
+
- center.y) + center.y };
|
|
13349
|
+
const p3 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.startX - center.x) - Math.sin(obj.rotatedAngle) *
|
|
13350
|
+
(obj.activePoint.endY - center.y) + center.x,
|
|
13351
|
+
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.startX - center.x) + Math.cos(obj.rotatedAngle) * (obj.activePoint.endY
|
|
13352
|
+
- center.y) + center.y };
|
|
13353
|
+
const p4 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.endX - center.x) - Math.sin(obj.rotatedAngle) *
|
|
13354
|
+
(obj.activePoint.endY - center.y) + center.x,
|
|
13355
|
+
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.endX - center.x) + Math.cos(obj.rotatedAngle) *
|
|
13356
|
+
(obj.activePoint.endY - center.y) + center.y };
|
|
13357
|
+
point.startX = p1.x;
|
|
13358
|
+
point.startY = p1.y;
|
|
13359
|
+
point.endX = p1.x;
|
|
13360
|
+
point.endY = p1.y;
|
|
13361
|
+
if (point.startX > p2.x) {
|
|
13362
|
+
point.startX = p2.x;
|
|
13363
|
+
}
|
|
13364
|
+
if (point.startX > p3.x) {
|
|
13365
|
+
point.startX = p3.x;
|
|
13366
|
+
}
|
|
13367
|
+
if (point.startX > p4.x) {
|
|
13368
|
+
point.startX = p4.x;
|
|
13369
|
+
}
|
|
13370
|
+
if (point.startY > p2.y) {
|
|
13371
|
+
point.startY = p2.y;
|
|
13372
|
+
}
|
|
13373
|
+
if (point.startY > p3.y) {
|
|
13374
|
+
point.startY = p3.y;
|
|
13375
|
+
}
|
|
13376
|
+
if (point.startY > p4.y) {
|
|
13377
|
+
point.startY = p4.y;
|
|
13378
|
+
}
|
|
13379
|
+
if (point.endX < p2.x) {
|
|
13380
|
+
point.endX = p2.x;
|
|
13381
|
+
}
|
|
13382
|
+
if (point.endX < p3.x) {
|
|
13383
|
+
point.endX = p3.x;
|
|
13384
|
+
}
|
|
13385
|
+
if (point.endX < p4.x) {
|
|
13386
|
+
point.endX = p4.x;
|
|
13387
|
+
}
|
|
13388
|
+
if (point.endY < p2.y) {
|
|
13389
|
+
point.endY = p2.y;
|
|
13390
|
+
}
|
|
13391
|
+
if (point.endY < p3.y) {
|
|
13392
|
+
point.endY = p3.y;
|
|
13393
|
+
}
|
|
13394
|
+
if (point.endY < p4.y) {
|
|
13395
|
+
point.endY = p4.y;
|
|
13396
|
+
}
|
|
13397
|
+
point.width = point.endX - point.startX;
|
|
13398
|
+
point.height = point.endY - point.startY;
|
|
13399
|
+
if (object) {
|
|
13400
|
+
object['activePoint'] = point;
|
|
13401
|
+
}
|
|
13402
|
+
return point;
|
|
13403
|
+
}
|
|
13464
13404
|
}
|
|
13465
13405
|
|
|
13466
13406
|
class Transform {
|
|
@@ -13638,7 +13578,7 @@ class Transform {
|
|
|
13638
13578
|
const parent = this.parent;
|
|
13639
13579
|
const transitionArgs = { cancel: false, previousDegree: parent.transform.degree,
|
|
13640
13580
|
currentDegree: Math.abs(parent.transform.degree + degree) === 360 ? 0 : parent.transform.degree + degree };
|
|
13641
|
-
if (!this.isPreventSelect && isBlazor() &&
|
|
13581
|
+
if (!this.isPreventSelect && isBlazor() && parent.events && parent.events.rotating.hasDelegate === true) {
|
|
13642
13582
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
13643
13583
|
parent.dotNetRef.invokeMethodAsync('RotateEventAsync', 'OnRotate', transitionArgs).then((args) => {
|
|
13644
13584
|
this.rotateEvent(args, degree);
|
|
@@ -13670,7 +13610,7 @@ class Transform {
|
|
|
13670
13610
|
parent.afterCropActions.push(degree === 90 ? 'rotateRight' : 'rotateLeft');
|
|
13671
13611
|
let splitWords = [];
|
|
13672
13612
|
let activeObjShape;
|
|
13673
|
-
if (
|
|
13613
|
+
if (parent.activeObj.activePoint && parent.activeObj.shape) {
|
|
13674
13614
|
if (parent.activeObj.shape !== undefined) {
|
|
13675
13615
|
splitWords = parent.activeObj.shape.split('-');
|
|
13676
13616
|
}
|
|
@@ -13823,7 +13763,7 @@ class Transform {
|
|
|
13823
13763
|
const parent = this.parent;
|
|
13824
13764
|
const transitionArgs = { direction: direction, cancel: false,
|
|
13825
13765
|
previousDirection: parent.toPascalCase(parent.transform.currFlipState) };
|
|
13826
|
-
if (!this.isPreventSelect && isBlazor() &&
|
|
13766
|
+
if (!this.isPreventSelect && isBlazor() && parent.events && parent.events.flipping.hasDelegate === true) {
|
|
13827
13767
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
13828
13768
|
parent.dotNetRef.invokeMethodAsync('FlipEventAsync', 'OnFlip', transitionArgs).then((args) => {
|
|
13829
13769
|
this.flipEvent(args, direction);
|
|
@@ -13961,7 +13901,7 @@ class Transform {
|
|
|
13961
13901
|
parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
|
|
13962
13902
|
value: { context: this.lowerContext, isSave: null, isFlip: null } });
|
|
13963
13903
|
}
|
|
13964
|
-
if (
|
|
13904
|
+
if (activeObjShape) {
|
|
13965
13905
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
13966
13906
|
parent.activeObj = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
|
|
13967
13907
|
parent.objColl.pop();
|
|
@@ -14092,13 +14032,13 @@ class Transform {
|
|
|
14092
14032
|
this.tempActiveObj = extend({}, parent.activeObj, {}, true);
|
|
14093
14033
|
parent.isCropTab = true;
|
|
14094
14034
|
}
|
|
14095
|
-
else if (
|
|
14035
|
+
else if (parent.activeObj.shape && splitWords[0] !== 'crop') {
|
|
14096
14036
|
this.isShape = true;
|
|
14097
14037
|
}
|
|
14098
14038
|
const obj = { zoomType: null };
|
|
14099
14039
|
parent.notify('selection', { prop: 'getZoomType', onPropertyChange: false, value: { obj: obj } });
|
|
14100
14040
|
if (isNullOrUndefined(zoomPoint)) {
|
|
14101
|
-
if (parent.isCropTab &&
|
|
14041
|
+
if (parent.isCropTab && this.tempActiveObj) {
|
|
14102
14042
|
zoomPoint = { x: parent.activeObj.activePoint.startX + (parent.activeObj.activePoint.width / 2),
|
|
14103
14043
|
y: parent.activeObj.activePoint.startY + (parent.activeObj.activePoint.height / 2) };
|
|
14104
14044
|
}
|
|
@@ -14112,7 +14052,7 @@ class Transform {
|
|
|
14112
14052
|
const previousZoomFactor = parent.zoomSettings.zoomFactor - (zoomFactor * 10);
|
|
14113
14053
|
const zoomEventArgs = { zoomPoint: zoomPoint, cancel: false, previousZoomFactor: previousZoomFactor,
|
|
14114
14054
|
currentZoomFactor: parent.zoomSettings.zoomFactor, zoomTrigger: obj['zoomType'] };
|
|
14115
|
-
if (!parent.isCropToolbar && isBlazor() &&
|
|
14055
|
+
if (!parent.isCropToolbar && isBlazor() && parent.events && parent.events.zooming.hasDelegate === true) {
|
|
14116
14056
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
14117
14057
|
parent.dotNetRef.invokeMethodAsync('ZoomEventAsync', 'OnZoom', zoomEventArgs).then((args) => {
|
|
14118
14058
|
this.zoomEvent(args, zoomFactor);
|
|
@@ -14249,7 +14189,7 @@ class Transform {
|
|
|
14249
14189
|
}
|
|
14250
14190
|
}
|
|
14251
14191
|
this.autoEnablePan();
|
|
14252
|
-
if (
|
|
14192
|
+
if (this.tempActiveObj) {
|
|
14253
14193
|
parent.activeObj = extend({}, this.tempActiveObj, {}, true);
|
|
14254
14194
|
}
|
|
14255
14195
|
if (parent.activeObj.shape === 'crop-custom') {
|
|
@@ -14555,7 +14495,7 @@ class Transform {
|
|
|
14555
14495
|
const obj = { panDown: null };
|
|
14556
14496
|
parent.notify('selection', { prop: 'getPanDown', onPropertyChange: false, value: { obj: obj } });
|
|
14557
14497
|
const panEventArgs = { startPoint: obj['panDown'], endPoint: this.panMove, cancel: false };
|
|
14558
|
-
if (isBlazor() && isNullOrUndefined(this.parent.eventType) &&
|
|
14498
|
+
if (isBlazor() && isNullOrUndefined(this.parent.eventType) && parent.events && parent.events.onPanStart.hasDelegate === true) {
|
|
14559
14499
|
this.parent.eventType = 'pan';
|
|
14560
14500
|
this.parent.panEventArgs = panEventArgs;
|
|
14561
14501
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
@@ -14769,7 +14709,7 @@ class Transform {
|
|
|
14769
14709
|
const tempDegree = parent.transform.degree;
|
|
14770
14710
|
let rotatePanActiveObj;
|
|
14771
14711
|
const object = { selPointColl: null };
|
|
14772
|
-
if (
|
|
14712
|
+
if (parent.activeObj.activePoint && parent.activeObj.shape) {
|
|
14773
14713
|
rotatePanActiveObj = extend({}, parent.activeObj, {}, true);
|
|
14774
14714
|
}
|
|
14775
14715
|
const tempObjColl = extend([], parent.objColl, [], true);
|
|
@@ -14840,7 +14780,7 @@ class Transform {
|
|
|
14840
14780
|
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
14841
14781
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
14842
14782
|
parent.activeObj = extend({}, rotatePanActiveObj, {}, true);
|
|
14843
|
-
if (
|
|
14783
|
+
if (parent.activeObj.activePoint) {
|
|
14844
14784
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj, isCropRatio: null,
|
|
14845
14785
|
points: null, isPreventDrag: true, saveContext: null, isPreventSelection: null } });
|
|
14846
14786
|
}
|
|
@@ -15008,38 +14948,218 @@ class Transform {
|
|
|
15008
14948
|
update() {
|
|
15009
14949
|
const parent = this.parent;
|
|
15010
14950
|
let toolbarHeight = 0;
|
|
14951
|
+
let isActiveObj = false;
|
|
14952
|
+
const freehandObj = { bool: false };
|
|
14953
|
+
if (parent.isImageLoaded) {
|
|
14954
|
+
if ((parent.element.querySelector('#' + parent.element.id + '_contextualToolbar') &&
|
|
14955
|
+
!parent.element.querySelector('#' + parent.element.id + '_contextualToolbar').parentElement.classList.contains('e-hide')) ||
|
|
14956
|
+
(parent.element.querySelector('#' + parent.element.id + '_headWrapper')
|
|
14957
|
+
&& !parent.element.querySelector('#' + parent.element.id + '_headWrapper').parentElement.classList.contains('e-hide'))) {
|
|
14958
|
+
parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
14959
|
+
parent.okBtn();
|
|
14960
|
+
if (!isBlazor()) {
|
|
14961
|
+
parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
|
|
14962
|
+
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
14963
|
+
}
|
|
14964
|
+
else {
|
|
14965
|
+
parent.updateToolbar(parent.element, 'imageLoaded');
|
|
14966
|
+
}
|
|
14967
|
+
}
|
|
14968
|
+
parent.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: freehandObj } });
|
|
14969
|
+
if (freehandObj['bool']) {
|
|
14970
|
+
if (!isBlazor()) {
|
|
14971
|
+
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
14972
|
+
}
|
|
14973
|
+
else {
|
|
14974
|
+
parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
|
|
14975
|
+
}
|
|
14976
|
+
}
|
|
14977
|
+
if (parent.activeObj.shape !== undefined) {
|
|
14978
|
+
isActiveObj = true;
|
|
14979
|
+
if (parent.textArea.style.display === 'block') {
|
|
14980
|
+
parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
|
|
14981
|
+
value: { x: null, y: null, isMouseDown: null } });
|
|
14982
|
+
if (!isBlazor()) {
|
|
14983
|
+
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
14984
|
+
}
|
|
14985
|
+
else {
|
|
14986
|
+
parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
|
|
14987
|
+
}
|
|
14988
|
+
}
|
|
14989
|
+
else {
|
|
14990
|
+
parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
|
|
14991
|
+
parent.objColl.push(parent.activeObj);
|
|
14992
|
+
}
|
|
14993
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
14994
|
+
}
|
|
14995
|
+
}
|
|
14996
|
+
const tempFilter = this.lowerContext.filter;
|
|
15011
14997
|
const canvasWrapper = document.querySelector('#' + parent.element.id + '_canvasWrapper');
|
|
15012
|
-
if (
|
|
14998
|
+
if (canvasWrapper) {
|
|
15013
14999
|
canvasWrapper.style.width = parent.element.offsetWidth - 2 + 'px';
|
|
15014
15000
|
}
|
|
15015
15001
|
parent.lowerCanvas.width = parent.upperCanvas.width = parent.element.offsetWidth - 2;
|
|
15016
|
-
if (
|
|
15017
|
-
parent.
|
|
15002
|
+
if (parent.toolbarTemplate) {
|
|
15003
|
+
toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
|
|
15018
15004
|
}
|
|
15019
15005
|
else if (parent.element.querySelector('#' + parent.element.id + '_toolbar')) {
|
|
15020
15006
|
toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbar').clientHeight;
|
|
15021
|
-
parent.notify('toolbar', { prop: 'setToolbarHeight', value: { height: toolbarHeight } });
|
|
15022
15007
|
}
|
|
15008
|
+
parent.notify('toolbar', { prop: 'setToolbarHeight', value: { height: toolbarHeight } });
|
|
15023
15009
|
if (Browser.isDevice) {
|
|
15024
|
-
if (
|
|
15010
|
+
if (canvasWrapper) {
|
|
15025
15011
|
canvasWrapper.style.height = parent.element.offsetHeight - (2 * toolbarHeight) - 5 + 'px';
|
|
15026
15012
|
}
|
|
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';
|
|
15013
|
+
parent.lowerCanvas.height = parent.upperCanvas.height = parent.element.offsetHeight - (2 * toolbarHeight) - 5;
|
|
15014
|
+
}
|
|
15015
|
+
else {
|
|
15016
|
+
if (canvasWrapper) {
|
|
15017
|
+
canvasWrapper.style.height = parent.element.offsetHeight - toolbarHeight - 3 + 'px';
|
|
15018
|
+
}
|
|
15019
|
+
parent.lowerCanvas.height = parent.upperCanvas.height = parent.element.offsetHeight - toolbarHeight - 3;
|
|
15020
|
+
}
|
|
15021
|
+
this.lowerContext.filter =
|
|
15022
|
+
'brightness(' + 1 + ') ' + 'contrast(' + 100 + '%) ' + 'hue-rotate(' + 0 + 'deg) ' +
|
|
15023
|
+
'saturate(' + 100 + '%) ' + 'opacity(' + 1 + ') ' + 'blur(' + 0 + 'px) ' + 'sepia(0%) ' + 'grayscale(0%) ' + 'invert(0%)';
|
|
15024
|
+
parent.notify('filter', { prop: 'setAdjustmentValue', onPropertyChange: false, value: { adjustmentValue: this.lowerContext.filter } });
|
|
15025
|
+
parent.canvasFilter = this.lowerContext.filter;
|
|
15026
|
+
this.parent.initialAdjustmentValue = this.lowerContext.filter;
|
|
15027
|
+
parent.clearContext(this.lowerContext);
|
|
15028
|
+
this.parent.clearContext(this.upperContext);
|
|
15029
|
+
if (parent.isImageLoaded) {
|
|
15030
|
+
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: null } });
|
|
15031
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
15032
|
+
this.lowerContext.filter = tempFilter;
|
|
15033
|
+
parent.initialAdjustmentValue = tempFilter;
|
|
15034
|
+
if (parent.isImageLoaded) {
|
|
15035
|
+
showSpinner(parent.element);
|
|
15036
|
+
parent.element.style.opacity = '0.5';
|
|
15037
|
+
}
|
|
15038
|
+
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
15039
|
+
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
15040
|
+
if (canvasWrapper) {
|
|
15041
|
+
canvasWrapper.style.width = parent.element.offsetWidth - 2 + 'px';
|
|
15042
|
+
canvasWrapper.style.height = parent.element.offsetHeight + 'px';
|
|
15043
|
+
const obj = { toolbarHeight: !isBlazor() ? 0 : parent.toolbarHeight };
|
|
15044
|
+
if (!isBlazor()) {
|
|
15045
|
+
parent.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: obj } });
|
|
15046
|
+
}
|
|
15047
|
+
if (Browser.isDevice) {
|
|
15048
|
+
canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - (2 * obj['toolbarHeight'])) - 3 + 'px';
|
|
15049
|
+
}
|
|
15050
|
+
else {
|
|
15051
|
+
canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - obj['toolbarHeight']) - 3 + 'px';
|
|
15052
|
+
}
|
|
15053
|
+
}
|
|
15054
|
+
const obj = { width: 0, height: 0 };
|
|
15055
|
+
parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
|
|
15056
|
+
value: { width: parent.img.srcWidth, height: parent.img.srcHeight, obj: obj } });
|
|
15057
|
+
const maxDimension = obj;
|
|
15058
|
+
if (parent.transform.defaultZoomFactor > 0) {
|
|
15059
|
+
maxDimension.width += (maxDimension.width * parent.transform.defaultZoomFactor);
|
|
15060
|
+
maxDimension.height += (maxDimension.height * parent.transform.defaultZoomFactor);
|
|
15061
|
+
}
|
|
15062
|
+
parent.img.destLeft = (parent.lowerCanvas.clientWidth - maxDimension.width) / 2;
|
|
15063
|
+
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height) / 2;
|
|
15064
|
+
if (parent.transform.degree === 0 && parent.transform.currFlipState === '') {
|
|
15065
|
+
if (parent.transform.defaultZoomFactor > 0) {
|
|
15066
|
+
parent.img.destLeft += parent.panPoint.totalPannedPoint.x;
|
|
15067
|
+
parent.img.destTop += parent.panPoint.totalPannedPoint.y;
|
|
15068
|
+
}
|
|
15069
|
+
parent.notify('draw', { prop: 'draw-image-to-canvas', value: { dimension: maxDimension } });
|
|
15070
|
+
}
|
|
15071
|
+
else {
|
|
15072
|
+
parent.notify('draw', { prop: 'draw-image-to-canvas', value: { dimension: maxDimension } });
|
|
15073
|
+
parent.notify('draw', { prop: 'updateCurrTransState', onPropertyChange: false,
|
|
15074
|
+
value: { type: 'initial', isPreventDestination: null, isRotatePan: null } });
|
|
15075
|
+
const temp = this.lowerContext.filter;
|
|
15076
|
+
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
15077
|
+
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);
|
|
15078
|
+
this.lowerContext.filter = temp;
|
|
15079
|
+
parent.notify('draw', { prop: 'updateCurrTransState', onPropertyChange: false,
|
|
15080
|
+
value: { type: 'reverse', isPreventDestination: null, isRotatePan: null } });
|
|
15081
|
+
}
|
|
15082
|
+
parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
15083
|
+
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
15084
|
+
if (parent.isCircleCrop) {
|
|
15085
|
+
parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
|
|
15086
|
+
value: { context: this.lowerContext, isSave: null, isFlip: null } });
|
|
15087
|
+
}
|
|
15088
|
+
hideSpinner(parent.element);
|
|
15089
|
+
parent.element.style.opacity = '1';
|
|
15090
|
+
const obj1 = { defToolbarItems: null };
|
|
15091
|
+
if (!isBlazor()) {
|
|
15092
|
+
parent.notify('toolbar', { prop: 'getDefToolbarItems', value: { obj: obj1 } });
|
|
15093
|
+
if (obj1['defToolbarItems'] && obj1['defToolbarItems'].length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
15094
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
15095
|
+
const toolbar = getComponent(parent.element.id + '_toolbar', 'toolbar');
|
|
15096
|
+
toolbar.refreshOverflow();
|
|
15097
|
+
if (parent.element.querySelector('.e-contextual-toolbar-wrapper')) {
|
|
15098
|
+
parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
15099
|
+
}
|
|
15100
|
+
}
|
|
15101
|
+
}
|
|
15102
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
15103
|
+
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
15104
|
+
if (isActiveObj) {
|
|
15105
|
+
parent.activeObj = extend({}, parent.objColl[parent.objColl.length - 1], null, true);
|
|
15106
|
+
parent.objColl.pop();
|
|
15107
|
+
if (parent.activeObj.activePoint.width !== 0 && parent.activeObj.activePoint.height !== 0) {
|
|
15108
|
+
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj } });
|
|
15109
|
+
if (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse' || parent.activeObj.shape === 'text' ||
|
|
15110
|
+
parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path') {
|
|
15111
|
+
if (!isBlazor()) {
|
|
15112
|
+
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
15113
|
+
}
|
|
15114
|
+
else {
|
|
15115
|
+
parent.updateToolbar(parent.element, 'quickAccessToolbar', parent.activeObj.shape);
|
|
15116
|
+
}
|
|
15117
|
+
}
|
|
15118
|
+
}
|
|
15119
|
+
}
|
|
15120
|
+
if (freehandObj['bool']) {
|
|
15121
|
+
if (!isBlazor()) {
|
|
15122
|
+
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
|
|
15123
|
+
}
|
|
15124
|
+
else {
|
|
15125
|
+
parent.updateToolbar(parent.element, 'quickAccessToolbar', 'pen');
|
|
15126
|
+
}
|
|
15127
|
+
}
|
|
15128
|
+
if ((parent.transform.degree !== 0 || parent.transform.currFlipState !== '') && parent.transform.defaultZoomFactor > 0) {
|
|
15129
|
+
const totalPannedPoint = extend({}, parent.panPoint.totalPannedPoint, null, true);
|
|
15130
|
+
const totalPannedInternalPoint = extend({}, parent.panPoint.totalPannedInternalPoint, null, true);
|
|
15131
|
+
const totalPannedClientPoint = extend({}, parent.panPoint.totalPannedClientPoint, null, true);
|
|
15132
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
15133
|
+
value: { zoomFactor: .1, zoomPoint: null } });
|
|
15134
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
15135
|
+
value: { zoomFactor: -.1, zoomPoint: null } });
|
|
15136
|
+
if (parent.transform.degree === 0) {
|
|
15137
|
+
parent.img.destLeft += totalPannedPoint.x;
|
|
15138
|
+
parent.img.destTop += totalPannedPoint.y;
|
|
15139
|
+
parent.panPoint.totalPannedPoint = totalPannedPoint;
|
|
15140
|
+
parent.notify('draw', { prop: 'updateFlipPan', value: { tempSelectionObj: null } });
|
|
15141
|
+
}
|
|
15142
|
+
else {
|
|
15143
|
+
parent.panPoint.totalPannedInternalPoint = totalPannedInternalPoint;
|
|
15144
|
+
parent.panPoint.totalPannedClientPoint = totalPannedClientPoint;
|
|
15145
|
+
parent.panPoint.currentPannedPoint = { x: 0, y: 0 };
|
|
15146
|
+
parent.isCropTab = true;
|
|
15147
|
+
parent.notify('transform', { prop: 'rotatePan', onPropertyChange: false,
|
|
15148
|
+
value: { isCropSelection: null, isDefaultZoom: null } });
|
|
15149
|
+
parent.isCropTab = false;
|
|
15150
|
+
}
|
|
15151
|
+
}
|
|
15152
|
+
else if (parent.transform.degree !== 0 && parent.transform.cropZoomFactor > 0) {
|
|
15153
|
+
parent.transform.zoomFactor = 0;
|
|
15154
|
+
parent.transform.cropZoomFactor = null;
|
|
15155
|
+
if (!isBlazor()) {
|
|
15156
|
+
parent.notify('toolbar', { prop: 'enable-disable-btns', onPropertyChange: false });
|
|
15157
|
+
}
|
|
15158
|
+
else {
|
|
15159
|
+
parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
|
|
15160
|
+
}
|
|
15032
15161
|
}
|
|
15033
|
-
parent.lowerCanvas.height = parent.upperCanvas.height = parent.element.offsetHeight - toolbarHeight - 3;
|
|
15034
15162
|
}
|
|
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
15163
|
}
|
|
15044
15164
|
calcMaxDimension(width, height, obj) {
|
|
15045
15165
|
const object = { toolbarHeight: 0 };
|
|
@@ -15070,7 +15190,15 @@ class Transform {
|
|
|
15070
15190
|
cssMaxWidth = width * heightScale;
|
|
15071
15191
|
cssMaxHeight = height * heightScale;
|
|
15072
15192
|
}
|
|
15073
|
-
|
|
15193
|
+
const cropObj = { bool: null };
|
|
15194
|
+
this.parent.notify('crop', { prop: 'getPreventScaling', onPropertyChange: false,
|
|
15195
|
+
value: { obj: cropObj } });
|
|
15196
|
+
if (cropObj['bool'] && this.parent.cropObj.activeObj.activePoint &&
|
|
15197
|
+
this.parent.cropObj.activeObj.activePoint.width !== 0 && this.parent.cropObj.activeObj.activePoint.height !== 0) {
|
|
15198
|
+
cssMaxWidth = this.parent.cropObj.activeObj.activePoint.width;
|
|
15199
|
+
cssMaxHeight = this.parent.cropObj.activeObj.activePoint.height;
|
|
15200
|
+
}
|
|
15201
|
+
if (obj) {
|
|
15074
15202
|
obj['width'] = cssMaxWidth;
|
|
15075
15203
|
obj['height'] = cssMaxHeight;
|
|
15076
15204
|
}
|
|
@@ -15118,7 +15246,7 @@ class Transform {
|
|
|
15118
15246
|
}
|
|
15119
15247
|
this.limitPan();
|
|
15120
15248
|
parent.activeObj = tempActObj;
|
|
15121
|
-
if (
|
|
15249
|
+
if (obj) {
|
|
15122
15250
|
obj['x'] = parent.img.destLeft - tempDestLeft;
|
|
15123
15251
|
obj['y'] = parent.img.destTop - tempDestTop;
|
|
15124
15252
|
}
|
|
@@ -15151,10 +15279,10 @@ class UndoRedo {
|
|
|
15151
15279
|
this.parent.off('destroyed', this.destroy);
|
|
15152
15280
|
}
|
|
15153
15281
|
initializeUrPvtProp() {
|
|
15154
|
-
if (
|
|
15282
|
+
if (this.parent.lowerCanvas) {
|
|
15155
15283
|
this.lowerContext = this.parent.lowerCanvas.getContext('2d');
|
|
15156
15284
|
}
|
|
15157
|
-
if (
|
|
15285
|
+
if (this.parent.upperCanvas) {
|
|
15158
15286
|
this.upperContext = this.parent.upperCanvas.getContext('2d');
|
|
15159
15287
|
}
|
|
15160
15288
|
}
|
|
@@ -15374,7 +15502,7 @@ class UndoRedo {
|
|
|
15374
15502
|
if (!parent.disabled && parent.isImageLoaded) {
|
|
15375
15503
|
if (this.undoRedoStep > 0) {
|
|
15376
15504
|
this.refreshToolbarActions();
|
|
15377
|
-
if (
|
|
15505
|
+
if (parent.activeObj.activePoint && parent.activeObj.activePoint.width !== 0) {
|
|
15378
15506
|
this.tempActObj = parent.activeObj;
|
|
15379
15507
|
}
|
|
15380
15508
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
@@ -15546,10 +15674,10 @@ class UndoRedo {
|
|
|
15546
15674
|
if (obj.operation === 'crop' && !obj.isCircleCrop) {
|
|
15547
15675
|
parent.isCircleCrop = false;
|
|
15548
15676
|
}
|
|
15549
|
-
if (obj.operation === 'crop' &&
|
|
15677
|
+
if (obj.operation === 'crop' && obj.currentObj.currSelectionPoint) {
|
|
15550
15678
|
parent.currSelectionPoint = extend({}, obj.currentObj.currSelectionPoint, {}, true);
|
|
15551
15679
|
}
|
|
15552
|
-
if (
|
|
15680
|
+
if (parent.currSelectionPoint && isNullOrUndefined(parent.currSelectionPoint.shape)) {
|
|
15553
15681
|
parent.currSelectionPoint = null;
|
|
15554
15682
|
}
|
|
15555
15683
|
this.endUndoRedo(obj.operation, false);
|
|
@@ -15687,7 +15815,7 @@ class UndoRedo {
|
|
|
15687
15815
|
}
|
|
15688
15816
|
undoDefault(obj) {
|
|
15689
15817
|
this.lowerContext.filter = obj.previousObj.filter;
|
|
15690
|
-
|
|
15818
|
+
const parent = this.parent;
|
|
15691
15819
|
parent.objColl = [];
|
|
15692
15820
|
parent.pointColl = [];
|
|
15693
15821
|
parent.freehandCounter = 0;
|
|
@@ -16195,7 +16323,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16195
16323
|
break;
|
|
16196
16324
|
case 'theme':
|
|
16197
16325
|
if (newProperties.theme) {
|
|
16198
|
-
if (
|
|
16326
|
+
if (this.theme && this.theme !== '') {
|
|
16199
16327
|
this.theme = this.toPascalCase(this.theme);
|
|
16200
16328
|
}
|
|
16201
16329
|
else {
|
|
@@ -16257,7 +16385,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16257
16385
|
case 'selectionSettings':
|
|
16258
16386
|
if (newProperties.selectionSettings) {
|
|
16259
16387
|
this.selectionSettings = newProperties.selectionSettings;
|
|
16260
|
-
if (
|
|
16388
|
+
if (this.activeObj.shape) {
|
|
16261
16389
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
16262
16390
|
this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: this.activeObj } });
|
|
16263
16391
|
}
|
|
@@ -16277,9 +16405,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16277
16405
|
this.element.removeAttribute('class');
|
|
16278
16406
|
}
|
|
16279
16407
|
if (!isBlazor()) {
|
|
16280
|
-
this.notify('toolbar', {
|
|
16281
|
-
prop: 'destroySubComponents', onPropertyChange: false
|
|
16282
|
-
});
|
|
16408
|
+
this.notify('toolbar', { prop: 'destroySubComponents', onPropertyChange: false });
|
|
16283
16409
|
this.notify('destroyed', null);
|
|
16284
16410
|
super.destroy();
|
|
16285
16411
|
}
|
|
@@ -16290,7 +16416,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16290
16416
|
this.element.innerHTML = '';
|
|
16291
16417
|
}
|
|
16292
16418
|
initialize() {
|
|
16293
|
-
if (
|
|
16419
|
+
if (this.toolbarTemplate) {
|
|
16294
16420
|
this.element.appendChild(this.createElement('div', {
|
|
16295
16421
|
id: this.element.id + '_toolbarArea', className: 'e-toolbar-area'
|
|
16296
16422
|
}));
|
|
@@ -16309,13 +16435,13 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16309
16435
|
const quickAccessToolbar = document.getElementById(this.element.id + '_quickAccessToolbarArea');
|
|
16310
16436
|
quickAccessToolbar.style.position = 'absolute';
|
|
16311
16437
|
quickAccessToolbar.style.display = 'none';
|
|
16312
|
-
if (
|
|
16438
|
+
if (this.activeObj) {
|
|
16313
16439
|
quickAccessToolbar.style.left = this.activeObj.activePoint.startX + 'px';
|
|
16314
16440
|
quickAccessToolbar.style.top = this.activeObj.activePoint.startY + 'px';
|
|
16315
16441
|
}
|
|
16316
16442
|
quickAccessToolbar.style.width = '100%';
|
|
16317
16443
|
}
|
|
16318
|
-
if (
|
|
16444
|
+
if (this.quickAccessToolbarTemplate) {
|
|
16319
16445
|
this.quickAccessToolbarTemplateFn();
|
|
16320
16446
|
}
|
|
16321
16447
|
else {
|
|
@@ -16471,7 +16597,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16471
16597
|
this.notify('selection', { prop: 'handleScroll', onPropertyChange: false, value: { e: e } });
|
|
16472
16598
|
}
|
|
16473
16599
|
adjustToScreen() {
|
|
16474
|
-
this.
|
|
16600
|
+
this.update();
|
|
16475
16601
|
}
|
|
16476
16602
|
screenOrientation() {
|
|
16477
16603
|
if (Browser.isDevice) {
|
|
@@ -16628,10 +16754,10 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16628
16754
|
this.currentFilter = '';
|
|
16629
16755
|
const obj = { initialZoomValue: false };
|
|
16630
16756
|
this.notify('draw', { prop: 'getInitialZoomValue', onPropertyChange: false, value: { obj: obj } });
|
|
16631
|
-
if (
|
|
16757
|
+
if (obj['initialZoomValue']) {
|
|
16632
16758
|
this.setProperties({ zoomSettings: { zoomFactor: obj['initialZoomValue'] } }, true);
|
|
16633
16759
|
}
|
|
16634
|
-
if (
|
|
16760
|
+
if (document.getElementById(this.element.id + '_quickAccessToolbarArea')) {
|
|
16635
16761
|
document.getElementById(this.element.id + '_quickAccessToolbarArea').style.display = 'none';
|
|
16636
16762
|
}
|
|
16637
16763
|
this.notifyResetForAllModules();
|
|
@@ -16640,7 +16766,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16640
16766
|
this.notify('draw', { prop: 'update-canvas', onPropertyChange: false });
|
|
16641
16767
|
this.isImageLoaded = true;
|
|
16642
16768
|
if (!isBlazor()) {
|
|
16643
|
-
if (
|
|
16769
|
+
if (this.element.querySelector('.e-contextual-toolbar-wrapper')) {
|
|
16644
16770
|
this.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
16645
16771
|
}
|
|
16646
16772
|
this.notify('toolbar', { prop: 'refresh-dropdown-btn', value: { isDisabled: false } });
|
|
@@ -16776,7 +16902,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16776
16902
|
drawEllipse(x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor) {
|
|
16777
16903
|
let isEllipse = false;
|
|
16778
16904
|
const isPointsInRange = this.allowShape(x, y);
|
|
16779
|
-
if (!this.disabled && this.isImageLoaded && isPointsInRange) {
|
|
16905
|
+
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
16780
16906
|
isEllipse = true;
|
|
16781
16907
|
this.notify('shape', { prop: 'drawEllipse', onPropertyChange: false, value: { x: x, y: y, radiusX: radiusX, radiusY: radiusY,
|
|
16782
16908
|
strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor } });
|
|
@@ -16797,7 +16923,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16797
16923
|
drawLine(startX, startY, endX, endY, strokeWidth, strokeColor) {
|
|
16798
16924
|
let isLine = false;
|
|
16799
16925
|
const isPointsInRange = this.allowShape(startX, startY);
|
|
16800
|
-
if (!this.disabled && this.isImageLoaded && isPointsInRange) {
|
|
16926
|
+
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(startX) && isNullOrUndefined(startY)))) {
|
|
16801
16927
|
isLine = true;
|
|
16802
16928
|
this.notify('shape', { prop: 'drawLine', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
|
|
16803
16929
|
endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor } });
|
|
@@ -16815,14 +16941,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16815
16941
|
* @param {string} strokeColor - Specifies the stroke color of arrow.
|
|
16816
16942
|
* @param {ArrowheadType} arrowStart – Specifies the type of arrowhead for start position. The default value is ‘None’.
|
|
16817
16943
|
* @param {ArrowheadType} arrowEnd – Specifies the type of arrowhead for end position. The default value is ‘SolidArrow’.
|
|
16818
|
-
|
|
16819
16944
|
* @returns {boolean}.
|
|
16820
|
-
* @private
|
|
16821
16945
|
*/
|
|
16822
16946
|
drawArrow(startX, startY, endX, endY, strokeWidth, strokeColor, arrowStart, arrowEnd) {
|
|
16823
16947
|
let isArrow = false;
|
|
16824
16948
|
const isPointsInRange = this.allowShape(startX, startY);
|
|
16825
|
-
if (!this.disabled && this.isImageLoaded && isPointsInRange) {
|
|
16949
|
+
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(startX) && isNullOrUndefined(startY)))) {
|
|
16826
16950
|
isArrow = true;
|
|
16827
16951
|
this.notify('shape', { prop: 'drawArrow', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
|
|
16828
16952
|
endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, arrowStart: arrowStart, arrowEnd: arrowEnd } });
|
|
@@ -16841,7 +16965,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16841
16965
|
this.isPublicMethod = true;
|
|
16842
16966
|
const obj = { inRange: false };
|
|
16843
16967
|
let isPath = false;
|
|
16844
|
-
if (pointColl.length > 0) {
|
|
16968
|
+
if (pointColl && pointColl.length > 0) {
|
|
16845
16969
|
for (let i = 0; i < pointColl.length; i++) {
|
|
16846
16970
|
if (obj['inRange']) {
|
|
16847
16971
|
break;
|
|
@@ -16850,7 +16974,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16850
16974
|
value: { x: pointColl[i].x, y: pointColl[i].y, obj: obj } });
|
|
16851
16975
|
}
|
|
16852
16976
|
}
|
|
16853
|
-
if (!this.disabled && this.isImageLoaded && obj['inRange']) {
|
|
16977
|
+
if (!this.disabled && this.isImageLoaded && (obj['inRange'] || isNullOrUndefined(pointColl))) {
|
|
16854
16978
|
isPath = true;
|
|
16855
16979
|
this.notify('shape', { prop: 'drawPath', onPropertyChange: false, value: { pointColl: pointColl,
|
|
16856
16980
|
strokeWidth: strokeWidth, strokeColor: strokeColor } });
|
|
@@ -16872,7 +16996,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16872
16996
|
drawRectangle(x, y, width, height, strokeWidth, strokeColor, fillColor) {
|
|
16873
16997
|
let isRectangle = false;
|
|
16874
16998
|
const isPointsInRange = this.allowShape(x, y);
|
|
16875
|
-
if (!this.disabled && this.isImageLoaded && isPointsInRange) {
|
|
16999
|
+
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
16876
17000
|
isRectangle = true;
|
|
16877
17001
|
this.notify('shape', { prop: 'drawRectangle', onPropertyChange: false, value: { x: x, y: y, width: width, height: height,
|
|
16878
17002
|
strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor } });
|
|
@@ -16898,7 +17022,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16898
17022
|
drawText(x, y, text, fontFamily, fontSize, bold, italic, color) {
|
|
16899
17023
|
let isText = false;
|
|
16900
17024
|
const isPointsInRange = this.allowShape(x, y);
|
|
16901
|
-
if (!this.disabled && this.isImageLoaded && isPointsInRange) {
|
|
17025
|
+
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
16902
17026
|
isText = true;
|
|
16903
17027
|
this.notify('shape', { prop: 'drawText', onPropertyChange: false, value: { x: x, y: y, text: text, fontFamily: fontFamily,
|
|
16904
17028
|
fontSize: fontSize, bold: bold, italic: italic, color: color } });
|
|
@@ -17050,6 +17174,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17050
17174
|
template = this.toolbarFn({ type: 'toolbar' }, this, 'Template', templateID)[0];
|
|
17051
17175
|
}
|
|
17052
17176
|
toolbarArea.appendChild(template);
|
|
17177
|
+
this.toolbarHeight = toolbarArea.clientHeight;
|
|
17178
|
+
this.notify('toolbar', { prop: 'setToolbarHeight', value: { height: this.toolbarHeight } });
|
|
17053
17179
|
this['renderReactTemplates']();
|
|
17054
17180
|
}
|
|
17055
17181
|
}
|
|
@@ -17117,7 +17243,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17117
17243
|
const isUndoRedo = this.isUndoRedo;
|
|
17118
17244
|
this.isCropTab = false;
|
|
17119
17245
|
this.isUndoRedo = true;
|
|
17120
|
-
if (
|
|
17246
|
+
if (this.transform.cropZoomFactor && this.transform.cropZoomFactor > 0) {
|
|
17121
17247
|
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
17122
17248
|
value: { zoomFactor: -this.transform.cropZoomFactor, zoomPoint: null } });
|
|
17123
17249
|
}
|
|
@@ -17134,120 +17260,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17134
17260
|
this.isCropTab = true;
|
|
17135
17261
|
this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: this.activeObj } });
|
|
17136
17262
|
}
|
|
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
17263
|
/**
|
|
17252
17264
|
* Set the old item Transform item state.
|
|
17253
17265
|
*
|
|
@@ -17291,7 +17303,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17291
17303
|
for (let i = 0; i < strArr.length; i++) {
|
|
17292
17304
|
strArr[i] = strArr[i].charAt(0).toUpperCase() + strArr[i].slice(1);
|
|
17293
17305
|
}
|
|
17294
|
-
if (
|
|
17306
|
+
if (obj) {
|
|
17295
17307
|
obj['maxText'] = strArr.join('');
|
|
17296
17308
|
}
|
|
17297
17309
|
return strArr.join('');
|
|
@@ -17358,7 +17370,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17358
17370
|
this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
17359
17371
|
}
|
|
17360
17372
|
}
|
|
17361
|
-
else if ((!isBlazor() &&
|
|
17373
|
+
else if ((!isBlazor() && document.querySelector('#' + this.element.id + '_sliderWrapper')) || (isBlazor() && !this.element.querySelector('.e-ie-contextual-slider').classList.contains('e-hidden')) ||
|
|
17362
17374
|
this.currObjType.isFiltered) {
|
|
17363
17375
|
this.initialAdjustmentValue = this.canvasFilter = this.lowerContext.filter;
|
|
17364
17376
|
this.currObjType.isFiltered = false;
|
|
@@ -17420,7 +17432,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17420
17432
|
* @returns {void}.
|
|
17421
17433
|
*/
|
|
17422
17434
|
cropSelectedState() {
|
|
17423
|
-
if (
|
|
17435
|
+
if (this.activeObj.shape && this.activeObj.shape.split('-')[0] === 'crop') {
|
|
17424
17436
|
this.okBtn();
|
|
17425
17437
|
}
|
|
17426
17438
|
}
|
|
@@ -17435,7 +17447,10 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17435
17447
|
const tempFilter = this.lowerContext.filter;
|
|
17436
17448
|
this.lowerContext.filter = this.canvasFilter = 'none';
|
|
17437
17449
|
const objColl = extend([], this.objColl, null, true);
|
|
17450
|
+
const pointColl = extend([], this.pointColl, null, true);
|
|
17438
17451
|
this.objColl = [];
|
|
17452
|
+
this.pointColl = [];
|
|
17453
|
+
this.freehandCounter = 0;
|
|
17439
17454
|
this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
|
|
17440
17455
|
const data = this.getImageData();
|
|
17441
17456
|
if (!isBlazor()) {
|
|
@@ -17444,6 +17459,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17444
17459
|
this.element.querySelector('#' + this.element.id + '_contextualToolbarArea').classList.remove('e-hide');
|
|
17445
17460
|
}
|
|
17446
17461
|
this.objColl = objColl;
|
|
17462
|
+
this.pointColl = pointColl;
|
|
17463
|
+
this.freehandCounter = pointColl.length;
|
|
17447
17464
|
this.notify('shape', { prop: 'iterateObjColl', onPropertyChange: false });
|
|
17448
17465
|
this.lowerContext.filter = this.canvasFilter = tempFilter;
|
|
17449
17466
|
return data;
|
|
@@ -17459,7 +17476,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17459
17476
|
setCurrAdjustmentValue(type, value) {
|
|
17460
17477
|
const finetuneValueChanging = { finetune: this.getFinetuneOption(type),
|
|
17461
17478
|
value: value, cancel: false };
|
|
17462
|
-
if (isBlazor() &&
|
|
17479
|
+
if (isBlazor() && this.events && this.events.finetuneValueChanging.hasDelegate === true) {
|
|
17463
17480
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
17464
17481
|
this.dotNetRef.invokeMethodAsync('OnFinetuneValueChangeAsync', finetuneValueChanging).then((finetuneValueChanging) => {
|
|
17465
17482
|
if (finetuneValueChanging.cancel) {
|
|
@@ -17476,82 +17493,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17476
17493
|
this.notify('filter', { prop: 'setCurrAdjValue', value: { type: type.toLowerCase(), value: value } });
|
|
17477
17494
|
}
|
|
17478
17495
|
}
|
|
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
17496
|
/**
|
|
17556
17497
|
* Get the square point for path.
|
|
17557
17498
|
*
|
|
@@ -17640,14 +17581,14 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17640
17581
|
this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
|
|
17641
17582
|
if (!isBlazor()) {
|
|
17642
17583
|
if (Browser.isDevice) {
|
|
17643
|
-
if (
|
|
17584
|
+
if (document.getElementById(this.element.id + '_bottomToolbar')) {
|
|
17644
17585
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
17645
17586
|
const toolbar = getComponent(this.element.id + '_bottomToolbar', 'toolbar');
|
|
17646
17587
|
toolbar.refreshOverflow();
|
|
17647
17588
|
}
|
|
17648
17589
|
}
|
|
17649
17590
|
else {
|
|
17650
|
-
if (
|
|
17591
|
+
if (document.getElementById(this.element.id + '_toolbar')) {
|
|
17651
17592
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
17652
17593
|
const toolbar = getComponent(this.element.id + '_toolbar', 'toolbar');
|
|
17653
17594
|
toolbar.refreshOverflow();
|
|
@@ -18067,7 +18008,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
18067
18008
|
return str;
|
|
18068
18009
|
}
|
|
18069
18010
|
else {
|
|
18070
|
-
return splitStr.map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
|
|
18011
|
+
return splitStr.map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
|
|
18071
18012
|
}
|
|
18072
18013
|
}
|
|
18073
18014
|
/**
|
|
@@ -18081,9 +18022,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
18081
18022
|
const obj = { adjustmentLevel: null };
|
|
18082
18023
|
this.notify('filter', { prop: 'getAdjustmentLevel', onPropertyChange: false,
|
|
18083
18024
|
value: { obj: obj } });
|
|
18084
|
-
let value;
|
|
18085
18025
|
const typeToAdjustmentLevel = { 'brightness': obj['adjustmentLevel'].brightness,
|
|
18086
|
-
'contrast':
|
|
18026
|
+
'contrast': obj['adjustmentLevel'].contrast, 'hue': obj['adjustmentLevel'].hue,
|
|
18087
18027
|
'saturation': obj['adjustmentLevel'].saturation, 'opacity': obj['adjustmentLevel'].opacity,
|
|
18088
18028
|
'blur': obj['adjustmentLevel'].blur, 'exposure': obj['adjustmentLevel'].exposure };
|
|
18089
18029
|
return typeToAdjustmentLevel[`${type}`];
|
|
@@ -18102,7 +18042,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
18102
18042
|
this.cropSelectedState();
|
|
18103
18043
|
this.notify('draw', { prop: 'resetCurrentSelectionPoint' });
|
|
18104
18044
|
this.notify('transform', { prop: 'performTransformation', value: { text: type } });
|
|
18105
|
-
this.moveToSelectionRange
|
|
18045
|
+
this.notify('draw', { prop: 'moveToSelectionRange', value: { type: type, activeObj: activeObj } });
|
|
18106
18046
|
this.isCropToolbar = false;
|
|
18107
18047
|
}
|
|
18108
18048
|
/**
|
|
@@ -18129,7 +18069,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
18129
18069
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
18130
18070
|
this.element = element;
|
|
18131
18071
|
const canvasWrapper = this.element.querySelector('.e-canvas-wrapper');
|
|
18132
|
-
if (
|
|
18072
|
+
if (this.element.querySelector('#' + this.element.id + '_toolbar')) {
|
|
18133
18073
|
this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbar').clientHeight;
|
|
18134
18074
|
}
|
|
18135
18075
|
else {
|
|
@@ -18647,6 +18587,7 @@ class ToolbarModule {
|
|
|
18647
18587
|
this.l10n = new L10n('image-editor', this.defaultLocale, this.parent.locale);
|
|
18648
18588
|
}
|
|
18649
18589
|
toolbar(args) {
|
|
18590
|
+
const parent = this.parent;
|
|
18650
18591
|
this.updatePrivateVariables();
|
|
18651
18592
|
switch (args.prop) {
|
|
18652
18593
|
case 'create-toolbar':
|
|
@@ -18719,19 +18660,19 @@ class ToolbarModule {
|
|
|
18719
18660
|
this.selFhdColor = args.value['color'];
|
|
18720
18661
|
break;
|
|
18721
18662
|
case 'getCurrentFilter':
|
|
18722
|
-
args.value['obj']['currentFilter'] =
|
|
18663
|
+
args.value['obj']['currentFilter'] = parent.currentFilter;
|
|
18723
18664
|
break;
|
|
18724
18665
|
case 'setCurrentFilter':
|
|
18725
|
-
|
|
18666
|
+
parent.currentFilter = args.value['filter'];
|
|
18726
18667
|
break;
|
|
18727
18668
|
case 'setInitialAdjustmentValue':
|
|
18728
|
-
|
|
18669
|
+
parent.initialAdjustmentValue = args.value['value'];
|
|
18729
18670
|
break;
|
|
18730
18671
|
case 'getCanvasFilter':
|
|
18731
|
-
args.value['obj']['canvasFilter'] =
|
|
18672
|
+
args.value['obj']['canvasFilter'] = parent.canvasFilter;
|
|
18732
18673
|
break;
|
|
18733
18674
|
case 'setCanvasFilter':
|
|
18734
|
-
|
|
18675
|
+
parent.canvasFilter = args.value['filter'];
|
|
18735
18676
|
break;
|
|
18736
18677
|
case 'getDefToolbarItems':
|
|
18737
18678
|
args.value['obj']['defToolbarItems'] = this.defToolbarItems;
|
|
@@ -18743,7 +18684,7 @@ class ToolbarModule {
|
|
|
18743
18684
|
this.performDefTbrClick(args.value['type'], args.value['isContextualToolbar'], args.value['isDisabledAdjustment'], args.value['isDisabledFilter'], args.value['isFilterFinetune']);
|
|
18744
18685
|
break;
|
|
18745
18686
|
case 'setTempFilterProperties':
|
|
18746
|
-
|
|
18687
|
+
parent.setTempFilterProperties();
|
|
18747
18688
|
break;
|
|
18748
18689
|
case 'refreshSlider':
|
|
18749
18690
|
this.refreshSlider();
|
|
@@ -18752,28 +18693,25 @@ class ToolbarModule {
|
|
|
18752
18693
|
this.renderSlider(args.value['type']);
|
|
18753
18694
|
break;
|
|
18754
18695
|
case 'getCurrAdjustmentValue':
|
|
18755
|
-
|
|
18696
|
+
parent.getCurrAdjustmentValue(args.value['type']);
|
|
18756
18697
|
break;
|
|
18757
18698
|
case 'setCurrAdjustmentValue':
|
|
18758
|
-
|
|
18699
|
+
parent.setCurrAdjustmentValue(args.value['type'], args.value['value']);
|
|
18759
18700
|
break;
|
|
18760
18701
|
case 'refreshShapeDrawing':
|
|
18761
18702
|
this.refreshShapeDrawing();
|
|
18762
18703
|
break;
|
|
18763
|
-
case 'getSquarePointForRotatedShape':
|
|
18764
|
-
this.parent.getSquarePointForRotatedShape(args.value['obj'], args.value['object']);
|
|
18765
|
-
break;
|
|
18766
18704
|
case 'getCropToolbar':
|
|
18767
|
-
args.value['obj']['isCropToolbar'] =
|
|
18705
|
+
args.value['obj']['isCropToolbar'] = parent.isCropToolbar;
|
|
18768
18706
|
break;
|
|
18769
18707
|
case 'getPrevCurrSelectionPoint':
|
|
18770
|
-
args.value['obj']['prevCurrSelectionPoint'] =
|
|
18708
|
+
args.value['obj']['prevCurrSelectionPoint'] = parent.prevCurrSelectionPoint;
|
|
18771
18709
|
break;
|
|
18772
18710
|
case 'setPrevCurrSelectionPoint':
|
|
18773
|
-
|
|
18711
|
+
parent.prevCurrSelectionPoint = args.value['point'];
|
|
18774
18712
|
break;
|
|
18775
18713
|
case 'updateCropTransformItems':
|
|
18776
|
-
|
|
18714
|
+
parent.updateCropTransformItems();
|
|
18777
18715
|
break;
|
|
18778
18716
|
case 'setEnableDisableUndoRedo':
|
|
18779
18717
|
this.preventEnableDisableUr = args.value['isPrevent'];
|
|
@@ -18786,51 +18724,53 @@ class ToolbarModule {
|
|
|
18786
18724
|
updatePrivateVariables() {
|
|
18787
18725
|
const parent = this.parent;
|
|
18788
18726
|
this.inMemoryCanvas = parent.inMemoryCanvas;
|
|
18789
|
-
if (
|
|
18727
|
+
if (parent.lowerCanvas) {
|
|
18790
18728
|
this.lowerContext = parent.lowerCanvas.getContext('2d');
|
|
18791
18729
|
}
|
|
18792
|
-
if (
|
|
18730
|
+
if (parent.upperCanvas) {
|
|
18793
18731
|
this.upperContext = parent.upperCanvas.getContext('2d');
|
|
18794
18732
|
}
|
|
18795
|
-
if (
|
|
18733
|
+
if (this.inMemoryCanvas) {
|
|
18796
18734
|
this.inMemoryContext = this.inMemoryCanvas.getContext('2d');
|
|
18797
18735
|
}
|
|
18798
18736
|
}
|
|
18799
18737
|
reset() {
|
|
18738
|
+
const parent = this.parent;
|
|
18800
18739
|
this.defToolbarItems = [];
|
|
18801
18740
|
this.toolbarHeight = 46;
|
|
18802
|
-
|
|
18741
|
+
parent.prevCurrSelectionPoint = null;
|
|
18803
18742
|
this.zoomBtnHold = null;
|
|
18804
18743
|
this.currToolbar = '';
|
|
18805
18744
|
this.currentToolbar = 'main';
|
|
18806
18745
|
this.selFhdColor = '#42a5f5';
|
|
18807
|
-
|
|
18808
|
-
this.preventZoomBtn =
|
|
18809
|
-
|
|
18746
|
+
parent.currentFilter = '';
|
|
18747
|
+
this.preventZoomBtn = parent.isCropToolbar = this.preventEnableDisableUr = false;
|
|
18748
|
+
parent.initialAdjustmentValue = parent.canvasFilter =
|
|
18810
18749
|
'brightness(' + 1 + ') ' + 'contrast(' + 100 + '%) ' + 'hue-rotate(' + 0 + 'deg) ' +
|
|
18811
18750
|
'saturate(' + 100 + '%) ' + 'opacity(' + 1 + ') ' + 'blur(' + 0 + 'px) ' + 'sepia(0%) ' + 'grayscale(0%) ' + 'invert(0%)';
|
|
18812
18751
|
}
|
|
18813
18752
|
destroyTopToolbar() {
|
|
18814
18753
|
const parent = this.parent;
|
|
18815
|
-
|
|
18816
|
-
|
|
18754
|
+
const toolbar = document.getElementById(parent.element.id + '_toolbar');
|
|
18755
|
+
if (this.isToolbar() && toolbar && toolbar.classList.contains('e-control')) {
|
|
18817
18756
|
getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
|
|
18818
18757
|
}
|
|
18819
18758
|
}
|
|
18820
18759
|
destroyBottomToolbar() {
|
|
18821
18760
|
const parent = this.parent;
|
|
18822
|
-
|
|
18823
|
-
|
|
18761
|
+
const toolbar = document.getElementById(parent.element.id + '_bottomToolbar');
|
|
18762
|
+
if (toolbar && toolbar.classList.contains('e-control')) {
|
|
18824
18763
|
getComponent(document.getElementById(parent.element.id + '_bottomToolbar'), 'toolbar').destroy();
|
|
18825
18764
|
}
|
|
18826
18765
|
}
|
|
18827
18766
|
isToolbar() {
|
|
18828
|
-
|
|
18829
|
-
|
|
18767
|
+
const parent = this.parent;
|
|
18768
|
+
return (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)
|
|
18769
|
+
|| !isNullOrUndefined(parent.toolbarTemplate));
|
|
18830
18770
|
}
|
|
18831
18771
|
createToolbar() {
|
|
18832
18772
|
const parent = this.parent;
|
|
18833
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18773
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)) {
|
|
18834
18774
|
parent.element.appendChild(parent.createElement('div', {
|
|
18835
18775
|
id: parent.element.id + '_toolbarArea', className: 'e-toolbar-area'
|
|
18836
18776
|
}));
|
|
@@ -18856,10 +18796,10 @@ class ToolbarModule {
|
|
|
18856
18796
|
if (!parent.disabled) {
|
|
18857
18797
|
if (Browser.isDevice) {
|
|
18858
18798
|
if (this.defToolbarItems.length > 0 &&
|
|
18859
|
-
|
|
18799
|
+
document.getElementById(parent.element.id + '_toolbar')) {
|
|
18860
18800
|
getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
|
|
18861
18801
|
}
|
|
18862
|
-
if (
|
|
18802
|
+
if (document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
18863
18803
|
getComponent(document.getElementById(parent.element.id + '_bottomToolbar'), 'toolbar').destroy();
|
|
18864
18804
|
}
|
|
18865
18805
|
this.initMainToolbar(false, Browser.isDevice, null);
|
|
@@ -18867,7 +18807,7 @@ class ToolbarModule {
|
|
|
18867
18807
|
}
|
|
18868
18808
|
else {
|
|
18869
18809
|
if (this.defToolbarItems.length > 0 &&
|
|
18870
|
-
|
|
18810
|
+
document.getElementById(parent.element.id + '_toolbar')) {
|
|
18871
18811
|
getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
|
|
18872
18812
|
}
|
|
18873
18813
|
this.initMainToolbar(false, false, null);
|
|
@@ -18884,7 +18824,7 @@ class ToolbarModule {
|
|
|
18884
18824
|
clicked: this.defToolbarClicked.bind(this) });
|
|
18885
18825
|
toolbarObj.appendTo('#' + parent.element.id + '_toolbar');
|
|
18886
18826
|
this.createLeftToolbarControls();
|
|
18887
|
-
if (
|
|
18827
|
+
if (document.getElementById(parent.element.id + '_toolbar')) {
|
|
18888
18828
|
this.toolbarHeight = document.getElementById(parent.element.id + '_toolbar').clientHeight;
|
|
18889
18829
|
}
|
|
18890
18830
|
}
|
|
@@ -18894,7 +18834,7 @@ class ToolbarModule {
|
|
|
18894
18834
|
}
|
|
18895
18835
|
createContextualToolbar() {
|
|
18896
18836
|
const parent = this.parent;
|
|
18897
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18837
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)) {
|
|
18898
18838
|
parent.element.appendChild(parent.createElement('div', { id: parent.element.id + '_contextualToolbarArea',
|
|
18899
18839
|
className: 'e-contextual-toolbar-wrapper e-hide', attrs: { style: 'position: absolute;' }
|
|
18900
18840
|
}));
|
|
@@ -18905,7 +18845,7 @@ class ToolbarModule {
|
|
|
18905
18845
|
}
|
|
18906
18846
|
createBottomToolbar() {
|
|
18907
18847
|
const parent = this.parent;
|
|
18908
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18848
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)) {
|
|
18909
18849
|
parent.element.appendChild(parent.createElement('div', {
|
|
18910
18850
|
id: parent.element.id + '_bottomToolbarArea', className: 'e-bottom-toolbar'
|
|
18911
18851
|
}));
|
|
@@ -18968,7 +18908,7 @@ class ToolbarModule {
|
|
|
18968
18908
|
toolbarObj.appendTo('#' + parent.element.id + '_toolbar');
|
|
18969
18909
|
this.createLeftToolbarControls();
|
|
18970
18910
|
this.enableDisableTbrBtn();
|
|
18971
|
-
if (this.isToolbar() &&
|
|
18911
|
+
if (this.isToolbar() && document.getElementById(parent.element.id + '_toolbar')) {
|
|
18972
18912
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
18973
18913
|
const toolbar = getComponent(parent.element.id + '_toolbar', 'toolbar');
|
|
18974
18914
|
toolbar.refreshOverflow();
|
|
@@ -18977,7 +18917,7 @@ class ToolbarModule {
|
|
|
18977
18917
|
}
|
|
18978
18918
|
initBottomToolbar() {
|
|
18979
18919
|
const parent = this.parent;
|
|
18980
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18920
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)) {
|
|
18981
18921
|
const items = this.getMainToolbarItem();
|
|
18982
18922
|
const toolbarObj = new Toolbar({ items: items, width: '100%',
|
|
18983
18923
|
created: () => {
|
|
@@ -18989,7 +18929,7 @@ class ToolbarModule {
|
|
|
18989
18929
|
clicked: this.defToolbarClicked.bind(this)
|
|
18990
18930
|
});
|
|
18991
18931
|
toolbarObj.appendTo('#' + parent.element.id + '_bottomToolbar');
|
|
18992
|
-
if (this.defToolbarItems.length > 0 &&
|
|
18932
|
+
if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
18993
18933
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
18994
18934
|
const toolbar = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
|
|
18995
18935
|
toolbar.refreshOverflow();
|
|
@@ -19004,21 +18944,21 @@ class ToolbarModule {
|
|
|
19004
18944
|
toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
|
|
19005
18945
|
}
|
|
19006
18946
|
if (parent.allowUndoRedo) {
|
|
19007
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18947
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Undo') > -1)) {
|
|
19008
18948
|
toolbarItems.push({ id: parent.element.id + '_undo', prefixIcon: 'e-icons e-undo', cssClass: 'top-icon e-undo',
|
|
19009
18949
|
tooltipText: this.l10n.getConstant('Undo'), align: 'Left' });
|
|
19010
18950
|
}
|
|
19011
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18951
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Redo') > -1)) {
|
|
19012
18952
|
toolbarItems.push({ id: parent.element.id + '_redo', prefixIcon: 'e-icons e-redo', cssClass: 'top-icon e-redo',
|
|
19013
18953
|
tooltipText: this.l10n.getConstant('Redo'), align: 'Left' });
|
|
19014
18954
|
}
|
|
19015
18955
|
}
|
|
19016
18956
|
if (!this.preventZoomBtn && (parent.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
|
|
19017
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18957
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('ZoomOut') > -1)) {
|
|
19018
18958
|
toolbarItems.push({ id: parent.element.id + '_zoomOut', prefixIcon: 'e-icons e-zoom-out', cssClass: 'top-icon e-dec-zoom',
|
|
19019
18959
|
tooltipText: this.l10n.getConstant('ZoomOut'), align: 'Left' });
|
|
19020
18960
|
}
|
|
19021
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18961
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('ZoomIn') > -1)) {
|
|
19022
18962
|
toolbarItems.push({ id: parent.element.id + '_zoomIn', prefixIcon: 'e-icons e-zoom-in', cssClass: 'top-icon e-inc-zoom',
|
|
19023
18963
|
tooltipText: this.l10n.getConstant('ZoomIn'), align: 'Left' });
|
|
19024
18964
|
}
|
|
@@ -19038,12 +18978,12 @@ class ToolbarModule {
|
|
|
19038
18978
|
toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
19039
18979
|
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
19040
18980
|
}
|
|
19041
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18981
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Reset') > -1)) {
|
|
19042
18982
|
toolbarItems.push({ id: parent.element.id + '_reset', prefixIcon: 'e-icons e-btn-reset', cssClass: 'top-icon e-img-reset',
|
|
19043
18983
|
tooltipText: this.l10n.getConstant('Reset'), align: 'Right' });
|
|
19044
18984
|
}
|
|
19045
18985
|
if (!isOkBtn) {
|
|
19046
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18986
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Save') > -1)) {
|
|
19047
18987
|
toolbarItems.push({ id: parent.element.id + '_save', prefixIcon: 'e-icons e-btn-save', cssClass: 'top-icon e-save',
|
|
19048
18988
|
tooltipText: this.l10n.getConstant('Save'), align: 'Right', template: '<button id="' + parent.element.id + '_saveBtn"></button>' });
|
|
19049
18989
|
}
|
|
@@ -19057,19 +18997,19 @@ class ToolbarModule {
|
|
|
19057
18997
|
getMainToolbarItem(isApplyOption) {
|
|
19058
18998
|
const parent = this.parent;
|
|
19059
18999
|
const toolbarItems = [];
|
|
19060
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19000
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Crop') > -1)) {
|
|
19061
19001
|
toolbarItems.push({ id: parent.element.id + '_cropTransform', prefixIcon: 'e-icons e-crop', cssClass: 'top-icon e-crop',
|
|
19062
19002
|
tooltipText: this.l10n.getConstant('CropAndTransform'), align: 'Center' });
|
|
19063
19003
|
}
|
|
19064
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19004
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Annotate') > -1)) {
|
|
19065
19005
|
toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
|
|
19066
|
-
template: '<button id="' +
|
|
19006
|
+
template: '<button id="' + parent.element.id + '_annotationBtn"></button>' });
|
|
19067
19007
|
}
|
|
19068
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19008
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Finetune') > -1)) {
|
|
19069
19009
|
toolbarItems.push({ id: parent.element.id + '_adjustment', prefixIcon: 'e-icons e-adjustment', cssClass: 'top-icon e-adjustment',
|
|
19070
19010
|
tooltipText: this.l10n.getConstant('Finetune'), align: 'Center' });
|
|
19071
19011
|
}
|
|
19072
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19012
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Filter') > -1)) {
|
|
19073
19013
|
toolbarItems.push({ id: parent.element.id + '_filter', prefixIcon: 'e-icons e-filters', cssClass: 'top-icon e-filters',
|
|
19074
19014
|
tooltipText: this.l10n.getConstant('Filter'), align: 'Center' });
|
|
19075
19015
|
}
|
|
@@ -19132,7 +19072,7 @@ class ToolbarModule {
|
|
|
19132
19072
|
if (typeof (parent.toolbar[i]) === 'object') {
|
|
19133
19073
|
if (isNullOrUndefined(parent.toolbar[i].align)) {
|
|
19134
19074
|
if (position === 'left') {
|
|
19135
|
-
toolbarItems.push(
|
|
19075
|
+
toolbarItems.push(parent.toolbar[i]);
|
|
19136
19076
|
}
|
|
19137
19077
|
}
|
|
19138
19078
|
else if (parent.toolbar[i].align.toLowerCase() === position) {
|
|
@@ -19158,13 +19098,13 @@ class ToolbarModule {
|
|
|
19158
19098
|
wireZoomBtnEvents() {
|
|
19159
19099
|
const zoomIn = document.querySelector('#' + this.parent.element.id + '_zoomIn');
|
|
19160
19100
|
const zoomOut = document.querySelector('#' + this.parent.element.id + '_zoomOut');
|
|
19161
|
-
if (
|
|
19101
|
+
if (zoomIn) {
|
|
19162
19102
|
zoomIn.addEventListener('mousedown', this.zoomInBtnMouseDownHandler.bind(this));
|
|
19163
19103
|
zoomIn.addEventListener('mouseup', this.zoomBtnMouseUpHandler.bind(this));
|
|
19164
19104
|
zoomIn.addEventListener('click', this.zoomInBtnClickHandler.bind(this));
|
|
19165
19105
|
zoomIn.addEventListener('touchstart', this.zoomInBtnClickHandler.bind(this));
|
|
19166
19106
|
}
|
|
19167
|
-
if (
|
|
19107
|
+
if (zoomOut) {
|
|
19168
19108
|
zoomOut.addEventListener('mousedown', this.zoomOutBtnMouseDownHandler.bind(this));
|
|
19169
19109
|
zoomOut.addEventListener('mouseup', this.zoomBtnMouseUpHandler.bind(this));
|
|
19170
19110
|
zoomOut.addEventListener('click', this.zoomOutBtnClickHandler.bind(this));
|
|
@@ -19179,58 +19119,58 @@ class ToolbarModule {
|
|
|
19179
19119
|
const undoRedoObj = { undoRedoStep: null };
|
|
19180
19120
|
parent.notify('undo-redo', { prop: 'getUndoRedoStep', value: { obj: undoRedoObj } });
|
|
19181
19121
|
const undo = document.querySelector('#' + parent.element.id + '_undo');
|
|
19182
|
-
if (
|
|
19122
|
+
if (undo && undoRedoObj['undoRedoStep'] === 0) {
|
|
19183
19123
|
undo.classList.add('e-disabled');
|
|
19184
19124
|
undo.parentElement.classList.add('e-overlay');
|
|
19185
19125
|
}
|
|
19186
|
-
else if (
|
|
19126
|
+
else if (undo && undoRedoObj['undoRedoStep'] > 0) {
|
|
19187
19127
|
undo.classList.remove('e-disabled');
|
|
19188
19128
|
undo.parentElement.classList.remove('e-overlay');
|
|
19189
19129
|
}
|
|
19190
19130
|
const redo = document.querySelector('#' + parent.element.id + '_redo');
|
|
19191
|
-
if (
|
|
19131
|
+
if (redo && (undoRedoObj['undoRedoStep'] === object['appliedUndoRedoColl'].length)) {
|
|
19192
19132
|
redo.classList.add('e-disabled');
|
|
19193
19133
|
redo.parentElement.classList.add('e-overlay');
|
|
19194
19134
|
}
|
|
19195
|
-
else if (
|
|
19135
|
+
else if (redo && (undoRedoObj['undoRedoStep'] === 0 && object['appliedUndoRedoColl'].length > 0)) {
|
|
19196
19136
|
redo.classList.remove('e-disabled');
|
|
19197
19137
|
redo.parentElement.classList.remove('e-overlay');
|
|
19198
19138
|
}
|
|
19199
|
-
else if (
|
|
19139
|
+
else if (redo && undoRedoObj['undoRedoStep'] > 0) {
|
|
19200
19140
|
redo.classList.remove('e-disabled');
|
|
19201
19141
|
redo.parentElement.classList.remove('e-overlay');
|
|
19202
19142
|
}
|
|
19203
19143
|
}
|
|
19204
19144
|
const zoomIn = document.querySelector('#' + parent.element.id + '_zoomIn');
|
|
19205
|
-
if (
|
|
19145
|
+
if (zoomIn && parent.zoomSettings.zoomFactor >= parent.zoomSettings.maxZoomFactor) {
|
|
19206
19146
|
zoomIn.classList.add('e-disabled');
|
|
19207
19147
|
zoomIn.parentElement.classList.add('e-overlay');
|
|
19208
19148
|
}
|
|
19209
|
-
else if (
|
|
19149
|
+
else if (zoomIn) {
|
|
19210
19150
|
zoomIn.classList.remove('e-disabled');
|
|
19211
19151
|
zoomIn.parentElement.classList.remove('e-overlay');
|
|
19212
19152
|
}
|
|
19213
19153
|
const zoomOut = document.querySelector('#' + parent.element.id + '_zoomOut');
|
|
19214
|
-
if (
|
|
19154
|
+
if (zoomOut && parent.zoomSettings.zoomFactor <= parent.zoomSettings.minZoomFactor) {
|
|
19215
19155
|
zoomOut.classList.add('e-disabled');
|
|
19216
19156
|
zoomOut.parentElement.classList.add('e-overlay');
|
|
19217
19157
|
}
|
|
19218
|
-
else if (
|
|
19158
|
+
else if (zoomOut) {
|
|
19219
19159
|
zoomOut.classList.remove('e-disabled');
|
|
19220
19160
|
zoomOut.parentElement.classList.remove('e-overlay');
|
|
19221
19161
|
}
|
|
19222
19162
|
const pan = document.querySelector('#' + parent.element.id + '_pan');
|
|
19223
|
-
if (
|
|
19163
|
+
if (pan && parent.zoomSettings.zoomFactor <= parent.zoomSettings.minZoomFactor) {
|
|
19224
19164
|
pan.style.display = 'none';
|
|
19225
19165
|
}
|
|
19226
|
-
else if (
|
|
19166
|
+
else if (pan) {
|
|
19227
19167
|
pan.style.display = 'block';
|
|
19228
19168
|
}
|
|
19229
19169
|
}
|
|
19230
19170
|
createLeftToolbarControls() {
|
|
19231
19171
|
const parent = this.parent;
|
|
19232
19172
|
if (this.defToolbarItems !== undefined && this.defToolbarItems.length > 0 &&
|
|
19233
|
-
(
|
|
19173
|
+
(document.getElementById(parent.element.id + '_toolbar'))) {
|
|
19234
19174
|
const uploadDiv = document.getElementById(parent.element.id + '_toolbar')
|
|
19235
19175
|
.querySelector('.e-image-upload');
|
|
19236
19176
|
if (uploadDiv) {
|
|
@@ -19251,25 +19191,25 @@ class ToolbarModule {
|
|
|
19251
19191
|
renderAnnotationBtn(isContextualToolbar) {
|
|
19252
19192
|
const parent = this.parent;
|
|
19253
19193
|
const items = [];
|
|
19254
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19194
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Pen') > -1)) {
|
|
19255
19195
|
items.push({ text: this.l10n.getConstant('Pen'), id: 'pen', iconCss: 'e-icons e-free-pen' });
|
|
19256
19196
|
}
|
|
19257
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19197
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Line') > -1)) {
|
|
19258
19198
|
items.push({ text: this.l10n.getConstant('Line'), id: 'line', iconCss: 'e-icons e-line' });
|
|
19259
19199
|
}
|
|
19260
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19200
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Rectangle') > -1)) {
|
|
19261
19201
|
items.push({ text: this.l10n.getConstant('Rectangle'), id: 'rectangle', iconCss: 'e-icons e-rectangle' });
|
|
19262
19202
|
}
|
|
19263
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19203
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Ellipse') > -1)) {
|
|
19264
19204
|
items.push({ text: this.l10n.getConstant('Ellipse'), id: 'ellipse', iconCss: 'e-icons e-circle' });
|
|
19265
19205
|
}
|
|
19266
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19206
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Arrow') > -1)) {
|
|
19267
19207
|
items.push({ text: this.l10n.getConstant('Arrow'), id: 'arrow', iconCss: 'e-icons e-arrow-right-up' });
|
|
19268
19208
|
}
|
|
19269
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19209
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Path') > -1)) {
|
|
19270
19210
|
items.push({ text: this.l10n.getConstant('Path'), id: 'path', iconCss: 'e-icons e-critical-path' });
|
|
19271
19211
|
}
|
|
19272
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19212
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Text') > -1)) {
|
|
19273
19213
|
items.push({ text: this.l10n.getConstant('Text'), id: 'text', iconCss: 'e-icons e-add-text' });
|
|
19274
19214
|
}
|
|
19275
19215
|
const obj = { freehandDrawSelectedId: null };
|
|
@@ -19278,7 +19218,7 @@ class ToolbarModule {
|
|
|
19278
19218
|
const removeElement = document.querySelector('#' + parent.element.id + '_remove');
|
|
19279
19219
|
const editTextElement = document.querySelector('#' + parent.element.id + '_editText');
|
|
19280
19220
|
if ((parent.activeObj.activePoint.width === 0 && parent.activeObj.activePoint.height === 0) &&
|
|
19281
|
-
(isNullOrUndefined(parent.activeObj.pointColl) || (
|
|
19221
|
+
(isNullOrUndefined(parent.activeObj.pointColl) || (parent.activeObj.pointColl
|
|
19282
19222
|
&& parent.activeObj.pointColl.length === 0)) &&
|
|
19283
19223
|
isNullOrUndefined(obj['freehandDrawSelectedId'])) {
|
|
19284
19224
|
if (duplicateElement) {
|
|
@@ -19310,10 +19250,10 @@ class ToolbarModule {
|
|
|
19310
19250
|
args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
|
|
19311
19251
|
args.element.parentElement.offsetHeight + 'px';
|
|
19312
19252
|
}
|
|
19313
|
-
if (
|
|
19314
|
-
document.getElementById(
|
|
19253
|
+
if (parent.activeObj.shape) {
|
|
19254
|
+
document.getElementById(parent.activeObj.shape).classList.add('e-selected');
|
|
19315
19255
|
}
|
|
19316
|
-
else if (
|
|
19256
|
+
else if (parent.togglePen) {
|
|
19317
19257
|
document.getElementById('pen').classList.add('e-selected');
|
|
19318
19258
|
}
|
|
19319
19259
|
},
|
|
@@ -19368,21 +19308,21 @@ class ToolbarModule {
|
|
|
19368
19308
|
}
|
|
19369
19309
|
});
|
|
19370
19310
|
// Render initialized DropDownButton.
|
|
19371
|
-
drpDownBtn.appendTo('#' +
|
|
19311
|
+
drpDownBtn.appendTo('#' + parent.element.id + '_annotationBtn');
|
|
19372
19312
|
}
|
|
19373
19313
|
renderCropBtn() {
|
|
19374
19314
|
const parent = this.parent;
|
|
19375
19315
|
const items = [];
|
|
19376
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19316
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('CustomSelection') > -1)) {
|
|
19377
19317
|
items.push({ text: this.l10n.getConstant('Custom'), id: 'custom', iconCss: 'e-icons e-custom' });
|
|
19378
19318
|
}
|
|
19379
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19319
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('CircleSelection') > -1)) {
|
|
19380
19320
|
items.push({ text: this.l10n.getConstant('Circle'), id: 'circle', iconCss: 'e-icons e-circle' });
|
|
19381
19321
|
}
|
|
19382
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19322
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('SquareSelection') > -1)) {
|
|
19383
19323
|
items.push({ text: this.l10n.getConstant('Square'), id: 'square', iconCss: 'e-icons e-square' });
|
|
19384
19324
|
}
|
|
19385
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19325
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('RatioSelection') > -1)) {
|
|
19386
19326
|
items.push({ text: '3:2', id: '3:2', iconCss: 'e-icons e-custom-a' });
|
|
19387
19327
|
items.push({ text: '4:3', id: '4:3', iconCss: 'e-icons e-custom-b' });
|
|
19388
19328
|
items.push({ text: '5:4', id: '5:4', iconCss: 'e-icons e-custom-c' });
|
|
@@ -19391,11 +19331,11 @@ class ToolbarModule {
|
|
|
19391
19331
|
}
|
|
19392
19332
|
let iconCss;
|
|
19393
19333
|
let shape;
|
|
19394
|
-
if (
|
|
19334
|
+
if (parent.activeObj.shape) {
|
|
19395
19335
|
iconCss = this.getCurrentShapeIcon(parent.activeObj.shape);
|
|
19396
19336
|
shape = parent.activeObj.shape;
|
|
19397
19337
|
}
|
|
19398
|
-
else if (
|
|
19338
|
+
else if (parent.currSelectionPoint) {
|
|
19399
19339
|
iconCss = this.getCurrentShapeIcon(parent.currSelectionPoint.shape);
|
|
19400
19340
|
shape = parent.currSelectionPoint.shape;
|
|
19401
19341
|
}
|
|
@@ -19412,8 +19352,8 @@ class ToolbarModule {
|
|
|
19412
19352
|
args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
|
|
19413
19353
|
args.element.parentElement.offsetHeight + 'px';
|
|
19414
19354
|
}
|
|
19415
|
-
if (
|
|
19416
|
-
document.getElementById(
|
|
19355
|
+
if (parent.activeObj.shape && parent.activeObj.shape.split('-').length > 1) {
|
|
19356
|
+
document.getElementById(parent.activeObj.shape.split('-')[1]).classList.add('e-selected');
|
|
19417
19357
|
}
|
|
19418
19358
|
parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
|
|
19419
19359
|
},
|
|
@@ -19426,21 +19366,21 @@ class ToolbarModule {
|
|
|
19426
19366
|
iconCss: 'e-icons ' + iconCss, cssClass: 'e-image-popup',
|
|
19427
19367
|
content: parent.toPascalCase(shape.replace('crop-', ''))
|
|
19428
19368
|
});
|
|
19429
|
-
drpDownBtn.appendTo('#' +
|
|
19369
|
+
drpDownBtn.appendTo('#' + parent.element.id + '_cropBtn');
|
|
19430
19370
|
}
|
|
19431
19371
|
renderTransformBtn() {
|
|
19432
19372
|
const parent = this.parent;
|
|
19433
19373
|
const items = [];
|
|
19434
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19374
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('RotateLeft') > -1)) {
|
|
19435
19375
|
items.push({ text: this.l10n.getConstant('RotateLeft'), id: 'rotateleft', iconCss: 'e-icons e-anti-clock-wise' });
|
|
19436
19376
|
}
|
|
19437
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19377
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('RotateRight') > -1)) {
|
|
19438
19378
|
items.push({ text: this.l10n.getConstant('RotateRight'), id: 'rotateright', iconCss: 'e-icons e-clock-wise' });
|
|
19439
19379
|
}
|
|
19440
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19380
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('FlipHorizontal') > -1)) {
|
|
19441
19381
|
items.push({ text: this.l10n.getConstant('HorizontalFlip'), id: 'horizontalflip', iconCss: 'e-icons e-horizontal-flip' });
|
|
19442
19382
|
}
|
|
19443
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19383
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('FlipVertical') > -1)) {
|
|
19444
19384
|
items.push({ text: this.l10n.getConstant('VerticalFlip'), id: 'verticalflip', iconCss: 'e-icons e-vertical-flip' });
|
|
19445
19385
|
}
|
|
19446
19386
|
const drpDownBtn = new DropDownButton({
|
|
@@ -19453,27 +19393,27 @@ class ToolbarModule {
|
|
|
19453
19393
|
args.element.parentElement.style.display = 'block';
|
|
19454
19394
|
}
|
|
19455
19395
|
},
|
|
19456
|
-
items: items, select:
|
|
19396
|
+
items: items, select: parent.transformSelect.bind(this),
|
|
19457
19397
|
iconCss: 'e-icons e-transform', cssClass: 'e-image-popup'
|
|
19458
19398
|
});
|
|
19459
19399
|
drpDownBtn.appendTo('#' + parent.element.id + '_transformBtn');
|
|
19460
19400
|
}
|
|
19461
19401
|
renderSaveBtn() {
|
|
19462
|
-
const
|
|
19402
|
+
const parent = this.parent;
|
|
19463
19403
|
const saveItems = [
|
|
19464
19404
|
{ text: 'JPEG', id: 'jpeg' },
|
|
19465
19405
|
{ text: 'PNG', id: 'png' },
|
|
19466
19406
|
{ text: 'SVG', id: 'svg' }
|
|
19467
19407
|
];
|
|
19468
|
-
const ddbElem = document.getElementById(
|
|
19408
|
+
const ddbElem = document.getElementById(parent.element.id + '_saveBtn');
|
|
19469
19409
|
if (ddbElem) {
|
|
19470
19410
|
// Initialize the DropDownButton component.
|
|
19471
19411
|
const saveDrpDownBtn = new DropDownButton({ items: saveItems, cssClass: 'e-caret-hide e-image-popup', iconCss: 'e-icons e-save',
|
|
19472
19412
|
select: (args) => {
|
|
19473
|
-
|
|
19413
|
+
parent.export(args.item.text);
|
|
19474
19414
|
}
|
|
19475
19415
|
});
|
|
19476
|
-
saveDrpDownBtn.appendTo('#' +
|
|
19416
|
+
saveDrpDownBtn.appendTo('#' + parent.element.id + '_saveBtn');
|
|
19477
19417
|
}
|
|
19478
19418
|
}
|
|
19479
19419
|
getCropTransformToolbarItem() {
|
|
@@ -19483,19 +19423,19 @@ class ToolbarModule {
|
|
|
19483
19423
|
template: '<button id="' + parent.element.id + '_cropBtn"></button>'
|
|
19484
19424
|
});
|
|
19485
19425
|
toolbarItems.push({ align: 'Center', type: 'Separator' });
|
|
19486
|
-
toolbarItems.push({ id:
|
|
19426
|
+
toolbarItems.push({ id: parent.element.id + '_rotateLeft', prefixIcon: 'e-icons e-anti-clock-wise',
|
|
19487
19427
|
tooltipText: this.l10n.getConstant('RotateLeft'), align: 'Center' });
|
|
19488
|
-
toolbarItems.push({ id:
|
|
19428
|
+
toolbarItems.push({ id: parent.element.id + '_rotateRight', prefixIcon: 'e-icons e-clock-wise',
|
|
19489
19429
|
tooltipText: this.l10n.getConstant('RotateRight'), align: 'Center' });
|
|
19490
19430
|
toolbarItems.push({ align: 'Center', type: 'Separator' });
|
|
19491
|
-
toolbarItems.push({ id:
|
|
19431
|
+
toolbarItems.push({ id: parent.element.id + '_horizontalFlip', prefixIcon: 'e-icons e-horizontal-flip',
|
|
19492
19432
|
tooltipText: this.l10n.getConstant('HorizontalFlip'), align: 'Center' });
|
|
19493
|
-
toolbarItems.push({ id:
|
|
19433
|
+
toolbarItems.push({ id: parent.element.id + '_verticalFlip', prefixIcon: 'e-icons e-vertical-flip',
|
|
19494
19434
|
tooltipText: this.l10n.getConstant('VerticalFlip'), align: 'Center' });
|
|
19495
19435
|
if (!Browser.isDevice) {
|
|
19496
|
-
toolbarItems.push({ id:
|
|
19436
|
+
toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
19497
19437
|
tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
|
|
19498
|
-
toolbarItems.push({ id:
|
|
19438
|
+
toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
19499
19439
|
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
19500
19440
|
}
|
|
19501
19441
|
return toolbarItems;
|
|
@@ -19503,31 +19443,31 @@ class ToolbarModule {
|
|
|
19503
19443
|
getShapesToolbarItem(items) {
|
|
19504
19444
|
const parent = this.parent;
|
|
19505
19445
|
const toolbarItems = [];
|
|
19506
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19446
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar)) {
|
|
19507
19447
|
toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
|
|
19508
|
-
template: '<button id="' +
|
|
19448
|
+
template: '<button id="' + parent.element.id + '_annotationBtn"></button>' });
|
|
19509
19449
|
}
|
|
19510
19450
|
if (items.indexOf('fillColor') > -1) {
|
|
19511
|
-
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id:
|
|
19451
|
+
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: parent.element.id + '_fillcolor',
|
|
19512
19452
|
cssClass: 'top-icon e-fill', tooltipText: this.l10n.getConstant('FillColor'), align: 'Center', type: 'Input',
|
|
19513
|
-
template: '<button id="' +
|
|
19453
|
+
template: '<button id="' + parent.element.id + '_fillColorBtn"></button>' });
|
|
19514
19454
|
}
|
|
19515
19455
|
if (items.indexOf('strokeColor') > -1) {
|
|
19516
|
-
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id:
|
|
19456
|
+
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: parent.element.id + '_strokecolor',
|
|
19517
19457
|
cssClass: 'top-icon e-stroke', tooltipText: this.l10n.getConstant('StrokeColor'), align: 'Center', type: 'Input',
|
|
19518
|
-
template: '<button id="' +
|
|
19458
|
+
template: '<button id="' + parent.element.id + '_borderColorBtn"></button>' });
|
|
19519
19459
|
}
|
|
19520
19460
|
if (items.indexOf('strokeWidth') > -1) {
|
|
19521
|
-
toolbarItems.push({ id:
|
|
19522
|
-
type: 'Input', template: '<button id="' +
|
|
19461
|
+
toolbarItems.push({ id: parent.element.id + '_strokeWidth', cssClass: 'top-icon e-size', tooltipText: 'Stroke Width', align: 'Center',
|
|
19462
|
+
type: 'Input', template: '<button id="' + parent.element.id + '_borderWidthBtn"></button>' });
|
|
19523
19463
|
}
|
|
19524
19464
|
if (items.indexOf('start') > -1) {
|
|
19525
|
-
toolbarItems.push({ id:
|
|
19526
|
-
type: 'Input', template: '<button id="' +
|
|
19465
|
+
toolbarItems.push({ id: parent.element.id + '_start', cssClass: 'top-icon e-size', tooltipText: 'Start', align: 'Center',
|
|
19466
|
+
type: 'Input', template: '<button id="' + parent.element.id + '_startBtn"></button>' });
|
|
19527
19467
|
}
|
|
19528
19468
|
if (items.indexOf('end') > -1) {
|
|
19529
|
-
toolbarItems.push({ id:
|
|
19530
|
-
type: 'Input', template: '<button id="' +
|
|
19469
|
+
toolbarItems.push({ id: parent.element.id + '_end', cssClass: 'top-icon e-size', tooltipText: 'End', align: 'Center',
|
|
19470
|
+
type: 'Input', template: '<button id="' + parent.element.id + '_endBtn"></button>' });
|
|
19531
19471
|
}
|
|
19532
19472
|
toolbarItems.push({ align: 'Center', type: 'Separator' });
|
|
19533
19473
|
if (items.indexOf('duplicate') > -1) {
|
|
@@ -19550,15 +19490,16 @@ class ToolbarModule {
|
|
|
19550
19490
|
const obj = { shape: null };
|
|
19551
19491
|
parent.notify('selection', { prop: 'getCurrentDrawingShape', value: { obj: obj } });
|
|
19552
19492
|
if (obj['shape'] !== 'path') {
|
|
19553
|
-
toolbarItems.push({ id:
|
|
19493
|
+
toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
19554
19494
|
tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
|
|
19555
|
-
toolbarItems.push({ id:
|
|
19495
|
+
toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
19556
19496
|
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
19557
19497
|
}
|
|
19558
19498
|
}
|
|
19559
19499
|
return toolbarItems;
|
|
19560
19500
|
}
|
|
19561
19501
|
initCropTransformToolbar() {
|
|
19502
|
+
const parent = this.parent;
|
|
19562
19503
|
const leftItem = this.getLeftToolbarItem();
|
|
19563
19504
|
const rightItem = this.getRightToolbarItem();
|
|
19564
19505
|
const mainItem = this.getCropTransformToolbarItem();
|
|
@@ -19579,9 +19520,9 @@ class ToolbarModule {
|
|
|
19579
19520
|
if (!Browser.isDevice) {
|
|
19580
19521
|
this.renderSaveBtn();
|
|
19581
19522
|
}
|
|
19582
|
-
|
|
19523
|
+
parent.trigger('toolbarCreated', { toolbarType: 'shapes' });
|
|
19583
19524
|
if (Browser.isDevice) {
|
|
19584
|
-
if (this.defToolbarItems.length > 0 &&
|
|
19525
|
+
if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
19585
19526
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
19586
19527
|
toolbar.refreshOverflow();
|
|
19587
19528
|
toolbar.refreshOverflow();
|
|
@@ -19590,22 +19531,22 @@ class ToolbarModule {
|
|
|
19590
19531
|
}
|
|
19591
19532
|
else {
|
|
19592
19533
|
this.createLeftToolbarControls();
|
|
19593
|
-
if (this.defToolbarItems.length > 0 &&
|
|
19534
|
+
if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
19594
19535
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
19595
19536
|
toolbar.refreshOverflow();
|
|
19596
19537
|
}
|
|
19597
19538
|
}
|
|
19598
|
-
|
|
19539
|
+
parent.select('custom');
|
|
19599
19540
|
}
|
|
19600
19541
|
});
|
|
19601
19542
|
if (Browser.isDevice) {
|
|
19602
|
-
toolbar.appendTo('#' +
|
|
19543
|
+
toolbar.appendTo('#' + parent.element.id + '_bottomToolbar');
|
|
19603
19544
|
}
|
|
19604
19545
|
else {
|
|
19605
|
-
toolbar.appendTo('#' +
|
|
19546
|
+
toolbar.appendTo('#' + parent.element.id + '_toolbar');
|
|
19606
19547
|
}
|
|
19607
19548
|
this.enableDisableTbrBtn();
|
|
19608
|
-
|
|
19549
|
+
parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
|
|
19609
19550
|
}
|
|
19610
19551
|
getCurrentShapeIcon(shape) {
|
|
19611
19552
|
let icon = '';
|
|
@@ -19616,9 +19557,6 @@ class ToolbarModule {
|
|
|
19616
19557
|
case 'ellipse':
|
|
19617
19558
|
icon = 'e-circle';
|
|
19618
19559
|
break;
|
|
19619
|
-
case 'triangle':
|
|
19620
|
-
icon = 'e-triangle';
|
|
19621
|
-
break;
|
|
19622
19560
|
case 'line':
|
|
19623
19561
|
icon = 'e-line';
|
|
19624
19562
|
break;
|
|
@@ -19665,6 +19603,7 @@ class ToolbarModule {
|
|
|
19665
19603
|
return icon;
|
|
19666
19604
|
}
|
|
19667
19605
|
initShapesToolbarItem(items) {
|
|
19606
|
+
const parent = this.parent;
|
|
19668
19607
|
const leftItem = this.getLeftToolbarItem();
|
|
19669
19608
|
const rightItem = this.getRightToolbarItem();
|
|
19670
19609
|
const mainItem = this.getShapesToolbarItem(items);
|
|
@@ -19683,7 +19622,7 @@ class ToolbarModule {
|
|
|
19683
19622
|
this.renderAnnotationBtn(true);
|
|
19684
19623
|
this.createShapeColor(items);
|
|
19685
19624
|
this.createShapeBtn(items);
|
|
19686
|
-
if (
|
|
19625
|
+
if (parent.activeObj.shape === 'arrow') {
|
|
19687
19626
|
this.createStartBtn();
|
|
19688
19627
|
this.createEndBtn();
|
|
19689
19628
|
}
|
|
@@ -19691,9 +19630,9 @@ class ToolbarModule {
|
|
|
19691
19630
|
if (!Browser.isDevice) {
|
|
19692
19631
|
this.renderSaveBtn();
|
|
19693
19632
|
}
|
|
19694
|
-
|
|
19633
|
+
parent.trigger('toolbarCreated', { toolbarType: 'shapes' });
|
|
19695
19634
|
if (Browser.isDevice) {
|
|
19696
|
-
if (this.defToolbarItems.length > 0 &&
|
|
19635
|
+
if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
19697
19636
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
19698
19637
|
toolbar.refreshOverflow();
|
|
19699
19638
|
toolbar.refreshOverflow();
|
|
@@ -19702,7 +19641,7 @@ class ToolbarModule {
|
|
|
19702
19641
|
}
|
|
19703
19642
|
else {
|
|
19704
19643
|
this.createLeftToolbarControls();
|
|
19705
|
-
if (this.defToolbarItems.length > 0 &&
|
|
19644
|
+
if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
19706
19645
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
19707
19646
|
toolbar.refreshOverflow();
|
|
19708
19647
|
}
|
|
@@ -19710,10 +19649,10 @@ class ToolbarModule {
|
|
|
19710
19649
|
}
|
|
19711
19650
|
});
|
|
19712
19651
|
if (Browser.isDevice) {
|
|
19713
|
-
toolbar.appendTo('#' +
|
|
19652
|
+
toolbar.appendTo('#' + parent.element.id + '_bottomToolbar');
|
|
19714
19653
|
}
|
|
19715
19654
|
else {
|
|
19716
|
-
toolbar.appendTo('#' +
|
|
19655
|
+
toolbar.appendTo('#' + parent.element.id + '_toolbar');
|
|
19717
19656
|
}
|
|
19718
19657
|
this.enableDisableTbrBtn();
|
|
19719
19658
|
}
|
|
@@ -19727,7 +19666,7 @@ class ToolbarModule {
|
|
|
19727
19666
|
modeSwitcher: false, noColor: true, value: '',
|
|
19728
19667
|
showButtons: false, mode: 'Palette', cssClass: 'e-shape-fill-color',
|
|
19729
19668
|
change: (args) => {
|
|
19730
|
-
|
|
19669
|
+
parent.updateFillColor(args.currentValue.hex);
|
|
19731
19670
|
if (args.currentValue.rgba === '') {
|
|
19732
19671
|
fillDDB.element.children[0].classList.add('e-nocolor-item');
|
|
19733
19672
|
}
|
|
@@ -19748,7 +19687,7 @@ class ToolbarModule {
|
|
|
19748
19687
|
},
|
|
19749
19688
|
target: '.e-shape-fill-color',
|
|
19750
19689
|
iconCss: 'e-dropdownbtn-preview'
|
|
19751
|
-
}, '#' +
|
|
19690
|
+
}, '#' + parent.element.id + '_fillColorBtn');
|
|
19752
19691
|
fillColor.inline = true;
|
|
19753
19692
|
parent.element.querySelector('.e-fill.e-template .e-dropdownbtn-preview').classList.add('e-nocolor-item');
|
|
19754
19693
|
}
|
|
@@ -19760,7 +19699,7 @@ class ToolbarModule {
|
|
|
19760
19699
|
modeSwitcher: false, noColor: false, value: '#fff',
|
|
19761
19700
|
showButtons: false, mode: 'Palette', cssClass: 'e-shape-stroke-color',
|
|
19762
19701
|
change: (args) => {
|
|
19763
|
-
|
|
19702
|
+
parent.updateStrokeColor(args.currentValue.hex);
|
|
19764
19703
|
strokeDDB.element.children[0].style.backgroundColor = args.currentValue.rgba;
|
|
19765
19704
|
strokeDDB.toggle();
|
|
19766
19705
|
}
|
|
@@ -19770,7 +19709,7 @@ class ToolbarModule {
|
|
|
19770
19709
|
if (Browser.isDevice) {
|
|
19771
19710
|
args.element.parentElement.style.top = strokeDDB.element.getBoundingClientRect().top -
|
|
19772
19711
|
args.element.parentElement.offsetHeight + 'px';
|
|
19773
|
-
args.element.parentElement.style.left =
|
|
19712
|
+
args.element.parentElement.style.left = parent.element.offsetLeft + 'px';
|
|
19774
19713
|
}
|
|
19775
19714
|
},
|
|
19776
19715
|
target: '.e-shape-stroke-color',
|
|
@@ -19809,18 +19748,18 @@ class ToolbarModule {
|
|
|
19809
19748
|
},
|
|
19810
19749
|
select: (args) => {
|
|
19811
19750
|
spanElem.textContent = args.item.text;
|
|
19812
|
-
|
|
19751
|
+
parent.updateStrokeWidth(args.item.id);
|
|
19813
19752
|
if (Browser.isDevice) {
|
|
19814
|
-
if (
|
|
19753
|
+
if (document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
19815
19754
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
19816
|
-
const toolbar = getComponent(
|
|
19755
|
+
const toolbar = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
|
|
19817
19756
|
toolbar.refreshOverflow();
|
|
19818
19757
|
}
|
|
19819
19758
|
}
|
|
19820
19759
|
else {
|
|
19821
|
-
if (
|
|
19760
|
+
if (document.getElementById(parent.element.id + '_toolbar')) {
|
|
19822
19761
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
19823
|
-
const toolbar = getComponent(
|
|
19762
|
+
const toolbar = getComponent(parent.element.id + '_toolbar', 'toolbar');
|
|
19824
19763
|
toolbar.refreshOverflow();
|
|
19825
19764
|
}
|
|
19826
19765
|
}
|
|
@@ -19844,10 +19783,10 @@ class ToolbarModule {
|
|
|
19844
19783
|
];
|
|
19845
19784
|
const strokeWidthBtn = document.getElementById(parent.element.id + '_startBtn');
|
|
19846
19785
|
const spanElem = document.createElement('span');
|
|
19847
|
-
if (isNullOrUndefined(
|
|
19848
|
-
|
|
19786
|
+
if (isNullOrUndefined(parent.activeObj.start)) {
|
|
19787
|
+
parent.activeObj.start = 'none';
|
|
19849
19788
|
}
|
|
19850
|
-
spanElem.innerHTML =
|
|
19789
|
+
spanElem.innerHTML = parent.pascalToSplitWords(parent.activeObj.start);
|
|
19851
19790
|
spanElem.className = 'e-shape-start';
|
|
19852
19791
|
strokeWidthBtn.appendChild(spanElem);
|
|
19853
19792
|
// Initialize the DropDownButton component.
|
|
@@ -19884,10 +19823,10 @@ class ToolbarModule {
|
|
|
19884
19823
|
];
|
|
19885
19824
|
const strokeEndBtn = document.getElementById(parent.element.id + '_endBtn');
|
|
19886
19825
|
const spanElem = document.createElement('span');
|
|
19887
|
-
if (isNullOrUndefined(
|
|
19888
|
-
|
|
19826
|
+
if (isNullOrUndefined(parent.activeObj.end)) {
|
|
19827
|
+
parent.activeObj.end = 'arrowSolid';
|
|
19889
19828
|
}
|
|
19890
|
-
spanElem.innerHTML =
|
|
19829
|
+
spanElem.innerHTML = parent.pascalToSplitWords(parent.activeObj.end);
|
|
19891
19830
|
spanElem.className = 'e-shape-end';
|
|
19892
19831
|
strokeEndBtn.appendChild(spanElem);
|
|
19893
19832
|
// Initialize the DropDownButton component.
|
|
@@ -19913,9 +19852,9 @@ class ToolbarModule {
|
|
|
19913
19852
|
getTextToolbarItem(items) {
|
|
19914
19853
|
const parent = this.parent;
|
|
19915
19854
|
const toolbarItems = [];
|
|
19916
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19855
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar)) {
|
|
19917
19856
|
toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
|
|
19918
|
-
template: '<button id="' +
|
|
19857
|
+
template: '<button id="' + parent.element.id + '_annotationBtn"></button>' });
|
|
19919
19858
|
}
|
|
19920
19859
|
if (items.indexOf('fontFamily') > -1) {
|
|
19921
19860
|
toolbarItems.push({ id: parent.element.id + '_fontFamily', cssClass: 'top-icon e-img-font-family',
|
|
@@ -19999,7 +19938,7 @@ class ToolbarModule {
|
|
|
19999
19938
|
}
|
|
20000
19939
|
parent.trigger('toolbarCreated', { toolbarType: 'text' });
|
|
20001
19940
|
if (Browser.isDevice) {
|
|
20002
|
-
if (this.defToolbarItems.length > 0 &&
|
|
19941
|
+
if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
20003
19942
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20004
19943
|
toolbar.refreshOverflow();
|
|
20005
19944
|
toolbar.refreshOverflow();
|
|
@@ -20008,7 +19947,7 @@ class ToolbarModule {
|
|
|
20008
19947
|
}
|
|
20009
19948
|
else {
|
|
20010
19949
|
this.createLeftToolbarControls();
|
|
20011
|
-
if (this.defToolbarItems.length > 0 &&
|
|
19950
|
+
if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
20012
19951
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20013
19952
|
toolbar.refreshOverflow();
|
|
20014
19953
|
}
|
|
@@ -20025,7 +19964,7 @@ class ToolbarModule {
|
|
|
20025
19964
|
}
|
|
20026
19965
|
createTextColor(items) {
|
|
20027
19966
|
const parent = this.parent;
|
|
20028
|
-
if (items.indexOf('fontColor') > -1 &&
|
|
19967
|
+
if (items.indexOf('fontColor') > -1 && parent.element.querySelector('.e-template.e-text-font-color')) {
|
|
20029
19968
|
parent.element.querySelector('.e-template.e-text-font-color').appendChild(parent.createElement('input', {
|
|
20030
19969
|
id: parent.element.id + '_text_font'
|
|
20031
19970
|
}));
|
|
@@ -20033,7 +19972,7 @@ class ToolbarModule {
|
|
|
20033
19972
|
modeSwitcher: false, value: '#fff',
|
|
20034
19973
|
showButtons: false, mode: 'Palette', cssClass: 'e-text-fontt-color',
|
|
20035
19974
|
change: (args) => {
|
|
20036
|
-
|
|
19975
|
+
parent.updateFontColor(args.currentValue.hex);
|
|
20037
19976
|
strokeDDB.element.children[0].style.backgroundColor = args.currentValue.rgba;
|
|
20038
19977
|
strokeDDB.toggle();
|
|
20039
19978
|
}
|
|
@@ -20067,7 +20006,7 @@ class ToolbarModule {
|
|
|
20067
20006
|
spanElem.innerHTML = 'Arial';
|
|
20068
20007
|
}
|
|
20069
20008
|
spanElem.className = 'e-text-font-family';
|
|
20070
|
-
if (
|
|
20009
|
+
if (fontNameBtn) {
|
|
20071
20010
|
fontNameBtn.appendChild(spanElem);
|
|
20072
20011
|
}
|
|
20073
20012
|
const fontFamilyBtn = new DropDownButton({ items: this.getFontFamilyItems(),
|
|
@@ -20128,24 +20067,25 @@ class ToolbarModule {
|
|
|
20128
20067
|
}
|
|
20129
20068
|
}
|
|
20130
20069
|
refreshToolbar(type, isApplyBtn, isCropping, isZooming, cType) {
|
|
20131
|
-
|
|
20070
|
+
const parent = this.parent;
|
|
20071
|
+
if (!parent.isImageLoaded || parent.isCropToolbar) {
|
|
20132
20072
|
return;
|
|
20133
20073
|
}
|
|
20134
20074
|
const args = { toolbarType: type };
|
|
20135
20075
|
if (type !== 'filter' && type !== 'color') {
|
|
20136
|
-
if (document.getElementById(
|
|
20137
|
-
getComponent(document.getElementById(
|
|
20138
|
-
document.getElementById(
|
|
20076
|
+
if (document.getElementById(parent.element.id + '_toolbar') && this.defToolbarItems.length > 0) {
|
|
20077
|
+
getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
|
|
20078
|
+
document.getElementById(parent.element.id + '_toolbar').innerHTML = '';
|
|
20139
20079
|
}
|
|
20140
|
-
if (document.getElementById(
|
|
20141
|
-
if (document.getElementById(
|
|
20142
|
-
getComponent(document.getElementById(
|
|
20143
|
-
document.getElementById(
|
|
20080
|
+
if (document.getElementById(parent.element.id + '_bottomToolbar') && this.defToolbarItems.length > 0) {
|
|
20081
|
+
if (document.getElementById(parent.element.id + '_bottomToolbar').className.indexOf('e-control') > -1) {
|
|
20082
|
+
getComponent(document.getElementById(parent.element.id + '_bottomToolbar'), 'toolbar').destroy();
|
|
20083
|
+
document.getElementById(parent.element.id + '_bottomToolbar').innerHTML = '';
|
|
20144
20084
|
}
|
|
20145
20085
|
}
|
|
20146
20086
|
}
|
|
20147
20087
|
this.refreshSlider();
|
|
20148
|
-
|
|
20088
|
+
parent.isCropTab = false;
|
|
20149
20089
|
switch (type) {
|
|
20150
20090
|
case 'main':
|
|
20151
20091
|
if (Browser.isDevice) {
|
|
@@ -20172,16 +20112,16 @@ class ToolbarModule {
|
|
|
20172
20112
|
if (Browser.isDevice) {
|
|
20173
20113
|
this.initMainToolbar(false, true, true);
|
|
20174
20114
|
}
|
|
20175
|
-
if (
|
|
20115
|
+
if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'path') {
|
|
20176
20116
|
args.toolbarItems = ['strokeColor', 'strokeWidth', 'duplicate', 'remove'];
|
|
20177
20117
|
}
|
|
20178
|
-
else if (
|
|
20118
|
+
else if (parent.activeObj.shape === 'arrow') {
|
|
20179
20119
|
args.toolbarItems = ['strokeColor', 'strokeWidth', 'start', 'end', 'duplicate', 'remove'];
|
|
20180
20120
|
}
|
|
20181
20121
|
else {
|
|
20182
20122
|
args.toolbarItems = ['fillColor', 'strokeColor', 'strokeWidth', 'duplicate', 'remove'];
|
|
20183
20123
|
}
|
|
20184
|
-
|
|
20124
|
+
parent.trigger('toolbarUpdating', args);
|
|
20185
20125
|
this.initShapesToolbarItem(args.toolbarItems);
|
|
20186
20126
|
break;
|
|
20187
20127
|
case 'text':
|
|
@@ -20189,7 +20129,7 @@ class ToolbarModule {
|
|
|
20189
20129
|
this.initMainToolbar(false, true, true);
|
|
20190
20130
|
}
|
|
20191
20131
|
args.toolbarItems = ['fontFamily', 'fontSize', 'fontColor', 'bold', 'italic', 'duplicate', 'remove', 'text'];
|
|
20192
|
-
|
|
20132
|
+
parent.trigger('toolbarUpdating', args);
|
|
20193
20133
|
this.initTextToolbarItem(args.toolbarItems);
|
|
20194
20134
|
break;
|
|
20195
20135
|
case 'pen':
|
|
@@ -20197,7 +20137,7 @@ class ToolbarModule {
|
|
|
20197
20137
|
this.initMainToolbar(false, true, true);
|
|
20198
20138
|
}
|
|
20199
20139
|
args.toolbarItems = ['strokeColor', 'strokeWidth', 'remove'];
|
|
20200
|
-
|
|
20140
|
+
parent.trigger('toolbarUpdating', args);
|
|
20201
20141
|
this.initPenToolbarItem(args.toolbarItems);
|
|
20202
20142
|
break;
|
|
20203
20143
|
case 'adjustment':
|
|
@@ -20213,11 +20153,11 @@ class ToolbarModule {
|
|
|
20213
20153
|
this.updateContextualToolbar(type, cType);
|
|
20214
20154
|
break;
|
|
20215
20155
|
case 'croptransform':
|
|
20216
|
-
|
|
20156
|
+
parent.isCropTab = true;
|
|
20217
20157
|
if (Browser.isDevice) {
|
|
20218
20158
|
this.initMainToolbar(false, true, true);
|
|
20219
20159
|
}
|
|
20220
|
-
|
|
20160
|
+
parent.updateCropTransformItems();
|
|
20221
20161
|
this.initCropTransformToolbar();
|
|
20222
20162
|
break;
|
|
20223
20163
|
}
|
|
@@ -20226,32 +20166,33 @@ class ToolbarModule {
|
|
|
20226
20166
|
}
|
|
20227
20167
|
getAdjustmentToolbarItem() {
|
|
20228
20168
|
const toolbarItems = [];
|
|
20229
|
-
|
|
20230
|
-
|
|
20169
|
+
const parent = this.parent;
|
|
20170
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Brightness') > -1)) {
|
|
20171
|
+
toolbarItems.push({ id: parent.element.id + '_brightness', prefixIcon: 'e-icons e-brightness', cssClass: 'top-icon e-brightness',
|
|
20231
20172
|
tooltipText: this.l10n.getConstant('Brightness'), align: 'Center' });
|
|
20232
20173
|
}
|
|
20233
|
-
if (isNullOrUndefined(
|
|
20234
|
-
toolbarItems.push({ id:
|
|
20174
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Contrast') > -1)) {
|
|
20175
|
+
toolbarItems.push({ id: parent.element.id + '_contrast', prefixIcon: 'e-icons e-contrast', cssClass: 'top-icon e-contrast',
|
|
20235
20176
|
tooltipText: this.l10n.getConstant('Contrast'), align: 'Center' });
|
|
20236
20177
|
}
|
|
20237
|
-
if (isNullOrUndefined(
|
|
20238
|
-
toolbarItems.push({ id:
|
|
20178
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Hue') > -1)) {
|
|
20179
|
+
toolbarItems.push({ id: parent.element.id + '_hue', prefixIcon: 'e-icons e-fade', cssClass: 'top-icon e-fade',
|
|
20239
20180
|
tooltipText: this.l10n.getConstant('Hue'), align: 'Center' });
|
|
20240
20181
|
}
|
|
20241
|
-
if (isNullOrUndefined(
|
|
20242
|
-
toolbarItems.push({ id:
|
|
20182
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Saturation') > -1)) {
|
|
20183
|
+
toolbarItems.push({ id: parent.element.id + '_saturation', prefixIcon: 'e-icons e-saturation', cssClass: 'top-icon e-saturation',
|
|
20243
20184
|
tooltipText: this.l10n.getConstant('Saturation'), align: 'Center' });
|
|
20244
20185
|
}
|
|
20245
|
-
if (isNullOrUndefined(
|
|
20246
|
-
toolbarItems.push({ id:
|
|
20186
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Exposure') > -1)) {
|
|
20187
|
+
toolbarItems.push({ id: parent.element.id + '_exposure', prefixIcon: 'e-icons e-grain', cssClass: 'top-icon e-grain',
|
|
20247
20188
|
tooltipText: this.l10n.getConstant('Exposure'), align: 'Center' });
|
|
20248
20189
|
}
|
|
20249
|
-
if (isNullOrUndefined(
|
|
20250
|
-
toolbarItems.push({ id:
|
|
20190
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Opacity') > -1)) {
|
|
20191
|
+
toolbarItems.push({ id: parent.element.id + '_opacity', prefixIcon: 'e-icons e-opacity', cssClass: 'top-icon e-opacity',
|
|
20251
20192
|
tooltipText: this.l10n.getConstant('Opacity'), align: 'Center' });
|
|
20252
20193
|
}
|
|
20253
|
-
if (isNullOrUndefined(
|
|
20254
|
-
toolbarItems.push({ id:
|
|
20194
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Blur') > -1)) {
|
|
20195
|
+
toolbarItems.push({ id: parent.element.id + '_blur', prefixIcon: 'e-icons e-tint', cssClass: 'top-icon e-tint',
|
|
20255
20196
|
tooltipText: this.l10n.getConstant('Blur'), align: 'Center' });
|
|
20256
20197
|
}
|
|
20257
20198
|
const tempToolbarItems = this.processToolbar('center');
|
|
@@ -20259,49 +20200,50 @@ class ToolbarModule {
|
|
|
20259
20200
|
toolbarItems.push(tempToolbarItems[i]);
|
|
20260
20201
|
}
|
|
20261
20202
|
if (!Browser.isDevice) {
|
|
20262
|
-
toolbarItems.push({ id:
|
|
20203
|
+
toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
20263
20204
|
tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
|
|
20264
|
-
toolbarItems.push({ id:
|
|
20205
|
+
toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
20265
20206
|
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
20266
20207
|
}
|
|
20267
20208
|
return toolbarItems;
|
|
20268
20209
|
}
|
|
20269
20210
|
getFilterToolbarItem() {
|
|
20270
20211
|
const toolbarItems = [];
|
|
20271
|
-
|
|
20272
|
-
|
|
20212
|
+
const parent = this.parent;
|
|
20213
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Default') > -1)) {
|
|
20214
|
+
toolbarItems.push({ id: parent.element.id + '_default', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
20273
20215
|
tooltipText: this.l10n.getConstant('Default'), align: 'Center',
|
|
20274
|
-
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' +
|
|
20216
|
+
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
20217
|
}
|
|
20276
|
-
if (isNullOrUndefined(
|
|
20277
|
-
toolbarItems.push({ id:
|
|
20218
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Chrome') > -1)) {
|
|
20219
|
+
toolbarItems.push({ id: parent.element.id + '_chrome', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
20278
20220
|
tooltipText: this.l10n.getConstant('Chrome'), align: 'Center',
|
|
20279
|
-
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' +
|
|
20221
|
+
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
20222
|
}
|
|
20281
|
-
if (isNullOrUndefined(
|
|
20282
|
-
toolbarItems.push({ id:
|
|
20223
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Cold') > -1)) {
|
|
20224
|
+
toolbarItems.push({ id: parent.element.id + '_cold', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
20283
20225
|
tooltipText: this.l10n.getConstant('Cold'), align: 'Center',
|
|
20284
|
-
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' +
|
|
20226
|
+
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
20227
|
}
|
|
20286
|
-
if (isNullOrUndefined(
|
|
20287
|
-
toolbarItems.push({ id:
|
|
20228
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Warm') > -1)) {
|
|
20229
|
+
toolbarItems.push({ id: parent.element.id + '_warm', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
20288
20230
|
tooltipText: this.l10n.getConstant('Warm'), align: 'Center',
|
|
20289
|
-
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' +
|
|
20231
|
+
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
20232
|
}
|
|
20291
|
-
if (isNullOrUndefined(
|
|
20292
|
-
toolbarItems.push({ id:
|
|
20233
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Grayscale') > -1)) {
|
|
20234
|
+
toolbarItems.push({ id: parent.element.id + '_grayscale', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
20293
20235
|
tooltipText: this.l10n.getConstant('Grayscale'), align: 'Center',
|
|
20294
|
-
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' +
|
|
20236
|
+
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
20237
|
}
|
|
20296
|
-
if (isNullOrUndefined(
|
|
20297
|
-
toolbarItems.push({ id:
|
|
20238
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Sepia') > -1)) {
|
|
20239
|
+
toolbarItems.push({ id: parent.element.id + '_sepia', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
20298
20240
|
tooltipText: this.l10n.getConstant('Sepia'), align: 'Center',
|
|
20299
|
-
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' +
|
|
20241
|
+
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
20242
|
}
|
|
20301
|
-
if (isNullOrUndefined(
|
|
20302
|
-
toolbarItems.push({ id:
|
|
20243
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Invert') > -1)) {
|
|
20244
|
+
toolbarItems.push({ id: parent.element.id + '_invert', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
20303
20245
|
tooltipText: this.l10n.getConstant('Invert'), align: 'Center',
|
|
20304
|
-
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' +
|
|
20246
|
+
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
20247
|
}
|
|
20306
20248
|
const tempToolbarItems = this.processToolbar('center');
|
|
20307
20249
|
for (let i = 0, len = tempToolbarItems.length; i < len; i++) {
|
|
@@ -20312,20 +20254,20 @@ class ToolbarModule {
|
|
|
20312
20254
|
getPenToolbarItem(items) {
|
|
20313
20255
|
const parent = this.parent;
|
|
20314
20256
|
const toolbarItems = [];
|
|
20315
|
-
if (isNullOrUndefined(parent.toolbar) ||
|
|
20257
|
+
if (isNullOrUndefined(parent.toolbar) || parent.toolbar) {
|
|
20316
20258
|
toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
|
|
20317
|
-
template: '<button id="' +
|
|
20259
|
+
template: '<button id="' + parent.element.id + '_annotationBtn"></button>' });
|
|
20318
20260
|
}
|
|
20319
20261
|
if (items.indexOf('strokeColor') > -1) {
|
|
20320
|
-
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id:
|
|
20262
|
+
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: parent.element.id + '_pen_strokecolor',
|
|
20321
20263
|
cssClass: 'top-icon e-pen-stroke-color',
|
|
20322
20264
|
tooltipText: this.l10n.getConstant('StrokeColor'), align: 'Center', type: 'Input',
|
|
20323
|
-
template: '<button id="' +
|
|
20265
|
+
template: '<button id="' + parent.element.id + '_penColorBtn"></button>' });
|
|
20324
20266
|
}
|
|
20325
20267
|
if (items.indexOf('strokeWidth') > -1) {
|
|
20326
20268
|
toolbarItems.push({ prefixIcon: 'e-icons e-copy', cssClass: 'top-icon e-size',
|
|
20327
20269
|
tooltipText: this.l10n.getConstant('StrokeWidth'),
|
|
20328
|
-
align: 'Center', type: 'Input', template: '<button id="' +
|
|
20270
|
+
align: 'Center', type: 'Input', template: '<button id="' + parent.element.id + '_penStrokeWidth"></button>' });
|
|
20329
20271
|
}
|
|
20330
20272
|
toolbarItems.push({ align: 'Center', type: 'Separator' });
|
|
20331
20273
|
if (items.indexOf('remove') > -1) {
|
|
@@ -20337,14 +20279,15 @@ class ToolbarModule {
|
|
|
20337
20279
|
toolbarItems.push(tempToolbarItems[i]);
|
|
20338
20280
|
}
|
|
20339
20281
|
if (!Browser.isDevice) {
|
|
20340
|
-
toolbarItems.push({ id:
|
|
20282
|
+
toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
20341
20283
|
tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
|
|
20342
|
-
toolbarItems.push({ id:
|
|
20284
|
+
toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
20343
20285
|
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
20344
20286
|
}
|
|
20345
20287
|
return toolbarItems;
|
|
20346
20288
|
}
|
|
20347
20289
|
initPenToolbarItem(items) {
|
|
20290
|
+
const parent = this.parent;
|
|
20348
20291
|
const leftItem = this.getLeftToolbarItem();
|
|
20349
20292
|
const rightItem = this.getRightToolbarItem();
|
|
20350
20293
|
const mainItem = this.getPenToolbarItem(items);
|
|
@@ -20367,9 +20310,9 @@ class ToolbarModule {
|
|
|
20367
20310
|
if (!Browser.isDevice) {
|
|
20368
20311
|
this.renderSaveBtn();
|
|
20369
20312
|
}
|
|
20370
|
-
|
|
20313
|
+
parent.trigger('toolbarCreated', { toolbarType: 'pen' });
|
|
20371
20314
|
if (Browser.isDevice) {
|
|
20372
|
-
if (this.defToolbarItems.length > 0 &&
|
|
20315
|
+
if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
20373
20316
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20374
20317
|
toolbar.refreshOverflow();
|
|
20375
20318
|
toolbar.refreshOverflow();
|
|
@@ -20377,7 +20320,7 @@ class ToolbarModule {
|
|
|
20377
20320
|
}
|
|
20378
20321
|
else {
|
|
20379
20322
|
this.createLeftToolbarControls();
|
|
20380
|
-
if (this.defToolbarItems.length > 0 &&
|
|
20323
|
+
if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
20381
20324
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20382
20325
|
toolbar.refreshOverflow();
|
|
20383
20326
|
}
|
|
@@ -20385,16 +20328,15 @@ class ToolbarModule {
|
|
|
20385
20328
|
}
|
|
20386
20329
|
});
|
|
20387
20330
|
if (Browser.isDevice) {
|
|
20388
|
-
toolbar.appendTo('#' +
|
|
20331
|
+
toolbar.appendTo('#' + parent.element.id + '_bottomToolbar');
|
|
20389
20332
|
}
|
|
20390
20333
|
else {
|
|
20391
|
-
toolbar.appendTo('#' +
|
|
20334
|
+
toolbar.appendTo('#' + parent.element.id + '_toolbar');
|
|
20392
20335
|
}
|
|
20393
20336
|
this.enableDisableTbrBtn();
|
|
20394
20337
|
}
|
|
20395
20338
|
createPenColor(items) {
|
|
20396
20339
|
const parent = this.parent;
|
|
20397
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
20398
20340
|
if (items.indexOf('strokeColor') > -1) {
|
|
20399
20341
|
parent.element.querySelector('.e-template.e-pen-stroke-color').appendChild(parent.createElement('input', {
|
|
20400
20342
|
id: parent.element.id + '_pen_stroke'
|
|
@@ -20403,7 +20345,7 @@ class ToolbarModule {
|
|
|
20403
20345
|
modeSwitcher: false, value: '#fff',
|
|
20404
20346
|
showButtons: false, mode: 'Palette', cssClass: 'e-pen-color',
|
|
20405
20347
|
change: (args) => {
|
|
20406
|
-
|
|
20348
|
+
parent.updatePenStrokeColor(args.currentValue.hex);
|
|
20407
20349
|
this.selFhdColor = args.currentValue.hex;
|
|
20408
20350
|
strokeDDB.element.children[0].style.backgroundColor = args.currentValue.rgba;
|
|
20409
20351
|
strokeDDB.toggle();
|
|
@@ -20426,7 +20368,7 @@ class ToolbarModule {
|
|
|
20426
20368
|
const indexObj = { freehandSelectedIndex: null };
|
|
20427
20369
|
parent.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
|
|
20428
20370
|
if (!isNullOrUndefined(indexObj['freehandSelectedIndex']) && indexObj['freehandSelectedIndex'] > -1) {
|
|
20429
|
-
|
|
20371
|
+
parent.element.querySelector('.e-pen-stroke-color.e-template .e-dropdownbtn-preview').style.background
|
|
20430
20372
|
= this.selFhdColor === '#42a5f5' ? obj['tempFreeHandDrawEditingStyles'].strokeColor :
|
|
20431
20373
|
parent.pointColl[indexObj['freehandSelectedIndex']].strokeColor;
|
|
20432
20374
|
}
|
|
@@ -20470,16 +20412,16 @@ class ToolbarModule {
|
|
|
20470
20412
|
},
|
|
20471
20413
|
select: (args) => {
|
|
20472
20414
|
spanElem.textContent = args.item.text;
|
|
20473
|
-
|
|
20415
|
+
parent.updatePenStrokeWidth(args.item.id);
|
|
20474
20416
|
if (Browser.isDevice) {
|
|
20475
|
-
if (
|
|
20417
|
+
if (document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
20476
20418
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20477
20419
|
const toolbar = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
|
|
20478
20420
|
toolbar.refreshOverflow();
|
|
20479
20421
|
}
|
|
20480
20422
|
}
|
|
20481
20423
|
else {
|
|
20482
|
-
if (
|
|
20424
|
+
if (document.getElementById(parent.element.id + '_toolbar')) {
|
|
20483
20425
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20484
20426
|
const toolbar = getComponent(parent.element.id + '_toolbar', 'toolbar');
|
|
20485
20427
|
toolbar.refreshOverflow();
|
|
@@ -20527,14 +20469,14 @@ class ToolbarModule {
|
|
|
20527
20469
|
this.renderSaveBtn();
|
|
20528
20470
|
}
|
|
20529
20471
|
if (Browser.isDevice) {
|
|
20530
|
-
if (this.defToolbarItems.length > 0 &&
|
|
20472
|
+
if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
20531
20473
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20532
20474
|
toolbar.refreshOverflow();
|
|
20533
20475
|
}
|
|
20534
20476
|
}
|
|
20535
20477
|
else {
|
|
20536
20478
|
this.createLeftToolbarControls();
|
|
20537
|
-
if (this.defToolbarItems.length > 0 &&
|
|
20479
|
+
if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
20538
20480
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20539
20481
|
toolbar.refreshOverflow();
|
|
20540
20482
|
}
|
|
@@ -20552,8 +20494,8 @@ class ToolbarModule {
|
|
|
20552
20494
|
initFilterToolbarItem() {
|
|
20553
20495
|
const parent = this.parent;
|
|
20554
20496
|
const mainItem = this.getFilterToolbarItem();
|
|
20555
|
-
if (document.querySelector('#' +
|
|
20556
|
-
getComponent(document.getElementById(
|
|
20497
|
+
if (document.querySelector('#' + parent.element.id + '_contextualToolbar').classList.contains('e-control')) {
|
|
20498
|
+
getComponent(document.getElementById(parent.element.id + '_contextualToolbar'), 'toolbar').destroy();
|
|
20557
20499
|
}
|
|
20558
20500
|
const toolbar = new Toolbar({
|
|
20559
20501
|
width: '100%',
|
|
@@ -20563,7 +20505,7 @@ class ToolbarModule {
|
|
|
20563
20505
|
this.updatePrivateVariables();
|
|
20564
20506
|
this.createCanvasFilter();
|
|
20565
20507
|
if (parent.currentFilter === '') {
|
|
20566
|
-
parent.currentFilter =
|
|
20508
|
+
parent.currentFilter = parent.element.id + '_default';
|
|
20567
20509
|
}
|
|
20568
20510
|
const hdrWrapper = document.querySelector('#' + parent.element.id + '_headWrapper');
|
|
20569
20511
|
if (hdrWrapper) {
|
|
@@ -20574,10 +20516,12 @@ class ToolbarModule {
|
|
|
20574
20516
|
toolbar.refreshOverflow();
|
|
20575
20517
|
}
|
|
20576
20518
|
});
|
|
20577
|
-
toolbar.appendTo('#' +
|
|
20519
|
+
toolbar.appendTo('#' + parent.element.id + '_contextualToolbar');
|
|
20578
20520
|
}
|
|
20579
20521
|
createCanvasFilter() {
|
|
20580
20522
|
const parent = this.parent;
|
|
20523
|
+
showSpinner(parent.element);
|
|
20524
|
+
parent.element.style.opacity = '0.5';
|
|
20581
20525
|
const imageData = parent.getCurrentCanvasData();
|
|
20582
20526
|
this.inMemoryCanvas.width = imageData.width;
|
|
20583
20527
|
this.inMemoryCanvas.height = imageData.height;
|
|
@@ -20589,16 +20533,19 @@ class ToolbarModule {
|
|
|
20589
20533
|
this.updateFilterCanvas('_grayscaleCanvas', 'grayscale');
|
|
20590
20534
|
this.updateFilterCanvas('_sepiaCanvas', 'sepia');
|
|
20591
20535
|
this.updateFilterCanvas('_invertCanvas', 'invert');
|
|
20536
|
+
hideSpinner(parent.element);
|
|
20537
|
+
parent.element.style.opacity = '1';
|
|
20592
20538
|
parent.initialAdjustmentValue = this.lowerContext.filter;
|
|
20593
20539
|
}
|
|
20594
20540
|
updateFilterCanvas(selector, type) {
|
|
20595
|
-
const
|
|
20596
|
-
|
|
20541
|
+
const parent = this.parent;
|
|
20542
|
+
const filter = parent.element.querySelector('#' + parent.element.id + selector);
|
|
20543
|
+
if (filter) {
|
|
20597
20544
|
let ctx = filter.getContext('2d');
|
|
20598
20545
|
ctx = filter.getContext('2d');
|
|
20599
20546
|
filter.style.width = '100px';
|
|
20600
20547
|
filter.style.height = '100px';
|
|
20601
|
-
|
|
20548
|
+
parent.notify('filter', { prop: 'updateAdj', value: { type: type, value: null, isPreview: true, ctx: ctx } });
|
|
20602
20549
|
ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
|
|
20603
20550
|
}
|
|
20604
20551
|
}
|
|
@@ -20648,47 +20595,51 @@ class ToolbarModule {
|
|
|
20648
20595
|
return orgToolbarItems;
|
|
20649
20596
|
}
|
|
20650
20597
|
renderQAT(isPenEdit) {
|
|
20651
|
-
|
|
20652
|
-
|
|
20653
|
-
|
|
20598
|
+
const parent = this.parent;
|
|
20599
|
+
if (parent.activeObj && parent.showQuickAccessToolbar) {
|
|
20600
|
+
const qtArea = document.getElementById(parent.element.id + '_quickAccessToolbarArea');
|
|
20601
|
+
if (qtArea) {
|
|
20654
20602
|
this.destroyQuickAccessToolbar();
|
|
20655
|
-
|
|
20603
|
+
qtArea.style.display = 'block';
|
|
20656
20604
|
}
|
|
20657
20605
|
const items = this.getQuickAccessToolbarItem(isPenEdit);
|
|
20658
20606
|
if (items.length === 0) {
|
|
20659
20607
|
return;
|
|
20660
20608
|
}
|
|
20661
|
-
if (isNullOrUndefined(
|
|
20609
|
+
if (isNullOrUndefined(parent.quickAccessToolbarTemplate)) {
|
|
20662
20610
|
const toolbarObj = new Toolbar({
|
|
20663
20611
|
items: items,
|
|
20664
20612
|
clicked: this.quickAccessToolbarClicked.bind(this)
|
|
20665
20613
|
});
|
|
20666
|
-
toolbarObj.appendTo('#' +
|
|
20614
|
+
toolbarObj.appendTo('#' + parent.element.id + '_quickAccessToolbar');
|
|
20667
20615
|
}
|
|
20668
20616
|
if (isNullOrUndefined(isPenEdit)) {
|
|
20669
20617
|
qtArea.style.width = 'auto';
|
|
20670
|
-
|
|
20671
|
-
|
|
20672
|
-
let x =
|
|
20673
|
-
|
|
20674
|
-
let y =
|
|
20675
|
-
|
|
20676
|
-
let width =
|
|
20677
|
-
if (
|
|
20678
|
-
const
|
|
20618
|
+
parent.activeObj.activePoint.width = Math.abs(parent.activeObj.activePoint.width);
|
|
20619
|
+
parent.activeObj.activePoint.height = Math.abs(parent.activeObj.activePoint.height);
|
|
20620
|
+
let x = parent.activeObj.activePoint.startX < parent.activeObj.activePoint.endX ?
|
|
20621
|
+
parent.activeObj.activePoint.startX : parent.activeObj.activePoint.endX;
|
|
20622
|
+
let y = parent.activeObj.activePoint.startY < parent.activeObj.activePoint.endY ?
|
|
20623
|
+
parent.activeObj.activePoint.startY : parent.activeObj.activePoint.endY;
|
|
20624
|
+
let width = parent.activeObj.activePoint.width;
|
|
20625
|
+
if (parent.activeObj.rotatedAngle !== 0 && parent.activeObj.shape !== 'arrow') {
|
|
20626
|
+
const object = { activePoint: null };
|
|
20627
|
+
parent.notify('shape', { prop: 'getSquarePointForRotatedShape', onPropertyChange: false,
|
|
20628
|
+
value: { obj: parent.activeObj, object: object } });
|
|
20629
|
+
const point = object['activePoint'];
|
|
20679
20630
|
x = point.startX;
|
|
20680
20631
|
y = point.startY;
|
|
20681
20632
|
width = point.width;
|
|
20682
20633
|
}
|
|
20683
|
-
else if (
|
|
20684
|
-
const path =
|
|
20634
|
+
else if (parent.activeObj.shape === 'path') {
|
|
20635
|
+
const path = parent.getSquarePointForPath(parent.activeObj);
|
|
20685
20636
|
x = path.startX;
|
|
20686
20637
|
y = path.startY;
|
|
20687
20638
|
width = path.width;
|
|
20688
20639
|
}
|
|
20689
20640
|
qtArea.style.left = (x + (width / 2)) - (items.length * 25) + 'px';
|
|
20690
|
-
if (y - 60 <
|
|
20691
|
-
qtArea.style.top =
|
|
20641
|
+
if (y - 60 < parent.img.destTop) {
|
|
20642
|
+
qtArea.style.top = parent.img.destTop + 'px';
|
|
20692
20643
|
}
|
|
20693
20644
|
else {
|
|
20694
20645
|
qtArea.style.top = y - 60 + 'px';
|
|
@@ -20697,14 +20648,14 @@ class ToolbarModule {
|
|
|
20697
20648
|
else if (isPenEdit) {
|
|
20698
20649
|
const obj = { activePoint: null };
|
|
20699
20650
|
const indexObj = { freehandSelectedIndex: null };
|
|
20700
|
-
|
|
20701
|
-
|
|
20651
|
+
parent.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
|
|
20652
|
+
parent.notify('freehand-draw', { prop: 'getSqPtFD',
|
|
20702
20653
|
value: { idx: indexObj['freehandSelectedIndex'], obj: obj } });
|
|
20703
20654
|
const point = obj['activePoint'];
|
|
20704
20655
|
qtArea.style.width = 'auto';
|
|
20705
20656
|
qtArea.style.left = (point.startX + (point.width / 2)) - (items.length * 27) + 'px';
|
|
20706
|
-
if (point.startY - 60 <
|
|
20707
|
-
qtArea.style.top =
|
|
20657
|
+
if (point.startY - 60 < parent.img.destTop) {
|
|
20658
|
+
qtArea.style.top = parent.img.destTop + 'px';
|
|
20708
20659
|
}
|
|
20709
20660
|
else {
|
|
20710
20661
|
qtArea.style.top = point.startY - 60 + 'px';
|
|
@@ -20716,8 +20667,9 @@ class ToolbarModule {
|
|
|
20716
20667
|
if (isNullOrUndefined(isDisabled)) {
|
|
20717
20668
|
return;
|
|
20718
20669
|
}
|
|
20719
|
-
const
|
|
20720
|
-
|
|
20670
|
+
const parent = this.parent;
|
|
20671
|
+
const annotation = document.querySelector('#' + parent.element.id + '_annotationBtn');
|
|
20672
|
+
if (annotation) {
|
|
20721
20673
|
if (isDisabled) {
|
|
20722
20674
|
annotation.classList.add('e-disabled');
|
|
20723
20675
|
annotation.parentElement.classList.add('e-overlay');
|
|
@@ -20728,8 +20680,8 @@ class ToolbarModule {
|
|
|
20728
20680
|
}
|
|
20729
20681
|
getComponent(annotation, 'dropdown-btn').disabled = isDisabled;
|
|
20730
20682
|
}
|
|
20731
|
-
const transform = document.querySelector('#' +
|
|
20732
|
-
if (
|
|
20683
|
+
const transform = document.querySelector('#' + parent.element.id + '_transformBtn');
|
|
20684
|
+
if (transform) {
|
|
20733
20685
|
if (isDisabled) {
|
|
20734
20686
|
transform.classList.add('e-disabled');
|
|
20735
20687
|
transform.parentElement.classList.add('e-overlay');
|
|
@@ -20740,8 +20692,8 @@ class ToolbarModule {
|
|
|
20740
20692
|
}
|
|
20741
20693
|
getComponent(transform, 'dropdown-btn').disabled = isDisabled;
|
|
20742
20694
|
}
|
|
20743
|
-
const adjustment = document.querySelector('#' +
|
|
20744
|
-
if (
|
|
20695
|
+
const adjustment = document.querySelector('#' + parent.element.id + '_adjustment');
|
|
20696
|
+
if (adjustment) {
|
|
20745
20697
|
if (isDisabled) {
|
|
20746
20698
|
adjustment.classList.add('e-disabled');
|
|
20747
20699
|
adjustment.parentElement.classList.add('e-overlay');
|
|
@@ -20752,8 +20704,8 @@ class ToolbarModule {
|
|
|
20752
20704
|
}
|
|
20753
20705
|
getComponent(adjustment, 'btn').disabled = isDisabled;
|
|
20754
20706
|
}
|
|
20755
|
-
const filter = document.querySelector('#' +
|
|
20756
|
-
if (
|
|
20707
|
+
const filter = document.querySelector('#' + parent.element.id + '_filter');
|
|
20708
|
+
if (filter) {
|
|
20757
20709
|
if (isDisabled) {
|
|
20758
20710
|
filter.classList.add('e-disabled');
|
|
20759
20711
|
filter.parentElement.classList.add('e-overlay');
|
|
@@ -20783,7 +20735,7 @@ class ToolbarModule {
|
|
|
20783
20735
|
quickAccessToolbarClicked(args, isContextualToolbar) {
|
|
20784
20736
|
const parent = this.parent;
|
|
20785
20737
|
const points = { x: parent.activeObj.activePoint.startX, y: parent.activeObj.activePoint.startY };
|
|
20786
|
-
if (
|
|
20738
|
+
if (args.item) {
|
|
20787
20739
|
let duplicateObj;
|
|
20788
20740
|
let objColl;
|
|
20789
20741
|
let isPreventUndoRedo = null;
|
|
@@ -20796,7 +20748,7 @@ class ToolbarModule {
|
|
|
20796
20748
|
parent.notify('draw', { prop: 'getNewPath', value: { obj: pathObject } });
|
|
20797
20749
|
switch (args.item.id.replace(parent.element.id + '_', '').toLowerCase()) {
|
|
20798
20750
|
case 'duplicate':
|
|
20799
|
-
if (!
|
|
20751
|
+
if (!parent.element.querySelector('#' + parent.element.id + '_duplicate').classList.contains('e-disabled')) {
|
|
20800
20752
|
if (!pathObject['isNewPath'] && JSON.stringify(object['tempObj']) === JSON.stringify(parent.activeObj)) {
|
|
20801
20753
|
isPreventUndoRedo = true;
|
|
20802
20754
|
}
|
|
@@ -20804,7 +20756,7 @@ class ToolbarModule {
|
|
|
20804
20756
|
if (isNullOrUndefined(parent.activeObj.currIndex)) {
|
|
20805
20757
|
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: isPreventUndoRedo } });
|
|
20806
20758
|
}
|
|
20807
|
-
else if (
|
|
20759
|
+
else if (obj['prevActObj']) {
|
|
20808
20760
|
parent.activeObj.currIndex = null;
|
|
20809
20761
|
duplicateObj.currIndex = null;
|
|
20810
20762
|
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: isPreventUndoRedo } });
|
|
@@ -20831,19 +20783,19 @@ class ToolbarModule {
|
|
|
20831
20783
|
parent.notify('shape', { prop: 'setPointCollForLineArrow', onPropertyChange: false,
|
|
20832
20784
|
value: { obj: parent.activeObj } });
|
|
20833
20785
|
}
|
|
20834
|
-
// parent.updateTrianglePoints(
|
|
20786
|
+
// parent.updateTrianglePoints(parent.activeObj); Invoke
|
|
20835
20787
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj } });
|
|
20836
20788
|
parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
|
|
20837
20789
|
this.renderQAT();
|
|
20838
20790
|
}
|
|
20839
20791
|
break;
|
|
20840
20792
|
case 'remove':
|
|
20841
|
-
if (!
|
|
20793
|
+
if (!parent.element.querySelector('#' + parent.element.id + '_remove').classList.contains('e-disabled')) {
|
|
20842
20794
|
parent.notify('selection', { prop: 'deleteItem', onPropertyChange: false });
|
|
20843
20795
|
}
|
|
20844
20796
|
break;
|
|
20845
20797
|
case 'edittext':
|
|
20846
|
-
if (!
|
|
20798
|
+
if (!parent.element.querySelector('#' + parent.element.id + '_editText').classList.contains('e-disabled')) {
|
|
20847
20799
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
20848
20800
|
parent.notify('selection', { prop: 'setTempActObj', onPropertyChange: false,
|
|
20849
20801
|
value: { obj: extend({}, parent.activeObj, {}, true) } });
|
|
@@ -20860,10 +20812,10 @@ class ToolbarModule {
|
|
|
20860
20812
|
if (isNullOrUndefined(parent.activeObj.currIndex)) {
|
|
20861
20813
|
parent.notify('draw', { prop: 'setShapeTextInsert', onPropertyChange: false, value: { bool: true } });
|
|
20862
20814
|
}
|
|
20863
|
-
else if (
|
|
20815
|
+
else if (obj['prevActObj']) {
|
|
20864
20816
|
parent.notify('draw', { prop: 'setShapeTextInsert', onPropertyChange: false, value: { bool: true } });
|
|
20865
20817
|
}
|
|
20866
|
-
if (
|
|
20818
|
+
if (document.getElementById(parent.element.id + '_quickAccessToolbarArea')) {
|
|
20867
20819
|
document.getElementById(parent.element.id + '_quickAccessToolbarArea').style.display = 'none';
|
|
20868
20820
|
}
|
|
20869
20821
|
}
|
|
@@ -20884,7 +20836,7 @@ class ToolbarModule {
|
|
|
20884
20836
|
}
|
|
20885
20837
|
parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
20886
20838
|
}
|
|
20887
|
-
if (
|
|
20839
|
+
if (args.item) {
|
|
20888
20840
|
const type = args.item.id.replace(parent.element.id + '_', '').toLowerCase();
|
|
20889
20841
|
if (type === 'duplicate' || type === 'remove' || type === 'edittext') {
|
|
20890
20842
|
this.quickAccessToolbarClicked(args, true);
|
|
@@ -20894,11 +20846,11 @@ class ToolbarModule {
|
|
|
20894
20846
|
let isDisabledFilter = false;
|
|
20895
20847
|
let isDisabledAdjustment = false;
|
|
20896
20848
|
const adjustment = document.querySelector('#' + parent.element.id + '_adjustment');
|
|
20897
|
-
if (
|
|
20849
|
+
if (adjustment && adjustment.classList.contains('e-disabled')) {
|
|
20898
20850
|
isDisabledAdjustment = true;
|
|
20899
20851
|
}
|
|
20900
20852
|
const filter = document.querySelector('#' + parent.element.id + '_filter');
|
|
20901
|
-
if (
|
|
20853
|
+
if (filter && filter.classList.contains('e-disabled')) {
|
|
20902
20854
|
isDisabledFilter = true;
|
|
20903
20855
|
}
|
|
20904
20856
|
this.enableDisableTbrBtn();
|
|
@@ -20943,18 +20895,18 @@ class ToolbarModule {
|
|
|
20943
20895
|
}
|
|
20944
20896
|
}
|
|
20945
20897
|
else {
|
|
20946
|
-
panBtn =
|
|
20947
|
-
if (
|
|
20898
|
+
panBtn = parent.element.querySelector('.e-img-pan .e-btn');
|
|
20899
|
+
if (panBtn) {
|
|
20948
20900
|
panBtn.classList.add('e-selected-btn');
|
|
20949
20901
|
}
|
|
20950
20902
|
parent.pan(true);
|
|
20951
20903
|
parent.notify('transform', { prop: 'setDisablePan', onPropertyChange: false, value: { bool: false } });
|
|
20952
20904
|
}
|
|
20953
|
-
if (
|
|
20905
|
+
if (zoomIn && parent.zoomSettings.zoomFactor >= parent.zoomSettings.maxZoomFactor) {
|
|
20954
20906
|
zoomIn.classList.add('e-disabled');
|
|
20955
20907
|
zoomIn.parentElement.classList.add('e-overlay');
|
|
20956
20908
|
}
|
|
20957
|
-
else if (
|
|
20909
|
+
else if (zoomIn) {
|
|
20958
20910
|
zoomIn.classList.remove('e-disabled');
|
|
20959
20911
|
zoomIn.parentElement.classList.remove('e-overlay');
|
|
20960
20912
|
}
|
|
@@ -20969,19 +20921,6 @@ class ToolbarModule {
|
|
|
20969
20921
|
this.currentToolbar = 'main';
|
|
20970
20922
|
break;
|
|
20971
20923
|
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
20924
|
parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
|
|
20986
20925
|
break;
|
|
20987
20926
|
case 'reset':
|
|
@@ -21095,7 +21034,7 @@ class ToolbarModule {
|
|
|
21095
21034
|
case 'rotateright':
|
|
21096
21035
|
case 'horizontalflip':
|
|
21097
21036
|
case 'verticalflip':
|
|
21098
|
-
|
|
21037
|
+
parent.transformSelect(type);
|
|
21099
21038
|
parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
|
|
21100
21039
|
break;
|
|
21101
21040
|
case 'save':
|
|
@@ -21120,7 +21059,7 @@ class ToolbarModule {
|
|
|
21120
21059
|
}
|
|
21121
21060
|
const type = args.item.id.replace(parent.element.id, '').split('_')[1];
|
|
21122
21061
|
const imageFiltering = { filter: parent.toPascalCase(type), cancel: false };
|
|
21123
|
-
|
|
21062
|
+
parent.trigger('imageFiltering', imageFiltering);
|
|
21124
21063
|
if (imageFiltering.cancel) {
|
|
21125
21064
|
return;
|
|
21126
21065
|
}
|
|
@@ -21131,11 +21070,12 @@ class ToolbarModule {
|
|
|
21131
21070
|
this.enableDisableTbrBtn();
|
|
21132
21071
|
}
|
|
21133
21072
|
refreshShapeDrawing() {
|
|
21073
|
+
const parent = this.parent;
|
|
21134
21074
|
const object = { shape: '' };
|
|
21135
|
-
|
|
21075
|
+
parent.notify('selection', { prop: 'getCurrentDrawingShape', onPropertyChange: false, value: { obj: object } });
|
|
21136
21076
|
if (object['shape'] !== '') {
|
|
21137
|
-
|
|
21138
|
-
|
|
21077
|
+
parent.notify('selection', { prop: 'setCurrentDrawingShape', onPropertyChange: false, value: { value: '' } });
|
|
21078
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
21139
21079
|
this.refreshToolbar('main', false);
|
|
21140
21080
|
}
|
|
21141
21081
|
}
|
|
@@ -21214,9 +21154,9 @@ class ToolbarModule {
|
|
|
21214
21154
|
closeContextualToolbar() {
|
|
21215
21155
|
const parent = this.parent;
|
|
21216
21156
|
let isContextualToolbar = false;
|
|
21217
|
-
if ((
|
|
21157
|
+
if ((parent.element.querySelector('#' + parent.element.id + '_contextualToolbar') &&
|
|
21218
21158
|
!parent.element.querySelector('#' + parent.element.id + '_contextualToolbar').parentElement.classList.contains('e-hide')) ||
|
|
21219
|
-
(
|
|
21159
|
+
(parent.element.querySelector('#' + parent.element.id + '_headWrapper')
|
|
21220
21160
|
&& !parent.element.querySelector('#' + parent.element.id + '_headWrapper').parentElement.classList.contains('e-hide'))) {
|
|
21221
21161
|
parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
21222
21162
|
parent.okBtn();
|
|
@@ -21227,12 +21167,13 @@ class ToolbarModule {
|
|
|
21227
21167
|
}
|
|
21228
21168
|
destroyQuickAccessToolbar() {
|
|
21229
21169
|
const parent = this.parent;
|
|
21230
|
-
|
|
21231
|
-
|
|
21232
|
-
getComponent(
|
|
21170
|
+
const quickToolbar = document.getElementById(parent.element.id + '_quickAccessToolbar');
|
|
21171
|
+
if (quickToolbar && quickToolbar.classList.contains('e-control')) {
|
|
21172
|
+
getComponent(quickToolbar, 'toolbar').destroy();
|
|
21233
21173
|
}
|
|
21234
|
-
|
|
21235
|
-
|
|
21174
|
+
const qatArea = document.getElementById(parent.element.id + '_quickAccessToolbarArea');
|
|
21175
|
+
if (qatArea) {
|
|
21176
|
+
qatArea.style.display = 'none';
|
|
21236
21177
|
}
|
|
21237
21178
|
}
|
|
21238
21179
|
renderSlider(type) {
|
|
@@ -21245,7 +21186,7 @@ class ToolbarModule {
|
|
|
21245
21186
|
id: parent.element.id + '_headWrapper',
|
|
21246
21187
|
styles: 'position: relative'
|
|
21247
21188
|
}));
|
|
21248
|
-
labelWrapper = hdrWrapper.appendChild(
|
|
21189
|
+
labelWrapper = hdrWrapper.appendChild(parent.createElement('label', {
|
|
21249
21190
|
id: parent.element.id + '_labelWrapper',
|
|
21250
21191
|
styles: Browser.isDevice ? 'position: absolute; top: 25%; left: calc(50% - 150px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
|
|
21251
21192
|
: 'position: absolute; top: 25%; left: calc(50% - 226px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
|
|
@@ -21259,12 +21200,12 @@ class ToolbarModule {
|
|
|
21259
21200
|
id: parent.element.id + '_sliderWrapper',
|
|
21260
21201
|
styles: 'position: absolute'
|
|
21261
21202
|
}));
|
|
21262
|
-
const value =
|
|
21203
|
+
const value = parent.getCurrAdjustmentValue(type);
|
|
21263
21204
|
let min;
|
|
21264
21205
|
let max;
|
|
21265
21206
|
let slider;
|
|
21266
21207
|
if (type === 'brightness' || type === 'contrast' || type === 'saturation' || type === 'exposure') {
|
|
21267
|
-
if (
|
|
21208
|
+
if (parent.finetuneSettings) {
|
|
21268
21209
|
if (type === 'brightness' && parent.finetuneSettings.brightness) {
|
|
21269
21210
|
min = parent.finetuneSettings.brightness.min;
|
|
21270
21211
|
max = parent.finetuneSettings.brightness.max;
|
|
@@ -21277,7 +21218,7 @@ class ToolbarModule {
|
|
|
21277
21218
|
min = parent.finetuneSettings.saturation.min;
|
|
21278
21219
|
max = parent.finetuneSettings.saturation.max;
|
|
21279
21220
|
}
|
|
21280
|
-
else if (type === 'exposure' &&
|
|
21221
|
+
else if (type === 'exposure' && parent.finetuneSettings.exposure) {
|
|
21281
21222
|
min = parent.finetuneSettings.exposure.min;
|
|
21282
21223
|
max = parent.finetuneSettings.exposure.max;
|
|
21283
21224
|
}
|
|
@@ -21332,27 +21273,29 @@ class ToolbarModule {
|
|
|
21332
21273
|
width: Browser.isDevice ? '200px' : '300px',
|
|
21333
21274
|
cssClass: 'e-slider',
|
|
21334
21275
|
change: (args) => {
|
|
21335
|
-
|
|
21276
|
+
parent.setCurrAdjustmentValue(type, args.value);
|
|
21336
21277
|
this.enableDisableTbrBtn();
|
|
21337
21278
|
}
|
|
21338
21279
|
});
|
|
21339
21280
|
}
|
|
21340
21281
|
applyPreviewFilter() {
|
|
21341
|
-
|
|
21342
|
-
|
|
21343
|
-
|
|
21344
|
-
|
|
21282
|
+
const parent = this.parent;
|
|
21283
|
+
if (document.querySelector('#' + parent.element.id + '_sliderWrapper') ||
|
|
21284
|
+
parent.currObjType.isFiltered) {
|
|
21285
|
+
parent.initialAdjustmentValue = parent.canvasFilter = this.lowerContext.filter;
|
|
21286
|
+
parent.currObjType.isFiltered = false;
|
|
21345
21287
|
}
|
|
21346
21288
|
}
|
|
21347
21289
|
unselectBtn() {
|
|
21290
|
+
const parent = this.parent;
|
|
21348
21291
|
const selectors = [
|
|
21349
|
-
'#' +
|
|
21350
|
-
'#' +
|
|
21351
|
-
'#' +
|
|
21352
|
-
'#' +
|
|
21353
|
-
'#' +
|
|
21354
|
-
'#' +
|
|
21355
|
-
'#' +
|
|
21292
|
+
'#' + parent.element.id + '_brightness',
|
|
21293
|
+
'#' + parent.element.id + '_contrast',
|
|
21294
|
+
'#' + parent.element.id + '_hue',
|
|
21295
|
+
'#' + parent.element.id + '_saturation',
|
|
21296
|
+
'#' + parent.element.id + '_opacity',
|
|
21297
|
+
'#' + parent.element.id + '_blur',
|
|
21298
|
+
'#' + parent.element.id + '_exposure'
|
|
21356
21299
|
];
|
|
21357
21300
|
for (const selector of selectors) {
|
|
21358
21301
|
const element = document.querySelector(selector);
|
|
@@ -21376,68 +21319,69 @@ class ToolbarModule {
|
|
|
21376
21319
|
if (hdrWrapper) {
|
|
21377
21320
|
hdrWrapper.style.display = 'none';
|
|
21378
21321
|
}
|
|
21379
|
-
if (
|
|
21322
|
+
if (sliderWrapper && slider) {
|
|
21380
21323
|
slider.ej2_instances[0].destroy();
|
|
21381
21324
|
sliderWrapper.remove();
|
|
21382
21325
|
}
|
|
21383
21326
|
}
|
|
21384
21327
|
updateToolbarItems() {
|
|
21385
|
-
const
|
|
21386
|
-
const
|
|
21387
|
-
const
|
|
21388
|
-
const
|
|
21389
|
-
const
|
|
21390
|
-
const
|
|
21391
|
-
const
|
|
21392
|
-
const
|
|
21393
|
-
const
|
|
21394
|
-
|
|
21395
|
-
|
|
21328
|
+
const parent = this.parent;
|
|
21329
|
+
const selFillElem = parent.element.querySelector('.e-fill.e-template .e-dropdownbtn-preview');
|
|
21330
|
+
const selStrokeElem = parent.element.querySelector('.e-stroke.e-template .e-dropdownbtn-preview');
|
|
21331
|
+
const selTextStrokeElem = parent.element.querySelector('.e-text-font-color.e-template .e-dropdownbtn-preview');
|
|
21332
|
+
const selPenStrokeElem = parent.element.querySelector('.e-pen-stroke-color.e-template .e-dropdownbtn-preview');
|
|
21333
|
+
const strokeWidthElem = parent.element.querySelector('.e-shape-stroke-width');
|
|
21334
|
+
const fontFamilyElem = parent.element.querySelector('.e-text-font-family');
|
|
21335
|
+
const fontSizeElem = parent.element.querySelector('.e-text-font-size');
|
|
21336
|
+
const boldBtn = parent.element.querySelector('#' + parent.element.id + '_bold');
|
|
21337
|
+
const italicBtn = parent.element.querySelector('#' + parent.element.id + '_italic');
|
|
21338
|
+
if (isNullOrUndefined(parent.activeObj.strokeSettings.strokeWidth)) {
|
|
21339
|
+
parent.activeObj.strokeSettings.strokeWidth = 2;
|
|
21396
21340
|
}
|
|
21397
21341
|
if (selFillElem) {
|
|
21398
|
-
if (
|
|
21342
|
+
if (parent.activeObj.strokeSettings.fillColor === '') {
|
|
21399
21343
|
selFillElem.classList.add('e-nocolor-item');
|
|
21400
21344
|
}
|
|
21401
21345
|
else {
|
|
21402
21346
|
selFillElem.classList.remove('e-nocolor-item');
|
|
21403
|
-
selFillElem.style.background =
|
|
21347
|
+
selFillElem.style.background = parent.activeObj.strokeSettings.fillColor;
|
|
21404
21348
|
}
|
|
21405
|
-
getComponent(
|
|
21406
|
-
=
|
|
21349
|
+
getComponent(parent.element.id + '_shape_fill', 'colorpicker').value
|
|
21350
|
+
= parent.activeObj.strokeSettings.fillColor + 'ff';
|
|
21407
21351
|
}
|
|
21408
21352
|
if (selStrokeElem) {
|
|
21409
|
-
selStrokeElem.style.background =
|
|
21410
|
-
getComponent(
|
|
21411
|
-
=
|
|
21353
|
+
selStrokeElem.style.background = parent.activeObj.strokeSettings.strokeColor;
|
|
21354
|
+
getComponent(parent.element.id + '_shape_stroke', 'colorpicker').value
|
|
21355
|
+
= parent.activeObj.strokeSettings.strokeColor + 'ff';
|
|
21412
21356
|
}
|
|
21413
21357
|
if (selTextStrokeElem) {
|
|
21414
|
-
selTextStrokeElem.style.background =
|
|
21415
|
-
getComponent(
|
|
21416
|
-
=
|
|
21358
|
+
selTextStrokeElem.style.background = parent.activeObj.strokeSettings.strokeColor;
|
|
21359
|
+
getComponent(parent.element.id + '_text_font', 'colorpicker').value
|
|
21360
|
+
= parent.activeObj.strokeSettings.strokeColor + 'ff';
|
|
21417
21361
|
}
|
|
21418
21362
|
if (selPenStrokeElem) {
|
|
21419
|
-
selPenStrokeElem.style.background =
|
|
21420
|
-
getComponent(
|
|
21421
|
-
=
|
|
21363
|
+
selPenStrokeElem.style.background = parent.activeObj.strokeSettings.strokeColor;
|
|
21364
|
+
getComponent(parent.element.id + '_pen_stroke', 'colorpicker').value
|
|
21365
|
+
= parent.activeObj.strokeSettings.strokeColor + 'ff';
|
|
21422
21366
|
}
|
|
21423
21367
|
if (fontFamilyElem) {
|
|
21424
21368
|
if (Browser.isDevice) {
|
|
21425
|
-
fontFamilyElem.setAttribute('style', 'font-family:' +
|
|
21369
|
+
fontFamilyElem.setAttribute('style', 'font-family:' + parent.activeObj.textSettings.fontFamily.toLowerCase());
|
|
21426
21370
|
}
|
|
21427
21371
|
else {
|
|
21428
|
-
fontFamilyElem.textContent =
|
|
21372
|
+
fontFamilyElem.textContent = parent.activeObj.textSettings.fontFamily;
|
|
21429
21373
|
}
|
|
21430
21374
|
}
|
|
21431
21375
|
if (fontSizeElem) {
|
|
21432
|
-
for (let i = 0; i <
|
|
21433
|
-
if (parseInt(
|
|
21376
|
+
for (let i = 0; i < parent.fontSizeColl.length; i++) {
|
|
21377
|
+
if (parseInt(parent.fontSizeColl[i].text, 10) >= Math.round(parent.activeObj.textSettings.fontSize)) {
|
|
21434
21378
|
fontSizeElem.textContent = (i + 1).toString();
|
|
21435
21379
|
break;
|
|
21436
21380
|
}
|
|
21437
21381
|
}
|
|
21438
21382
|
}
|
|
21439
21383
|
if (boldBtn) {
|
|
21440
|
-
if (
|
|
21384
|
+
if (parent.activeObj.textSettings.bold) {
|
|
21441
21385
|
boldBtn.classList.add('e-selected-btn');
|
|
21442
21386
|
}
|
|
21443
21387
|
else {
|
|
@@ -21445,7 +21389,7 @@ class ToolbarModule {
|
|
|
21445
21389
|
}
|
|
21446
21390
|
}
|
|
21447
21391
|
if (italicBtn) {
|
|
21448
|
-
if (
|
|
21392
|
+
if (parent.activeObj.textSettings.italic) {
|
|
21449
21393
|
italicBtn.classList.add('e-selected-btn');
|
|
21450
21394
|
}
|
|
21451
21395
|
else {
|
|
@@ -21453,7 +21397,7 @@ class ToolbarModule {
|
|
|
21453
21397
|
}
|
|
21454
21398
|
}
|
|
21455
21399
|
if (strokeWidthElem) {
|
|
21456
|
-
const strokeWidth = Math.round((
|
|
21400
|
+
const strokeWidth = Math.round((parent.activeObj.strokeSettings.strokeWidth)).toString();
|
|
21457
21401
|
strokeWidthElem.textContent = this.getStrokeWidth(strokeWidth);
|
|
21458
21402
|
}
|
|
21459
21403
|
}
|
|
@@ -21483,7 +21427,7 @@ class ToolbarModule {
|
|
|
21483
21427
|
const parent = this.parent;
|
|
21484
21428
|
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: true } });
|
|
21485
21429
|
const panBtn = parent.element.querySelector('.e-img-pan .e-btn');
|
|
21486
|
-
if (
|
|
21430
|
+
if (panBtn) {
|
|
21487
21431
|
panBtn.classList.remove('e-selected-btn');
|
|
21488
21432
|
}
|
|
21489
21433
|
parent.pan(false);
|
|
@@ -21494,22 +21438,23 @@ class ToolbarModule {
|
|
|
21494
21438
|
}
|
|
21495
21439
|
}
|
|
21496
21440
|
destroySubComponents() {
|
|
21497
|
-
const
|
|
21498
|
-
const
|
|
21441
|
+
const parent = this.parent;
|
|
21442
|
+
const inputElement = parent.element.querySelectorAll('input.e-control');
|
|
21443
|
+
const btnElement = parent.element.querySelectorAll('button.e-control');
|
|
21499
21444
|
for (let i = 0, len = inputElement.length; i < len; i++) {
|
|
21500
21445
|
if (inputElement[i].classList.contains('e-color-picker')) {
|
|
21501
21446
|
getComponent(inputElement[i], 'color-picker').destroy();
|
|
21502
|
-
detach(select('input#' + inputElement[i].id,
|
|
21447
|
+
detach(select('input#' + inputElement[i].id, parent.element));
|
|
21503
21448
|
}
|
|
21504
21449
|
}
|
|
21505
21450
|
for (let i = 0, len = btnElement.length; i < len; i++) {
|
|
21506
21451
|
if (btnElement[i].classList.contains('e-dropdown-btn')) {
|
|
21507
21452
|
getComponent(btnElement[i], 'dropdown-btn').destroy();
|
|
21508
|
-
detach(select('button#' + btnElement[i].id,
|
|
21453
|
+
detach(select('button#' + btnElement[i].id, parent.element));
|
|
21509
21454
|
}
|
|
21510
21455
|
else if (btnElement[i].classList.contains('e-btn')) {
|
|
21511
21456
|
getComponent(btnElement[i], 'btn').destroy();
|
|
21512
|
-
detach(select('button#' + btnElement[i].id,
|
|
21457
|
+
detach(select('button#' + btnElement[i].id, parent.element));
|
|
21513
21458
|
}
|
|
21514
21459
|
}
|
|
21515
21460
|
}
|