@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 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
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 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
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 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
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
|
Crop.prototype.cropImg = function (isRotateCrop) {
|
|
98
103
|
var parent = this.parent;
|
|
@@ -710,7 +715,7 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
710
715
|
}
|
|
711
716
|
var transitionArgs = { cancel: false, startPoint: { x: parent.activeObj.activePoint.startX,
|
|
712
717
|
y: parent.activeObj.activePoint.startY }, endPoint: { x: parent.activeObj.activePoint.endX,
|
|
713
|
-
y: parent.activeObj.activePoint.endY } };
|
|
718
|
+
y: parent.activeObj.activePoint.endY }, preventScaling: false };
|
|
714
719
|
if (!object_1['isCropToolbar'] && isBlazor() && parent.events && parent.events.cropping.hasDelegate === true) {
|
|
715
720
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
716
721
|
parent.dotNetRef.invokeMethodAsync('CropEventAsync', 'OnCrop', transitionArgs).then(function (args) {
|
|
@@ -736,6 +741,12 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
736
741
|
obj.isCrop = true;
|
|
737
742
|
var prevCropObj = extend({}, parent.cropObj, {}, true);
|
|
738
743
|
var prevObj = extend({}, this.prevCropCurrObj, {}, true);
|
|
744
|
+
if (transitionArgs.preventScaling) {
|
|
745
|
+
this.isPreventScaling = true;
|
|
746
|
+
}
|
|
747
|
+
else {
|
|
748
|
+
this.isPreventScaling = false;
|
|
749
|
+
}
|
|
739
750
|
this.cropImg();
|
|
740
751
|
parent.transform.zoomFactor = 0;
|
|
741
752
|
parent.zoomSettings.zoomFactor = 1;
|
|
@@ -994,10 +1005,6 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
994
1005
|
case 'setPrevActObj':
|
|
995
1006
|
this.prevActObj = args.value['prevActObj'];
|
|
996
1007
|
break;
|
|
997
|
-
case 'getZoomCrop':
|
|
998
|
-
args.value['obj']['width'] = this.zoomCrop.width;
|
|
999
|
-
args.value['obj']['height'] = this.zoomCrop.height;
|
|
1000
|
-
break;
|
|
1001
1008
|
case 'setZoomCropWidth':
|
|
1002
1009
|
this.zoomCrop.width = args.value['width'];
|
|
1003
1010
|
this.zoomCrop.height = args.value['height'];
|
|
@@ -1026,6 +1033,9 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
1026
1033
|
case 'setArrowDimension':
|
|
1027
1034
|
this.arrowDimension = args.value['arrowDimension'];
|
|
1028
1035
|
break;
|
|
1036
|
+
case 'moveToSelectionRange':
|
|
1037
|
+
this.moveToSelectionRange(args.value['type'], args.value['activeObj']);
|
|
1038
|
+
break;
|
|
1029
1039
|
}
|
|
1030
1040
|
};
|
|
1031
1041
|
Draw.prototype.getModuleName = function () {
|
|
@@ -1313,8 +1323,10 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
1313
1323
|
};
|
|
1314
1324
|
Draw.prototype.adjToCenter = function () {
|
|
1315
1325
|
var parent = this.parent;
|
|
1316
|
-
var diffX = ((parent.lowerCanvas.width) / 2) - (parent.activeObj.activePoint.endX -
|
|
1317
|
-
|
|
1326
|
+
var diffX = ((parent.lowerCanvas.width) / 2) - (parent.activeObj.activePoint.endX -
|
|
1327
|
+
parent.activeObj.activePoint.width / 2);
|
|
1328
|
+
var diffY = ((parent.lowerCanvas.height) / 2) - (parent.activeObj.activePoint.endY -
|
|
1329
|
+
parent.activeObj.activePoint.height / 2);
|
|
1318
1330
|
parent.activeObj.activePoint.startX += diffX;
|
|
1319
1331
|
parent.activeObj.activePoint.endX += diffX;
|
|
1320
1332
|
parent.activeObj.activePoint.startY += diffY;
|
|
@@ -2761,11 +2773,22 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
2761
2773
|
// proxy.reset();
|
|
2762
2774
|
// proxy.parent.baseImg.src = proxy.baseImgSrc;
|
|
2763
2775
|
proxy.isErrorImage = true;
|
|
2776
|
+
proxy.errorLoading();
|
|
2764
2777
|
};
|
|
2765
2778
|
};
|
|
2779
|
+
Draw.prototype.errorLoading = function () {
|
|
2780
|
+
var parent = this.parent;
|
|
2781
|
+
var fileOpened = { fileName: null, fileType: null, isValidImage: false };
|
|
2782
|
+
if (isBlazor() && parent.events && parent.events.fileOpened.hasDelegate === true) {
|
|
2783
|
+
parent.dotNetRef.invokeMethodAsync('FileOpenEventAsync', 'FileOpened', fileOpened);
|
|
2784
|
+
}
|
|
2785
|
+
else {
|
|
2786
|
+
parent.trigger('fileOpened', fileOpened);
|
|
2787
|
+
}
|
|
2788
|
+
};
|
|
2766
2789
|
Draw.prototype.updateCanvas = function () {
|
|
2767
2790
|
var parent = this.parent;
|
|
2768
|
-
var fileOpened = { fileName: this.fileName, fileType: this.fileType };
|
|
2791
|
+
var fileOpened = { fileName: this.fileName, fileType: this.fileType, isValidImage: true };
|
|
2769
2792
|
parent.img.srcWidth = parent.baseImg.width;
|
|
2770
2793
|
parent.img.srcHeight = parent.baseImg.height;
|
|
2771
2794
|
var obj = { width: 0, height: 0 };
|
|
@@ -2944,10 +2967,6 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
2944
2967
|
else if (isCropSelection) {
|
|
2945
2968
|
this.cancelSelection();
|
|
2946
2969
|
}
|
|
2947
|
-
else if ((parent.transform.zoomFactor !== this.tempZoomFactor) || isCropSelection &&
|
|
2948
|
-
isNullOrUndefined(parent.currSelectionPoint)) {
|
|
2949
|
-
this.cancelZoom();
|
|
2950
|
-
}
|
|
2951
2970
|
else {
|
|
2952
2971
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
2953
2972
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
@@ -3089,114 +3108,6 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
3089
3108
|
}
|
|
3090
3109
|
}
|
|
3091
3110
|
};
|
|
3092
|
-
Draw.prototype.cancelZoom = function () {
|
|
3093
|
-
var parent = this.parent;
|
|
3094
|
-
var length = parent.transform.cropZoomFactor - this.tempZoomFactor;
|
|
3095
|
-
parent.transform.zoomFactor = parent.transform.cropZoomFactor;
|
|
3096
|
-
if (isNullOrUndefined(parent.cropObj.activeObj.shape)) {
|
|
3097
|
-
if ((parent.transform.degree === 0 && parent.panPoint.totalPannedPoint.x === 0 && parent.panPoint.totalPannedPoint.y === 0)
|
|
3098
|
-
|| (parent.transform.degree !== 0 && parent.panPoint.totalPannedInternalPoint.x === 0 &&
|
|
3099
|
-
parent.panPoint.totalPannedInternalPoint.y === 0 && parent.panPoint.totalPannedClientPoint.x === 0 &&
|
|
3100
|
-
parent.panPoint.totalPannedClientPoint.y === 0)) {
|
|
3101
|
-
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
3102
|
-
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
3103
|
-
if (length > 0) {
|
|
3104
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3105
|
-
value: { zoomFactor: -length, zoomPoint: null } });
|
|
3106
|
-
}
|
|
3107
|
-
else {
|
|
3108
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3109
|
-
value: { zoomFactor: Math.abs(length), zoomPoint: null } });
|
|
3110
|
-
}
|
|
3111
|
-
parent.transform.cropZoomFactor = this.tempZoomFactor;
|
|
3112
|
-
parent.currObjType.isCustomCrop = false;
|
|
3113
|
-
parent.upperCanvas.style.cursor = parent.cursor = 'default';
|
|
3114
|
-
parent.currObjType.isCustomCrop = false;
|
|
3115
|
-
this.tempStrokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null };
|
|
3116
|
-
var eventargs = { type: 'main', isApplyBtn: null, isCropping: false, isZooming: null };
|
|
3117
|
-
if (!isBlazor()) {
|
|
3118
|
-
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: eventargs });
|
|
3119
|
-
}
|
|
3120
|
-
else {
|
|
3121
|
-
parent.updateToolbar(parent.element, 'imageLoaded');
|
|
3122
|
-
}
|
|
3123
|
-
return;
|
|
3124
|
-
}
|
|
3125
|
-
}
|
|
3126
|
-
if (isNullOrUndefined(parent.cropObj.activeObj.shape)) {
|
|
3127
|
-
if (parent.transform.degree === 0) {
|
|
3128
|
-
var activeObj = extend({}, parent.activeObj, {});
|
|
3129
|
-
parent.img.destLeft += (-parent.panPoint.totalPannedPoint.x);
|
|
3130
|
-
parent.img.destTop += (-parent.panPoint.totalPannedPoint.y);
|
|
3131
|
-
parent.notify('transform', { prop: 'drawPannImage', onPropertyChange: false,
|
|
3132
|
-
value: { point: { x: -parent.panPoint.totalPannedPoint.x, y: -parent.panPoint.totalPannedPoint.y } } });
|
|
3133
|
-
this.updateFlipPan(activeObj);
|
|
3134
|
-
parent.panPoint.totalPannedPoint = { x: 0, y: 0 };
|
|
3135
|
-
}
|
|
3136
|
-
else {
|
|
3137
|
-
parent.panPoint.totalPannedClientPoint = { x: -parent.panPoint.totalPannedClientPoint.x,
|
|
3138
|
-
y: -parent.panPoint.totalPannedClientPoint.y };
|
|
3139
|
-
parent.panPoint.totalPannedInternalPoint = { x: -parent.panPoint.totalPannedInternalPoint.x,
|
|
3140
|
-
y: -parent.panPoint.totalPannedInternalPoint.y };
|
|
3141
|
-
parent.notify('transform', { prop: 'rotatePan', onPropertyChange: false,
|
|
3142
|
-
value: { isCropSelection: true, isDefaultZoom: null } });
|
|
3143
|
-
parent.panPoint.totalPannedClientPoint = { x: 0, y: 0 };
|
|
3144
|
-
parent.panPoint.totalPannedInternalPoint = { x: 0, y: 0 };
|
|
3145
|
-
parent.panPoint.currentPannedPoint = { x: 0, y: 0 };
|
|
3146
|
-
}
|
|
3147
|
-
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
3148
|
-
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
3149
|
-
if (length > 0) {
|
|
3150
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3151
|
-
value: { zoomFactor: -length, zoomPoint: null } });
|
|
3152
|
-
}
|
|
3153
|
-
else {
|
|
3154
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3155
|
-
value: { zoomFactor: Math.abs(length), zoomPoint: null } });
|
|
3156
|
-
}
|
|
3157
|
-
parent.transform.cropZoomFactor = this.tempZoomFactor;
|
|
3158
|
-
}
|
|
3159
|
-
else {
|
|
3160
|
-
this.isCancelAction = true;
|
|
3161
|
-
parent.objColl = [];
|
|
3162
|
-
parent.pointColl = [];
|
|
3163
|
-
var freehandCounter = parent.freehandCounter;
|
|
3164
|
-
parent.freehandCounter = 0;
|
|
3165
|
-
var object = { selPointColl: null };
|
|
3166
|
-
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
3167
|
-
value: { obj: object } });
|
|
3168
|
-
var cropSelPointColl = object['selPointColl'];
|
|
3169
|
-
parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
|
|
3170
|
-
value: { obj: { selPointColl: [] } } });
|
|
3171
|
-
var cropObj = extend({}, parent.cropObj, {});
|
|
3172
|
-
var afterCropActions = extend([], parent.afterCropActions, {}, true);
|
|
3173
|
-
this.setCurrentObj();
|
|
3174
|
-
parent.notify('crop', { prop: 'cropImg', onPropertyChange: false, value: { isRotateCrop: null } });
|
|
3175
|
-
parent.cropObj = cropObj;
|
|
3176
|
-
parent.afterCropActions = afterCropActions;
|
|
3177
|
-
parent.objColl = extend([], this.cancelObjColl, [], true);
|
|
3178
|
-
parent.pointColl = extend([], this.cancelPointColl, [], true);
|
|
3179
|
-
parent.freehandCounter = freehandCounter;
|
|
3180
|
-
parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
|
|
3181
|
-
value: { obj: { selPointColl: cropSelPointColl } } });
|
|
3182
|
-
parent.notify('shape', { prop: 'iterateObjColl', onPropertyChange: false });
|
|
3183
|
-
parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
|
|
3184
|
-
value: { context: this.lowerContext, points: null } });
|
|
3185
|
-
this.clearOuterCanvas(this.lowerContext);
|
|
3186
|
-
if (parent.isCircleCrop) {
|
|
3187
|
-
parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
|
|
3188
|
-
value: { context: this.lowerContext, isSave: null, isFlip: null } });
|
|
3189
|
-
}
|
|
3190
|
-
this.isCancelAction = false;
|
|
3191
|
-
}
|
|
3192
|
-
parent.transform.zoomFactor = parent.transform.defaultZoomFactor;
|
|
3193
|
-
if (!isBlazor()) {
|
|
3194
|
-
parent.notify('toolbar', { prop: 'enable-disable-btns', onPropertyChange: false });
|
|
3195
|
-
}
|
|
3196
|
-
else {
|
|
3197
|
-
parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
|
|
3198
|
-
}
|
|
3199
|
-
};
|
|
3200
3111
|
Draw.prototype.updateFlipPan = function (tempSelectionObj) {
|
|
3201
3112
|
var parent = this.parent;
|
|
3202
3113
|
if (parent.transform.currFlipState !== '') {
|
|
@@ -3858,13 +3769,8 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
3858
3769
|
parent.notify('toolbar', { prop: 'getDefToolbarItems', value: { obj: obj } });
|
|
3859
3770
|
if (obj['defToolbarItems'].length === 0 &&
|
|
3860
3771
|
(isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar')))) {
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
}
|
|
3864
|
-
else if (parent.element.querySelector('#' + parent.element.id + '_toolbarArea')) {
|
|
3865
|
-
var height = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
|
|
3866
|
-
parent.notify('toolbar', { prop: 'setToolbarHeight', value: { height: height } });
|
|
3867
|
-
}
|
|
3772
|
+
var height = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
|
|
3773
|
+
parent.notify('toolbar', { prop: 'setToolbarHeight', value: { height: height } });
|
|
3868
3774
|
}
|
|
3869
3775
|
}
|
|
3870
3776
|
else {
|
|
@@ -4021,6 +3927,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
4021
3927
|
var fileData = filesData;
|
|
4022
3928
|
var fileExtension = fileData.name && fileData.name.split('.')[1].toLowerCase();
|
|
4023
3929
|
if (fileExtension && ['jpg', 'jpeg', 'png', 'svg'].indexOf(fileExtension) === -1) {
|
|
3930
|
+
this.errorLoading();
|
|
4024
3931
|
return;
|
|
4025
3932
|
}
|
|
4026
3933
|
showSpinner(parent.element);
|
|
@@ -4068,6 +3975,121 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
4068
3975
|
this.imageOnLoad(url.toString());
|
|
4069
3976
|
inputElement.value = '';
|
|
4070
3977
|
};
|
|
3978
|
+
Draw.prototype.moveToSelectionRange = function (type, activeObj) {
|
|
3979
|
+
var parent = this.parent;
|
|
3980
|
+
if (parent.activeObj.shape) {
|
|
3981
|
+
if (type === 'rotateleft' || type === 'rotateright') {
|
|
3982
|
+
var zoomFactor = parent.transform.zoomFactor;
|
|
3983
|
+
parent.objColl.push(parent.activeObj);
|
|
3984
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
3985
|
+
if (parent.transform.degree % 90 === 0 && parent.transform.degree % 180 !== 0) {
|
|
3986
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.width < activeObj.activePoint.height) {
|
|
3987
|
+
for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
3988
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
|
|
3989
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
3990
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
3991
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
3992
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3993
|
+
value: { zoomFactor: -0.1, zoomPoint: null } });
|
|
3994
|
+
}
|
|
3995
|
+
break;
|
|
3996
|
+
}
|
|
3997
|
+
zoomFactor += 0.1;
|
|
3998
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3999
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4000
|
+
}
|
|
4001
|
+
}
|
|
4002
|
+
else {
|
|
4003
|
+
for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
4004
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
|
|
4005
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
4006
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
4007
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
4008
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4009
|
+
value: { zoomFactor: 0.1, zoomPoint: null } });
|
|
4010
|
+
}
|
|
4011
|
+
break;
|
|
4012
|
+
}
|
|
4013
|
+
zoomFactor -= .1;
|
|
4014
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4015
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4016
|
+
}
|
|
4017
|
+
}
|
|
4018
|
+
}
|
|
4019
|
+
else {
|
|
4020
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.height < activeObj.activePoint.width) {
|
|
4021
|
+
for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
4022
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
|
|
4023
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
4024
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
4025
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
4026
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4027
|
+
value: { zoomFactor: -0.1, zoomPoint: null } });
|
|
4028
|
+
}
|
|
4029
|
+
break;
|
|
4030
|
+
}
|
|
4031
|
+
zoomFactor += 0.1;
|
|
4032
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4033
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4034
|
+
}
|
|
4035
|
+
}
|
|
4036
|
+
else {
|
|
4037
|
+
for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
4038
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
|
|
4039
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
4040
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
4041
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
4042
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4043
|
+
value: { zoomFactor: 0.1, zoomPoint: null } });
|
|
4044
|
+
}
|
|
4045
|
+
break;
|
|
4046
|
+
}
|
|
4047
|
+
zoomFactor -= .1;
|
|
4048
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4049
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4050
|
+
}
|
|
4051
|
+
}
|
|
4052
|
+
}
|
|
4053
|
+
var panX = (parent.lowerCanvas.clientWidth / 2) - (parent.objColl[parent.objColl.length - 1].activePoint.startX +
|
|
4054
|
+
(parent.objColl[parent.objColl.length - 1].activePoint.width / 2));
|
|
4055
|
+
var panY = (parent.lowerCanvas.clientHeight / 2) - (parent.objColl[parent.objColl.length - 1].activePoint.startY +
|
|
4056
|
+
(parent.objColl[parent.objColl.length - 1].activePoint.height / 2));
|
|
4057
|
+
if (parent.transform.degree === 0) {
|
|
4058
|
+
parent.img.destLeft += panX;
|
|
4059
|
+
parent.img.destTop += panY;
|
|
4060
|
+
parent.notify('transform', { prop: 'drawPannImage', value: { point: { x: panX, y: panY } } });
|
|
4061
|
+
}
|
|
4062
|
+
else {
|
|
4063
|
+
parent.panPoint.currentPannedPoint = { x: panX, y: panY };
|
|
4064
|
+
parent.notify('transform', { prop: 'drawPannedImage', value: { xDiff: panX, yDiff: panY } });
|
|
4065
|
+
parent.panPoint.currentPannedPoint = { x: 0, y: 0 };
|
|
4066
|
+
}
|
|
4067
|
+
parent.notify('transform', { prop: 'setTempPanMove', onPropertyChange: false,
|
|
4068
|
+
value: { point: null } });
|
|
4069
|
+
parent.activeObj = extend({}, parent.objColl[parent.objColl.length - 1]);
|
|
4070
|
+
parent.objColl.pop();
|
|
4071
|
+
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj } });
|
|
4072
|
+
}
|
|
4073
|
+
}
|
|
4074
|
+
};
|
|
4075
|
+
Draw.prototype.isSelectionBiggerThanCanvas = function (obj) {
|
|
4076
|
+
var isBigger = false;
|
|
4077
|
+
if (obj.activePoint.startX <= this.parent.img.destLeft ||
|
|
4078
|
+
obj.activePoint.startY <= this.parent.img.destTop ||
|
|
4079
|
+
obj.activePoint.endX >= this.parent.img.destLeft + this.parent.img.destWidth ||
|
|
4080
|
+
obj.activePoint.endY >= this.parent.img.destTop + this.parent.img.destHeight) {
|
|
4081
|
+
isBigger = true;
|
|
4082
|
+
}
|
|
4083
|
+
return isBigger;
|
|
4084
|
+
};
|
|
4085
|
+
Draw.prototype.isSelectionOutsideCanvas = function (obj) {
|
|
4086
|
+
var isOutside = false;
|
|
4087
|
+
if ((obj.activePoint.height < this.parent.lowerCanvas.height - this.parent.toolbarHeight) ||
|
|
4088
|
+
(obj.activePoint.width < this.parent.lowerCanvas.width)) {
|
|
4089
|
+
isOutside = true;
|
|
4090
|
+
}
|
|
4091
|
+
return isOutside;
|
|
4092
|
+
};
|
|
4071
4093
|
return Draw;
|
|
4072
4094
|
}());
|
|
4073
4095
|
|
|
@@ -4523,7 +4545,7 @@ var Filter = /** @__PURE__ @class */ (function () {
|
|
|
4523
4545
|
};
|
|
4524
4546
|
Filter.prototype.updatePrivateVariables = function () {
|
|
4525
4547
|
var parent = this.parent;
|
|
4526
|
-
if (
|
|
4548
|
+
if (parent.lowerCanvas) {
|
|
4527
4549
|
this.lowerContext = parent.lowerCanvas.getContext('2d');
|
|
4528
4550
|
}
|
|
4529
4551
|
};
|
|
@@ -5833,7 +5855,7 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
5833
5855
|
FreehandDrawing.prototype.updateFHDCurPts = function () {
|
|
5834
5856
|
var parent = this.parent;
|
|
5835
5857
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
5836
|
-
if (
|
|
5858
|
+
if (this.selPointColl[n]) {
|
|
5837
5859
|
this.selPoints = extend([], this.selPointColl[n].points, []);
|
|
5838
5860
|
this.pointCounter = 0;
|
|
5839
5861
|
var len = this.selPoints.length;
|
|
@@ -5861,7 +5883,7 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
5861
5883
|
}
|
|
5862
5884
|
// Update rotation points for each point for cursor styles
|
|
5863
5885
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
5864
|
-
if (
|
|
5886
|
+
if (this.selPointColl[n]) {
|
|
5865
5887
|
this.selPoints = extend([], this.selPointColl[n].points, []);
|
|
5866
5888
|
this.pointCounter = 0;
|
|
5867
5889
|
var len = this.selPoints.length;
|
|
@@ -5917,7 +5939,7 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
5917
5939
|
}
|
|
5918
5940
|
// Update flip value for each points for cursor styles
|
|
5919
5941
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
5920
|
-
if (
|
|
5942
|
+
if (this.selPointColl[n]) {
|
|
5921
5943
|
if (this.selPointColl[n].shapeFlip !== parent.transform.currFlipState) {
|
|
5922
5944
|
this.selPoints = extend([], this.selPointColl[n].points, []);
|
|
5923
5945
|
this.pointCounter = 0;
|
|
@@ -5964,7 +5986,7 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
5964
5986
|
}
|
|
5965
5987
|
// Update flip value for each points for cursor styles
|
|
5966
5988
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
5967
|
-
if (
|
|
5989
|
+
if (this.selPointColl[n]) {
|
|
5968
5990
|
if (this.selPointColl[n].shapeFlip !== parent.transform.currFlipState) {
|
|
5969
5991
|
this.selPoints = extend([], this.selPointColl[n].points, []);
|
|
5970
5992
|
this.pointCounter = 0;
|
|
@@ -6015,7 +6037,7 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
6015
6037
|
}
|
|
6016
6038
|
}
|
|
6017
6039
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
6018
|
-
if (
|
|
6040
|
+
if (this.selPointColl[n]) {
|
|
6019
6041
|
this.selPoints = extend([], this.selPointColl[n].points, []);
|
|
6020
6042
|
this.pointCounter = 0;
|
|
6021
6043
|
var len = this.selPoints.length;
|
|
@@ -6050,7 +6072,7 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
6050
6072
|
}
|
|
6051
6073
|
// Updating each points for cursor styles for panning
|
|
6052
6074
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
6053
|
-
if (
|
|
6075
|
+
if (this.selPointColl[n]) {
|
|
6054
6076
|
this.selPoints = extend([], this.selPointColl[n].points, []);
|
|
6055
6077
|
this.pointCounter = 0;
|
|
6056
6078
|
var len = this.selPoints.length;
|
|
@@ -6113,13 +6135,13 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
6113
6135
|
FreehandDrawing.prototype.isFHDIdx = function (index, obj) {
|
|
6114
6136
|
var isIndex = false;
|
|
6115
6137
|
for (var i = 0; i < this.parent.freehandCounter; i++) {
|
|
6116
|
-
if (
|
|
6138
|
+
if (this.parent.pointColl[i].id &&
|
|
6117
6139
|
parseInt(this.parent.pointColl[i].id.split('_')[1], 10) - 1 === index) {
|
|
6118
6140
|
isIndex = true;
|
|
6119
6141
|
break;
|
|
6120
6142
|
}
|
|
6121
6143
|
}
|
|
6122
|
-
if (
|
|
6144
|
+
if (obj) {
|
|
6123
6145
|
obj['isIndex'] = isIndex;
|
|
6124
6146
|
}
|
|
6125
6147
|
return isIndex;
|
|
@@ -6128,7 +6150,7 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
6128
6150
|
var parent = this.parent;
|
|
6129
6151
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
6130
6152
|
var obj = { selPointColl: extend([], this.selPointColl) };
|
|
6131
|
-
if (
|
|
6153
|
+
if (obj['selPointColl'][n]) {
|
|
6132
6154
|
this.selPoints = extend([], obj['selPointColl'][n].points, []);
|
|
6133
6155
|
this.pointCounter = 0;
|
|
6134
6156
|
var len = this.selPoints.length;
|
|
@@ -6275,9 +6297,6 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
6275
6297
|
case 'handleScroll':
|
|
6276
6298
|
this.handleScroll(args.value['e']);
|
|
6277
6299
|
break;
|
|
6278
|
-
case 'adjustToScreen':
|
|
6279
|
-
this.adjustToScreen();
|
|
6280
|
-
break;
|
|
6281
6300
|
case 'textKeyDown':
|
|
6282
6301
|
setTimeout(this.textKeyDown.bind(this), 1, args.value['e']);
|
|
6283
6302
|
break;
|
|
@@ -6369,6 +6388,18 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
6369
6388
|
case 'getTransRotationPoint':
|
|
6370
6389
|
this.getTransRotationPoint(args.value['obj'], args.value['object']);
|
|
6371
6390
|
break;
|
|
6391
|
+
case 'adjustNEPoints':
|
|
6392
|
+
this.adjustNEPoints(args.value['rectangle'], args.value['x'], args.value['y'], args.value['angle']);
|
|
6393
|
+
break;
|
|
6394
|
+
case 'adjustRotationPoints':
|
|
6395
|
+
this.adjustRotationPoints(args.value['rectangle'], args.value['x'], args.value['y'], args.value['angle']);
|
|
6396
|
+
break;
|
|
6397
|
+
case 'getResizeDirection':
|
|
6398
|
+
this.getResizeDirection(args.value['rectangle'], args.value['x'], args.value['y'], args.value['angle']);
|
|
6399
|
+
break;
|
|
6400
|
+
case 'setResizedElement':
|
|
6401
|
+
this.resizedElement = args.value['value'];
|
|
6402
|
+
break;
|
|
6372
6403
|
case 'reset':
|
|
6373
6404
|
this.reset();
|
|
6374
6405
|
break;
|
|
@@ -6379,10 +6410,10 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
6379
6410
|
};
|
|
6380
6411
|
Selection.prototype.updatePrivateVariables = function () {
|
|
6381
6412
|
var parent = this.parent;
|
|
6382
|
-
if (
|
|
6413
|
+
if (parent.lowerCanvas) {
|
|
6383
6414
|
this.lowerContext = parent.lowerCanvas.getContext('2d');
|
|
6384
6415
|
}
|
|
6385
|
-
if (
|
|
6416
|
+
if (parent.upperCanvas) {
|
|
6386
6417
|
this.upperContext = parent.upperCanvas.getContext('2d');
|
|
6387
6418
|
}
|
|
6388
6419
|
};
|
|
@@ -6493,7 +6524,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
6493
6524
|
cursor = 'move';
|
|
6494
6525
|
}
|
|
6495
6526
|
}
|
|
6496
|
-
else if (
|
|
6527
|
+
else if (rotationCirclePoint && !isApply &&
|
|
6497
6528
|
x >= (rotationCirclePoint.x - (actObj.bottomCenterCircle.radius + 2)) &&
|
|
6498
6529
|
x <= rotationCirclePoint.x + (actObj.bottomCenterCircle.radius + 2) &&
|
|
6499
6530
|
y >= rotationCirclePoint.y - (actObj.bottomCenterCircle.radius + 2) &&
|
|
@@ -6595,7 +6626,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
6595
6626
|
}
|
|
6596
6627
|
}
|
|
6597
6628
|
if ((parent.cursor === 'default' || parent.cursor === 'grab')
|
|
6598
|
-
&&
|
|
6629
|
+
&& parent.pointColl[0] && (parent.cursor !== 'grab' || !isCropSelection)
|
|
6599
6630
|
&& !parent.currObjType.isDragging && !parent.currObjType.isResize) {
|
|
6600
6631
|
this.setCursorForFreehandDrawing(x, y, upperCanvas);
|
|
6601
6632
|
}
|
|
@@ -6713,7 +6744,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
6713
6744
|
(actObj.bottomCenterCircle.radius + 2))) {
|
|
6714
6745
|
upperCanvas.style.cursor = parent.cursor = 'se-resize';
|
|
6715
6746
|
}
|
|
6716
|
-
else if (
|
|
6747
|
+
else if (actObj.rotationCirclePointColl &&
|
|
6717
6748
|
x >= (actObj.rotationCirclePointColl.x - (actObj.bottomCenterCircle.radius + 2)) &&
|
|
6718
6749
|
x <= actObj.rotationCirclePointColl.x + (actObj.bottomCenterCircle.radius + 2) &&
|
|
6719
6750
|
y >= actObj.rotationCirclePointColl.y - (actObj.bottomCenterCircle.radius + 2) &&
|
|
@@ -6781,7 +6812,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
6781
6812
|
if ((length >= 92 && length <= 182) || (length >= -178 && length <= -88)) {
|
|
6782
6813
|
var cursorMap = { 'nw-resize': 'ne-resize', 'n-resize': 's-resize',
|
|
6783
6814
|
'ne-resize': 'nw-resize', 'w-resize': 'e-resize', 'e-resize': 'w-resize',
|
|
6784
|
-
'sw-resize': 'se-resize', 's-resize': 'n-resize', 'se-resize': 'sw-resize'
|
|
6815
|
+
'sw-resize': 'se-resize', 's-resize': 'n-resize', 'se-resize': 'sw-resize'
|
|
6785
6816
|
};
|
|
6786
6817
|
if (parent.cursor in cursorMap) {
|
|
6787
6818
|
parent.cursor = cursorMap[parent.cursor];
|
|
@@ -6926,7 +6957,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
6926
6957
|
else if (!this.isFhdEditing || parent.pointColl[n].isSelected) {
|
|
6927
6958
|
if (this.isFhdPoint || this.isFhdEditing) {
|
|
6928
6959
|
upperContext.clearRect(0, 0, upperCanvas.width, upperCanvas.height);
|
|
6929
|
-
if (
|
|
6960
|
+
if (parent.activeObj.shape && textArea.style.display === 'none') {
|
|
6930
6961
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj } });
|
|
6931
6962
|
}
|
|
6932
6963
|
}
|
|
@@ -7202,7 +7233,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
7202
7233
|
if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
7203
7234
|
this.isCropSelection = true;
|
|
7204
7235
|
}
|
|
7205
|
-
if (!this.isCropSelection && this.parent.eventType !== 'resize' && isBlazor() &&
|
|
7236
|
+
if (!this.isCropSelection && this.parent.eventType !== 'resize' && isBlazor() && parent.events && this.parent.events.onShapeResizeStart.hasDelegate === true) {
|
|
7206
7237
|
shapeResizingArgs.action = 'resize-start';
|
|
7207
7238
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
7208
7239
|
parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShapeResizeStart', shapeResizingArgs).then(function (shapeResizingArgs) {
|
|
@@ -8413,7 +8444,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
8413
8444
|
isResize = true;
|
|
8414
8445
|
this.dragElement = parent.upperCanvas.style.cursor;
|
|
8415
8446
|
}
|
|
8416
|
-
else if (
|
|
8447
|
+
else if (rotationCirclePoint &&
|
|
8417
8448
|
x >= rotationCirclePoint.x - (actObj.topLeftCircle.radius * 2) &&
|
|
8418
8449
|
x <= rotationCirclePoint.x + (actObj.topLeftCircle.radius * 2) &&
|
|
8419
8450
|
y >= rotationCirclePoint.y - (actObj.topLeftCircle.radius * 2) &&
|
|
@@ -8724,7 +8755,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
8724
8755
|
this.dragCanvas = parent.togglePan = true;
|
|
8725
8756
|
}
|
|
8726
8757
|
var imageEditorClickEventArgs = { point: this.setXYPoints(e) };
|
|
8727
|
-
if (isBlazor() &&
|
|
8758
|
+
if (isBlazor() && parent.events && parent.events.clicked.hasDelegate === true) {
|
|
8728
8759
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
8729
8760
|
parent.dotNetRef.invokeMethodAsync('ClickEventAsync', 'click', imageEditorClickEventArgs).then(function (imageEditorClickEventArgs) {
|
|
8730
8761
|
_this.clickEvent(imageEditorClickEventArgs, e);
|
|
@@ -8755,7 +8786,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
8755
8786
|
var parent = this.parent;
|
|
8756
8787
|
var x = imageEditorClickEventArgs.point.x;
|
|
8757
8788
|
var y = imageEditorClickEventArgs.point.y;
|
|
8758
|
-
var cursor =
|
|
8789
|
+
var cursor = parent.activeObj.shape && parent.activeObj.shape === 'text' ?
|
|
8759
8790
|
parent.cursor : 'default';
|
|
8760
8791
|
if (this.currentDrawingShape !== '') {
|
|
8761
8792
|
var object_1 = { currObj: {} };
|
|
@@ -8791,7 +8822,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
8791
8822
|
this.isPan = false;
|
|
8792
8823
|
}
|
|
8793
8824
|
}
|
|
8794
|
-
if (
|
|
8825
|
+
if (parent.activeObj.shape) {
|
|
8795
8826
|
this.isObjSelected = true;
|
|
8796
8827
|
}
|
|
8797
8828
|
else {
|
|
@@ -8805,7 +8836,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
8805
8836
|
var isFreehandDraw = this.isFreehandDrawTouch(e, this.isCropSelection);
|
|
8806
8837
|
var isShapeClick = isShape ? isShape : this.isShapeClick(e, this.isCropSelection);
|
|
8807
8838
|
var allowUndoRedoPush = this.applyCurrShape(isShapeClick);
|
|
8808
|
-
if (this.isTouch && !isShape &&
|
|
8839
|
+
if (this.isTouch && !isShape && activeObj.shape && !this.isCropSelection) {
|
|
8809
8840
|
if (this.applyObj(x, y)) {
|
|
8810
8841
|
parent.okBtn(true);
|
|
8811
8842
|
parent.notify('draw', { prop: 'setPrevActObj', onPropertyChange: false, value: { prevActObj: null } });
|
|
@@ -8840,11 +8871,12 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
8840
8871
|
}
|
|
8841
8872
|
if (this.isFhdEditing) {
|
|
8842
8873
|
parent.notify('freehand-draw', { prop: 'applyFhd', onPropertyChange: false });
|
|
8874
|
+
this.isFhdCustomized = false;
|
|
8843
8875
|
if (!isBlazor()) {
|
|
8844
8876
|
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
8845
8877
|
}
|
|
8846
8878
|
}
|
|
8847
|
-
if (
|
|
8879
|
+
if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' ||
|
|
8848
8880
|
parent.activeObj.shape === 'ellipse' || parent.activeObj.shape === 'line' ||
|
|
8849
8881
|
parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path' || parent.activeObj.shape === 'text')) {
|
|
8850
8882
|
parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
|
|
@@ -8862,7 +8894,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
8862
8894
|
}
|
|
8863
8895
|
else {
|
|
8864
8896
|
var isLineArrow = false;
|
|
8865
|
-
if (
|
|
8897
|
+
if (parent.activeObj.shape && (parent.activeObj.shape === 'line' ||
|
|
8866
8898
|
parent.activeObj.shape === 'arrow')) {
|
|
8867
8899
|
isLineArrow = true;
|
|
8868
8900
|
}
|
|
@@ -8918,7 +8950,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
8918
8950
|
else {
|
|
8919
8951
|
if (this.isFhdEditing) {
|
|
8920
8952
|
parent.notify('freehand-draw', { prop: 'cancelFhd', value: { type: 'ok' } });
|
|
8921
|
-
if (
|
|
8953
|
+
if (document.getElementById(parent.element.id + '_quickAccessToolbarArea')) {
|
|
8922
8954
|
document.getElementById(parent.element.id + '_quickAccessToolbarArea').style.display = 'none';
|
|
8923
8955
|
}
|
|
8924
8956
|
}
|
|
@@ -9056,7 +9088,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
9056
9088
|
!this.dragCanvas || parent.activeObj.activePoint !== undefined) {
|
|
9057
9089
|
if (this.dragElement === '') {
|
|
9058
9090
|
this.setCursor(x, y);
|
|
9059
|
-
if ((
|
|
9091
|
+
if ((parent.activeObj.activePoint &&
|
|
9060
9092
|
(parent.activeObj.activePoint.width === 0 || (!isNullOrUndefined(parent.activeObj.currIndex) &&
|
|
9061
9093
|
this.cursorTargetId !== parent.activeObj.currIndex)))
|
|
9062
9094
|
&& parent.cursor !== 'default' &&
|
|
@@ -9131,15 +9163,14 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
9131
9163
|
if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
9132
9164
|
isCropSelection = true;
|
|
9133
9165
|
}
|
|
9134
|
-
if (isBlazor() &&
|
|
9166
|
+
if (isBlazor() && this.parent.eventType) {
|
|
9135
9167
|
if (this.parent.eventType === 'pan') {
|
|
9136
|
-
if (
|
|
9137
|
-
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
9168
|
+
if (parent.events && parent.events.onPanEnd.hasDelegate === true) {
|
|
9138
9169
|
parent.dotNetRef.invokeMethodAsync('PanEventAsync', 'OnPanEnd', this.parent.panEventArgs);
|
|
9139
9170
|
}
|
|
9140
9171
|
}
|
|
9141
9172
|
else if (this.parent.eventType === 'resize') {
|
|
9142
|
-
if (!this.isCropSelection &&
|
|
9173
|
+
if (!this.isCropSelection && this.parent.events && this.parent.events.onShapeResizeEnd.hasDelegate === true) {
|
|
9143
9174
|
this.shapeResizingArgs.currentShapeSettings = this.updatePrevShapeSettings();
|
|
9144
9175
|
this.shapeResizingArgs.action = 'resize-end';
|
|
9145
9176
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
@@ -9148,7 +9179,8 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
9148
9179
|
value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
|
|
9149
9180
|
});
|
|
9150
9181
|
}
|
|
9151
|
-
else if (
|
|
9182
|
+
else if (this.shapeResizingArgs && this.selectionResizingArgs && this.parent.events &&
|
|
9183
|
+
this.parent.events.onSelectionResizeEnd.hasDelegate === true) {
|
|
9152
9184
|
var currentSelectionSettings = { type: this.parent.activeObj.shape,
|
|
9153
9185
|
startX: this.shapeResizingArgs.currentShapeSettings.startX,
|
|
9154
9186
|
startY: this.shapeResizingArgs.currentShapeSettings.startY,
|
|
@@ -9164,7 +9196,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
9164
9196
|
}
|
|
9165
9197
|
}
|
|
9166
9198
|
else {
|
|
9167
|
-
if (
|
|
9199
|
+
if (this.shapeMovingArgs && this.parent.events && this.parent.events.onShapeDragEnd.hasDelegate === true) {
|
|
9168
9200
|
this.shapeMovingArgs.currentShapeSettings = this.updatePrevShapeSettings();
|
|
9169
9201
|
this.shapeMovingArgs.action = 'drag-end';
|
|
9170
9202
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
@@ -9217,7 +9249,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
9217
9249
|
value: { obj: selPointCollObj } });
|
|
9218
9250
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
9219
9251
|
if (!parent.togglePen && !isCropSelection) {
|
|
9220
|
-
if (
|
|
9252
|
+
if (this.tempObjColl && parent.activeObj.activePoint.width !== 0) {
|
|
9221
9253
|
parent.objColl.push(parent.activeObj);
|
|
9222
9254
|
if (JSON.stringify(parent.activeObj.activePoint) !== JSON.stringify(this.tempActiveObj.activePoint)) {
|
|
9223
9255
|
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
@@ -9234,7 +9266,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
9234
9266
|
parent.currObjType.isResize = false;
|
|
9235
9267
|
}
|
|
9236
9268
|
}
|
|
9237
|
-
if (
|
|
9269
|
+
if (parent.activeObj) {
|
|
9238
9270
|
var isCropSelection_1 = false;
|
|
9239
9271
|
var splitWords_1;
|
|
9240
9272
|
if (parent.activeObj.shape !== undefined) {
|
|
@@ -9283,7 +9315,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
9283
9315
|
if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
9284
9316
|
isCropSelection = true;
|
|
9285
9317
|
}
|
|
9286
|
-
if (
|
|
9318
|
+
if (parent.activeObj.shape && !isCropSelection && e.currentTarget === parent.upperCanvas &&
|
|
9287
9319
|
parent.textArea.style.display === 'none') {
|
|
9288
9320
|
if (parent.activeObj.shape === 'text') {
|
|
9289
9321
|
if (!isBlazor()) {
|
|
@@ -9320,7 +9352,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
9320
9352
|
var isAdjusted = false;
|
|
9321
9353
|
var parent = this.parent;
|
|
9322
9354
|
obj = obj ? obj : parent.activeObj;
|
|
9323
|
-
if (
|
|
9355
|
+
if (obj.shape && (obj.shape === 'line' || parent.activeObj.shape === 'arrow')) {
|
|
9324
9356
|
var temp = void 0;
|
|
9325
9357
|
if ((this.dragElement === 'e-resize' && obj.activePoint.endX < obj.activePoint.startX) ||
|
|
9326
9358
|
(this.dragElement === 'w-resize' && obj.activePoint.startX > obj.activePoint.endX)) {
|
|
@@ -9351,7 +9383,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
9351
9383
|
Selection.prototype.updPtCollForShpRot = function (obj) {
|
|
9352
9384
|
var parent = this.parent;
|
|
9353
9385
|
obj = obj ? obj : parent.activeObj;
|
|
9354
|
-
if (
|
|
9386
|
+
if (obj.shape && obj.rotatedAngle !== 0) {
|
|
9355
9387
|
parent.notify('shape', { prop: 'setPointCollForShapeRotation', onPropertyChange: false,
|
|
9356
9388
|
value: { obj: obj } });
|
|
9357
9389
|
// Updating ratio for point collection
|
|
@@ -9415,7 +9447,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
9415
9447
|
if (parent.togglePen) {
|
|
9416
9448
|
return isShape;
|
|
9417
9449
|
}
|
|
9418
|
-
if (
|
|
9450
|
+
if (parent.activeObj.shape && parent.activeObj.shape === 'text' && this.isShapeInserted) {
|
|
9419
9451
|
var isTextArea = parent.textArea.style.display === 'block' ? true : false;
|
|
9420
9452
|
var activeObj = extend({}, parent.activeObj, null, true);
|
|
9421
9453
|
parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
|
|
@@ -9439,7 +9471,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
9439
9471
|
parent.objColl.splice(index, 1);
|
|
9440
9472
|
}
|
|
9441
9473
|
}
|
|
9442
|
-
else if (!isShape &&
|
|
9474
|
+
else if (!isShape && activeObj.shape) {
|
|
9443
9475
|
parent.activeObj = activeObj;
|
|
9444
9476
|
var index = this.getCurrentIndex();
|
|
9445
9477
|
if ((!isNullOrUndefined(index) &&
|
|
@@ -9457,7 +9489,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
9457
9489
|
var parent = this.parent;
|
|
9458
9490
|
var isShape = false;
|
|
9459
9491
|
if (e.type === 'touchstart' && !parent.togglePen) {
|
|
9460
|
-
if (
|
|
9492
|
+
if (parent.activeObj && parent.activeObj.shape === 'text') {
|
|
9461
9493
|
this.timer = setTimeout(this.setTimer.bind(this), 1000, e);
|
|
9462
9494
|
}
|
|
9463
9495
|
var isTextArea = parent.textArea.style.display === 'block' ? true : false;
|
|
@@ -9527,7 +9559,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
9527
9559
|
parent.objColl.splice(index, 1);
|
|
9528
9560
|
}
|
|
9529
9561
|
}
|
|
9530
|
-
else if (
|
|
9562
|
+
else if (activeObj.shape) {
|
|
9531
9563
|
parent.activeObj = activeObj;
|
|
9532
9564
|
var index = this.getCurrentIndex();
|
|
9533
9565
|
if (!isCropSelection) {
|
|
@@ -9546,7 +9578,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
9546
9578
|
Selection.prototype.applyObj = function (x, y) {
|
|
9547
9579
|
var parent = this.parent;
|
|
9548
9580
|
var isApply = false;
|
|
9549
|
-
if (
|
|
9581
|
+
if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse' ||
|
|
9550
9582
|
parent.activeObj.shape === 'text' || parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' ||
|
|
9551
9583
|
parent.activeObj.shape === 'path')) {
|
|
9552
9584
|
if (x >= (parent.activeObj.activePoint.startX - (parent.activeObj.topLeftCircle.radius * 2)) &&
|
|
@@ -9726,7 +9758,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
9726
9758
|
var splitWords;
|
|
9727
9759
|
switch (e.key) {
|
|
9728
9760
|
case (e.ctrlKey && 's'):
|
|
9729
|
-
if (isBlazor() &&
|
|
9761
|
+
if (isBlazor() && parent.events && parent.events.saving.hasDelegate === true) {
|
|
9730
9762
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
9731
9763
|
parent.dotNetRef.invokeMethodAsync('BeforeSaveEventAsync', 'BeforeSave', beforeSave).then(function (args) {
|
|
9732
9764
|
_this.beforeSaveEvent(args, e);
|
|
@@ -9824,7 +9856,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
9824
9856
|
e.stopPropagation();
|
|
9825
9857
|
if (e.ctrlKey === true && isInsideCanvas) {
|
|
9826
9858
|
e.preventDefault();
|
|
9827
|
-
if (!parent.isCropTab && (
|
|
9859
|
+
if (!parent.isCropTab && (parent.activeObj.shape && parent.activeObj.shape.split('-')[0] !== 'crop')) {
|
|
9828
9860
|
parent.okBtn();
|
|
9829
9861
|
if (!isBlazor()) {
|
|
9830
9862
|
parent.notify('toolbar', { prop: 'close-contextual-toolbar', onPropertyChange: false });
|
|
@@ -9847,265 +9879,85 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
9847
9879
|
}
|
|
9848
9880
|
}
|
|
9849
9881
|
};
|
|
9850
|
-
Selection.prototype.
|
|
9882
|
+
Selection.prototype.textKeyDown = function (e) {
|
|
9851
9883
|
var parent = this.parent;
|
|
9852
|
-
if (
|
|
9853
|
-
|
|
9884
|
+
if (String.fromCharCode(e.which) === '\r') {
|
|
9885
|
+
this.textRow += 1;
|
|
9854
9886
|
}
|
|
9855
|
-
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
|
|
9859
|
-
|
|
9860
|
-
parent.
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
|
|
9887
|
+
parent.textArea.setAttribute('rows', this.textRow.toString());
|
|
9888
|
+
parent.textArea.style.height = 'auto';
|
|
9889
|
+
parent.textArea.style.height = parent.textArea.scrollHeight + 'px';
|
|
9890
|
+
parent.notify('shape', { prop: 'setTextBoxWidth', onPropertyChange: false, value: { e: e } });
|
|
9891
|
+
if (Browser.isDevice) {
|
|
9892
|
+
parent.textArea.style.width = parseFloat(parent.textArea.style.width) + parent.textArea.style.fontSize + 'px';
|
|
9893
|
+
}
|
|
9894
|
+
var rows = parent.textArea.value.split('\n');
|
|
9895
|
+
this.textRow = rows.length;
|
|
9896
|
+
parent.textArea.setAttribute('rows', this.textRow.toString());
|
|
9897
|
+
this.isInitialTextEdited = false;
|
|
9898
|
+
};
|
|
9899
|
+
Selection.prototype.clearSelection = function () {
|
|
9900
|
+
var parent = this.parent;
|
|
9901
|
+
if (!parent.disabled && parent.isImageLoaded) {
|
|
9902
|
+
parent.togglePen = false;
|
|
9903
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
9904
|
+
this.dragElement = '';
|
|
9905
|
+
this.dragPoint.startX = this.dragPoint.startY = this.dragPoint.endX = this.dragPoint.endY = 0;
|
|
9906
|
+
parent.currObjType.shape = '';
|
|
9907
|
+
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
9908
|
+
parent.currObjType.isActiveObj = true;
|
|
9909
|
+
parent.currObjType.isCustomCrop = false;
|
|
9910
|
+
parent.upperCanvas.style.cursor = parent.cursor = 'default';
|
|
9911
|
+
}
|
|
9912
|
+
};
|
|
9913
|
+
Selection.prototype.setDragDirection = function (width, height) {
|
|
9914
|
+
var arcRadius = (7.5);
|
|
9915
|
+
var parent = this.parent;
|
|
9916
|
+
if (parent.img.destWidth > parent.img.destHeight) {
|
|
9917
|
+
parent.activeObj.activePoint.startX = this.dragPoint.startX = ((width / 2) - (height / 2))
|
|
9918
|
+
+ arcRadius;
|
|
9919
|
+
parent.activeObj.activePoint.startY = this.dragPoint.startY = ((height / 2) - (height / 2))
|
|
9920
|
+
+ arcRadius;
|
|
9921
|
+
parent.activeObj.activePoint.endX = ((width / 2) + (height / 2)) - arcRadius;
|
|
9922
|
+
parent.activeObj.activePoint.endY = ((height / 2) + (height / 2)) - arcRadius;
|
|
9923
|
+
}
|
|
9924
|
+
else {
|
|
9925
|
+
parent.activeObj.activePoint.startY = this.dragPoint.startX = ((height / 2) - (width) / 2)
|
|
9926
|
+
+ arcRadius;
|
|
9927
|
+
parent.activeObj.activePoint.endY = ((height / 2) + (width) / 2) - arcRadius;
|
|
9928
|
+
parent.activeObj.activePoint.startX = this.dragPoint.startX = arcRadius;
|
|
9929
|
+
parent.activeObj.activePoint.endX = width - arcRadius;
|
|
9930
|
+
}
|
|
9931
|
+
};
|
|
9932
|
+
Selection.prototype.calcShapeRatio = function (x, y, imgWidth, imgHeight) {
|
|
9933
|
+
var parent = this.parent;
|
|
9934
|
+
var arcRadius = (7.5);
|
|
9935
|
+
var originalWidth = imgWidth;
|
|
9936
|
+
var originalHeight = imgHeight;
|
|
9937
|
+
var presetRatio = x / y;
|
|
9938
|
+
var standardSize = originalWidth >= originalHeight ? originalWidth : originalHeight;
|
|
9939
|
+
var width = standardSize * presetRatio;
|
|
9940
|
+
var height = standardSize;
|
|
9941
|
+
var scaleWidth = this.getScale(width, originalWidth);
|
|
9942
|
+
var snippetArray = [];
|
|
9943
|
+
for (var i = 0; i < 2; i++) {
|
|
9944
|
+
if (i === 0) {
|
|
9945
|
+
snippetArray.push(width * scaleWidth);
|
|
9864
9946
|
}
|
|
9865
9947
|
else {
|
|
9866
|
-
|
|
9948
|
+
snippetArray.push(height * scaleWidth);
|
|
9867
9949
|
}
|
|
9868
9950
|
}
|
|
9869
|
-
|
|
9870
|
-
|
|
9871
|
-
|
|
9951
|
+
width = snippetArray[0];
|
|
9952
|
+
height = snippetArray[1];
|
|
9953
|
+
var scaleHeight = this.getScale(height, originalHeight);
|
|
9954
|
+
var snippetArray1 = [];
|
|
9955
|
+
for (var i = 0; i < 2; i++) {
|
|
9956
|
+
if (i === 0) {
|
|
9957
|
+
snippetArray1.push(width * scaleHeight);
|
|
9872
9958
|
}
|
|
9873
9959
|
else {
|
|
9874
|
-
|
|
9875
|
-
}
|
|
9876
|
-
}
|
|
9877
|
-
var isActiveObj = false;
|
|
9878
|
-
if (parent.activeObj.shape !== undefined) {
|
|
9879
|
-
isActiveObj = true;
|
|
9880
|
-
if (parent.textArea.style.display === 'block') {
|
|
9881
|
-
parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
|
|
9882
|
-
value: { x: null, y: null, isMouseDown: null } });
|
|
9883
|
-
if (!isBlazor()) {
|
|
9884
|
-
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
9885
|
-
}
|
|
9886
|
-
else {
|
|
9887
|
-
parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
|
|
9888
|
-
}
|
|
9889
|
-
}
|
|
9890
|
-
else {
|
|
9891
|
-
parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
|
|
9892
|
-
parent.objColl.push(parent.activeObj);
|
|
9893
|
-
}
|
|
9894
|
-
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
9895
|
-
}
|
|
9896
|
-
var tempFilter = this.lowerContext.filter;
|
|
9897
|
-
parent.update();
|
|
9898
|
-
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: null } });
|
|
9899
|
-
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
9900
|
-
this.lowerContext.filter = tempFilter;
|
|
9901
|
-
parent.initialAdjustmentValue = tempFilter;
|
|
9902
|
-
if (parent.isImageLoaded) {
|
|
9903
|
-
showSpinner(parent.element);
|
|
9904
|
-
parent.element.style.opacity = '0.5';
|
|
9905
|
-
}
|
|
9906
|
-
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
9907
|
-
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
9908
|
-
var canvasWrapper = document.querySelector('#' + parent.element.id + '_canvasWrapper');
|
|
9909
|
-
if (!isNullOrUndefined(canvasWrapper)) {
|
|
9910
|
-
canvasWrapper.style.width = parent.element.offsetWidth - 2 + 'px';
|
|
9911
|
-
canvasWrapper.style.height = parent.element.offsetHeight + 'px';
|
|
9912
|
-
var obj_3 = { toolbarHeight: !isBlazor() ? 0 : parent.toolbarHeight };
|
|
9913
|
-
if (!isBlazor()) {
|
|
9914
|
-
parent.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: obj_3 } });
|
|
9915
|
-
}
|
|
9916
|
-
if (Browser.isDevice) {
|
|
9917
|
-
canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - (2 * obj_3['toolbarHeight'])) - 3 + 'px';
|
|
9918
|
-
}
|
|
9919
|
-
else {
|
|
9920
|
-
canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - obj_3['toolbarHeight']) - 3 + 'px';
|
|
9921
|
-
}
|
|
9922
|
-
}
|
|
9923
|
-
var obj = { width: 0, height: 0 };
|
|
9924
|
-
parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
|
|
9925
|
-
value: { width: parent.img.srcWidth, height: parent.img.srcHeight, obj: obj } });
|
|
9926
|
-
var maxDimension = obj;
|
|
9927
|
-
if (parent.transform.defaultZoomFactor > 0) {
|
|
9928
|
-
maxDimension.width += (maxDimension.width * parent.transform.defaultZoomFactor);
|
|
9929
|
-
maxDimension.height += (maxDimension.height * parent.transform.defaultZoomFactor);
|
|
9930
|
-
}
|
|
9931
|
-
parent.img.destLeft = (parent.lowerCanvas.clientWidth - maxDimension.width) / 2;
|
|
9932
|
-
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height) / 2;
|
|
9933
|
-
if (parent.transform.degree === 0 && parent.transform.currFlipState === '') {
|
|
9934
|
-
if (parent.transform.defaultZoomFactor > 0) {
|
|
9935
|
-
parent.img.destLeft += parent.panPoint.totalPannedPoint.x;
|
|
9936
|
-
parent.img.destTop += parent.panPoint.totalPannedPoint.y;
|
|
9937
|
-
}
|
|
9938
|
-
parent.notify('draw', { prop: 'draw-image-to-canvas', value: { dimension: maxDimension } });
|
|
9939
|
-
}
|
|
9940
|
-
else {
|
|
9941
|
-
parent.notify('draw', { prop: 'draw-image-to-canvas', value: { dimension: maxDimension } });
|
|
9942
|
-
parent.notify('draw', { prop: 'updateCurrTransState', onPropertyChange: false,
|
|
9943
|
-
value: { type: 'initial', isPreventDestination: null, isRotatePan: null } });
|
|
9944
|
-
var temp = this.lowerContext.filter;
|
|
9945
|
-
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
9946
|
-
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);
|
|
9947
|
-
this.lowerContext.filter = temp;
|
|
9948
|
-
parent.notify('draw', { prop: 'updateCurrTransState', onPropertyChange: false,
|
|
9949
|
-
value: { type: 'reverse', isPreventDestination: null, isRotatePan: null } });
|
|
9950
|
-
}
|
|
9951
|
-
parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
9952
|
-
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
9953
|
-
if (parent.isCircleCrop) {
|
|
9954
|
-
parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
|
|
9955
|
-
value: { context: this.lowerContext, isSave: null, isFlip: null } });
|
|
9956
|
-
}
|
|
9957
|
-
hideSpinner(parent.element);
|
|
9958
|
-
parent.element.style.opacity = '1';
|
|
9959
|
-
var obj1 = { defToolbarItems: null };
|
|
9960
|
-
if (!isBlazor()) {
|
|
9961
|
-
parent.notify('toolbar', { prop: 'getDefToolbarItems', value: { obj: obj1 } });
|
|
9962
|
-
if (obj1['defToolbarItems'] && obj1['defToolbarItems'].length > 0 && (!isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar')))) {
|
|
9963
|
-
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
9964
|
-
var toolbar_1 = getComponent(parent.element.id + '_toolbar', 'toolbar');
|
|
9965
|
-
toolbar_1.refreshOverflow();
|
|
9966
|
-
if (!isNullOrUndefined(parent.element.querySelector('.e-contextual-toolbar-wrapper'))) {
|
|
9967
|
-
parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
9968
|
-
}
|
|
9969
|
-
}
|
|
9970
|
-
}
|
|
9971
|
-
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
9972
|
-
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
9973
|
-
if (isActiveObj) {
|
|
9974
|
-
parent.activeObj = extend({}, parent.objColl[parent.objColl.length - 1], null, true);
|
|
9975
|
-
parent.objColl.pop();
|
|
9976
|
-
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj } });
|
|
9977
|
-
if (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse' || parent.activeObj.shape === 'text' ||
|
|
9978
|
-
parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path') {
|
|
9979
|
-
if (!isBlazor()) {
|
|
9980
|
-
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
9981
|
-
}
|
|
9982
|
-
else {
|
|
9983
|
-
parent.updateToolbar(parent.element, 'quickAccessToolbar', parent.activeObj.shape);
|
|
9984
|
-
}
|
|
9985
|
-
}
|
|
9986
|
-
}
|
|
9987
|
-
if (this.isFhdEditing) {
|
|
9988
|
-
if (!isBlazor()) {
|
|
9989
|
-
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
|
|
9990
|
-
}
|
|
9991
|
-
else {
|
|
9992
|
-
parent.updateToolbar(parent.element, 'quickAccessToolbar', 'pen');
|
|
9993
|
-
}
|
|
9994
|
-
}
|
|
9995
|
-
if ((parent.transform.degree !== 0 || parent.transform.currFlipState !== '') && parent.transform.defaultZoomFactor > 0) {
|
|
9996
|
-
var totalPannedPoint = extend({}, parent.panPoint.totalPannedPoint, null, true);
|
|
9997
|
-
var totalPannedInternalPoint = extend({}, parent.panPoint.totalPannedInternalPoint, null, true);
|
|
9998
|
-
var totalPannedClientPoint = extend({}, parent.panPoint.totalPannedClientPoint, null, true);
|
|
9999
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
10000
|
-
value: { zoomFactor: .1, zoomPoint: null } });
|
|
10001
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
10002
|
-
value: { zoomFactor: -.1, zoomPoint: null } });
|
|
10003
|
-
if (parent.transform.degree === 0) {
|
|
10004
|
-
parent.img.destLeft += totalPannedPoint.x;
|
|
10005
|
-
parent.img.destTop += totalPannedPoint.y;
|
|
10006
|
-
parent.panPoint.totalPannedPoint = totalPannedPoint;
|
|
10007
|
-
parent.notify('draw', { prop: 'updateFlipPan', value: { tempSelectionObj: null } });
|
|
10008
|
-
}
|
|
10009
|
-
else {
|
|
10010
|
-
parent.panPoint.totalPannedInternalPoint = totalPannedInternalPoint;
|
|
10011
|
-
parent.panPoint.totalPannedClientPoint = totalPannedClientPoint;
|
|
10012
|
-
parent.panPoint.currentPannedPoint = { x: 0, y: 0 };
|
|
10013
|
-
parent.isCropTab = true;
|
|
10014
|
-
parent.notify('transform', { prop: 'rotatePan', onPropertyChange: false,
|
|
10015
|
-
value: { isCropSelection: null, isDefaultZoom: null } });
|
|
10016
|
-
parent.isCropTab = false;
|
|
10017
|
-
}
|
|
10018
|
-
}
|
|
10019
|
-
else if (parent.transform.degree !== 0 && parent.transform.cropZoomFactor > 0) {
|
|
10020
|
-
parent.transform.zoomFactor = 0;
|
|
10021
|
-
parent.transform.cropZoomFactor = null;
|
|
10022
|
-
if (!isBlazor()) {
|
|
10023
|
-
parent.notify('toolbar', { prop: 'enable-disable-btns', onPropertyChange: false });
|
|
10024
|
-
}
|
|
10025
|
-
else {
|
|
10026
|
-
parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
|
|
10027
|
-
}
|
|
10028
|
-
}
|
|
10029
|
-
};
|
|
10030
|
-
Selection.prototype.textKeyDown = function (e) {
|
|
10031
|
-
var parent = this.parent;
|
|
10032
|
-
if (String.fromCharCode(e.which) === '\r') {
|
|
10033
|
-
this.textRow += 1;
|
|
10034
|
-
}
|
|
10035
|
-
parent.textArea.setAttribute('rows', this.textRow.toString());
|
|
10036
|
-
parent.textArea.style.height = 'auto';
|
|
10037
|
-
parent.textArea.style.height = parent.textArea.scrollHeight + 'px';
|
|
10038
|
-
parent.notify('shape', { prop: 'setTextBoxWidth', onPropertyChange: false, value: { e: e } });
|
|
10039
|
-
if (Browser.isDevice) {
|
|
10040
|
-
parent.textArea.style.width = parseFloat(parent.textArea.style.width) + parent.textArea.style.fontSize + 'px';
|
|
10041
|
-
}
|
|
10042
|
-
var rows = parent.textArea.value.split('\n');
|
|
10043
|
-
this.textRow = rows.length;
|
|
10044
|
-
parent.textArea.setAttribute('rows', this.textRow.toString());
|
|
10045
|
-
this.isInitialTextEdited = false;
|
|
10046
|
-
};
|
|
10047
|
-
Selection.prototype.clearSelection = function () {
|
|
10048
|
-
var parent = this.parent;
|
|
10049
|
-
if (!parent.disabled && parent.isImageLoaded) {
|
|
10050
|
-
parent.togglePen = false;
|
|
10051
|
-
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
10052
|
-
this.dragElement = '';
|
|
10053
|
-
this.dragPoint.startX = this.dragPoint.startY = this.dragPoint.endX = this.dragPoint.endY = 0;
|
|
10054
|
-
parent.currObjType.shape = '';
|
|
10055
|
-
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
10056
|
-
parent.currObjType.isActiveObj = true;
|
|
10057
|
-
parent.currObjType.isCustomCrop = false;
|
|
10058
|
-
parent.upperCanvas.style.cursor = parent.cursor = 'default';
|
|
10059
|
-
}
|
|
10060
|
-
};
|
|
10061
|
-
Selection.prototype.setDragDirection = function (width, height) {
|
|
10062
|
-
var arcRadius = (7.5);
|
|
10063
|
-
var parent = this.parent;
|
|
10064
|
-
if (parent.img.destWidth > parent.img.destHeight) {
|
|
10065
|
-
parent.activeObj.activePoint.startX = this.dragPoint.startX = ((width / 2) - (height / 2))
|
|
10066
|
-
+ arcRadius;
|
|
10067
|
-
parent.activeObj.activePoint.startY = this.dragPoint.startY = ((height / 2) - (height / 2))
|
|
10068
|
-
+ arcRadius;
|
|
10069
|
-
parent.activeObj.activePoint.endX = ((width / 2) + (height / 2)) - arcRadius;
|
|
10070
|
-
parent.activeObj.activePoint.endY = ((height / 2) + (height / 2)) - arcRadius;
|
|
10071
|
-
}
|
|
10072
|
-
else {
|
|
10073
|
-
parent.activeObj.activePoint.startY = this.dragPoint.startX = ((height / 2) - (width) / 2)
|
|
10074
|
-
+ arcRadius;
|
|
10075
|
-
parent.activeObj.activePoint.endY = ((height / 2) + (width) / 2) - arcRadius;
|
|
10076
|
-
parent.activeObj.activePoint.startX = this.dragPoint.startX = arcRadius;
|
|
10077
|
-
parent.activeObj.activePoint.endX = width - arcRadius;
|
|
10078
|
-
}
|
|
10079
|
-
};
|
|
10080
|
-
Selection.prototype.calcShapeRatio = function (x, y, imgWidth, imgHeight) {
|
|
10081
|
-
var parent = this.parent;
|
|
10082
|
-
var arcRadius = (7.5);
|
|
10083
|
-
var originalWidth = imgWidth;
|
|
10084
|
-
var originalHeight = imgHeight;
|
|
10085
|
-
var presetRatio = x / y;
|
|
10086
|
-
var standardSize = originalWidth >= originalHeight ? originalWidth : originalHeight;
|
|
10087
|
-
var width = standardSize * presetRatio;
|
|
10088
|
-
var height = standardSize;
|
|
10089
|
-
var scaleWidth = this.getScale(width, originalWidth);
|
|
10090
|
-
var snippetArray = [];
|
|
10091
|
-
for (var i = 0; i < 2; i++) {
|
|
10092
|
-
if (i === 0) {
|
|
10093
|
-
snippetArray.push(width * scaleWidth);
|
|
10094
|
-
}
|
|
10095
|
-
else {
|
|
10096
|
-
snippetArray.push(height * scaleWidth);
|
|
10097
|
-
}
|
|
10098
|
-
}
|
|
10099
|
-
width = snippetArray[0];
|
|
10100
|
-
height = snippetArray[1];
|
|
10101
|
-
var scaleHeight = this.getScale(height, originalHeight);
|
|
10102
|
-
var snippetArray1 = [];
|
|
10103
|
-
for (var i = 0; i < 2; i++) {
|
|
10104
|
-
if (i === 0) {
|
|
10105
|
-
snippetArray1.push(width * scaleHeight);
|
|
10106
|
-
}
|
|
10107
|
-
else {
|
|
10108
|
-
snippetArray1.push(height * scaleHeight);
|
|
9960
|
+
snippetArray1.push(height * scaleHeight);
|
|
10109
9961
|
}
|
|
10110
9962
|
}
|
|
10111
9963
|
width = snippetArray1[0];
|
|
@@ -10256,7 +10108,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
10256
10108
|
x <= (actObj.activePoint.endX + (actObj.topLeftCircle.radius * 2)) &&
|
|
10257
10109
|
y >= (actObj.activePoint.startY - (actObj.topLeftCircle.radius * 2)) &&
|
|
10258
10110
|
y <= (actObj.activePoint.endY + (actObj.topLeftCircle.radius * 2))) ||
|
|
10259
|
-
(
|
|
10111
|
+
(rotationCirclePoint &&
|
|
10260
10112
|
x >= (rotationCirclePoint.x - (actObj.topLeftCircle.radius * 2)) &&
|
|
10261
10113
|
x <= (rotationCirclePoint.x + (actObj.topLeftCircle.radius * 2)) &&
|
|
10262
10114
|
y >= (rotationCirclePoint.y - (actObj.topLeftCircle.radius * 2)) &&
|
|
@@ -10303,7 +10155,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
10303
10155
|
value: { context: this.lowerContext, points: null } });
|
|
10304
10156
|
}
|
|
10305
10157
|
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
10306
|
-
if ((
|
|
10158
|
+
if ((parent.currSelectionPoint && parent.currSelectionPoint.shape === 'crop-circle') || parent.isCircleCrop) {
|
|
10307
10159
|
parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
|
|
10308
10160
|
value: { context: this.lowerContext, isSave: null, isFlip: null } });
|
|
10309
10161
|
}
|
|
@@ -10330,7 +10182,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
10330
10182
|
this.isCropSelection = true;
|
|
10331
10183
|
}
|
|
10332
10184
|
if (!this.isCropSelection && isBlazor() && isNullOrUndefined(this.parent.eventType) &&
|
|
10333
|
-
|
|
10185
|
+
parent.events && parent.events.shapeChanging.hasDelegate === true) {
|
|
10334
10186
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
10335
10187
|
parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs_1).then(function (shapeChangingArgs) {
|
|
10336
10188
|
_this.shapeEvent(shapeChangingArgs);
|
|
@@ -10352,7 +10204,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
10352
10204
|
startY: shapeChangingArgs_1.currentShapeSettings.startY,
|
|
10353
10205
|
width: shapeChangingArgs_1.currentShapeSettings.width,
|
|
10354
10206
|
height: shapeChangingArgs_1.currentShapeSettings.height } };
|
|
10355
|
-
if (isBlazor() &&
|
|
10207
|
+
if (isBlazor() && parent.events && parent.events.onSelectionResizeStart.hasDelegate === true) {
|
|
10356
10208
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
10357
10209
|
parent.dotNetRef.invokeMethodAsync('SelectionEventAsync', 'OnSelectionResizeStart', selectionChangingArgs).then(function (selectionChangingArgs) {
|
|
10358
10210
|
shapeChangingArgs_1.currentShapeSettings.startX = selectionChangingArgs.currentSelectionSettings.startX;
|
|
@@ -10421,7 +10273,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
10421
10273
|
Selection.prototype.getDistance = function (a, b) {
|
|
10422
10274
|
var x = 0;
|
|
10423
10275
|
var y = 0;
|
|
10424
|
-
if (
|
|
10276
|
+
if (a && b) {
|
|
10425
10277
|
x = a.x - b.x;
|
|
10426
10278
|
y = a.y - b.y;
|
|
10427
10279
|
}
|
|
@@ -10539,7 +10391,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
10539
10391
|
}
|
|
10540
10392
|
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
10541
10393
|
this.lowerContext.filter = tempFilter;
|
|
10542
|
-
if (
|
|
10394
|
+
if (parent.activeObj.shape) {
|
|
10543
10395
|
parent.notify('shape', { prop: 'apply', onPropertyChange: false,
|
|
10544
10396
|
value: { shape: null, obj: null, canvas: null } });
|
|
10545
10397
|
}
|
|
@@ -11035,6 +10887,9 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
11035
10887
|
case 'updateArrowRatio':
|
|
11036
10888
|
this.updateArrowRatio(args.value['obj']);
|
|
11037
10889
|
break;
|
|
10890
|
+
case 'getSquarePointForRotatedShape':
|
|
10891
|
+
this.getSquarePointForRotatedShape(args.value['obj'], args.value['object']);
|
|
10892
|
+
break;
|
|
11038
10893
|
case 'reset':
|
|
11039
10894
|
this.reset();
|
|
11040
10895
|
break;
|
|
@@ -11058,30 +10913,41 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
11058
10913
|
};
|
|
11059
10914
|
Shape.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor) {
|
|
11060
10915
|
this.initializeShape('ellipse');
|
|
11061
|
-
var start = { x: x, y: y };
|
|
10916
|
+
var start = x && y ? { x: x, y: y } : null;
|
|
11062
10917
|
this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY);
|
|
11063
10918
|
};
|
|
11064
10919
|
Shape.prototype.drawLine = function (startX, startY, endX, endY, strokeWidth, strokeColor) {
|
|
11065
10920
|
this.initializeShape('line');
|
|
11066
|
-
var start = { x: startX, y: startY };
|
|
10921
|
+
var start = startX && startY ? { x: startX, y: startY } : null;
|
|
11067
10922
|
var width = endX - startX;
|
|
11068
10923
|
var height = endY - startY;
|
|
11069
10924
|
this.drawShape('line', strokeWidth, strokeColor, null, start, width, height);
|
|
11070
10925
|
};
|
|
11071
10926
|
Shape.prototype.drawPath = function (pointColl, strokeWidth, strokeColor) {
|
|
11072
10927
|
this.initializeShape('path');
|
|
11073
|
-
|
|
10928
|
+
if (pointColl) {
|
|
10929
|
+
this.drawShape('path', strokeWidth, strokeColor, null, null, null, null, pointColl);
|
|
10930
|
+
}
|
|
10931
|
+
else {
|
|
10932
|
+
this.drawShape('line', strokeWidth, strokeColor, null, null, null, null);
|
|
10933
|
+
var obj = extend({}, this.parent.objColl[this.parent.objColl.length - 1], null, true);
|
|
10934
|
+
obj.shape = 'path';
|
|
10935
|
+
obj.lineDraw = null;
|
|
10936
|
+
obj.pointColl = [{ x: obj.activePoint.startX, y: obj.activePoint.startY },
|
|
10937
|
+
{ x: obj.activePoint.endX, y: obj.activePoint.endY }];
|
|
10938
|
+
this.parent.objColl[this.parent.objColl.length - 1] = obj;
|
|
10939
|
+
}
|
|
11074
10940
|
};
|
|
11075
10941
|
Shape.prototype.drawArrow = function (startX, startY, endX, endY, strokeWidth, strokeColor, arrowStart, arrowEnd) {
|
|
11076
10942
|
this.initializeShape('arrow');
|
|
11077
|
-
var start = { x: startX, y: startY };
|
|
10943
|
+
var start = startX && startY ? { x: startX, y: startY } : null;
|
|
11078
10944
|
var width = endX - startX;
|
|
11079
10945
|
var height = endY - startY;
|
|
11080
10946
|
this.drawShape('arrow', strokeWidth, strokeColor, null, start, width, height, null, arrowStart, arrowEnd);
|
|
11081
10947
|
};
|
|
11082
10948
|
Shape.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor) {
|
|
11083
10949
|
this.initializeShape('rectangle');
|
|
11084
|
-
var start = { x: x, y: y };
|
|
10950
|
+
var start = x && y ? { x: x, y: y } : null;
|
|
11085
10951
|
this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height);
|
|
11086
10952
|
};
|
|
11087
10953
|
Shape.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color) {
|
|
@@ -11243,7 +11109,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
11243
11109
|
var parent = this.parent;
|
|
11244
11110
|
if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow') {
|
|
11245
11111
|
parent.activeObj.pointColl = this.getLinePoints(parent.activeObj.activePoint.startX, parent.activeObj.activePoint.startY, parent.activeObj.activePoint.endX, parent.activeObj.activePoint.endY);
|
|
11246
|
-
if (
|
|
11112
|
+
if (parent.activeObj.pointColl) {
|
|
11247
11113
|
for (var i = 0, len = parent.activeObj.pointColl.length; i < len; i++) {
|
|
11248
11114
|
parent.activeObj.pointColl[i].ratioX = (parent.activeObj.pointColl[i].x -
|
|
11249
11115
|
parent.img.destLeft) / parent.img.destWidth;
|
|
@@ -12366,7 +12232,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
12366
12232
|
this.upperContext.clearRect(0, 0, this.parent.upperCanvas.width, this.parent.upperCanvas.height);
|
|
12367
12233
|
this.lowerContext.clearRect(0, 0, this.parent.upperCanvas.width, this.parent.upperCanvas.height);
|
|
12368
12234
|
parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
|
|
12369
|
-
if ((
|
|
12235
|
+
if ((parent.currSelectionPoint && parent.currSelectionPoint.shape === 'crop-circle') || parent.isCircleCrop) {
|
|
12370
12236
|
parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
|
|
12371
12237
|
value: { context: this.lowerContext, isSave: null, isFlip: null } });
|
|
12372
12238
|
}
|
|
@@ -13084,8 +12950,8 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
13084
12950
|
};
|
|
13085
12951
|
Shape.prototype.isPointsInRange = function (x, y, obj) {
|
|
13086
12952
|
var inRange = false;
|
|
13087
|
-
if (!isNullOrUndefined(x) && !isNullOrUndefined(y) && x >=
|
|
13088
|
-
x <= this.parent.
|
|
12953
|
+
if (!isNullOrUndefined(x) && !isNullOrUndefined(y) && x >= this.parent.img.destLeft && y >= this.parent.img.destTop &&
|
|
12954
|
+
x <= this.parent.img.destLeft + this.parent.img.destWidth && y <= this.parent.img.destTop + this.parent.img.destHeight) {
|
|
13089
12955
|
inRange = true;
|
|
13090
12956
|
}
|
|
13091
12957
|
obj['inRange'] = inRange;
|
|
@@ -13242,8 +13108,10 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
13242
13108
|
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
13243
13109
|
}
|
|
13244
13110
|
parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
|
|
13111
|
+
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
13245
13112
|
}
|
|
13246
13113
|
else {
|
|
13114
|
+
parent.updateToolbar(parent.element, parent.activeObj.shape);
|
|
13247
13115
|
if (parent.activeObj.shape === 'path') {
|
|
13248
13116
|
parent.updateToolbar(this.parent.element, 'path', 'pathQuickAccessToolbar');
|
|
13249
13117
|
}
|
|
@@ -13265,8 +13133,13 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
13265
13133
|
isSelected = true;
|
|
13266
13134
|
parent.notify('freehand-draw', { prop: 'selectFhd', value: { id: id } });
|
|
13267
13135
|
if (!isBlazor()) {
|
|
13136
|
+
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
|
|
13268
13137
|
parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
|
|
13269
13138
|
}
|
|
13139
|
+
else {
|
|
13140
|
+
parent.updateToolbar(parent.element, 'pen');
|
|
13141
|
+
parent.updateToolbar(parent.element, 'quickAccessToolbar', 'pen');
|
|
13142
|
+
}
|
|
13270
13143
|
}
|
|
13271
13144
|
else {
|
|
13272
13145
|
isSelected = false;
|
|
@@ -13482,6 +13355,73 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
13482
13355
|
}
|
|
13483
13356
|
}
|
|
13484
13357
|
};
|
|
13358
|
+
Shape.prototype.getSquarePointForRotatedShape = function (obj, object) {
|
|
13359
|
+
var point = { startX: 0, startY: 0, endX: 0, endY: 0, width: 0, height: 0 };
|
|
13360
|
+
var center = { x: obj.activePoint.startX + (obj.activePoint.width / 2), y: obj.activePoint.startY +
|
|
13361
|
+
(obj.activePoint.height / 2) };
|
|
13362
|
+
var p1 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.startX - center.x) - Math.sin(obj.rotatedAngle)
|
|
13363
|
+
* (obj.activePoint.startY - center.y) + center.x,
|
|
13364
|
+
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.startX - center.x) + Math.cos(obj.rotatedAngle) * (obj.activePoint.startY
|
|
13365
|
+
- center.y) + center.y };
|
|
13366
|
+
var p2 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.endX - center.x) - Math.sin(obj.rotatedAngle) *
|
|
13367
|
+
(obj.activePoint.startY - center.y) + center.x,
|
|
13368
|
+
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.endX - center.x) + Math.cos(obj.rotatedAngle) * (obj.activePoint.startY
|
|
13369
|
+
- center.y) + center.y };
|
|
13370
|
+
var p3 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.startX - center.x) - Math.sin(obj.rotatedAngle) *
|
|
13371
|
+
(obj.activePoint.endY - center.y) + center.x,
|
|
13372
|
+
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.startX - center.x) + Math.cos(obj.rotatedAngle) * (obj.activePoint.endY
|
|
13373
|
+
- center.y) + center.y };
|
|
13374
|
+
var p4 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.endX - center.x) - Math.sin(obj.rotatedAngle) *
|
|
13375
|
+
(obj.activePoint.endY - center.y) + center.x,
|
|
13376
|
+
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.endX - center.x) + Math.cos(obj.rotatedAngle) *
|
|
13377
|
+
(obj.activePoint.endY - center.y) + center.y };
|
|
13378
|
+
point.startX = p1.x;
|
|
13379
|
+
point.startY = p1.y;
|
|
13380
|
+
point.endX = p1.x;
|
|
13381
|
+
point.endY = p1.y;
|
|
13382
|
+
if (point.startX > p2.x) {
|
|
13383
|
+
point.startX = p2.x;
|
|
13384
|
+
}
|
|
13385
|
+
if (point.startX > p3.x) {
|
|
13386
|
+
point.startX = p3.x;
|
|
13387
|
+
}
|
|
13388
|
+
if (point.startX > p4.x) {
|
|
13389
|
+
point.startX = p4.x;
|
|
13390
|
+
}
|
|
13391
|
+
if (point.startY > p2.y) {
|
|
13392
|
+
point.startY = p2.y;
|
|
13393
|
+
}
|
|
13394
|
+
if (point.startY > p3.y) {
|
|
13395
|
+
point.startY = p3.y;
|
|
13396
|
+
}
|
|
13397
|
+
if (point.startY > p4.y) {
|
|
13398
|
+
point.startY = p4.y;
|
|
13399
|
+
}
|
|
13400
|
+
if (point.endX < p2.x) {
|
|
13401
|
+
point.endX = p2.x;
|
|
13402
|
+
}
|
|
13403
|
+
if (point.endX < p3.x) {
|
|
13404
|
+
point.endX = p3.x;
|
|
13405
|
+
}
|
|
13406
|
+
if (point.endX < p4.x) {
|
|
13407
|
+
point.endX = p4.x;
|
|
13408
|
+
}
|
|
13409
|
+
if (point.endY < p2.y) {
|
|
13410
|
+
point.endY = p2.y;
|
|
13411
|
+
}
|
|
13412
|
+
if (point.endY < p3.y) {
|
|
13413
|
+
point.endY = p3.y;
|
|
13414
|
+
}
|
|
13415
|
+
if (point.endY < p4.y) {
|
|
13416
|
+
point.endY = p4.y;
|
|
13417
|
+
}
|
|
13418
|
+
point.width = point.endX - point.startX;
|
|
13419
|
+
point.height = point.endY - point.startY;
|
|
13420
|
+
if (object) {
|
|
13421
|
+
object['activePoint'] = point;
|
|
13422
|
+
}
|
|
13423
|
+
return point;
|
|
13424
|
+
};
|
|
13485
13425
|
return Shape;
|
|
13486
13426
|
}());
|
|
13487
13427
|
|
|
@@ -13661,7 +13601,7 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
13661
13601
|
var parent = this.parent;
|
|
13662
13602
|
var transitionArgs = { cancel: false, previousDegree: parent.transform.degree,
|
|
13663
13603
|
currentDegree: Math.abs(parent.transform.degree + degree) === 360 ? 0 : parent.transform.degree + degree };
|
|
13664
|
-
if (!this.isPreventSelect && isBlazor() &&
|
|
13604
|
+
if (!this.isPreventSelect && isBlazor() && parent.events && parent.events.rotating.hasDelegate === true) {
|
|
13665
13605
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
13666
13606
|
parent.dotNetRef.invokeMethodAsync('RotateEventAsync', 'OnRotate', transitionArgs).then(function (args) {
|
|
13667
13607
|
_this.rotateEvent(args, degree);
|
|
@@ -13693,7 +13633,7 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
13693
13633
|
parent.afterCropActions.push(degree === 90 ? 'rotateRight' : 'rotateLeft');
|
|
13694
13634
|
var splitWords = [];
|
|
13695
13635
|
var activeObjShape = void 0;
|
|
13696
|
-
if (
|
|
13636
|
+
if (parent.activeObj.activePoint && parent.activeObj.shape) {
|
|
13697
13637
|
if (parent.activeObj.shape !== undefined) {
|
|
13698
13638
|
splitWords = parent.activeObj.shape.split('-');
|
|
13699
13639
|
}
|
|
@@ -13847,7 +13787,7 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
13847
13787
|
var parent = this.parent;
|
|
13848
13788
|
var transitionArgs = { direction: direction, cancel: false,
|
|
13849
13789
|
previousDirection: parent.toPascalCase(parent.transform.currFlipState) };
|
|
13850
|
-
if (!this.isPreventSelect && isBlazor() &&
|
|
13790
|
+
if (!this.isPreventSelect && isBlazor() && parent.events && parent.events.flipping.hasDelegate === true) {
|
|
13851
13791
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
13852
13792
|
parent.dotNetRef.invokeMethodAsync('FlipEventAsync', 'OnFlip', transitionArgs).then(function (args) {
|
|
13853
13793
|
_this.flipEvent(args, direction);
|
|
@@ -13985,7 +13925,7 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
13985
13925
|
parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
|
|
13986
13926
|
value: { context: this.lowerContext, isSave: null, isFlip: null } });
|
|
13987
13927
|
}
|
|
13988
|
-
if (
|
|
13928
|
+
if (activeObjShape) {
|
|
13989
13929
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
13990
13930
|
parent.activeObj = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
|
|
13991
13931
|
parent.objColl.pop();
|
|
@@ -14117,13 +14057,13 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
14117
14057
|
this.tempActiveObj = extend({}, parent.activeObj, {}, true);
|
|
14118
14058
|
parent.isCropTab = true;
|
|
14119
14059
|
}
|
|
14120
|
-
else if (
|
|
14060
|
+
else if (parent.activeObj.shape && splitWords[0] !== 'crop') {
|
|
14121
14061
|
this.isShape = true;
|
|
14122
14062
|
}
|
|
14123
14063
|
var obj = { zoomType: null };
|
|
14124
14064
|
parent.notify('selection', { prop: 'getZoomType', onPropertyChange: false, value: { obj: obj } });
|
|
14125
14065
|
if (isNullOrUndefined(zoomPoint)) {
|
|
14126
|
-
if (parent.isCropTab &&
|
|
14066
|
+
if (parent.isCropTab && this.tempActiveObj) {
|
|
14127
14067
|
zoomPoint = { x: parent.activeObj.activePoint.startX + (parent.activeObj.activePoint.width / 2),
|
|
14128
14068
|
y: parent.activeObj.activePoint.startY + (parent.activeObj.activePoint.height / 2) };
|
|
14129
14069
|
}
|
|
@@ -14137,7 +14077,7 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
14137
14077
|
var previousZoomFactor = parent.zoomSettings.zoomFactor - (zoomFactor * 10);
|
|
14138
14078
|
var zoomEventArgs = { zoomPoint: zoomPoint, cancel: false, previousZoomFactor: previousZoomFactor,
|
|
14139
14079
|
currentZoomFactor: parent.zoomSettings.zoomFactor, zoomTrigger: obj['zoomType'] };
|
|
14140
|
-
if (!parent.isCropToolbar && isBlazor() &&
|
|
14080
|
+
if (!parent.isCropToolbar && isBlazor() && parent.events && parent.events.zooming.hasDelegate === true) {
|
|
14141
14081
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
14142
14082
|
parent.dotNetRef.invokeMethodAsync('ZoomEventAsync', 'OnZoom', zoomEventArgs).then(function (args) {
|
|
14143
14083
|
_this.zoomEvent(args, zoomFactor);
|
|
@@ -14274,7 +14214,7 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
14274
14214
|
}
|
|
14275
14215
|
}
|
|
14276
14216
|
this.autoEnablePan();
|
|
14277
|
-
if (
|
|
14217
|
+
if (this.tempActiveObj) {
|
|
14278
14218
|
parent.activeObj = extend({}, this.tempActiveObj, {}, true);
|
|
14279
14219
|
}
|
|
14280
14220
|
if (parent.activeObj.shape === 'crop-custom') {
|
|
@@ -14581,7 +14521,7 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
14581
14521
|
var obj = { panDown: null };
|
|
14582
14522
|
parent.notify('selection', { prop: 'getPanDown', onPropertyChange: false, value: { obj: obj } });
|
|
14583
14523
|
var panEventArgs = { startPoint: obj['panDown'], endPoint: this.panMove, cancel: false };
|
|
14584
|
-
if (isBlazor() && isNullOrUndefined(this.parent.eventType) &&
|
|
14524
|
+
if (isBlazor() && isNullOrUndefined(this.parent.eventType) && parent.events && parent.events.onPanStart.hasDelegate === true) {
|
|
14585
14525
|
this.parent.eventType = 'pan';
|
|
14586
14526
|
this.parent.panEventArgs = panEventArgs;
|
|
14587
14527
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
@@ -14795,7 +14735,7 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
14795
14735
|
var tempDegree = parent.transform.degree;
|
|
14796
14736
|
var rotatePanActiveObj;
|
|
14797
14737
|
var object = { selPointColl: null };
|
|
14798
|
-
if (
|
|
14738
|
+
if (parent.activeObj.activePoint && parent.activeObj.shape) {
|
|
14799
14739
|
rotatePanActiveObj = extend({}, parent.activeObj, {}, true);
|
|
14800
14740
|
}
|
|
14801
14741
|
var tempObjColl = extend([], parent.objColl, [], true);
|
|
@@ -14866,7 +14806,7 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
14866
14806
|
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
14867
14807
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
14868
14808
|
parent.activeObj = extend({}, rotatePanActiveObj, {}, true);
|
|
14869
|
-
if (
|
|
14809
|
+
if (parent.activeObj.activePoint) {
|
|
14870
14810
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj, isCropRatio: null,
|
|
14871
14811
|
points: null, isPreventDrag: true, saveContext: null, isPreventSelection: null } });
|
|
14872
14812
|
}
|
|
@@ -15034,38 +14974,218 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
15034
14974
|
Transform.prototype.update = function () {
|
|
15035
14975
|
var parent = this.parent;
|
|
15036
14976
|
var toolbarHeight = 0;
|
|
14977
|
+
var isActiveObj = false;
|
|
14978
|
+
var freehandObj = { bool: false };
|
|
14979
|
+
if (parent.isImageLoaded) {
|
|
14980
|
+
if ((parent.element.querySelector('#' + parent.element.id + '_contextualToolbar') &&
|
|
14981
|
+
!parent.element.querySelector('#' + parent.element.id + '_contextualToolbar').parentElement.classList.contains('e-hide')) ||
|
|
14982
|
+
(parent.element.querySelector('#' + parent.element.id + '_headWrapper')
|
|
14983
|
+
&& !parent.element.querySelector('#' + parent.element.id + '_headWrapper').parentElement.classList.contains('e-hide'))) {
|
|
14984
|
+
parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
14985
|
+
parent.okBtn();
|
|
14986
|
+
if (!isBlazor()) {
|
|
14987
|
+
parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
|
|
14988
|
+
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
14989
|
+
}
|
|
14990
|
+
else {
|
|
14991
|
+
parent.updateToolbar(parent.element, 'imageLoaded');
|
|
14992
|
+
}
|
|
14993
|
+
}
|
|
14994
|
+
parent.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: freehandObj } });
|
|
14995
|
+
if (freehandObj['bool']) {
|
|
14996
|
+
if (!isBlazor()) {
|
|
14997
|
+
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
14998
|
+
}
|
|
14999
|
+
else {
|
|
15000
|
+
parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
|
|
15001
|
+
}
|
|
15002
|
+
}
|
|
15003
|
+
if (parent.activeObj.shape !== undefined) {
|
|
15004
|
+
isActiveObj = true;
|
|
15005
|
+
if (parent.textArea.style.display === 'block') {
|
|
15006
|
+
parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
|
|
15007
|
+
value: { x: null, y: null, isMouseDown: null } });
|
|
15008
|
+
if (!isBlazor()) {
|
|
15009
|
+
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
15010
|
+
}
|
|
15011
|
+
else {
|
|
15012
|
+
parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
|
|
15013
|
+
}
|
|
15014
|
+
}
|
|
15015
|
+
else {
|
|
15016
|
+
parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
|
|
15017
|
+
parent.objColl.push(parent.activeObj);
|
|
15018
|
+
}
|
|
15019
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
15020
|
+
}
|
|
15021
|
+
}
|
|
15022
|
+
var tempFilter = this.lowerContext.filter;
|
|
15037
15023
|
var canvasWrapper = document.querySelector('#' + parent.element.id + '_canvasWrapper');
|
|
15038
|
-
if (
|
|
15024
|
+
if (canvasWrapper) {
|
|
15039
15025
|
canvasWrapper.style.width = parent.element.offsetWidth - 2 + 'px';
|
|
15040
15026
|
}
|
|
15041
15027
|
parent.lowerCanvas.width = parent.upperCanvas.width = parent.element.offsetWidth - 2;
|
|
15042
|
-
if (
|
|
15043
|
-
parent.
|
|
15028
|
+
if (parent.toolbarTemplate) {
|
|
15029
|
+
toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
|
|
15044
15030
|
}
|
|
15045
15031
|
else if (parent.element.querySelector('#' + parent.element.id + '_toolbar')) {
|
|
15046
15032
|
toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbar').clientHeight;
|
|
15047
|
-
parent.notify('toolbar', { prop: 'setToolbarHeight', value: { height: toolbarHeight } });
|
|
15048
15033
|
}
|
|
15034
|
+
parent.notify('toolbar', { prop: 'setToolbarHeight', value: { height: toolbarHeight } });
|
|
15049
15035
|
if (Browser.isDevice) {
|
|
15050
|
-
if (
|
|
15036
|
+
if (canvasWrapper) {
|
|
15051
15037
|
canvasWrapper.style.height = parent.element.offsetHeight - (2 * toolbarHeight) - 5 + 'px';
|
|
15052
15038
|
}
|
|
15053
|
-
parent.lowerCanvas.height = parent.upperCanvas.height = parent.element.offsetHeight - (2 * toolbarHeight) - 5;
|
|
15054
|
-
}
|
|
15055
|
-
else {
|
|
15056
|
-
if (
|
|
15057
|
-
canvasWrapper.style.height = parent.element.offsetHeight - toolbarHeight - 3 + 'px';
|
|
15039
|
+
parent.lowerCanvas.height = parent.upperCanvas.height = parent.element.offsetHeight - (2 * toolbarHeight) - 5;
|
|
15040
|
+
}
|
|
15041
|
+
else {
|
|
15042
|
+
if (canvasWrapper) {
|
|
15043
|
+
canvasWrapper.style.height = parent.element.offsetHeight - toolbarHeight - 3 + 'px';
|
|
15044
|
+
}
|
|
15045
|
+
parent.lowerCanvas.height = parent.upperCanvas.height = parent.element.offsetHeight - toolbarHeight - 3;
|
|
15046
|
+
}
|
|
15047
|
+
this.lowerContext.filter =
|
|
15048
|
+
'brightness(' + 1 + ') ' + 'contrast(' + 100 + '%) ' + 'hue-rotate(' + 0 + 'deg) ' +
|
|
15049
|
+
'saturate(' + 100 + '%) ' + 'opacity(' + 1 + ') ' + 'blur(' + 0 + 'px) ' + 'sepia(0%) ' + 'grayscale(0%) ' + 'invert(0%)';
|
|
15050
|
+
parent.notify('filter', { prop: 'setAdjustmentValue', onPropertyChange: false, value: { adjustmentValue: this.lowerContext.filter } });
|
|
15051
|
+
parent.canvasFilter = this.lowerContext.filter;
|
|
15052
|
+
this.parent.initialAdjustmentValue = this.lowerContext.filter;
|
|
15053
|
+
parent.clearContext(this.lowerContext);
|
|
15054
|
+
this.parent.clearContext(this.upperContext);
|
|
15055
|
+
if (parent.isImageLoaded) {
|
|
15056
|
+
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: null } });
|
|
15057
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
15058
|
+
this.lowerContext.filter = tempFilter;
|
|
15059
|
+
parent.initialAdjustmentValue = tempFilter;
|
|
15060
|
+
if (parent.isImageLoaded) {
|
|
15061
|
+
showSpinner(parent.element);
|
|
15062
|
+
parent.element.style.opacity = '0.5';
|
|
15063
|
+
}
|
|
15064
|
+
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
15065
|
+
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
15066
|
+
if (canvasWrapper) {
|
|
15067
|
+
canvasWrapper.style.width = parent.element.offsetWidth - 2 + 'px';
|
|
15068
|
+
canvasWrapper.style.height = parent.element.offsetHeight + 'px';
|
|
15069
|
+
var obj_1 = { toolbarHeight: !isBlazor() ? 0 : parent.toolbarHeight };
|
|
15070
|
+
if (!isBlazor()) {
|
|
15071
|
+
parent.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: obj_1 } });
|
|
15072
|
+
}
|
|
15073
|
+
if (Browser.isDevice) {
|
|
15074
|
+
canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - (2 * obj_1['toolbarHeight'])) - 3 + 'px';
|
|
15075
|
+
}
|
|
15076
|
+
else {
|
|
15077
|
+
canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - obj_1['toolbarHeight']) - 3 + 'px';
|
|
15078
|
+
}
|
|
15079
|
+
}
|
|
15080
|
+
var obj = { width: 0, height: 0 };
|
|
15081
|
+
parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
|
|
15082
|
+
value: { width: parent.img.srcWidth, height: parent.img.srcHeight, obj: obj } });
|
|
15083
|
+
var maxDimension = obj;
|
|
15084
|
+
if (parent.transform.defaultZoomFactor > 0) {
|
|
15085
|
+
maxDimension.width += (maxDimension.width * parent.transform.defaultZoomFactor);
|
|
15086
|
+
maxDimension.height += (maxDimension.height * parent.transform.defaultZoomFactor);
|
|
15087
|
+
}
|
|
15088
|
+
parent.img.destLeft = (parent.lowerCanvas.clientWidth - maxDimension.width) / 2;
|
|
15089
|
+
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height) / 2;
|
|
15090
|
+
if (parent.transform.degree === 0 && parent.transform.currFlipState === '') {
|
|
15091
|
+
if (parent.transform.defaultZoomFactor > 0) {
|
|
15092
|
+
parent.img.destLeft += parent.panPoint.totalPannedPoint.x;
|
|
15093
|
+
parent.img.destTop += parent.panPoint.totalPannedPoint.y;
|
|
15094
|
+
}
|
|
15095
|
+
parent.notify('draw', { prop: 'draw-image-to-canvas', value: { dimension: maxDimension } });
|
|
15096
|
+
}
|
|
15097
|
+
else {
|
|
15098
|
+
parent.notify('draw', { prop: 'draw-image-to-canvas', value: { dimension: maxDimension } });
|
|
15099
|
+
parent.notify('draw', { prop: 'updateCurrTransState', onPropertyChange: false,
|
|
15100
|
+
value: { type: 'initial', isPreventDestination: null, isRotatePan: null } });
|
|
15101
|
+
var temp = this.lowerContext.filter;
|
|
15102
|
+
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
15103
|
+
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);
|
|
15104
|
+
this.lowerContext.filter = temp;
|
|
15105
|
+
parent.notify('draw', { prop: 'updateCurrTransState', onPropertyChange: false,
|
|
15106
|
+
value: { type: 'reverse', isPreventDestination: null, isRotatePan: null } });
|
|
15107
|
+
}
|
|
15108
|
+
parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
15109
|
+
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
15110
|
+
if (parent.isCircleCrop) {
|
|
15111
|
+
parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
|
|
15112
|
+
value: { context: this.lowerContext, isSave: null, isFlip: null } });
|
|
15113
|
+
}
|
|
15114
|
+
hideSpinner(parent.element);
|
|
15115
|
+
parent.element.style.opacity = '1';
|
|
15116
|
+
var obj1 = { defToolbarItems: null };
|
|
15117
|
+
if (!isBlazor()) {
|
|
15118
|
+
parent.notify('toolbar', { prop: 'getDefToolbarItems', value: { obj: obj1 } });
|
|
15119
|
+
if (obj1['defToolbarItems'] && obj1['defToolbarItems'].length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
15120
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
15121
|
+
var toolbar_1 = getComponent(parent.element.id + '_toolbar', 'toolbar');
|
|
15122
|
+
toolbar_1.refreshOverflow();
|
|
15123
|
+
if (parent.element.querySelector('.e-contextual-toolbar-wrapper')) {
|
|
15124
|
+
parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
15125
|
+
}
|
|
15126
|
+
}
|
|
15127
|
+
}
|
|
15128
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
15129
|
+
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
15130
|
+
if (isActiveObj) {
|
|
15131
|
+
parent.activeObj = extend({}, parent.objColl[parent.objColl.length - 1], null, true);
|
|
15132
|
+
parent.objColl.pop();
|
|
15133
|
+
if (parent.activeObj.activePoint.width !== 0 && parent.activeObj.activePoint.height !== 0) {
|
|
15134
|
+
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj } });
|
|
15135
|
+
if (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse' || parent.activeObj.shape === 'text' ||
|
|
15136
|
+
parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path') {
|
|
15137
|
+
if (!isBlazor()) {
|
|
15138
|
+
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
15139
|
+
}
|
|
15140
|
+
else {
|
|
15141
|
+
parent.updateToolbar(parent.element, 'quickAccessToolbar', parent.activeObj.shape);
|
|
15142
|
+
}
|
|
15143
|
+
}
|
|
15144
|
+
}
|
|
15145
|
+
}
|
|
15146
|
+
if (freehandObj['bool']) {
|
|
15147
|
+
if (!isBlazor()) {
|
|
15148
|
+
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
|
|
15149
|
+
}
|
|
15150
|
+
else {
|
|
15151
|
+
parent.updateToolbar(parent.element, 'quickAccessToolbar', 'pen');
|
|
15152
|
+
}
|
|
15153
|
+
}
|
|
15154
|
+
if ((parent.transform.degree !== 0 || parent.transform.currFlipState !== '') && parent.transform.defaultZoomFactor > 0) {
|
|
15155
|
+
var totalPannedPoint = extend({}, parent.panPoint.totalPannedPoint, null, true);
|
|
15156
|
+
var totalPannedInternalPoint = extend({}, parent.panPoint.totalPannedInternalPoint, null, true);
|
|
15157
|
+
var totalPannedClientPoint = extend({}, parent.panPoint.totalPannedClientPoint, null, true);
|
|
15158
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
15159
|
+
value: { zoomFactor: .1, zoomPoint: null } });
|
|
15160
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
15161
|
+
value: { zoomFactor: -.1, zoomPoint: null } });
|
|
15162
|
+
if (parent.transform.degree === 0) {
|
|
15163
|
+
parent.img.destLeft += totalPannedPoint.x;
|
|
15164
|
+
parent.img.destTop += totalPannedPoint.y;
|
|
15165
|
+
parent.panPoint.totalPannedPoint = totalPannedPoint;
|
|
15166
|
+
parent.notify('draw', { prop: 'updateFlipPan', value: { tempSelectionObj: null } });
|
|
15167
|
+
}
|
|
15168
|
+
else {
|
|
15169
|
+
parent.panPoint.totalPannedInternalPoint = totalPannedInternalPoint;
|
|
15170
|
+
parent.panPoint.totalPannedClientPoint = totalPannedClientPoint;
|
|
15171
|
+
parent.panPoint.currentPannedPoint = { x: 0, y: 0 };
|
|
15172
|
+
parent.isCropTab = true;
|
|
15173
|
+
parent.notify('transform', { prop: 'rotatePan', onPropertyChange: false,
|
|
15174
|
+
value: { isCropSelection: null, isDefaultZoom: null } });
|
|
15175
|
+
parent.isCropTab = false;
|
|
15176
|
+
}
|
|
15177
|
+
}
|
|
15178
|
+
else if (parent.transform.degree !== 0 && parent.transform.cropZoomFactor > 0) {
|
|
15179
|
+
parent.transform.zoomFactor = 0;
|
|
15180
|
+
parent.transform.cropZoomFactor = null;
|
|
15181
|
+
if (!isBlazor()) {
|
|
15182
|
+
parent.notify('toolbar', { prop: 'enable-disable-btns', onPropertyChange: false });
|
|
15183
|
+
}
|
|
15184
|
+
else {
|
|
15185
|
+
parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
|
|
15186
|
+
}
|
|
15058
15187
|
}
|
|
15059
|
-
parent.lowerCanvas.height = parent.upperCanvas.height = parent.element.offsetHeight - toolbarHeight - 3;
|
|
15060
15188
|
}
|
|
15061
|
-
this.lowerContext.filter =
|
|
15062
|
-
'brightness(' + 1 + ') ' + 'contrast(' + 100 + '%) ' + 'hue-rotate(' + 0 + 'deg) ' +
|
|
15063
|
-
'saturate(' + 100 + '%) ' + 'opacity(' + 1 + ') ' + 'blur(' + 0 + 'px) ' + 'sepia(0%) ' + 'grayscale(0%) ' + 'invert(0%)';
|
|
15064
|
-
parent.notify('filter', { prop: 'setAdjustmentValue', onPropertyChange: false, value: { adjustmentValue: this.lowerContext.filter } });
|
|
15065
|
-
this.parent.canvasFilter = this.lowerContext.filter;
|
|
15066
|
-
this.parent.initialAdjustmentValue = this.lowerContext.filter;
|
|
15067
|
-
this.parent.clearContext(this.lowerContext);
|
|
15068
|
-
this.parent.clearContext(this.upperContext);
|
|
15069
15189
|
};
|
|
15070
15190
|
Transform.prototype.calcMaxDimension = function (width, height, obj) {
|
|
15071
15191
|
var object = { toolbarHeight: 0 };
|
|
@@ -15096,7 +15216,15 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
15096
15216
|
cssMaxWidth = width * heightScale;
|
|
15097
15217
|
cssMaxHeight = height * heightScale;
|
|
15098
15218
|
}
|
|
15099
|
-
|
|
15219
|
+
var cropObj = { bool: null };
|
|
15220
|
+
this.parent.notify('crop', { prop: 'getPreventScaling', onPropertyChange: false,
|
|
15221
|
+
value: { obj: cropObj } });
|
|
15222
|
+
if (cropObj['bool'] && this.parent.cropObj.activeObj.activePoint &&
|
|
15223
|
+
this.parent.cropObj.activeObj.activePoint.width !== 0 && this.parent.cropObj.activeObj.activePoint.height !== 0) {
|
|
15224
|
+
cssMaxWidth = this.parent.cropObj.activeObj.activePoint.width;
|
|
15225
|
+
cssMaxHeight = this.parent.cropObj.activeObj.activePoint.height;
|
|
15226
|
+
}
|
|
15227
|
+
if (obj) {
|
|
15100
15228
|
obj['width'] = cssMaxWidth;
|
|
15101
15229
|
obj['height'] = cssMaxHeight;
|
|
15102
15230
|
}
|
|
@@ -15144,7 +15272,7 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
15144
15272
|
}
|
|
15145
15273
|
this.limitPan();
|
|
15146
15274
|
parent.activeObj = tempActObj;
|
|
15147
|
-
if (
|
|
15275
|
+
if (obj) {
|
|
15148
15276
|
obj['x'] = parent.img.destLeft - tempDestLeft;
|
|
15149
15277
|
obj['y'] = parent.img.destTop - tempDestTop;
|
|
15150
15278
|
}
|
|
@@ -15178,10 +15306,10 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
|
|
|
15178
15306
|
this.parent.off('destroyed', this.destroy);
|
|
15179
15307
|
};
|
|
15180
15308
|
UndoRedo.prototype.initializeUrPvtProp = function () {
|
|
15181
|
-
if (
|
|
15309
|
+
if (this.parent.lowerCanvas) {
|
|
15182
15310
|
this.lowerContext = this.parent.lowerCanvas.getContext('2d');
|
|
15183
15311
|
}
|
|
15184
|
-
if (
|
|
15312
|
+
if (this.parent.upperCanvas) {
|
|
15185
15313
|
this.upperContext = this.parent.upperCanvas.getContext('2d');
|
|
15186
15314
|
}
|
|
15187
15315
|
};
|
|
@@ -15401,7 +15529,7 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
|
|
|
15401
15529
|
if (!parent.disabled && parent.isImageLoaded) {
|
|
15402
15530
|
if (this.undoRedoStep > 0) {
|
|
15403
15531
|
this.refreshToolbarActions();
|
|
15404
|
-
if (
|
|
15532
|
+
if (parent.activeObj.activePoint && parent.activeObj.activePoint.width !== 0) {
|
|
15405
15533
|
this.tempActObj = parent.activeObj;
|
|
15406
15534
|
}
|
|
15407
15535
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
@@ -15573,10 +15701,10 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
|
|
|
15573
15701
|
if (obj.operation === 'crop' && !obj.isCircleCrop) {
|
|
15574
15702
|
parent.isCircleCrop = false;
|
|
15575
15703
|
}
|
|
15576
|
-
if (obj.operation === 'crop' &&
|
|
15704
|
+
if (obj.operation === 'crop' && obj.currentObj.currSelectionPoint) {
|
|
15577
15705
|
parent.currSelectionPoint = extend({}, obj.currentObj.currSelectionPoint, {}, true);
|
|
15578
15706
|
}
|
|
15579
|
-
if (
|
|
15707
|
+
if (parent.currSelectionPoint && isNullOrUndefined(parent.currSelectionPoint.shape)) {
|
|
15580
15708
|
parent.currSelectionPoint = null;
|
|
15581
15709
|
}
|
|
15582
15710
|
this.endUndoRedo(obj.operation, false);
|
|
@@ -16254,7 +16382,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
16254
16382
|
break;
|
|
16255
16383
|
case 'theme':
|
|
16256
16384
|
if (newProperties.theme) {
|
|
16257
|
-
if (
|
|
16385
|
+
if (this.theme && this.theme !== '') {
|
|
16258
16386
|
this.theme = this.toPascalCase(this.theme);
|
|
16259
16387
|
}
|
|
16260
16388
|
else {
|
|
@@ -16316,7 +16444,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
16316
16444
|
case 'selectionSettings':
|
|
16317
16445
|
if (newProperties.selectionSettings) {
|
|
16318
16446
|
this.selectionSettings = newProperties.selectionSettings;
|
|
16319
|
-
if (
|
|
16447
|
+
if (this.activeObj.shape) {
|
|
16320
16448
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
16321
16449
|
this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: this.activeObj } });
|
|
16322
16450
|
}
|
|
@@ -16336,9 +16464,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
16336
16464
|
this.element.removeAttribute('class');
|
|
16337
16465
|
}
|
|
16338
16466
|
if (!isBlazor()) {
|
|
16339
|
-
this.notify('toolbar', {
|
|
16340
|
-
prop: 'destroySubComponents', onPropertyChange: false
|
|
16341
|
-
});
|
|
16467
|
+
this.notify('toolbar', { prop: 'destroySubComponents', onPropertyChange: false });
|
|
16342
16468
|
this.notify('destroyed', null);
|
|
16343
16469
|
_super.prototype.destroy.call(this);
|
|
16344
16470
|
}
|
|
@@ -16349,7 +16475,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
16349
16475
|
this.element.innerHTML = '';
|
|
16350
16476
|
};
|
|
16351
16477
|
ImageEditor.prototype.initialize = function () {
|
|
16352
|
-
if (
|
|
16478
|
+
if (this.toolbarTemplate) {
|
|
16353
16479
|
this.element.appendChild(this.createElement('div', {
|
|
16354
16480
|
id: this.element.id + '_toolbarArea', className: 'e-toolbar-area'
|
|
16355
16481
|
}));
|
|
@@ -16368,13 +16494,13 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
16368
16494
|
var quickAccessToolbar = document.getElementById(this.element.id + '_quickAccessToolbarArea');
|
|
16369
16495
|
quickAccessToolbar.style.position = 'absolute';
|
|
16370
16496
|
quickAccessToolbar.style.display = 'none';
|
|
16371
|
-
if (
|
|
16497
|
+
if (this.activeObj) {
|
|
16372
16498
|
quickAccessToolbar.style.left = this.activeObj.activePoint.startX + 'px';
|
|
16373
16499
|
quickAccessToolbar.style.top = this.activeObj.activePoint.startY + 'px';
|
|
16374
16500
|
}
|
|
16375
16501
|
quickAccessToolbar.style.width = '100%';
|
|
16376
16502
|
}
|
|
16377
|
-
if (
|
|
16503
|
+
if (this.quickAccessToolbarTemplate) {
|
|
16378
16504
|
this.quickAccessToolbarTemplateFn();
|
|
16379
16505
|
}
|
|
16380
16506
|
else {
|
|
@@ -16530,7 +16656,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
16530
16656
|
this.notify('selection', { prop: 'handleScroll', onPropertyChange: false, value: { e: e } });
|
|
16531
16657
|
};
|
|
16532
16658
|
ImageEditor.prototype.adjustToScreen = function () {
|
|
16533
|
-
this.
|
|
16659
|
+
this.update();
|
|
16534
16660
|
};
|
|
16535
16661
|
ImageEditor.prototype.screenOrientation = function () {
|
|
16536
16662
|
if (Browser.isDevice) {
|
|
@@ -16687,10 +16813,10 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
16687
16813
|
this.currentFilter = '';
|
|
16688
16814
|
var obj_1 = { initialZoomValue: false };
|
|
16689
16815
|
this.notify('draw', { prop: 'getInitialZoomValue', onPropertyChange: false, value: { obj: obj_1 } });
|
|
16690
|
-
if (
|
|
16816
|
+
if (obj_1['initialZoomValue']) {
|
|
16691
16817
|
this.setProperties({ zoomSettings: { zoomFactor: obj_1['initialZoomValue'] } }, true);
|
|
16692
16818
|
}
|
|
16693
|
-
if (
|
|
16819
|
+
if (document.getElementById(this.element.id + '_quickAccessToolbarArea')) {
|
|
16694
16820
|
document.getElementById(this.element.id + '_quickAccessToolbarArea').style.display = 'none';
|
|
16695
16821
|
}
|
|
16696
16822
|
this.notifyResetForAllModules();
|
|
@@ -16699,7 +16825,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
16699
16825
|
this.notify('draw', { prop: 'update-canvas', onPropertyChange: false });
|
|
16700
16826
|
this.isImageLoaded = true;
|
|
16701
16827
|
if (!isBlazor()) {
|
|
16702
|
-
if (
|
|
16828
|
+
if (this.element.querySelector('.e-contextual-toolbar-wrapper')) {
|
|
16703
16829
|
this.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
16704
16830
|
}
|
|
16705
16831
|
this.notify('toolbar', { prop: 'refresh-dropdown-btn', value: { isDisabled: false } });
|
|
@@ -16835,7 +16961,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
16835
16961
|
ImageEditor.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor) {
|
|
16836
16962
|
var isEllipse = false;
|
|
16837
16963
|
var isPointsInRange = this.allowShape(x, y);
|
|
16838
|
-
if (!this.disabled && this.isImageLoaded && isPointsInRange) {
|
|
16964
|
+
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
16839
16965
|
isEllipse = true;
|
|
16840
16966
|
this.notify('shape', { prop: 'drawEllipse', onPropertyChange: false, value: { x: x, y: y, radiusX: radiusX, radiusY: radiusY,
|
|
16841
16967
|
strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor } });
|
|
@@ -16856,7 +16982,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
16856
16982
|
ImageEditor.prototype.drawLine = function (startX, startY, endX, endY, strokeWidth, strokeColor) {
|
|
16857
16983
|
var isLine = false;
|
|
16858
16984
|
var isPointsInRange = this.allowShape(startX, startY);
|
|
16859
|
-
if (!this.disabled && this.isImageLoaded && isPointsInRange) {
|
|
16985
|
+
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(startX) && isNullOrUndefined(startY)))) {
|
|
16860
16986
|
isLine = true;
|
|
16861
16987
|
this.notify('shape', { prop: 'drawLine', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
|
|
16862
16988
|
endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor } });
|
|
@@ -16874,14 +17000,12 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
16874
17000
|
* @param {string} strokeColor - Specifies the stroke color of arrow.
|
|
16875
17001
|
* @param {ArrowheadType} arrowStart – Specifies the type of arrowhead for start position. The default value is ‘None’.
|
|
16876
17002
|
* @param {ArrowheadType} arrowEnd – Specifies the type of arrowhead for end position. The default value is ‘SolidArrow’.
|
|
16877
|
-
|
|
16878
17003
|
* @returns {boolean}.
|
|
16879
|
-
* @private
|
|
16880
17004
|
*/
|
|
16881
17005
|
ImageEditor.prototype.drawArrow = function (startX, startY, endX, endY, strokeWidth, strokeColor, arrowStart, arrowEnd) {
|
|
16882
17006
|
var isArrow = false;
|
|
16883
17007
|
var isPointsInRange = this.allowShape(startX, startY);
|
|
16884
|
-
if (!this.disabled && this.isImageLoaded && isPointsInRange) {
|
|
17008
|
+
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(startX) && isNullOrUndefined(startY)))) {
|
|
16885
17009
|
isArrow = true;
|
|
16886
17010
|
this.notify('shape', { prop: 'drawArrow', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
|
|
16887
17011
|
endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, arrowStart: arrowStart, arrowEnd: arrowEnd } });
|
|
@@ -16900,7 +17024,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
16900
17024
|
this.isPublicMethod = true;
|
|
16901
17025
|
var obj = { inRange: false };
|
|
16902
17026
|
var isPath = false;
|
|
16903
|
-
if (pointColl.length > 0) {
|
|
17027
|
+
if (pointColl && pointColl.length > 0) {
|
|
16904
17028
|
for (var i = 0; i < pointColl.length; i++) {
|
|
16905
17029
|
if (obj['inRange']) {
|
|
16906
17030
|
break;
|
|
@@ -16909,7 +17033,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
16909
17033
|
value: { x: pointColl[i].x, y: pointColl[i].y, obj: obj } });
|
|
16910
17034
|
}
|
|
16911
17035
|
}
|
|
16912
|
-
if (!this.disabled && this.isImageLoaded && obj['inRange']) {
|
|
17036
|
+
if (!this.disabled && this.isImageLoaded && (obj['inRange'] || isNullOrUndefined(pointColl))) {
|
|
16913
17037
|
isPath = true;
|
|
16914
17038
|
this.notify('shape', { prop: 'drawPath', onPropertyChange: false, value: { pointColl: pointColl,
|
|
16915
17039
|
strokeWidth: strokeWidth, strokeColor: strokeColor } });
|
|
@@ -16931,7 +17055,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
16931
17055
|
ImageEditor.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor) {
|
|
16932
17056
|
var isRectangle = false;
|
|
16933
17057
|
var isPointsInRange = this.allowShape(x, y);
|
|
16934
|
-
if (!this.disabled && this.isImageLoaded && isPointsInRange) {
|
|
17058
|
+
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
16935
17059
|
isRectangle = true;
|
|
16936
17060
|
this.notify('shape', { prop: 'drawRectangle', onPropertyChange: false, value: { x: x, y: y, width: width, height: height,
|
|
16937
17061
|
strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor } });
|
|
@@ -16957,7 +17081,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
16957
17081
|
ImageEditor.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color) {
|
|
16958
17082
|
var isText = false;
|
|
16959
17083
|
var isPointsInRange = this.allowShape(x, y);
|
|
16960
|
-
if (!this.disabled && this.isImageLoaded && isPointsInRange) {
|
|
17084
|
+
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
16961
17085
|
isText = true;
|
|
16962
17086
|
this.notify('shape', { prop: 'drawText', onPropertyChange: false, value: { x: x, y: y, text: text, fontFamily: fontFamily,
|
|
16963
17087
|
fontSize: fontSize, bold: bold, italic: italic, color: color } });
|
|
@@ -17109,6 +17233,8 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
17109
17233
|
template = this.toolbarFn({ type: 'toolbar' }, this, 'Template', templateID)[0];
|
|
17110
17234
|
}
|
|
17111
17235
|
toolbarArea.appendChild(template);
|
|
17236
|
+
this.toolbarHeight = toolbarArea.clientHeight;
|
|
17237
|
+
this.notify('toolbar', { prop: 'setToolbarHeight', value: { height: this.toolbarHeight } });
|
|
17112
17238
|
this['renderReactTemplates']();
|
|
17113
17239
|
}
|
|
17114
17240
|
};
|
|
@@ -17176,7 +17302,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
17176
17302
|
var isUndoRedo = this.isUndoRedo;
|
|
17177
17303
|
this.isCropTab = false;
|
|
17178
17304
|
this.isUndoRedo = true;
|
|
17179
|
-
if (
|
|
17305
|
+
if (this.transform.cropZoomFactor && this.transform.cropZoomFactor > 0) {
|
|
17180
17306
|
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
17181
17307
|
value: { zoomFactor: -this.transform.cropZoomFactor, zoomPoint: null } });
|
|
17182
17308
|
}
|
|
@@ -17193,120 +17319,6 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
17193
17319
|
this.isCropTab = true;
|
|
17194
17320
|
this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: this.activeObj } });
|
|
17195
17321
|
};
|
|
17196
|
-
ImageEditor.prototype.moveToSelectionRange = function (type, activeObj) {
|
|
17197
|
-
if (!isNullOrUndefined(this.activeObj.shape)) {
|
|
17198
|
-
if (type === 'rotateleft' || type === 'rotateright') {
|
|
17199
|
-
var zoomFactor = this.transform.zoomFactor;
|
|
17200
|
-
this.objColl.push(this.activeObj);
|
|
17201
|
-
this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
17202
|
-
if (this.transform.degree % 90 === 0 && this.transform.degree % 180 !== 0) {
|
|
17203
|
-
if (this.objColl[this.objColl.length - 1].activePoint.width < activeObj.activePoint.height) {
|
|
17204
|
-
for (var i = 2; i < this.zoomSettings.maxZoomFactor; i++) {
|
|
17205
|
-
if (this.objColl[this.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
|
|
17206
|
-
this.isSelectionBiggerThanCanvas(this.objColl[this.objColl.length - 1]) ||
|
|
17207
|
-
this.isSelectionOutsideCanvas(this.objColl[this.objColl.length - 1])) {
|
|
17208
|
-
if (!isNullOrUndefined(zoomFactor)) {
|
|
17209
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
17210
|
-
value: { zoomFactor: -0.1, zoomPoint: null } });
|
|
17211
|
-
}
|
|
17212
|
-
break;
|
|
17213
|
-
}
|
|
17214
|
-
zoomFactor += .1;
|
|
17215
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
17216
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
17217
|
-
}
|
|
17218
|
-
}
|
|
17219
|
-
else {
|
|
17220
|
-
for (var i = 2; i < this.zoomSettings.maxZoomFactor; i++) {
|
|
17221
|
-
if (this.objColl[this.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
|
|
17222
|
-
this.isSelectionBiggerThanCanvas(this.objColl[this.objColl.length - 1]) ||
|
|
17223
|
-
this.isSelectionOutsideCanvas(this.objColl[this.objColl.length - 1])) {
|
|
17224
|
-
if (!isNullOrUndefined(zoomFactor)) {
|
|
17225
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
17226
|
-
value: { zoomFactor: 0.1, zoomPoint: null } });
|
|
17227
|
-
}
|
|
17228
|
-
break;
|
|
17229
|
-
}
|
|
17230
|
-
zoomFactor -= .1;
|
|
17231
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
17232
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
17233
|
-
}
|
|
17234
|
-
}
|
|
17235
|
-
}
|
|
17236
|
-
else {
|
|
17237
|
-
if (this.objColl[this.objColl.length - 1].activePoint.height < activeObj.activePoint.width) {
|
|
17238
|
-
for (var i = 2; i < this.zoomSettings.maxZoomFactor; i++) {
|
|
17239
|
-
if (this.objColl[this.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
|
|
17240
|
-
this.isSelectionBiggerThanCanvas(this.objColl[this.objColl.length - 1]) ||
|
|
17241
|
-
this.isSelectionOutsideCanvas(this.objColl[this.objColl.length - 1])) {
|
|
17242
|
-
if (!isNullOrUndefined(zoomFactor)) {
|
|
17243
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
17244
|
-
value: { zoomFactor: -0.1, zoomPoint: null } });
|
|
17245
|
-
}
|
|
17246
|
-
break;
|
|
17247
|
-
}
|
|
17248
|
-
zoomFactor += .1;
|
|
17249
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
17250
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
17251
|
-
}
|
|
17252
|
-
}
|
|
17253
|
-
else {
|
|
17254
|
-
for (var i = 2; i < this.zoomSettings.maxZoomFactor; i++) {
|
|
17255
|
-
if (this.objColl[this.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
|
|
17256
|
-
this.isSelectionBiggerThanCanvas(this.objColl[this.objColl.length - 1]) ||
|
|
17257
|
-
this.isSelectionOutsideCanvas(this.objColl[this.objColl.length - 1])) {
|
|
17258
|
-
if (!isNullOrUndefined(zoomFactor)) {
|
|
17259
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
17260
|
-
value: { zoomFactor: 0.1, zoomPoint: null } });
|
|
17261
|
-
}
|
|
17262
|
-
break;
|
|
17263
|
-
}
|
|
17264
|
-
zoomFactor -= .1;
|
|
17265
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
17266
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
17267
|
-
}
|
|
17268
|
-
}
|
|
17269
|
-
}
|
|
17270
|
-
var panX = (this.lowerCanvas.clientWidth / 2) - (this.objColl[this.objColl.length - 1].activePoint.startX +
|
|
17271
|
-
(this.objColl[this.objColl.length - 1].activePoint.width / 2));
|
|
17272
|
-
var panY = (this.lowerCanvas.clientHeight / 2) - (this.objColl[this.objColl.length - 1].activePoint.startY +
|
|
17273
|
-
(this.objColl[this.objColl.length - 1].activePoint.height / 2));
|
|
17274
|
-
if (this.transform.degree === 0) {
|
|
17275
|
-
this.img.destLeft += panX;
|
|
17276
|
-
this.img.destTop += panY;
|
|
17277
|
-
this.notify('transform', { prop: 'drawPannImage', value: { point: { x: panX, y: panY } } });
|
|
17278
|
-
}
|
|
17279
|
-
else {
|
|
17280
|
-
this.panPoint.currentPannedPoint = { x: panX, y: panY };
|
|
17281
|
-
this.notify('transform', { prop: 'drawPannedImage', value: { xDiff: panX, yDiff: panY } });
|
|
17282
|
-
this.panPoint.currentPannedPoint = { x: 0, y: 0 };
|
|
17283
|
-
}
|
|
17284
|
-
this.notify('transform', { prop: 'setTempPanMove', onPropertyChange: false,
|
|
17285
|
-
value: { point: null } });
|
|
17286
|
-
this.activeObj = extend({}, this.objColl[this.objColl.length - 1]);
|
|
17287
|
-
this.objColl.pop();
|
|
17288
|
-
this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: this.activeObj } });
|
|
17289
|
-
}
|
|
17290
|
-
}
|
|
17291
|
-
};
|
|
17292
|
-
ImageEditor.prototype.isSelectionBiggerThanCanvas = function (obj) {
|
|
17293
|
-
var isBigger = false;
|
|
17294
|
-
if (obj.activePoint.startX <= this.img.destLeft ||
|
|
17295
|
-
obj.activePoint.startY <= this.img.destTop ||
|
|
17296
|
-
obj.activePoint.endX >= this.img.destLeft + this.img.destWidth ||
|
|
17297
|
-
obj.activePoint.endY >= this.img.destTop + this.img.destHeight) {
|
|
17298
|
-
isBigger = true;
|
|
17299
|
-
}
|
|
17300
|
-
return isBigger;
|
|
17301
|
-
};
|
|
17302
|
-
ImageEditor.prototype.isSelectionOutsideCanvas = function (obj) {
|
|
17303
|
-
var isOutside = false;
|
|
17304
|
-
if ((obj.activePoint.height < this.lowerCanvas.height - this.toolbarHeight) ||
|
|
17305
|
-
(obj.activePoint.width < this.lowerCanvas.width)) {
|
|
17306
|
-
isOutside = true;
|
|
17307
|
-
}
|
|
17308
|
-
return isOutside;
|
|
17309
|
-
};
|
|
17310
17322
|
/**
|
|
17311
17323
|
* Set the old item Transform item state.
|
|
17312
17324
|
*
|
|
@@ -17350,7 +17362,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
17350
17362
|
for (var i = 0; i < strArr.length; i++) {
|
|
17351
17363
|
strArr[i] = strArr[i].charAt(0).toUpperCase() + strArr[i].slice(1);
|
|
17352
17364
|
}
|
|
17353
|
-
if (
|
|
17365
|
+
if (obj) {
|
|
17354
17366
|
obj['maxText'] = strArr.join('');
|
|
17355
17367
|
}
|
|
17356
17368
|
return strArr.join('');
|
|
@@ -17417,7 +17429,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
17417
17429
|
this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
17418
17430
|
}
|
|
17419
17431
|
}
|
|
17420
|
-
else if ((!isBlazor() &&
|
|
17432
|
+
else if ((!isBlazor() && document.querySelector('#' + this.element.id + '_sliderWrapper')) || (isBlazor() && !this.element.querySelector('.e-ie-contextual-slider').classList.contains('e-hidden')) ||
|
|
17421
17433
|
this.currObjType.isFiltered) {
|
|
17422
17434
|
this.initialAdjustmentValue = this.canvasFilter = this.lowerContext.filter;
|
|
17423
17435
|
this.currObjType.isFiltered = false;
|
|
@@ -17479,7 +17491,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
17479
17491
|
* @returns {void}.
|
|
17480
17492
|
*/
|
|
17481
17493
|
ImageEditor.prototype.cropSelectedState = function () {
|
|
17482
|
-
if (
|
|
17494
|
+
if (this.activeObj.shape && this.activeObj.shape.split('-')[0] === 'crop') {
|
|
17483
17495
|
this.okBtn();
|
|
17484
17496
|
}
|
|
17485
17497
|
};
|
|
@@ -17494,7 +17506,10 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
17494
17506
|
var tempFilter = this.lowerContext.filter;
|
|
17495
17507
|
this.lowerContext.filter = this.canvasFilter = 'none';
|
|
17496
17508
|
var objColl = extend([], this.objColl, null, true);
|
|
17509
|
+
var pointColl = extend([], this.pointColl, null, true);
|
|
17497
17510
|
this.objColl = [];
|
|
17511
|
+
this.pointColl = [];
|
|
17512
|
+
this.freehandCounter = 0;
|
|
17498
17513
|
this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
|
|
17499
17514
|
var data = this.getImageData();
|
|
17500
17515
|
if (!isBlazor()) {
|
|
@@ -17503,6 +17518,8 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
17503
17518
|
this.element.querySelector('#' + this.element.id + '_contextualToolbarArea').classList.remove('e-hide');
|
|
17504
17519
|
}
|
|
17505
17520
|
this.objColl = objColl;
|
|
17521
|
+
this.pointColl = pointColl;
|
|
17522
|
+
this.freehandCounter = pointColl.length;
|
|
17506
17523
|
this.notify('shape', { prop: 'iterateObjColl', onPropertyChange: false });
|
|
17507
17524
|
this.lowerContext.filter = this.canvasFilter = tempFilter;
|
|
17508
17525
|
return data;
|
|
@@ -17519,7 +17536,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
17519
17536
|
var _this = this;
|
|
17520
17537
|
var finetuneValueChanging = { finetune: this.getFinetuneOption(type),
|
|
17521
17538
|
value: value, cancel: false };
|
|
17522
|
-
if (isBlazor() &&
|
|
17539
|
+
if (isBlazor() && this.events && this.events.finetuneValueChanging.hasDelegate === true) {
|
|
17523
17540
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
17524
17541
|
this.dotNetRef.invokeMethodAsync('OnFinetuneValueChangeAsync', finetuneValueChanging).then(function (finetuneValueChanging) {
|
|
17525
17542
|
if (finetuneValueChanging.cancel) {
|
|
@@ -17536,82 +17553,6 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
17536
17553
|
this.notify('filter', { prop: 'setCurrAdjValue', value: { type: type.toLowerCase(), value: value } });
|
|
17537
17554
|
}
|
|
17538
17555
|
};
|
|
17539
|
-
/**
|
|
17540
|
-
* Get the square point for rotated shape.
|
|
17541
|
-
*
|
|
17542
|
-
* @param { SelectionPoint } obj - Specifies the selection point.
|
|
17543
|
-
* @param { Object } object - Specifies the object.
|
|
17544
|
-
* @hidden
|
|
17545
|
-
* @returns {ActivePoint}.
|
|
17546
|
-
* An ActivePoint object which returns the square point.
|
|
17547
|
-
*/
|
|
17548
|
-
ImageEditor.prototype.getSquarePointForRotatedShape = function (obj, object) {
|
|
17549
|
-
var point = { startX: 0, startY: 0, endX: 0, endY: 0, width: 0, height: 0 };
|
|
17550
|
-
var center = { x: obj.activePoint.startX + (obj.activePoint.width / 2), y: obj.activePoint.startY +
|
|
17551
|
-
(obj.activePoint.height / 2) };
|
|
17552
|
-
var p1 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.startX - center.x) - Math.sin(obj.rotatedAngle)
|
|
17553
|
-
* (obj.activePoint.startY - center.y) + center.x,
|
|
17554
|
-
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.startX - center.x) + Math.cos(obj.rotatedAngle) * (obj.activePoint.startY
|
|
17555
|
-
- center.y) + center.y };
|
|
17556
|
-
var p2 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.endX - center.x) - Math.sin(obj.rotatedAngle) *
|
|
17557
|
-
(obj.activePoint.startY - center.y) + center.x,
|
|
17558
|
-
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.endX - center.x) + Math.cos(obj.rotatedAngle) * (obj.activePoint.startY
|
|
17559
|
-
- center.y) + center.y };
|
|
17560
|
-
var p3 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.startX - center.x) - Math.sin(obj.rotatedAngle) *
|
|
17561
|
-
(obj.activePoint.endY - center.y) + center.x,
|
|
17562
|
-
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.startX - center.x) + Math.cos(obj.rotatedAngle) * (obj.activePoint.endY
|
|
17563
|
-
- center.y) + center.y };
|
|
17564
|
-
var p4 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.endX - center.x) - Math.sin(obj.rotatedAngle) *
|
|
17565
|
-
(obj.activePoint.endY - center.y) + center.x,
|
|
17566
|
-
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.endX - center.x) + Math.cos(obj.rotatedAngle) *
|
|
17567
|
-
(obj.activePoint.endY - center.y) + center.y };
|
|
17568
|
-
point.startX = p1.x;
|
|
17569
|
-
point.startY = p1.y;
|
|
17570
|
-
point.endX = p1.x;
|
|
17571
|
-
point.endY = p1.y;
|
|
17572
|
-
if (point.startX > p2.x) {
|
|
17573
|
-
point.startX = p2.x;
|
|
17574
|
-
}
|
|
17575
|
-
if (point.startX > p3.x) {
|
|
17576
|
-
point.startX = p3.x;
|
|
17577
|
-
}
|
|
17578
|
-
if (point.startX > p4.x) {
|
|
17579
|
-
point.startX = p4.x;
|
|
17580
|
-
}
|
|
17581
|
-
if (point.startY > p2.y) {
|
|
17582
|
-
point.startY = p2.y;
|
|
17583
|
-
}
|
|
17584
|
-
if (point.startY > p3.y) {
|
|
17585
|
-
point.startY = p3.y;
|
|
17586
|
-
}
|
|
17587
|
-
if (point.startY > p4.y) {
|
|
17588
|
-
point.startY = p4.y;
|
|
17589
|
-
}
|
|
17590
|
-
if (point.endX < p2.x) {
|
|
17591
|
-
point.endX = p2.x;
|
|
17592
|
-
}
|
|
17593
|
-
if (point.endX < p3.x) {
|
|
17594
|
-
point.endX = p3.x;
|
|
17595
|
-
}
|
|
17596
|
-
if (point.endX < p4.x) {
|
|
17597
|
-
point.endX = p4.x;
|
|
17598
|
-
}
|
|
17599
|
-
if (point.endY < p2.y) {
|
|
17600
|
-
point.endY = p2.y;
|
|
17601
|
-
}
|
|
17602
|
-
if (point.endY < p3.y) {
|
|
17603
|
-
point.endY = p3.y;
|
|
17604
|
-
}
|
|
17605
|
-
if (point.endY < p4.y) {
|
|
17606
|
-
point.endY = p4.y;
|
|
17607
|
-
}
|
|
17608
|
-
point.width = point.endX - point.startX;
|
|
17609
|
-
point.height = point.endY - point.startY;
|
|
17610
|
-
if (!isNullOrUndefined(object)) {
|
|
17611
|
-
object['activePoint'] = point;
|
|
17612
|
-
}
|
|
17613
|
-
return point;
|
|
17614
|
-
};
|
|
17615
17556
|
/**
|
|
17616
17557
|
* Get the square point for path.
|
|
17617
17558
|
*
|
|
@@ -17700,14 +17641,14 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
17700
17641
|
this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
|
|
17701
17642
|
if (!isBlazor()) {
|
|
17702
17643
|
if (Browser.isDevice) {
|
|
17703
|
-
if (
|
|
17644
|
+
if (document.getElementById(this.element.id + '_bottomToolbar')) {
|
|
17704
17645
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
17705
17646
|
var toolbar_1 = getComponent(this.element.id + '_bottomToolbar', 'toolbar');
|
|
17706
17647
|
toolbar_1.refreshOverflow();
|
|
17707
17648
|
}
|
|
17708
17649
|
}
|
|
17709
17650
|
else {
|
|
17710
|
-
if (
|
|
17651
|
+
if (document.getElementById(this.element.id + '_toolbar')) {
|
|
17711
17652
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
17712
17653
|
var toolbar_2 = getComponent(this.element.id + '_toolbar', 'toolbar');
|
|
17713
17654
|
toolbar_2.refreshOverflow();
|
|
@@ -18141,9 +18082,8 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
18141
18082
|
var obj = { adjustmentLevel: null };
|
|
18142
18083
|
this.notify('filter', { prop: 'getAdjustmentLevel', onPropertyChange: false,
|
|
18143
18084
|
value: { obj: obj } });
|
|
18144
|
-
var value;
|
|
18145
18085
|
var typeToAdjustmentLevel = { 'brightness': obj['adjustmentLevel'].brightness,
|
|
18146
|
-
'contrast':
|
|
18086
|
+
'contrast': obj['adjustmentLevel'].contrast, 'hue': obj['adjustmentLevel'].hue,
|
|
18147
18087
|
'saturation': obj['adjustmentLevel'].saturation, 'opacity': obj['adjustmentLevel'].opacity,
|
|
18148
18088
|
'blur': obj['adjustmentLevel'].blur, 'exposure': obj['adjustmentLevel'].exposure };
|
|
18149
18089
|
return typeToAdjustmentLevel["" + type];
|
|
@@ -18162,7 +18102,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
18162
18102
|
this.cropSelectedState();
|
|
18163
18103
|
this.notify('draw', { prop: 'resetCurrentSelectionPoint' });
|
|
18164
18104
|
this.notify('transform', { prop: 'performTransformation', value: { text: type } });
|
|
18165
|
-
this.moveToSelectionRange
|
|
18105
|
+
this.notify('draw', { prop: 'moveToSelectionRange', value: { type: type, activeObj: activeObj } });
|
|
18166
18106
|
this.isCropToolbar = false;
|
|
18167
18107
|
};
|
|
18168
18108
|
/**
|
|
@@ -18189,7 +18129,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
18189
18129
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
18190
18130
|
this.element = element;
|
|
18191
18131
|
var canvasWrapper = this.element.querySelector('.e-canvas-wrapper');
|
|
18192
|
-
if (
|
|
18132
|
+
if (this.element.querySelector('#' + this.element.id + '_toolbar')) {
|
|
18193
18133
|
this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbar').clientHeight;
|
|
18194
18134
|
}
|
|
18195
18135
|
else {
|
|
@@ -18709,6 +18649,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
18709
18649
|
this.l10n = new L10n('image-editor', this.defaultLocale, this.parent.locale);
|
|
18710
18650
|
};
|
|
18711
18651
|
ToolbarModule.prototype.toolbar = function (args) {
|
|
18652
|
+
var parent = this.parent;
|
|
18712
18653
|
this.updatePrivateVariables();
|
|
18713
18654
|
switch (args.prop) {
|
|
18714
18655
|
case 'create-toolbar':
|
|
@@ -18781,19 +18722,19 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
18781
18722
|
this.selFhdColor = args.value['color'];
|
|
18782
18723
|
break;
|
|
18783
18724
|
case 'getCurrentFilter':
|
|
18784
|
-
args.value['obj']['currentFilter'] =
|
|
18725
|
+
args.value['obj']['currentFilter'] = parent.currentFilter;
|
|
18785
18726
|
break;
|
|
18786
18727
|
case 'setCurrentFilter':
|
|
18787
|
-
|
|
18728
|
+
parent.currentFilter = args.value['filter'];
|
|
18788
18729
|
break;
|
|
18789
18730
|
case 'setInitialAdjustmentValue':
|
|
18790
|
-
|
|
18731
|
+
parent.initialAdjustmentValue = args.value['value'];
|
|
18791
18732
|
break;
|
|
18792
18733
|
case 'getCanvasFilter':
|
|
18793
|
-
args.value['obj']['canvasFilter'] =
|
|
18734
|
+
args.value['obj']['canvasFilter'] = parent.canvasFilter;
|
|
18794
18735
|
break;
|
|
18795
18736
|
case 'setCanvasFilter':
|
|
18796
|
-
|
|
18737
|
+
parent.canvasFilter = args.value['filter'];
|
|
18797
18738
|
break;
|
|
18798
18739
|
case 'getDefToolbarItems':
|
|
18799
18740
|
args.value['obj']['defToolbarItems'] = this.defToolbarItems;
|
|
@@ -18805,7 +18746,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
18805
18746
|
this.performDefTbrClick(args.value['type'], args.value['isContextualToolbar'], args.value['isDisabledAdjustment'], args.value['isDisabledFilter'], args.value['isFilterFinetune']);
|
|
18806
18747
|
break;
|
|
18807
18748
|
case 'setTempFilterProperties':
|
|
18808
|
-
|
|
18749
|
+
parent.setTempFilterProperties();
|
|
18809
18750
|
break;
|
|
18810
18751
|
case 'refreshSlider':
|
|
18811
18752
|
this.refreshSlider();
|
|
@@ -18814,28 +18755,25 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
18814
18755
|
this.renderSlider(args.value['type']);
|
|
18815
18756
|
break;
|
|
18816
18757
|
case 'getCurrAdjustmentValue':
|
|
18817
|
-
|
|
18758
|
+
parent.getCurrAdjustmentValue(args.value['type']);
|
|
18818
18759
|
break;
|
|
18819
18760
|
case 'setCurrAdjustmentValue':
|
|
18820
|
-
|
|
18761
|
+
parent.setCurrAdjustmentValue(args.value['type'], args.value['value']);
|
|
18821
18762
|
break;
|
|
18822
18763
|
case 'refreshShapeDrawing':
|
|
18823
18764
|
this.refreshShapeDrawing();
|
|
18824
18765
|
break;
|
|
18825
|
-
case 'getSquarePointForRotatedShape':
|
|
18826
|
-
this.parent.getSquarePointForRotatedShape(args.value['obj'], args.value['object']);
|
|
18827
|
-
break;
|
|
18828
18766
|
case 'getCropToolbar':
|
|
18829
|
-
args.value['obj']['isCropToolbar'] =
|
|
18767
|
+
args.value['obj']['isCropToolbar'] = parent.isCropToolbar;
|
|
18830
18768
|
break;
|
|
18831
18769
|
case 'getPrevCurrSelectionPoint':
|
|
18832
|
-
args.value['obj']['prevCurrSelectionPoint'] =
|
|
18770
|
+
args.value['obj']['prevCurrSelectionPoint'] = parent.prevCurrSelectionPoint;
|
|
18833
18771
|
break;
|
|
18834
18772
|
case 'setPrevCurrSelectionPoint':
|
|
18835
|
-
|
|
18773
|
+
parent.prevCurrSelectionPoint = args.value['point'];
|
|
18836
18774
|
break;
|
|
18837
18775
|
case 'updateCropTransformItems':
|
|
18838
|
-
|
|
18776
|
+
parent.updateCropTransformItems();
|
|
18839
18777
|
break;
|
|
18840
18778
|
case 'setEnableDisableUndoRedo':
|
|
18841
18779
|
this.preventEnableDisableUr = args.value['isPrevent'];
|
|
@@ -18848,52 +18786,54 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
18848
18786
|
ToolbarModule.prototype.updatePrivateVariables = function () {
|
|
18849
18787
|
var parent = this.parent;
|
|
18850
18788
|
this.inMemoryCanvas = parent.inMemoryCanvas;
|
|
18851
|
-
if (
|
|
18789
|
+
if (parent.lowerCanvas) {
|
|
18852
18790
|
this.lowerContext = parent.lowerCanvas.getContext('2d');
|
|
18853
18791
|
}
|
|
18854
|
-
if (
|
|
18792
|
+
if (parent.upperCanvas) {
|
|
18855
18793
|
this.upperContext = parent.upperCanvas.getContext('2d');
|
|
18856
18794
|
}
|
|
18857
|
-
if (
|
|
18795
|
+
if (this.inMemoryCanvas) {
|
|
18858
18796
|
this.inMemoryContext = this.inMemoryCanvas.getContext('2d');
|
|
18859
18797
|
}
|
|
18860
18798
|
};
|
|
18861
18799
|
ToolbarModule.prototype.reset = function () {
|
|
18800
|
+
var parent = this.parent;
|
|
18862
18801
|
this.defToolbarItems = [];
|
|
18863
18802
|
this.toolbarHeight = 46;
|
|
18864
|
-
|
|
18803
|
+
parent.prevCurrSelectionPoint = null;
|
|
18865
18804
|
this.zoomBtnHold = null;
|
|
18866
18805
|
this.currToolbar = '';
|
|
18867
18806
|
this.currentToolbar = 'main';
|
|
18868
18807
|
this.selFhdColor = '#42a5f5';
|
|
18869
|
-
|
|
18870
|
-
this.preventZoomBtn =
|
|
18871
|
-
|
|
18808
|
+
parent.currentFilter = '';
|
|
18809
|
+
this.preventZoomBtn = parent.isCropToolbar = this.preventEnableDisableUr = false;
|
|
18810
|
+
parent.initialAdjustmentValue = parent.canvasFilter =
|
|
18872
18811
|
'brightness(' + 1 + ') ' + 'contrast(' + 100 + '%) ' + 'hue-rotate(' + 0 + 'deg) ' +
|
|
18873
18812
|
'saturate(' + 100 + '%) ' + 'opacity(' + 1 + ') ' + 'blur(' + 0 + 'px) ' + 'sepia(0%) ' + 'grayscale(0%) ' + 'invert(0%)';
|
|
18874
18813
|
};
|
|
18875
18814
|
ToolbarModule.prototype.destroyTopToolbar = function () {
|
|
18876
18815
|
var parent = this.parent;
|
|
18877
|
-
|
|
18878
|
-
|
|
18816
|
+
var toolbar = document.getElementById(parent.element.id + '_toolbar');
|
|
18817
|
+
if (this.isToolbar() && toolbar && toolbar.classList.contains('e-control')) {
|
|
18879
18818
|
getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
|
|
18880
18819
|
}
|
|
18881
18820
|
};
|
|
18882
18821
|
ToolbarModule.prototype.destroyBottomToolbar = function () {
|
|
18883
18822
|
var parent = this.parent;
|
|
18884
|
-
|
|
18885
|
-
|
|
18823
|
+
var toolbar = document.getElementById(parent.element.id + '_bottomToolbar');
|
|
18824
|
+
if (toolbar && toolbar.classList.contains('e-control')) {
|
|
18886
18825
|
getComponent(document.getElementById(parent.element.id + '_bottomToolbar'), 'toolbar').destroy();
|
|
18887
18826
|
}
|
|
18888
18827
|
};
|
|
18889
18828
|
ToolbarModule.prototype.isToolbar = function () {
|
|
18890
|
-
|
|
18891
|
-
|
|
18829
|
+
var parent = this.parent;
|
|
18830
|
+
return (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)
|
|
18831
|
+
|| !isNullOrUndefined(parent.toolbarTemplate));
|
|
18892
18832
|
};
|
|
18893
18833
|
ToolbarModule.prototype.createToolbar = function () {
|
|
18894
18834
|
var _this = this;
|
|
18895
18835
|
var parent = this.parent;
|
|
18896
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18836
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)) {
|
|
18897
18837
|
parent.element.appendChild(parent.createElement('div', {
|
|
18898
18838
|
id: parent.element.id + '_toolbarArea', className: 'e-toolbar-area'
|
|
18899
18839
|
}));
|
|
@@ -18919,10 +18859,10 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
18919
18859
|
if (!parent.disabled) {
|
|
18920
18860
|
if (Browser.isDevice) {
|
|
18921
18861
|
if (_this.defToolbarItems.length > 0 &&
|
|
18922
|
-
|
|
18862
|
+
document.getElementById(parent.element.id + '_toolbar')) {
|
|
18923
18863
|
getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
|
|
18924
18864
|
}
|
|
18925
|
-
if (
|
|
18865
|
+
if (document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
18926
18866
|
getComponent(document.getElementById(parent.element.id + '_bottomToolbar'), 'toolbar').destroy();
|
|
18927
18867
|
}
|
|
18928
18868
|
_this.initMainToolbar(false, Browser.isDevice, null);
|
|
@@ -18930,7 +18870,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
18930
18870
|
}
|
|
18931
18871
|
else {
|
|
18932
18872
|
if (_this.defToolbarItems.length > 0 &&
|
|
18933
|
-
|
|
18873
|
+
document.getElementById(parent.element.id + '_toolbar')) {
|
|
18934
18874
|
getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
|
|
18935
18875
|
}
|
|
18936
18876
|
_this.initMainToolbar(false, false, null);
|
|
@@ -18947,7 +18887,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
18947
18887
|
clicked: this.defToolbarClicked.bind(this) });
|
|
18948
18888
|
toolbarObj.appendTo('#' + parent.element.id + '_toolbar');
|
|
18949
18889
|
this.createLeftToolbarControls();
|
|
18950
|
-
if (
|
|
18890
|
+
if (document.getElementById(parent.element.id + '_toolbar')) {
|
|
18951
18891
|
this.toolbarHeight = document.getElementById(parent.element.id + '_toolbar').clientHeight;
|
|
18952
18892
|
}
|
|
18953
18893
|
}
|
|
@@ -18957,7 +18897,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
18957
18897
|
};
|
|
18958
18898
|
ToolbarModule.prototype.createContextualToolbar = function () {
|
|
18959
18899
|
var parent = this.parent;
|
|
18960
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18900
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)) {
|
|
18961
18901
|
parent.element.appendChild(parent.createElement('div', { id: parent.element.id + '_contextualToolbarArea',
|
|
18962
18902
|
className: 'e-contextual-toolbar-wrapper e-hide', attrs: { style: 'position: absolute;' }
|
|
18963
18903
|
}));
|
|
@@ -18968,7 +18908,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
18968
18908
|
};
|
|
18969
18909
|
ToolbarModule.prototype.createBottomToolbar = function () {
|
|
18970
18910
|
var parent = this.parent;
|
|
18971
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18911
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)) {
|
|
18972
18912
|
parent.element.appendChild(parent.createElement('div', {
|
|
18973
18913
|
id: parent.element.id + '_bottomToolbarArea', className: 'e-bottom-toolbar'
|
|
18974
18914
|
}));
|
|
@@ -19032,7 +18972,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19032
18972
|
toolbarObj.appendTo('#' + parent.element.id + '_toolbar');
|
|
19033
18973
|
this.createLeftToolbarControls();
|
|
19034
18974
|
this.enableDisableTbrBtn();
|
|
19035
|
-
if (this.isToolbar() &&
|
|
18975
|
+
if (this.isToolbar() && document.getElementById(parent.element.id + '_toolbar')) {
|
|
19036
18976
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
19037
18977
|
var toolbar_4 = getComponent(parent.element.id + '_toolbar', 'toolbar');
|
|
19038
18978
|
toolbar_4.refreshOverflow();
|
|
@@ -19042,7 +18982,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19042
18982
|
ToolbarModule.prototype.initBottomToolbar = function () {
|
|
19043
18983
|
var _this = this;
|
|
19044
18984
|
var parent = this.parent;
|
|
19045
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
18985
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)) {
|
|
19046
18986
|
var items = this.getMainToolbarItem();
|
|
19047
18987
|
var toolbarObj = new Toolbar({ items: items, width: '100%',
|
|
19048
18988
|
created: function () {
|
|
@@ -19054,7 +18994,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19054
18994
|
clicked: this.defToolbarClicked.bind(this)
|
|
19055
18995
|
});
|
|
19056
18996
|
toolbarObj.appendTo('#' + parent.element.id + '_bottomToolbar');
|
|
19057
|
-
if (this.defToolbarItems.length > 0 &&
|
|
18997
|
+
if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
19058
18998
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
19059
18999
|
var toolbar_5 = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
|
|
19060
19000
|
toolbar_5.refreshOverflow();
|
|
@@ -19069,21 +19009,21 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19069
19009
|
toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
|
|
19070
19010
|
}
|
|
19071
19011
|
if (parent.allowUndoRedo) {
|
|
19072
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19012
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Undo') > -1)) {
|
|
19073
19013
|
toolbarItems.push({ id: parent.element.id + '_undo', prefixIcon: 'e-icons e-undo', cssClass: 'top-icon e-undo',
|
|
19074
19014
|
tooltipText: this.l10n.getConstant('Undo'), align: 'Left' });
|
|
19075
19015
|
}
|
|
19076
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19016
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Redo') > -1)) {
|
|
19077
19017
|
toolbarItems.push({ id: parent.element.id + '_redo', prefixIcon: 'e-icons e-redo', cssClass: 'top-icon e-redo',
|
|
19078
19018
|
tooltipText: this.l10n.getConstant('Redo'), align: 'Left' });
|
|
19079
19019
|
}
|
|
19080
19020
|
}
|
|
19081
19021
|
if (!this.preventZoomBtn && (parent.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
|
|
19082
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19022
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('ZoomOut') > -1)) {
|
|
19083
19023
|
toolbarItems.push({ id: parent.element.id + '_zoomOut', prefixIcon: 'e-icons e-zoom-out', cssClass: 'top-icon e-dec-zoom',
|
|
19084
19024
|
tooltipText: this.l10n.getConstant('ZoomOut'), align: 'Left' });
|
|
19085
19025
|
}
|
|
19086
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19026
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('ZoomIn') > -1)) {
|
|
19087
19027
|
toolbarItems.push({ id: parent.element.id + '_zoomIn', prefixIcon: 'e-icons e-zoom-in', cssClass: 'top-icon e-inc-zoom',
|
|
19088
19028
|
tooltipText: this.l10n.getConstant('ZoomIn'), align: 'Left' });
|
|
19089
19029
|
}
|
|
@@ -19103,12 +19043,12 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19103
19043
|
toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
19104
19044
|
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
19105
19045
|
}
|
|
19106
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19046
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Reset') > -1)) {
|
|
19107
19047
|
toolbarItems.push({ id: parent.element.id + '_reset', prefixIcon: 'e-icons e-btn-reset', cssClass: 'top-icon e-img-reset',
|
|
19108
19048
|
tooltipText: this.l10n.getConstant('Reset'), align: 'Right' });
|
|
19109
19049
|
}
|
|
19110
19050
|
if (!isOkBtn) {
|
|
19111
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19051
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Save') > -1)) {
|
|
19112
19052
|
toolbarItems.push({ id: parent.element.id + '_save', prefixIcon: 'e-icons e-btn-save', cssClass: 'top-icon e-save',
|
|
19113
19053
|
tooltipText: this.l10n.getConstant('Save'), align: 'Right', template: '<button id="' + parent.element.id + '_saveBtn"></button>' });
|
|
19114
19054
|
}
|
|
@@ -19122,19 +19062,19 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19122
19062
|
ToolbarModule.prototype.getMainToolbarItem = function (isApplyOption) {
|
|
19123
19063
|
var parent = this.parent;
|
|
19124
19064
|
var toolbarItems = [];
|
|
19125
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19065
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Crop') > -1)) {
|
|
19126
19066
|
toolbarItems.push({ id: parent.element.id + '_cropTransform', prefixIcon: 'e-icons e-crop', cssClass: 'top-icon e-crop',
|
|
19127
19067
|
tooltipText: this.l10n.getConstant('CropAndTransform'), align: 'Center' });
|
|
19128
19068
|
}
|
|
19129
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19069
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Annotate') > -1)) {
|
|
19130
19070
|
toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
|
|
19131
|
-
template: '<button id="' +
|
|
19071
|
+
template: '<button id="' + parent.element.id + '_annotationBtn"></button>' });
|
|
19132
19072
|
}
|
|
19133
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19073
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Finetune') > -1)) {
|
|
19134
19074
|
toolbarItems.push({ id: parent.element.id + '_adjustment', prefixIcon: 'e-icons e-adjustment', cssClass: 'top-icon e-adjustment',
|
|
19135
19075
|
tooltipText: this.l10n.getConstant('Finetune'), align: 'Center' });
|
|
19136
19076
|
}
|
|
19137
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19077
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Filter') > -1)) {
|
|
19138
19078
|
toolbarItems.push({ id: parent.element.id + '_filter', prefixIcon: 'e-icons e-filters', cssClass: 'top-icon e-filters',
|
|
19139
19079
|
tooltipText: this.l10n.getConstant('Filter'), align: 'Center' });
|
|
19140
19080
|
}
|
|
@@ -19197,7 +19137,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19197
19137
|
if (typeof (parent.toolbar[i]) === 'object') {
|
|
19198
19138
|
if (isNullOrUndefined(parent.toolbar[i].align)) {
|
|
19199
19139
|
if (position === 'left') {
|
|
19200
|
-
toolbarItems.push(
|
|
19140
|
+
toolbarItems.push(parent.toolbar[i]);
|
|
19201
19141
|
}
|
|
19202
19142
|
}
|
|
19203
19143
|
else if (parent.toolbar[i].align.toLowerCase() === position) {
|
|
@@ -19223,13 +19163,13 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19223
19163
|
ToolbarModule.prototype.wireZoomBtnEvents = function () {
|
|
19224
19164
|
var zoomIn = document.querySelector('#' + this.parent.element.id + '_zoomIn');
|
|
19225
19165
|
var zoomOut = document.querySelector('#' + this.parent.element.id + '_zoomOut');
|
|
19226
|
-
if (
|
|
19166
|
+
if (zoomIn) {
|
|
19227
19167
|
zoomIn.addEventListener('mousedown', this.zoomInBtnMouseDownHandler.bind(this));
|
|
19228
19168
|
zoomIn.addEventListener('mouseup', this.zoomBtnMouseUpHandler.bind(this));
|
|
19229
19169
|
zoomIn.addEventListener('click', this.zoomInBtnClickHandler.bind(this));
|
|
19230
19170
|
zoomIn.addEventListener('touchstart', this.zoomInBtnClickHandler.bind(this));
|
|
19231
19171
|
}
|
|
19232
|
-
if (
|
|
19172
|
+
if (zoomOut) {
|
|
19233
19173
|
zoomOut.addEventListener('mousedown', this.zoomOutBtnMouseDownHandler.bind(this));
|
|
19234
19174
|
zoomOut.addEventListener('mouseup', this.zoomBtnMouseUpHandler.bind(this));
|
|
19235
19175
|
zoomOut.addEventListener('click', this.zoomOutBtnClickHandler.bind(this));
|
|
@@ -19244,58 +19184,58 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19244
19184
|
var undoRedoObj = { undoRedoStep: null };
|
|
19245
19185
|
parent.notify('undo-redo', { prop: 'getUndoRedoStep', value: { obj: undoRedoObj } });
|
|
19246
19186
|
var undo = document.querySelector('#' + parent.element.id + '_undo');
|
|
19247
|
-
if (
|
|
19187
|
+
if (undo && undoRedoObj['undoRedoStep'] === 0) {
|
|
19248
19188
|
undo.classList.add('e-disabled');
|
|
19249
19189
|
undo.parentElement.classList.add('e-overlay');
|
|
19250
19190
|
}
|
|
19251
|
-
else if (
|
|
19191
|
+
else if (undo && undoRedoObj['undoRedoStep'] > 0) {
|
|
19252
19192
|
undo.classList.remove('e-disabled');
|
|
19253
19193
|
undo.parentElement.classList.remove('e-overlay');
|
|
19254
19194
|
}
|
|
19255
19195
|
var redo = document.querySelector('#' + parent.element.id + '_redo');
|
|
19256
|
-
if (
|
|
19196
|
+
if (redo && (undoRedoObj['undoRedoStep'] === object['appliedUndoRedoColl'].length)) {
|
|
19257
19197
|
redo.classList.add('e-disabled');
|
|
19258
19198
|
redo.parentElement.classList.add('e-overlay');
|
|
19259
19199
|
}
|
|
19260
|
-
else if (
|
|
19200
|
+
else if (redo && (undoRedoObj['undoRedoStep'] === 0 && object['appliedUndoRedoColl'].length > 0)) {
|
|
19261
19201
|
redo.classList.remove('e-disabled');
|
|
19262
19202
|
redo.parentElement.classList.remove('e-overlay');
|
|
19263
19203
|
}
|
|
19264
|
-
else if (
|
|
19204
|
+
else if (redo && undoRedoObj['undoRedoStep'] > 0) {
|
|
19265
19205
|
redo.classList.remove('e-disabled');
|
|
19266
19206
|
redo.parentElement.classList.remove('e-overlay');
|
|
19267
19207
|
}
|
|
19268
19208
|
}
|
|
19269
19209
|
var zoomIn = document.querySelector('#' + parent.element.id + '_zoomIn');
|
|
19270
|
-
if (
|
|
19210
|
+
if (zoomIn && parent.zoomSettings.zoomFactor >= parent.zoomSettings.maxZoomFactor) {
|
|
19271
19211
|
zoomIn.classList.add('e-disabled');
|
|
19272
19212
|
zoomIn.parentElement.classList.add('e-overlay');
|
|
19273
19213
|
}
|
|
19274
|
-
else if (
|
|
19214
|
+
else if (zoomIn) {
|
|
19275
19215
|
zoomIn.classList.remove('e-disabled');
|
|
19276
19216
|
zoomIn.parentElement.classList.remove('e-overlay');
|
|
19277
19217
|
}
|
|
19278
19218
|
var zoomOut = document.querySelector('#' + parent.element.id + '_zoomOut');
|
|
19279
|
-
if (
|
|
19219
|
+
if (zoomOut && parent.zoomSettings.zoomFactor <= parent.zoomSettings.minZoomFactor) {
|
|
19280
19220
|
zoomOut.classList.add('e-disabled');
|
|
19281
19221
|
zoomOut.parentElement.classList.add('e-overlay');
|
|
19282
19222
|
}
|
|
19283
|
-
else if (
|
|
19223
|
+
else if (zoomOut) {
|
|
19284
19224
|
zoomOut.classList.remove('e-disabled');
|
|
19285
19225
|
zoomOut.parentElement.classList.remove('e-overlay');
|
|
19286
19226
|
}
|
|
19287
19227
|
var pan = document.querySelector('#' + parent.element.id + '_pan');
|
|
19288
|
-
if (
|
|
19228
|
+
if (pan && parent.zoomSettings.zoomFactor <= parent.zoomSettings.minZoomFactor) {
|
|
19289
19229
|
pan.style.display = 'none';
|
|
19290
19230
|
}
|
|
19291
|
-
else if (
|
|
19231
|
+
else if (pan) {
|
|
19292
19232
|
pan.style.display = 'block';
|
|
19293
19233
|
}
|
|
19294
19234
|
};
|
|
19295
19235
|
ToolbarModule.prototype.createLeftToolbarControls = function () {
|
|
19296
19236
|
var parent = this.parent;
|
|
19297
19237
|
if (this.defToolbarItems !== undefined && this.defToolbarItems.length > 0 &&
|
|
19298
|
-
(
|
|
19238
|
+
(document.getElementById(parent.element.id + '_toolbar'))) {
|
|
19299
19239
|
var uploadDiv = document.getElementById(parent.element.id + '_toolbar')
|
|
19300
19240
|
.querySelector('.e-image-upload');
|
|
19301
19241
|
if (uploadDiv) {
|
|
@@ -19317,25 +19257,25 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19317
19257
|
var _this = this;
|
|
19318
19258
|
var parent = this.parent;
|
|
19319
19259
|
var items = [];
|
|
19320
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19260
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Pen') > -1)) {
|
|
19321
19261
|
items.push({ text: this.l10n.getConstant('Pen'), id: 'pen', iconCss: 'e-icons e-free-pen' });
|
|
19322
19262
|
}
|
|
19323
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19263
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Line') > -1)) {
|
|
19324
19264
|
items.push({ text: this.l10n.getConstant('Line'), id: 'line', iconCss: 'e-icons e-line' });
|
|
19325
19265
|
}
|
|
19326
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19266
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Rectangle') > -1)) {
|
|
19327
19267
|
items.push({ text: this.l10n.getConstant('Rectangle'), id: 'rectangle', iconCss: 'e-icons e-rectangle' });
|
|
19328
19268
|
}
|
|
19329
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19269
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Ellipse') > -1)) {
|
|
19330
19270
|
items.push({ text: this.l10n.getConstant('Ellipse'), id: 'ellipse', iconCss: 'e-icons e-circle' });
|
|
19331
19271
|
}
|
|
19332
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19272
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Arrow') > -1)) {
|
|
19333
19273
|
items.push({ text: this.l10n.getConstant('Arrow'), id: 'arrow', iconCss: 'e-icons e-arrow-right-up' });
|
|
19334
19274
|
}
|
|
19335
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19275
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Path') > -1)) {
|
|
19336
19276
|
items.push({ text: this.l10n.getConstant('Path'), id: 'path', iconCss: 'e-icons e-critical-path' });
|
|
19337
19277
|
}
|
|
19338
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19278
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Text') > -1)) {
|
|
19339
19279
|
items.push({ text: this.l10n.getConstant('Text'), id: 'text', iconCss: 'e-icons e-add-text' });
|
|
19340
19280
|
}
|
|
19341
19281
|
var obj = { freehandDrawSelectedId: null };
|
|
@@ -19344,7 +19284,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19344
19284
|
var removeElement = document.querySelector('#' + parent.element.id + '_remove');
|
|
19345
19285
|
var editTextElement = document.querySelector('#' + parent.element.id + '_editText');
|
|
19346
19286
|
if ((parent.activeObj.activePoint.width === 0 && parent.activeObj.activePoint.height === 0) &&
|
|
19347
|
-
(isNullOrUndefined(parent.activeObj.pointColl) || (
|
|
19287
|
+
(isNullOrUndefined(parent.activeObj.pointColl) || (parent.activeObj.pointColl
|
|
19348
19288
|
&& parent.activeObj.pointColl.length === 0)) &&
|
|
19349
19289
|
isNullOrUndefined(obj['freehandDrawSelectedId'])) {
|
|
19350
19290
|
if (duplicateElement) {
|
|
@@ -19376,10 +19316,10 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19376
19316
|
args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
|
|
19377
19317
|
args.element.parentElement.offsetHeight + 'px';
|
|
19378
19318
|
}
|
|
19379
|
-
if (
|
|
19380
|
-
document.getElementById(
|
|
19319
|
+
if (parent.activeObj.shape) {
|
|
19320
|
+
document.getElementById(parent.activeObj.shape).classList.add('e-selected');
|
|
19381
19321
|
}
|
|
19382
|
-
else if (
|
|
19322
|
+
else if (parent.togglePen) {
|
|
19383
19323
|
document.getElementById('pen').classList.add('e-selected');
|
|
19384
19324
|
}
|
|
19385
19325
|
},
|
|
@@ -19434,22 +19374,22 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19434
19374
|
}
|
|
19435
19375
|
});
|
|
19436
19376
|
// Render initialized DropDownButton.
|
|
19437
|
-
drpDownBtn.appendTo('#' +
|
|
19377
|
+
drpDownBtn.appendTo('#' + parent.element.id + '_annotationBtn');
|
|
19438
19378
|
};
|
|
19439
19379
|
ToolbarModule.prototype.renderCropBtn = function () {
|
|
19440
19380
|
var _this = this;
|
|
19441
19381
|
var parent = this.parent;
|
|
19442
19382
|
var items = [];
|
|
19443
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19383
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('CustomSelection') > -1)) {
|
|
19444
19384
|
items.push({ text: this.l10n.getConstant('Custom'), id: 'custom', iconCss: 'e-icons e-custom' });
|
|
19445
19385
|
}
|
|
19446
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19386
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('CircleSelection') > -1)) {
|
|
19447
19387
|
items.push({ text: this.l10n.getConstant('Circle'), id: 'circle', iconCss: 'e-icons e-circle' });
|
|
19448
19388
|
}
|
|
19449
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19389
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('SquareSelection') > -1)) {
|
|
19450
19390
|
items.push({ text: this.l10n.getConstant('Square'), id: 'square', iconCss: 'e-icons e-square' });
|
|
19451
19391
|
}
|
|
19452
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19392
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('RatioSelection') > -1)) {
|
|
19453
19393
|
items.push({ text: '3:2', id: '3:2', iconCss: 'e-icons e-custom-a' });
|
|
19454
19394
|
items.push({ text: '4:3', id: '4:3', iconCss: 'e-icons e-custom-b' });
|
|
19455
19395
|
items.push({ text: '5:4', id: '5:4', iconCss: 'e-icons e-custom-c' });
|
|
@@ -19458,11 +19398,11 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19458
19398
|
}
|
|
19459
19399
|
var iconCss;
|
|
19460
19400
|
var shape;
|
|
19461
|
-
if (
|
|
19401
|
+
if (parent.activeObj.shape) {
|
|
19462
19402
|
iconCss = this.getCurrentShapeIcon(parent.activeObj.shape);
|
|
19463
19403
|
shape = parent.activeObj.shape;
|
|
19464
19404
|
}
|
|
19465
|
-
else if (
|
|
19405
|
+
else if (parent.currSelectionPoint) {
|
|
19466
19406
|
iconCss = this.getCurrentShapeIcon(parent.currSelectionPoint.shape);
|
|
19467
19407
|
shape = parent.currSelectionPoint.shape;
|
|
19468
19408
|
}
|
|
@@ -19479,8 +19419,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19479
19419
|
args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
|
|
19480
19420
|
args.element.parentElement.offsetHeight + 'px';
|
|
19481
19421
|
}
|
|
19482
|
-
if (
|
|
19483
|
-
document.getElementById(
|
|
19422
|
+
if (parent.activeObj.shape && parent.activeObj.shape.split('-').length > 1) {
|
|
19423
|
+
document.getElementById(parent.activeObj.shape.split('-')[1]).classList.add('e-selected');
|
|
19484
19424
|
}
|
|
19485
19425
|
parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
|
|
19486
19426
|
},
|
|
@@ -19493,21 +19433,21 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19493
19433
|
iconCss: 'e-icons ' + iconCss, cssClass: 'e-image-popup',
|
|
19494
19434
|
content: parent.toPascalCase(shape.replace('crop-', ''))
|
|
19495
19435
|
});
|
|
19496
|
-
drpDownBtn.appendTo('#' +
|
|
19436
|
+
drpDownBtn.appendTo('#' + parent.element.id + '_cropBtn');
|
|
19497
19437
|
};
|
|
19498
19438
|
ToolbarModule.prototype.renderTransformBtn = function () {
|
|
19499
19439
|
var parent = this.parent;
|
|
19500
19440
|
var items = [];
|
|
19501
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19441
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('RotateLeft') > -1)) {
|
|
19502
19442
|
items.push({ text: this.l10n.getConstant('RotateLeft'), id: 'rotateleft', iconCss: 'e-icons e-anti-clock-wise' });
|
|
19503
19443
|
}
|
|
19504
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19444
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('RotateRight') > -1)) {
|
|
19505
19445
|
items.push({ text: this.l10n.getConstant('RotateRight'), id: 'rotateright', iconCss: 'e-icons e-clock-wise' });
|
|
19506
19446
|
}
|
|
19507
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19447
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('FlipHorizontal') > -1)) {
|
|
19508
19448
|
items.push({ text: this.l10n.getConstant('HorizontalFlip'), id: 'horizontalflip', iconCss: 'e-icons e-horizontal-flip' });
|
|
19509
19449
|
}
|
|
19510
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19450
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('FlipVertical') > -1)) {
|
|
19511
19451
|
items.push({ text: this.l10n.getConstant('VerticalFlip'), id: 'verticalflip', iconCss: 'e-icons e-vertical-flip' });
|
|
19512
19452
|
}
|
|
19513
19453
|
var drpDownBtn = new DropDownButton({
|
|
@@ -19520,27 +19460,27 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19520
19460
|
args.element.parentElement.style.display = 'block';
|
|
19521
19461
|
}
|
|
19522
19462
|
},
|
|
19523
|
-
items: items, select:
|
|
19463
|
+
items: items, select: parent.transformSelect.bind(this),
|
|
19524
19464
|
iconCss: 'e-icons e-transform', cssClass: 'e-image-popup'
|
|
19525
19465
|
});
|
|
19526
19466
|
drpDownBtn.appendTo('#' + parent.element.id + '_transformBtn');
|
|
19527
19467
|
};
|
|
19528
19468
|
ToolbarModule.prototype.renderSaveBtn = function () {
|
|
19529
|
-
var
|
|
19469
|
+
var parent = this.parent;
|
|
19530
19470
|
var saveItems = [
|
|
19531
19471
|
{ text: 'JPEG', id: 'jpeg' },
|
|
19532
19472
|
{ text: 'PNG', id: 'png' },
|
|
19533
19473
|
{ text: 'SVG', id: 'svg' }
|
|
19534
19474
|
];
|
|
19535
|
-
var ddbElem = document.getElementById(
|
|
19475
|
+
var ddbElem = document.getElementById(parent.element.id + '_saveBtn');
|
|
19536
19476
|
if (ddbElem) {
|
|
19537
19477
|
// Initialize the DropDownButton component.
|
|
19538
19478
|
var saveDrpDownBtn = new DropDownButton({ items: saveItems, cssClass: 'e-caret-hide e-image-popup', iconCss: 'e-icons e-save',
|
|
19539
19479
|
select: function (args) {
|
|
19540
|
-
|
|
19480
|
+
parent.export(args.item.text);
|
|
19541
19481
|
}
|
|
19542
19482
|
});
|
|
19543
|
-
saveDrpDownBtn.appendTo('#' +
|
|
19483
|
+
saveDrpDownBtn.appendTo('#' + parent.element.id + '_saveBtn');
|
|
19544
19484
|
}
|
|
19545
19485
|
};
|
|
19546
19486
|
ToolbarModule.prototype.getCropTransformToolbarItem = function () {
|
|
@@ -19550,19 +19490,19 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19550
19490
|
template: '<button id="' + parent.element.id + '_cropBtn"></button>'
|
|
19551
19491
|
});
|
|
19552
19492
|
toolbarItems.push({ align: 'Center', type: 'Separator' });
|
|
19553
|
-
toolbarItems.push({ id:
|
|
19493
|
+
toolbarItems.push({ id: parent.element.id + '_rotateLeft', prefixIcon: 'e-icons e-anti-clock-wise',
|
|
19554
19494
|
tooltipText: this.l10n.getConstant('RotateLeft'), align: 'Center' });
|
|
19555
|
-
toolbarItems.push({ id:
|
|
19495
|
+
toolbarItems.push({ id: parent.element.id + '_rotateRight', prefixIcon: 'e-icons e-clock-wise',
|
|
19556
19496
|
tooltipText: this.l10n.getConstant('RotateRight'), align: 'Center' });
|
|
19557
19497
|
toolbarItems.push({ align: 'Center', type: 'Separator' });
|
|
19558
|
-
toolbarItems.push({ id:
|
|
19498
|
+
toolbarItems.push({ id: parent.element.id + '_horizontalFlip', prefixIcon: 'e-icons e-horizontal-flip',
|
|
19559
19499
|
tooltipText: this.l10n.getConstant('HorizontalFlip'), align: 'Center' });
|
|
19560
|
-
toolbarItems.push({ id:
|
|
19500
|
+
toolbarItems.push({ id: parent.element.id + '_verticalFlip', prefixIcon: 'e-icons e-vertical-flip',
|
|
19561
19501
|
tooltipText: this.l10n.getConstant('VerticalFlip'), align: 'Center' });
|
|
19562
19502
|
if (!Browser.isDevice) {
|
|
19563
|
-
toolbarItems.push({ id:
|
|
19503
|
+
toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
19564
19504
|
tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
|
|
19565
|
-
toolbarItems.push({ id:
|
|
19505
|
+
toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
19566
19506
|
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
19567
19507
|
}
|
|
19568
19508
|
return toolbarItems;
|
|
@@ -19570,31 +19510,31 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19570
19510
|
ToolbarModule.prototype.getShapesToolbarItem = function (items) {
|
|
19571
19511
|
var parent = this.parent;
|
|
19572
19512
|
var toolbarItems = [];
|
|
19573
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19513
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar)) {
|
|
19574
19514
|
toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
|
|
19575
|
-
template: '<button id="' +
|
|
19515
|
+
template: '<button id="' + parent.element.id + '_annotationBtn"></button>' });
|
|
19576
19516
|
}
|
|
19577
19517
|
if (items.indexOf('fillColor') > -1) {
|
|
19578
|
-
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id:
|
|
19518
|
+
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: parent.element.id + '_fillcolor',
|
|
19579
19519
|
cssClass: 'top-icon e-fill', tooltipText: this.l10n.getConstant('FillColor'), align: 'Center', type: 'Input',
|
|
19580
|
-
template: '<button id="' +
|
|
19520
|
+
template: '<button id="' + parent.element.id + '_fillColorBtn"></button>' });
|
|
19581
19521
|
}
|
|
19582
19522
|
if (items.indexOf('strokeColor') > -1) {
|
|
19583
|
-
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id:
|
|
19523
|
+
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: parent.element.id + '_strokecolor',
|
|
19584
19524
|
cssClass: 'top-icon e-stroke', tooltipText: this.l10n.getConstant('StrokeColor'), align: 'Center', type: 'Input',
|
|
19585
|
-
template: '<button id="' +
|
|
19525
|
+
template: '<button id="' + parent.element.id + '_borderColorBtn"></button>' });
|
|
19586
19526
|
}
|
|
19587
19527
|
if (items.indexOf('strokeWidth') > -1) {
|
|
19588
|
-
toolbarItems.push({ id:
|
|
19589
|
-
type: 'Input', template: '<button id="' +
|
|
19528
|
+
toolbarItems.push({ id: parent.element.id + '_strokeWidth', cssClass: 'top-icon e-size', tooltipText: 'Stroke Width', align: 'Center',
|
|
19529
|
+
type: 'Input', template: '<button id="' + parent.element.id + '_borderWidthBtn"></button>' });
|
|
19590
19530
|
}
|
|
19591
19531
|
if (items.indexOf('start') > -1) {
|
|
19592
|
-
toolbarItems.push({ id:
|
|
19593
|
-
type: 'Input', template: '<button id="' +
|
|
19532
|
+
toolbarItems.push({ id: parent.element.id + '_start', cssClass: 'top-icon e-size', tooltipText: 'Start', align: 'Center',
|
|
19533
|
+
type: 'Input', template: '<button id="' + parent.element.id + '_startBtn"></button>' });
|
|
19594
19534
|
}
|
|
19595
19535
|
if (items.indexOf('end') > -1) {
|
|
19596
|
-
toolbarItems.push({ id:
|
|
19597
|
-
type: 'Input', template: '<button id="' +
|
|
19536
|
+
toolbarItems.push({ id: parent.element.id + '_end', cssClass: 'top-icon e-size', tooltipText: 'End', align: 'Center',
|
|
19537
|
+
type: 'Input', template: '<button id="' + parent.element.id + '_endBtn"></button>' });
|
|
19598
19538
|
}
|
|
19599
19539
|
toolbarItems.push({ align: 'Center', type: 'Separator' });
|
|
19600
19540
|
if (items.indexOf('duplicate') > -1) {
|
|
@@ -19617,9 +19557,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19617
19557
|
var obj = { shape: null };
|
|
19618
19558
|
parent.notify('selection', { prop: 'getCurrentDrawingShape', value: { obj: obj } });
|
|
19619
19559
|
if (obj['shape'] !== 'path') {
|
|
19620
|
-
toolbarItems.push({ id:
|
|
19560
|
+
toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
19621
19561
|
tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
|
|
19622
|
-
toolbarItems.push({ id:
|
|
19562
|
+
toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
19623
19563
|
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
19624
19564
|
}
|
|
19625
19565
|
}
|
|
@@ -19627,6 +19567,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19627
19567
|
};
|
|
19628
19568
|
ToolbarModule.prototype.initCropTransformToolbar = function () {
|
|
19629
19569
|
var _this = this;
|
|
19570
|
+
var parent = this.parent;
|
|
19630
19571
|
var leftItem = this.getLeftToolbarItem();
|
|
19631
19572
|
var rightItem = this.getRightToolbarItem();
|
|
19632
19573
|
var mainItem = this.getCropTransformToolbarItem();
|
|
@@ -19647,9 +19588,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19647
19588
|
if (!Browser.isDevice) {
|
|
19648
19589
|
_this.renderSaveBtn();
|
|
19649
19590
|
}
|
|
19650
|
-
|
|
19591
|
+
parent.trigger('toolbarCreated', { toolbarType: 'shapes' });
|
|
19651
19592
|
if (Browser.isDevice) {
|
|
19652
|
-
if (_this.defToolbarItems.length > 0 &&
|
|
19593
|
+
if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
19653
19594
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
19654
19595
|
toolbar.refreshOverflow();
|
|
19655
19596
|
toolbar.refreshOverflow();
|
|
@@ -19658,22 +19599,22 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19658
19599
|
}
|
|
19659
19600
|
else {
|
|
19660
19601
|
_this.createLeftToolbarControls();
|
|
19661
|
-
if (_this.defToolbarItems.length > 0 &&
|
|
19602
|
+
if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
19662
19603
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
19663
19604
|
toolbar.refreshOverflow();
|
|
19664
19605
|
}
|
|
19665
19606
|
}
|
|
19666
|
-
|
|
19607
|
+
parent.select('custom');
|
|
19667
19608
|
}
|
|
19668
19609
|
});
|
|
19669
19610
|
if (Browser.isDevice) {
|
|
19670
|
-
toolbar.appendTo('#' +
|
|
19611
|
+
toolbar.appendTo('#' + parent.element.id + '_bottomToolbar');
|
|
19671
19612
|
}
|
|
19672
19613
|
else {
|
|
19673
|
-
toolbar.appendTo('#' +
|
|
19614
|
+
toolbar.appendTo('#' + parent.element.id + '_toolbar');
|
|
19674
19615
|
}
|
|
19675
19616
|
this.enableDisableTbrBtn();
|
|
19676
|
-
|
|
19617
|
+
parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
|
|
19677
19618
|
};
|
|
19678
19619
|
ToolbarModule.prototype.getCurrentShapeIcon = function (shape) {
|
|
19679
19620
|
var icon = '';
|
|
@@ -19684,9 +19625,6 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19684
19625
|
case 'ellipse':
|
|
19685
19626
|
icon = 'e-circle';
|
|
19686
19627
|
break;
|
|
19687
|
-
case 'triangle':
|
|
19688
|
-
icon = 'e-triangle';
|
|
19689
|
-
break;
|
|
19690
19628
|
case 'line':
|
|
19691
19629
|
icon = 'e-line';
|
|
19692
19630
|
break;
|
|
@@ -19734,6 +19672,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19734
19672
|
};
|
|
19735
19673
|
ToolbarModule.prototype.initShapesToolbarItem = function (items) {
|
|
19736
19674
|
var _this = this;
|
|
19675
|
+
var parent = this.parent;
|
|
19737
19676
|
var leftItem = this.getLeftToolbarItem();
|
|
19738
19677
|
var rightItem = this.getRightToolbarItem();
|
|
19739
19678
|
var mainItem = this.getShapesToolbarItem(items);
|
|
@@ -19752,7 +19691,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19752
19691
|
_this.renderAnnotationBtn(true);
|
|
19753
19692
|
_this.createShapeColor(items);
|
|
19754
19693
|
_this.createShapeBtn(items);
|
|
19755
|
-
if (
|
|
19694
|
+
if (parent.activeObj.shape === 'arrow') {
|
|
19756
19695
|
_this.createStartBtn();
|
|
19757
19696
|
_this.createEndBtn();
|
|
19758
19697
|
}
|
|
@@ -19760,9 +19699,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19760
19699
|
if (!Browser.isDevice) {
|
|
19761
19700
|
_this.renderSaveBtn();
|
|
19762
19701
|
}
|
|
19763
|
-
|
|
19702
|
+
parent.trigger('toolbarCreated', { toolbarType: 'shapes' });
|
|
19764
19703
|
if (Browser.isDevice) {
|
|
19765
|
-
if (_this.defToolbarItems.length > 0 &&
|
|
19704
|
+
if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
19766
19705
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
19767
19706
|
toolbar.refreshOverflow();
|
|
19768
19707
|
toolbar.refreshOverflow();
|
|
@@ -19771,7 +19710,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19771
19710
|
}
|
|
19772
19711
|
else {
|
|
19773
19712
|
_this.createLeftToolbarControls();
|
|
19774
|
-
if (_this.defToolbarItems.length > 0 &&
|
|
19713
|
+
if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
19775
19714
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
19776
19715
|
toolbar.refreshOverflow();
|
|
19777
19716
|
}
|
|
@@ -19779,15 +19718,14 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19779
19718
|
}
|
|
19780
19719
|
});
|
|
19781
19720
|
if (Browser.isDevice) {
|
|
19782
|
-
toolbar.appendTo('#' +
|
|
19721
|
+
toolbar.appendTo('#' + parent.element.id + '_bottomToolbar');
|
|
19783
19722
|
}
|
|
19784
19723
|
else {
|
|
19785
|
-
toolbar.appendTo('#' +
|
|
19724
|
+
toolbar.appendTo('#' + parent.element.id + '_toolbar');
|
|
19786
19725
|
}
|
|
19787
19726
|
this.enableDisableTbrBtn();
|
|
19788
19727
|
};
|
|
19789
19728
|
ToolbarModule.prototype.createShapeColor = function (items) {
|
|
19790
|
-
var _this = this;
|
|
19791
19729
|
var parent = this.parent;
|
|
19792
19730
|
if (items.indexOf('fillColor') > -1) {
|
|
19793
19731
|
parent.element.querySelector('.e-template.e-fill').appendChild(parent.createElement('input', {
|
|
@@ -19797,7 +19735,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19797
19735
|
modeSwitcher: false, noColor: true, value: '',
|
|
19798
19736
|
showButtons: false, mode: 'Palette', cssClass: 'e-shape-fill-color',
|
|
19799
19737
|
change: function (args) {
|
|
19800
|
-
|
|
19738
|
+
parent.updateFillColor(args.currentValue.hex);
|
|
19801
19739
|
if (args.currentValue.rgba === '') {
|
|
19802
19740
|
fillDDB_1.element.children[0].classList.add('e-nocolor-item');
|
|
19803
19741
|
}
|
|
@@ -19818,7 +19756,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19818
19756
|
},
|
|
19819
19757
|
target: '.e-shape-fill-color',
|
|
19820
19758
|
iconCss: 'e-dropdownbtn-preview'
|
|
19821
|
-
}, '#' +
|
|
19759
|
+
}, '#' + parent.element.id + '_fillColorBtn');
|
|
19822
19760
|
fillColor.inline = true;
|
|
19823
19761
|
parent.element.querySelector('.e-fill.e-template .e-dropdownbtn-preview').classList.add('e-nocolor-item');
|
|
19824
19762
|
}
|
|
@@ -19830,7 +19768,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19830
19768
|
modeSwitcher: false, noColor: false, value: '#fff',
|
|
19831
19769
|
showButtons: false, mode: 'Palette', cssClass: 'e-shape-stroke-color',
|
|
19832
19770
|
change: function (args) {
|
|
19833
|
-
|
|
19771
|
+
parent.updateStrokeColor(args.currentValue.hex);
|
|
19834
19772
|
strokeDDB_1.element.children[0].style.backgroundColor = args.currentValue.rgba;
|
|
19835
19773
|
strokeDDB_1.toggle();
|
|
19836
19774
|
}
|
|
@@ -19840,7 +19778,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19840
19778
|
if (Browser.isDevice) {
|
|
19841
19779
|
args.element.parentElement.style.top = strokeDDB_1.element.getBoundingClientRect().top -
|
|
19842
19780
|
args.element.parentElement.offsetHeight + 'px';
|
|
19843
|
-
args.element.parentElement.style.left =
|
|
19781
|
+
args.element.parentElement.style.left = parent.element.offsetLeft + 'px';
|
|
19844
19782
|
}
|
|
19845
19783
|
},
|
|
19846
19784
|
target: '.e-shape-stroke-color',
|
|
@@ -19851,7 +19789,6 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19851
19789
|
}
|
|
19852
19790
|
};
|
|
19853
19791
|
ToolbarModule.prototype.createShapeBtn = function (items) {
|
|
19854
|
-
var _this = this;
|
|
19855
19792
|
var parent = this.parent;
|
|
19856
19793
|
var strokeWidthItems = [
|
|
19857
19794
|
{ id: '1', text: this.l10n.getConstant('XSmall') },
|
|
@@ -19880,18 +19817,18 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19880
19817
|
},
|
|
19881
19818
|
select: function (args) {
|
|
19882
19819
|
spanElem_1.textContent = args.item.text;
|
|
19883
|
-
|
|
19820
|
+
parent.updateStrokeWidth(args.item.id);
|
|
19884
19821
|
if (Browser.isDevice) {
|
|
19885
|
-
if (
|
|
19822
|
+
if (document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
19886
19823
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
19887
|
-
var toolbar_6 = getComponent(
|
|
19824
|
+
var toolbar_6 = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
|
|
19888
19825
|
toolbar_6.refreshOverflow();
|
|
19889
19826
|
}
|
|
19890
19827
|
}
|
|
19891
19828
|
else {
|
|
19892
|
-
if (
|
|
19829
|
+
if (document.getElementById(parent.element.id + '_toolbar')) {
|
|
19893
19830
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
19894
|
-
var toolbar_7 = getComponent(
|
|
19831
|
+
var toolbar_7 = getComponent(parent.element.id + '_toolbar', 'toolbar');
|
|
19895
19832
|
toolbar_7.refreshOverflow();
|
|
19896
19833
|
}
|
|
19897
19834
|
}
|
|
@@ -19915,10 +19852,10 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19915
19852
|
];
|
|
19916
19853
|
var strokeWidthBtn = document.getElementById(parent.element.id + '_startBtn');
|
|
19917
19854
|
var spanElem = document.createElement('span');
|
|
19918
|
-
if (isNullOrUndefined(
|
|
19919
|
-
|
|
19855
|
+
if (isNullOrUndefined(parent.activeObj.start)) {
|
|
19856
|
+
parent.activeObj.start = 'none';
|
|
19920
19857
|
}
|
|
19921
|
-
spanElem.innerHTML =
|
|
19858
|
+
spanElem.innerHTML = parent.pascalToSplitWords(parent.activeObj.start);
|
|
19922
19859
|
spanElem.className = 'e-shape-start';
|
|
19923
19860
|
strokeWidthBtn.appendChild(spanElem);
|
|
19924
19861
|
// Initialize the DropDownButton component.
|
|
@@ -19955,10 +19892,10 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19955
19892
|
];
|
|
19956
19893
|
var strokeEndBtn = document.getElementById(parent.element.id + '_endBtn');
|
|
19957
19894
|
var spanElem = document.createElement('span');
|
|
19958
|
-
if (isNullOrUndefined(
|
|
19959
|
-
|
|
19895
|
+
if (isNullOrUndefined(parent.activeObj.end)) {
|
|
19896
|
+
parent.activeObj.end = 'arrowSolid';
|
|
19960
19897
|
}
|
|
19961
|
-
spanElem.innerHTML =
|
|
19898
|
+
spanElem.innerHTML = parent.pascalToSplitWords(parent.activeObj.end);
|
|
19962
19899
|
spanElem.className = 'e-shape-end';
|
|
19963
19900
|
strokeEndBtn.appendChild(spanElem);
|
|
19964
19901
|
// Initialize the DropDownButton component.
|
|
@@ -19984,9 +19921,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
19984
19921
|
ToolbarModule.prototype.getTextToolbarItem = function (items) {
|
|
19985
19922
|
var parent = this.parent;
|
|
19986
19923
|
var toolbarItems = [];
|
|
19987
|
-
if (isNullOrUndefined(parent.toolbar) || (
|
|
19924
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar)) {
|
|
19988
19925
|
toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
|
|
19989
|
-
template: '<button id="' +
|
|
19926
|
+
template: '<button id="' + parent.element.id + '_annotationBtn"></button>' });
|
|
19990
19927
|
}
|
|
19991
19928
|
if (items.indexOf('fontFamily') > -1) {
|
|
19992
19929
|
toolbarItems.push({ id: parent.element.id + '_fontFamily', cssClass: 'top-icon e-img-font-family',
|
|
@@ -20071,7 +20008,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20071
20008
|
}
|
|
20072
20009
|
parent.trigger('toolbarCreated', { toolbarType: 'text' });
|
|
20073
20010
|
if (Browser.isDevice) {
|
|
20074
|
-
if (_this.defToolbarItems.length > 0 &&
|
|
20011
|
+
if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
20075
20012
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20076
20013
|
toolbar.refreshOverflow();
|
|
20077
20014
|
toolbar.refreshOverflow();
|
|
@@ -20080,7 +20017,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20080
20017
|
}
|
|
20081
20018
|
else {
|
|
20082
20019
|
_this.createLeftToolbarControls();
|
|
20083
|
-
if (_this.defToolbarItems.length > 0 &&
|
|
20020
|
+
if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
20084
20021
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20085
20022
|
toolbar.refreshOverflow();
|
|
20086
20023
|
}
|
|
@@ -20096,9 +20033,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20096
20033
|
this.enableDisableTbrBtn();
|
|
20097
20034
|
};
|
|
20098
20035
|
ToolbarModule.prototype.createTextColor = function (items) {
|
|
20099
|
-
var _this = this;
|
|
20100
20036
|
var parent = this.parent;
|
|
20101
|
-
if (items.indexOf('fontColor') > -1 &&
|
|
20037
|
+
if (items.indexOf('fontColor') > -1 && parent.element.querySelector('.e-template.e-text-font-color')) {
|
|
20102
20038
|
parent.element.querySelector('.e-template.e-text-font-color').appendChild(parent.createElement('input', {
|
|
20103
20039
|
id: parent.element.id + '_text_font'
|
|
20104
20040
|
}));
|
|
@@ -20106,7 +20042,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20106
20042
|
modeSwitcher: false, value: '#fff',
|
|
20107
20043
|
showButtons: false, mode: 'Palette', cssClass: 'e-text-fontt-color',
|
|
20108
20044
|
change: function (args) {
|
|
20109
|
-
|
|
20045
|
+
parent.updateFontColor(args.currentValue.hex);
|
|
20110
20046
|
strokeDDB_2.element.children[0].style.backgroundColor = args.currentValue.rgba;
|
|
20111
20047
|
strokeDDB_2.toggle();
|
|
20112
20048
|
}
|
|
@@ -20140,7 +20076,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20140
20076
|
spanElem_2.innerHTML = 'Arial';
|
|
20141
20077
|
}
|
|
20142
20078
|
spanElem_2.className = 'e-text-font-family';
|
|
20143
|
-
if (
|
|
20079
|
+
if (fontNameBtn) {
|
|
20144
20080
|
fontNameBtn.appendChild(spanElem_2);
|
|
20145
20081
|
}
|
|
20146
20082
|
var fontFamilyBtn_1 = new DropDownButton({ items: this.getFontFamilyItems(),
|
|
@@ -20201,24 +20137,25 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20201
20137
|
}
|
|
20202
20138
|
};
|
|
20203
20139
|
ToolbarModule.prototype.refreshToolbar = function (type, isApplyBtn, isCropping, isZooming, cType) {
|
|
20204
|
-
|
|
20140
|
+
var parent = this.parent;
|
|
20141
|
+
if (!parent.isImageLoaded || parent.isCropToolbar) {
|
|
20205
20142
|
return;
|
|
20206
20143
|
}
|
|
20207
20144
|
var args = { toolbarType: type };
|
|
20208
20145
|
if (type !== 'filter' && type !== 'color') {
|
|
20209
|
-
if (document.getElementById(
|
|
20210
|
-
getComponent(document.getElementById(
|
|
20211
|
-
document.getElementById(
|
|
20146
|
+
if (document.getElementById(parent.element.id + '_toolbar') && this.defToolbarItems.length > 0) {
|
|
20147
|
+
getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
|
|
20148
|
+
document.getElementById(parent.element.id + '_toolbar').innerHTML = '';
|
|
20212
20149
|
}
|
|
20213
|
-
if (document.getElementById(
|
|
20214
|
-
if (document.getElementById(
|
|
20215
|
-
getComponent(document.getElementById(
|
|
20216
|
-
document.getElementById(
|
|
20150
|
+
if (document.getElementById(parent.element.id + '_bottomToolbar') && this.defToolbarItems.length > 0) {
|
|
20151
|
+
if (document.getElementById(parent.element.id + '_bottomToolbar').className.indexOf('e-control') > -1) {
|
|
20152
|
+
getComponent(document.getElementById(parent.element.id + '_bottomToolbar'), 'toolbar').destroy();
|
|
20153
|
+
document.getElementById(parent.element.id + '_bottomToolbar').innerHTML = '';
|
|
20217
20154
|
}
|
|
20218
20155
|
}
|
|
20219
20156
|
}
|
|
20220
20157
|
this.refreshSlider();
|
|
20221
|
-
|
|
20158
|
+
parent.isCropTab = false;
|
|
20222
20159
|
switch (type) {
|
|
20223
20160
|
case 'main':
|
|
20224
20161
|
if (Browser.isDevice) {
|
|
@@ -20245,16 +20182,16 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20245
20182
|
if (Browser.isDevice) {
|
|
20246
20183
|
this.initMainToolbar(false, true, true);
|
|
20247
20184
|
}
|
|
20248
|
-
if (
|
|
20185
|
+
if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'path') {
|
|
20249
20186
|
args.toolbarItems = ['strokeColor', 'strokeWidth', 'duplicate', 'remove'];
|
|
20250
20187
|
}
|
|
20251
|
-
else if (
|
|
20188
|
+
else if (parent.activeObj.shape === 'arrow') {
|
|
20252
20189
|
args.toolbarItems = ['strokeColor', 'strokeWidth', 'start', 'end', 'duplicate', 'remove'];
|
|
20253
20190
|
}
|
|
20254
20191
|
else {
|
|
20255
20192
|
args.toolbarItems = ['fillColor', 'strokeColor', 'strokeWidth', 'duplicate', 'remove'];
|
|
20256
20193
|
}
|
|
20257
|
-
|
|
20194
|
+
parent.trigger('toolbarUpdating', args);
|
|
20258
20195
|
this.initShapesToolbarItem(args.toolbarItems);
|
|
20259
20196
|
break;
|
|
20260
20197
|
case 'text':
|
|
@@ -20262,7 +20199,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20262
20199
|
this.initMainToolbar(false, true, true);
|
|
20263
20200
|
}
|
|
20264
20201
|
args.toolbarItems = ['fontFamily', 'fontSize', 'fontColor', 'bold', 'italic', 'duplicate', 'remove', 'text'];
|
|
20265
|
-
|
|
20202
|
+
parent.trigger('toolbarUpdating', args);
|
|
20266
20203
|
this.initTextToolbarItem(args.toolbarItems);
|
|
20267
20204
|
break;
|
|
20268
20205
|
case 'pen':
|
|
@@ -20270,7 +20207,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20270
20207
|
this.initMainToolbar(false, true, true);
|
|
20271
20208
|
}
|
|
20272
20209
|
args.toolbarItems = ['strokeColor', 'strokeWidth', 'remove'];
|
|
20273
|
-
|
|
20210
|
+
parent.trigger('toolbarUpdating', args);
|
|
20274
20211
|
this.initPenToolbarItem(args.toolbarItems);
|
|
20275
20212
|
break;
|
|
20276
20213
|
case 'adjustment':
|
|
@@ -20286,11 +20223,11 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20286
20223
|
this.updateContextualToolbar(type, cType);
|
|
20287
20224
|
break;
|
|
20288
20225
|
case 'croptransform':
|
|
20289
|
-
|
|
20226
|
+
parent.isCropTab = true;
|
|
20290
20227
|
if (Browser.isDevice) {
|
|
20291
20228
|
this.initMainToolbar(false, true, true);
|
|
20292
20229
|
}
|
|
20293
|
-
|
|
20230
|
+
parent.updateCropTransformItems();
|
|
20294
20231
|
this.initCropTransformToolbar();
|
|
20295
20232
|
break;
|
|
20296
20233
|
}
|
|
@@ -20299,32 +20236,33 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20299
20236
|
};
|
|
20300
20237
|
ToolbarModule.prototype.getAdjustmentToolbarItem = function () {
|
|
20301
20238
|
var toolbarItems = [];
|
|
20302
|
-
|
|
20303
|
-
|
|
20239
|
+
var parent = this.parent;
|
|
20240
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Brightness') > -1)) {
|
|
20241
|
+
toolbarItems.push({ id: parent.element.id + '_brightness', prefixIcon: 'e-icons e-brightness', cssClass: 'top-icon e-brightness',
|
|
20304
20242
|
tooltipText: this.l10n.getConstant('Brightness'), align: 'Center' });
|
|
20305
20243
|
}
|
|
20306
|
-
if (isNullOrUndefined(
|
|
20307
|
-
toolbarItems.push({ id:
|
|
20244
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Contrast') > -1)) {
|
|
20245
|
+
toolbarItems.push({ id: parent.element.id + '_contrast', prefixIcon: 'e-icons e-contrast', cssClass: 'top-icon e-contrast',
|
|
20308
20246
|
tooltipText: this.l10n.getConstant('Contrast'), align: 'Center' });
|
|
20309
20247
|
}
|
|
20310
|
-
if (isNullOrUndefined(
|
|
20311
|
-
toolbarItems.push({ id:
|
|
20248
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Hue') > -1)) {
|
|
20249
|
+
toolbarItems.push({ id: parent.element.id + '_hue', prefixIcon: 'e-icons e-fade', cssClass: 'top-icon e-fade',
|
|
20312
20250
|
tooltipText: this.l10n.getConstant('Hue'), align: 'Center' });
|
|
20313
20251
|
}
|
|
20314
|
-
if (isNullOrUndefined(
|
|
20315
|
-
toolbarItems.push({ id:
|
|
20252
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Saturation') > -1)) {
|
|
20253
|
+
toolbarItems.push({ id: parent.element.id + '_saturation', prefixIcon: 'e-icons e-saturation', cssClass: 'top-icon e-saturation',
|
|
20316
20254
|
tooltipText: this.l10n.getConstant('Saturation'), align: 'Center' });
|
|
20317
20255
|
}
|
|
20318
|
-
if (isNullOrUndefined(
|
|
20319
|
-
toolbarItems.push({ id:
|
|
20256
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Exposure') > -1)) {
|
|
20257
|
+
toolbarItems.push({ id: parent.element.id + '_exposure', prefixIcon: 'e-icons e-grain', cssClass: 'top-icon e-grain',
|
|
20320
20258
|
tooltipText: this.l10n.getConstant('Exposure'), align: 'Center' });
|
|
20321
20259
|
}
|
|
20322
|
-
if (isNullOrUndefined(
|
|
20323
|
-
toolbarItems.push({ id:
|
|
20260
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Opacity') > -1)) {
|
|
20261
|
+
toolbarItems.push({ id: parent.element.id + '_opacity', prefixIcon: 'e-icons e-opacity', cssClass: 'top-icon e-opacity',
|
|
20324
20262
|
tooltipText: this.l10n.getConstant('Opacity'), align: 'Center' });
|
|
20325
20263
|
}
|
|
20326
|
-
if (isNullOrUndefined(
|
|
20327
|
-
toolbarItems.push({ id:
|
|
20264
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Blur') > -1)) {
|
|
20265
|
+
toolbarItems.push({ id: parent.element.id + '_blur', prefixIcon: 'e-icons e-tint', cssClass: 'top-icon e-tint',
|
|
20328
20266
|
tooltipText: this.l10n.getConstant('Blur'), align: 'Center' });
|
|
20329
20267
|
}
|
|
20330
20268
|
var tempToolbarItems = this.processToolbar('center');
|
|
@@ -20332,49 +20270,50 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20332
20270
|
toolbarItems.push(tempToolbarItems[i]);
|
|
20333
20271
|
}
|
|
20334
20272
|
if (!Browser.isDevice) {
|
|
20335
|
-
toolbarItems.push({ id:
|
|
20273
|
+
toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
20336
20274
|
tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
|
|
20337
|
-
toolbarItems.push({ id:
|
|
20275
|
+
toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
20338
20276
|
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
20339
20277
|
}
|
|
20340
20278
|
return toolbarItems;
|
|
20341
20279
|
};
|
|
20342
20280
|
ToolbarModule.prototype.getFilterToolbarItem = function () {
|
|
20343
20281
|
var toolbarItems = [];
|
|
20344
|
-
|
|
20345
|
-
|
|
20282
|
+
var parent = this.parent;
|
|
20283
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Default') > -1)) {
|
|
20284
|
+
toolbarItems.push({ id: parent.element.id + '_default', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
20346
20285
|
tooltipText: this.l10n.getConstant('Default'), align: 'Center',
|
|
20347
|
-
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' +
|
|
20286
|
+
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>' });
|
|
20348
20287
|
}
|
|
20349
|
-
if (isNullOrUndefined(
|
|
20350
|
-
toolbarItems.push({ id:
|
|
20288
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Chrome') > -1)) {
|
|
20289
|
+
toolbarItems.push({ id: parent.element.id + '_chrome', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
20351
20290
|
tooltipText: this.l10n.getConstant('Chrome'), align: 'Center',
|
|
20352
|
-
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' +
|
|
20291
|
+
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>' });
|
|
20353
20292
|
}
|
|
20354
|
-
if (isNullOrUndefined(
|
|
20355
|
-
toolbarItems.push({ id:
|
|
20293
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Cold') > -1)) {
|
|
20294
|
+
toolbarItems.push({ id: parent.element.id + '_cold', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
20356
20295
|
tooltipText: this.l10n.getConstant('Cold'), align: 'Center',
|
|
20357
|
-
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' +
|
|
20296
|
+
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>' });
|
|
20358
20297
|
}
|
|
20359
|
-
if (isNullOrUndefined(
|
|
20360
|
-
toolbarItems.push({ id:
|
|
20298
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Warm') > -1)) {
|
|
20299
|
+
toolbarItems.push({ id: parent.element.id + '_warm', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
20361
20300
|
tooltipText: this.l10n.getConstant('Warm'), align: 'Center',
|
|
20362
|
-
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' +
|
|
20301
|
+
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>' });
|
|
20363
20302
|
}
|
|
20364
|
-
if (isNullOrUndefined(
|
|
20365
|
-
toolbarItems.push({ id:
|
|
20303
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Grayscale') > -1)) {
|
|
20304
|
+
toolbarItems.push({ id: parent.element.id + '_grayscale', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
20366
20305
|
tooltipText: this.l10n.getConstant('Grayscale'), align: 'Center',
|
|
20367
|
-
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' +
|
|
20306
|
+
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>' });
|
|
20368
20307
|
}
|
|
20369
|
-
if (isNullOrUndefined(
|
|
20370
|
-
toolbarItems.push({ id:
|
|
20308
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Sepia') > -1)) {
|
|
20309
|
+
toolbarItems.push({ id: parent.element.id + '_sepia', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
20371
20310
|
tooltipText: this.l10n.getConstant('Sepia'), align: 'Center',
|
|
20372
|
-
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' +
|
|
20311
|
+
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>' });
|
|
20373
20312
|
}
|
|
20374
|
-
if (isNullOrUndefined(
|
|
20375
|
-
toolbarItems.push({ id:
|
|
20313
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Invert') > -1)) {
|
|
20314
|
+
toolbarItems.push({ id: parent.element.id + '_invert', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
20376
20315
|
tooltipText: this.l10n.getConstant('Invert'), align: 'Center',
|
|
20377
|
-
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' +
|
|
20316
|
+
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>' });
|
|
20378
20317
|
}
|
|
20379
20318
|
var tempToolbarItems = this.processToolbar('center');
|
|
20380
20319
|
for (var i = 0, len = tempToolbarItems.length; i < len; i++) {
|
|
@@ -20385,20 +20324,20 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20385
20324
|
ToolbarModule.prototype.getPenToolbarItem = function (items) {
|
|
20386
20325
|
var parent = this.parent;
|
|
20387
20326
|
var toolbarItems = [];
|
|
20388
|
-
if (isNullOrUndefined(parent.toolbar) ||
|
|
20327
|
+
if (isNullOrUndefined(parent.toolbar) || parent.toolbar) {
|
|
20389
20328
|
toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
|
|
20390
|
-
template: '<button id="' +
|
|
20329
|
+
template: '<button id="' + parent.element.id + '_annotationBtn"></button>' });
|
|
20391
20330
|
}
|
|
20392
20331
|
if (items.indexOf('strokeColor') > -1) {
|
|
20393
|
-
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id:
|
|
20332
|
+
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: parent.element.id + '_pen_strokecolor',
|
|
20394
20333
|
cssClass: 'top-icon e-pen-stroke-color',
|
|
20395
20334
|
tooltipText: this.l10n.getConstant('StrokeColor'), align: 'Center', type: 'Input',
|
|
20396
|
-
template: '<button id="' +
|
|
20335
|
+
template: '<button id="' + parent.element.id + '_penColorBtn"></button>' });
|
|
20397
20336
|
}
|
|
20398
20337
|
if (items.indexOf('strokeWidth') > -1) {
|
|
20399
20338
|
toolbarItems.push({ prefixIcon: 'e-icons e-copy', cssClass: 'top-icon e-size',
|
|
20400
20339
|
tooltipText: this.l10n.getConstant('StrokeWidth'),
|
|
20401
|
-
align: 'Center', type: 'Input', template: '<button id="' +
|
|
20340
|
+
align: 'Center', type: 'Input', template: '<button id="' + parent.element.id + '_penStrokeWidth"></button>' });
|
|
20402
20341
|
}
|
|
20403
20342
|
toolbarItems.push({ align: 'Center', type: 'Separator' });
|
|
20404
20343
|
if (items.indexOf('remove') > -1) {
|
|
@@ -20410,15 +20349,16 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20410
20349
|
toolbarItems.push(tempToolbarItems[i]);
|
|
20411
20350
|
}
|
|
20412
20351
|
if (!Browser.isDevice) {
|
|
20413
|
-
toolbarItems.push({ id:
|
|
20352
|
+
toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
20414
20353
|
tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
|
|
20415
|
-
toolbarItems.push({ id:
|
|
20354
|
+
toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
20416
20355
|
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
20417
20356
|
}
|
|
20418
20357
|
return toolbarItems;
|
|
20419
20358
|
};
|
|
20420
20359
|
ToolbarModule.prototype.initPenToolbarItem = function (items) {
|
|
20421
20360
|
var _this = this;
|
|
20361
|
+
var parent = this.parent;
|
|
20422
20362
|
var leftItem = this.getLeftToolbarItem();
|
|
20423
20363
|
var rightItem = this.getRightToolbarItem();
|
|
20424
20364
|
var mainItem = this.getPenToolbarItem(items);
|
|
@@ -20441,9 +20381,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20441
20381
|
if (!Browser.isDevice) {
|
|
20442
20382
|
_this.renderSaveBtn();
|
|
20443
20383
|
}
|
|
20444
|
-
|
|
20384
|
+
parent.trigger('toolbarCreated', { toolbarType: 'pen' });
|
|
20445
20385
|
if (Browser.isDevice) {
|
|
20446
|
-
if (_this.defToolbarItems.length > 0 &&
|
|
20386
|
+
if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
20447
20387
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20448
20388
|
toolbar.refreshOverflow();
|
|
20449
20389
|
toolbar.refreshOverflow();
|
|
@@ -20451,7 +20391,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20451
20391
|
}
|
|
20452
20392
|
else {
|
|
20453
20393
|
_this.createLeftToolbarControls();
|
|
20454
|
-
if (_this.defToolbarItems.length > 0 &&
|
|
20394
|
+
if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
20455
20395
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20456
20396
|
toolbar.refreshOverflow();
|
|
20457
20397
|
}
|
|
@@ -20459,17 +20399,16 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20459
20399
|
}
|
|
20460
20400
|
});
|
|
20461
20401
|
if (Browser.isDevice) {
|
|
20462
|
-
toolbar.appendTo('#' +
|
|
20402
|
+
toolbar.appendTo('#' + parent.element.id + '_bottomToolbar');
|
|
20463
20403
|
}
|
|
20464
20404
|
else {
|
|
20465
|
-
toolbar.appendTo('#' +
|
|
20405
|
+
toolbar.appendTo('#' + parent.element.id + '_toolbar');
|
|
20466
20406
|
}
|
|
20467
20407
|
this.enableDisableTbrBtn();
|
|
20468
20408
|
};
|
|
20469
20409
|
ToolbarModule.prototype.createPenColor = function (items) {
|
|
20470
20410
|
var _this = this;
|
|
20471
20411
|
var parent = this.parent;
|
|
20472
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
20473
20412
|
if (items.indexOf('strokeColor') > -1) {
|
|
20474
20413
|
parent.element.querySelector('.e-template.e-pen-stroke-color').appendChild(parent.createElement('input', {
|
|
20475
20414
|
id: parent.element.id + '_pen_stroke'
|
|
@@ -20478,7 +20417,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20478
20417
|
modeSwitcher: false, value: '#fff',
|
|
20479
20418
|
showButtons: false, mode: 'Palette', cssClass: 'e-pen-color',
|
|
20480
20419
|
change: function (args) {
|
|
20481
|
-
|
|
20420
|
+
parent.updatePenStrokeColor(args.currentValue.hex);
|
|
20482
20421
|
_this.selFhdColor = args.currentValue.hex;
|
|
20483
20422
|
strokeDDB_3.element.children[0].style.backgroundColor = args.currentValue.rgba;
|
|
20484
20423
|
strokeDDB_3.toggle();
|
|
@@ -20501,7 +20440,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20501
20440
|
var indexObj = { freehandSelectedIndex: null };
|
|
20502
20441
|
parent.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
|
|
20503
20442
|
if (!isNullOrUndefined(indexObj['freehandSelectedIndex']) && indexObj['freehandSelectedIndex'] > -1) {
|
|
20504
|
-
|
|
20443
|
+
parent.element.querySelector('.e-pen-stroke-color.e-template .e-dropdownbtn-preview').style.background
|
|
20505
20444
|
= this.selFhdColor === '#42a5f5' ? obj['tempFreeHandDrawEditingStyles'].strokeColor :
|
|
20506
20445
|
parent.pointColl[indexObj['freehandSelectedIndex']].strokeColor;
|
|
20507
20446
|
}
|
|
@@ -20512,7 +20451,6 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20512
20451
|
}
|
|
20513
20452
|
};
|
|
20514
20453
|
ToolbarModule.prototype.createPenBtn = function (items) {
|
|
20515
|
-
var _this = this;
|
|
20516
20454
|
var parent = this.parent;
|
|
20517
20455
|
var strokeWidthItems = [
|
|
20518
20456
|
{ id: '1', text: this.l10n.getConstant('XSmall') },
|
|
@@ -20546,16 +20484,16 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20546
20484
|
},
|
|
20547
20485
|
select: function (args) {
|
|
20548
20486
|
spanElem_3.textContent = args.item.text;
|
|
20549
|
-
|
|
20487
|
+
parent.updatePenStrokeWidth(args.item.id);
|
|
20550
20488
|
if (Browser.isDevice) {
|
|
20551
|
-
if (
|
|
20489
|
+
if (document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
20552
20490
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20553
20491
|
var toolbar_8 = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
|
|
20554
20492
|
toolbar_8.refreshOverflow();
|
|
20555
20493
|
}
|
|
20556
20494
|
}
|
|
20557
20495
|
else {
|
|
20558
|
-
if (
|
|
20496
|
+
if (document.getElementById(parent.element.id + '_toolbar')) {
|
|
20559
20497
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20560
20498
|
var toolbar_9 = getComponent(parent.element.id + '_toolbar', 'toolbar');
|
|
20561
20499
|
toolbar_9.refreshOverflow();
|
|
@@ -20604,14 +20542,14 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20604
20542
|
_this.renderSaveBtn();
|
|
20605
20543
|
}
|
|
20606
20544
|
if (Browser.isDevice) {
|
|
20607
|
-
if (_this.defToolbarItems.length > 0 &&
|
|
20545
|
+
if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
20608
20546
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20609
20547
|
toolbar.refreshOverflow();
|
|
20610
20548
|
}
|
|
20611
20549
|
}
|
|
20612
20550
|
else {
|
|
20613
20551
|
_this.createLeftToolbarControls();
|
|
20614
|
-
if (_this.defToolbarItems.length > 0 &&
|
|
20552
|
+
if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
20615
20553
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20616
20554
|
toolbar.refreshOverflow();
|
|
20617
20555
|
}
|
|
@@ -20630,8 +20568,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20630
20568
|
var _this = this;
|
|
20631
20569
|
var parent = this.parent;
|
|
20632
20570
|
var mainItem = this.getFilterToolbarItem();
|
|
20633
|
-
if (document.querySelector('#' +
|
|
20634
|
-
getComponent(document.getElementById(
|
|
20571
|
+
if (document.querySelector('#' + parent.element.id + '_contextualToolbar').classList.contains('e-control')) {
|
|
20572
|
+
getComponent(document.getElementById(parent.element.id + '_contextualToolbar'), 'toolbar').destroy();
|
|
20635
20573
|
}
|
|
20636
20574
|
var toolbar = new Toolbar({
|
|
20637
20575
|
width: '100%',
|
|
@@ -20641,7 +20579,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20641
20579
|
_this.updatePrivateVariables();
|
|
20642
20580
|
_this.createCanvasFilter();
|
|
20643
20581
|
if (parent.currentFilter === '') {
|
|
20644
|
-
parent.currentFilter =
|
|
20582
|
+
parent.currentFilter = parent.element.id + '_default';
|
|
20645
20583
|
}
|
|
20646
20584
|
var hdrWrapper = document.querySelector('#' + parent.element.id + '_headWrapper');
|
|
20647
20585
|
if (hdrWrapper) {
|
|
@@ -20652,10 +20590,12 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20652
20590
|
toolbar.refreshOverflow();
|
|
20653
20591
|
}
|
|
20654
20592
|
});
|
|
20655
|
-
toolbar.appendTo('#' +
|
|
20593
|
+
toolbar.appendTo('#' + parent.element.id + '_contextualToolbar');
|
|
20656
20594
|
};
|
|
20657
20595
|
ToolbarModule.prototype.createCanvasFilter = function () {
|
|
20658
20596
|
var parent = this.parent;
|
|
20597
|
+
showSpinner(parent.element);
|
|
20598
|
+
parent.element.style.opacity = '0.5';
|
|
20659
20599
|
var imageData = parent.getCurrentCanvasData();
|
|
20660
20600
|
this.inMemoryCanvas.width = imageData.width;
|
|
20661
20601
|
this.inMemoryCanvas.height = imageData.height;
|
|
@@ -20667,16 +20607,19 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20667
20607
|
this.updateFilterCanvas('_grayscaleCanvas', 'grayscale');
|
|
20668
20608
|
this.updateFilterCanvas('_sepiaCanvas', 'sepia');
|
|
20669
20609
|
this.updateFilterCanvas('_invertCanvas', 'invert');
|
|
20610
|
+
hideSpinner(parent.element);
|
|
20611
|
+
parent.element.style.opacity = '1';
|
|
20670
20612
|
parent.initialAdjustmentValue = this.lowerContext.filter;
|
|
20671
20613
|
};
|
|
20672
20614
|
ToolbarModule.prototype.updateFilterCanvas = function (selector, type) {
|
|
20673
|
-
var
|
|
20674
|
-
|
|
20615
|
+
var parent = this.parent;
|
|
20616
|
+
var filter = parent.element.querySelector('#' + parent.element.id + selector);
|
|
20617
|
+
if (filter) {
|
|
20675
20618
|
var ctx = filter.getContext('2d');
|
|
20676
20619
|
ctx = filter.getContext('2d');
|
|
20677
20620
|
filter.style.width = '100px';
|
|
20678
20621
|
filter.style.height = '100px';
|
|
20679
|
-
|
|
20622
|
+
parent.notify('filter', { prop: 'updateAdj', value: { type: type, value: null, isPreview: true, ctx: ctx } });
|
|
20680
20623
|
ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
|
|
20681
20624
|
}
|
|
20682
20625
|
};
|
|
@@ -20726,47 +20669,51 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20726
20669
|
return orgToolbarItems;
|
|
20727
20670
|
};
|
|
20728
20671
|
ToolbarModule.prototype.renderQAT = function (isPenEdit) {
|
|
20729
|
-
|
|
20730
|
-
|
|
20731
|
-
|
|
20672
|
+
var parent = this.parent;
|
|
20673
|
+
if (parent.activeObj && parent.showQuickAccessToolbar) {
|
|
20674
|
+
var qtArea = document.getElementById(parent.element.id + '_quickAccessToolbarArea');
|
|
20675
|
+
if (qtArea) {
|
|
20732
20676
|
this.destroyQuickAccessToolbar();
|
|
20733
|
-
|
|
20677
|
+
qtArea.style.display = 'block';
|
|
20734
20678
|
}
|
|
20735
20679
|
var items = this.getQuickAccessToolbarItem(isPenEdit);
|
|
20736
20680
|
if (items.length === 0) {
|
|
20737
20681
|
return;
|
|
20738
20682
|
}
|
|
20739
|
-
if (isNullOrUndefined(
|
|
20683
|
+
if (isNullOrUndefined(parent.quickAccessToolbarTemplate)) {
|
|
20740
20684
|
var toolbarObj = new Toolbar({
|
|
20741
20685
|
items: items,
|
|
20742
20686
|
clicked: this.quickAccessToolbarClicked.bind(this)
|
|
20743
20687
|
});
|
|
20744
|
-
toolbarObj.appendTo('#' +
|
|
20688
|
+
toolbarObj.appendTo('#' + parent.element.id + '_quickAccessToolbar');
|
|
20745
20689
|
}
|
|
20746
20690
|
if (isNullOrUndefined(isPenEdit)) {
|
|
20747
20691
|
qtArea.style.width = 'auto';
|
|
20748
|
-
|
|
20749
|
-
|
|
20750
|
-
var x =
|
|
20751
|
-
|
|
20752
|
-
var y =
|
|
20753
|
-
|
|
20754
|
-
var width =
|
|
20755
|
-
if (
|
|
20756
|
-
var
|
|
20692
|
+
parent.activeObj.activePoint.width = Math.abs(parent.activeObj.activePoint.width);
|
|
20693
|
+
parent.activeObj.activePoint.height = Math.abs(parent.activeObj.activePoint.height);
|
|
20694
|
+
var x = parent.activeObj.activePoint.startX < parent.activeObj.activePoint.endX ?
|
|
20695
|
+
parent.activeObj.activePoint.startX : parent.activeObj.activePoint.endX;
|
|
20696
|
+
var y = parent.activeObj.activePoint.startY < parent.activeObj.activePoint.endY ?
|
|
20697
|
+
parent.activeObj.activePoint.startY : parent.activeObj.activePoint.endY;
|
|
20698
|
+
var width = parent.activeObj.activePoint.width;
|
|
20699
|
+
if (parent.activeObj.rotatedAngle !== 0 && parent.activeObj.shape !== 'arrow') {
|
|
20700
|
+
var object = { activePoint: null };
|
|
20701
|
+
parent.notify('shape', { prop: 'getSquarePointForRotatedShape', onPropertyChange: false,
|
|
20702
|
+
value: { obj: parent.activeObj, object: object } });
|
|
20703
|
+
var point = object['activePoint'];
|
|
20757
20704
|
x = point.startX;
|
|
20758
20705
|
y = point.startY;
|
|
20759
20706
|
width = point.width;
|
|
20760
20707
|
}
|
|
20761
|
-
else if (
|
|
20762
|
-
var path =
|
|
20708
|
+
else if (parent.activeObj.shape === 'path') {
|
|
20709
|
+
var path = parent.getSquarePointForPath(parent.activeObj);
|
|
20763
20710
|
x = path.startX;
|
|
20764
20711
|
y = path.startY;
|
|
20765
20712
|
width = path.width;
|
|
20766
20713
|
}
|
|
20767
20714
|
qtArea.style.left = (x + (width / 2)) - (items.length * 25) + 'px';
|
|
20768
|
-
if (y - 60 <
|
|
20769
|
-
qtArea.style.top =
|
|
20715
|
+
if (y - 60 < parent.img.destTop) {
|
|
20716
|
+
qtArea.style.top = parent.img.destTop + 'px';
|
|
20770
20717
|
}
|
|
20771
20718
|
else {
|
|
20772
20719
|
qtArea.style.top = y - 60 + 'px';
|
|
@@ -20775,14 +20722,14 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20775
20722
|
else if (isPenEdit) {
|
|
20776
20723
|
var obj = { activePoint: null };
|
|
20777
20724
|
var indexObj = { freehandSelectedIndex: null };
|
|
20778
|
-
|
|
20779
|
-
|
|
20725
|
+
parent.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
|
|
20726
|
+
parent.notify('freehand-draw', { prop: 'getSqPtFD',
|
|
20780
20727
|
value: { idx: indexObj['freehandSelectedIndex'], obj: obj } });
|
|
20781
20728
|
var point = obj['activePoint'];
|
|
20782
20729
|
qtArea.style.width = 'auto';
|
|
20783
20730
|
qtArea.style.left = (point.startX + (point.width / 2)) - (items.length * 27) + 'px';
|
|
20784
|
-
if (point.startY - 60 <
|
|
20785
|
-
qtArea.style.top =
|
|
20731
|
+
if (point.startY - 60 < parent.img.destTop) {
|
|
20732
|
+
qtArea.style.top = parent.img.destTop + 'px';
|
|
20786
20733
|
}
|
|
20787
20734
|
else {
|
|
20788
20735
|
qtArea.style.top = point.startY - 60 + 'px';
|
|
@@ -20794,8 +20741,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20794
20741
|
if (isNullOrUndefined(isDisabled)) {
|
|
20795
20742
|
return;
|
|
20796
20743
|
}
|
|
20797
|
-
var
|
|
20798
|
-
|
|
20744
|
+
var parent = this.parent;
|
|
20745
|
+
var annotation = document.querySelector('#' + parent.element.id + '_annotationBtn');
|
|
20746
|
+
if (annotation) {
|
|
20799
20747
|
if (isDisabled) {
|
|
20800
20748
|
annotation.classList.add('e-disabled');
|
|
20801
20749
|
annotation.parentElement.classList.add('e-overlay');
|
|
@@ -20806,8 +20754,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20806
20754
|
}
|
|
20807
20755
|
getComponent(annotation, 'dropdown-btn').disabled = isDisabled;
|
|
20808
20756
|
}
|
|
20809
|
-
var transform = document.querySelector('#' +
|
|
20810
|
-
if (
|
|
20757
|
+
var transform = document.querySelector('#' + parent.element.id + '_transformBtn');
|
|
20758
|
+
if (transform) {
|
|
20811
20759
|
if (isDisabled) {
|
|
20812
20760
|
transform.classList.add('e-disabled');
|
|
20813
20761
|
transform.parentElement.classList.add('e-overlay');
|
|
@@ -20818,8 +20766,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20818
20766
|
}
|
|
20819
20767
|
getComponent(transform, 'dropdown-btn').disabled = isDisabled;
|
|
20820
20768
|
}
|
|
20821
|
-
var adjustment = document.querySelector('#' +
|
|
20822
|
-
if (
|
|
20769
|
+
var adjustment = document.querySelector('#' + parent.element.id + '_adjustment');
|
|
20770
|
+
if (adjustment) {
|
|
20823
20771
|
if (isDisabled) {
|
|
20824
20772
|
adjustment.classList.add('e-disabled');
|
|
20825
20773
|
adjustment.parentElement.classList.add('e-overlay');
|
|
@@ -20830,8 +20778,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20830
20778
|
}
|
|
20831
20779
|
getComponent(adjustment, 'btn').disabled = isDisabled;
|
|
20832
20780
|
}
|
|
20833
|
-
var filter = document.querySelector('#' +
|
|
20834
|
-
if (
|
|
20781
|
+
var filter = document.querySelector('#' + parent.element.id + '_filter');
|
|
20782
|
+
if (filter) {
|
|
20835
20783
|
if (isDisabled) {
|
|
20836
20784
|
filter.classList.add('e-disabled');
|
|
20837
20785
|
filter.parentElement.classList.add('e-overlay');
|
|
@@ -20861,7 +20809,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20861
20809
|
ToolbarModule.prototype.quickAccessToolbarClicked = function (args, isContextualToolbar) {
|
|
20862
20810
|
var parent = this.parent;
|
|
20863
20811
|
var points = { x: parent.activeObj.activePoint.startX, y: parent.activeObj.activePoint.startY };
|
|
20864
|
-
if (
|
|
20812
|
+
if (args.item) {
|
|
20865
20813
|
var duplicateObj = void 0;
|
|
20866
20814
|
var objColl = void 0;
|
|
20867
20815
|
var isPreventUndoRedo = null;
|
|
@@ -20874,7 +20822,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20874
20822
|
parent.notify('draw', { prop: 'getNewPath', value: { obj: pathObject } });
|
|
20875
20823
|
switch (args.item.id.replace(parent.element.id + '_', '').toLowerCase()) {
|
|
20876
20824
|
case 'duplicate':
|
|
20877
|
-
if (!
|
|
20825
|
+
if (!parent.element.querySelector('#' + parent.element.id + '_duplicate').classList.contains('e-disabled')) {
|
|
20878
20826
|
if (!pathObject['isNewPath'] && JSON.stringify(object['tempObj']) === JSON.stringify(parent.activeObj)) {
|
|
20879
20827
|
isPreventUndoRedo = true;
|
|
20880
20828
|
}
|
|
@@ -20882,7 +20830,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20882
20830
|
if (isNullOrUndefined(parent.activeObj.currIndex)) {
|
|
20883
20831
|
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: isPreventUndoRedo } });
|
|
20884
20832
|
}
|
|
20885
|
-
else if (
|
|
20833
|
+
else if (obj['prevActObj']) {
|
|
20886
20834
|
parent.activeObj.currIndex = null;
|
|
20887
20835
|
duplicateObj.currIndex = null;
|
|
20888
20836
|
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: isPreventUndoRedo } });
|
|
@@ -20909,19 +20857,19 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20909
20857
|
parent.notify('shape', { prop: 'setPointCollForLineArrow', onPropertyChange: false,
|
|
20910
20858
|
value: { obj: parent.activeObj } });
|
|
20911
20859
|
}
|
|
20912
|
-
// parent.updateTrianglePoints(
|
|
20860
|
+
// parent.updateTrianglePoints(parent.activeObj); Invoke
|
|
20913
20861
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj } });
|
|
20914
20862
|
parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
|
|
20915
20863
|
this.renderQAT();
|
|
20916
20864
|
}
|
|
20917
20865
|
break;
|
|
20918
20866
|
case 'remove':
|
|
20919
|
-
if (!
|
|
20867
|
+
if (!parent.element.querySelector('#' + parent.element.id + '_remove').classList.contains('e-disabled')) {
|
|
20920
20868
|
parent.notify('selection', { prop: 'deleteItem', onPropertyChange: false });
|
|
20921
20869
|
}
|
|
20922
20870
|
break;
|
|
20923
20871
|
case 'edittext':
|
|
20924
|
-
if (!
|
|
20872
|
+
if (!parent.element.querySelector('#' + parent.element.id + '_editText').classList.contains('e-disabled')) {
|
|
20925
20873
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
20926
20874
|
parent.notify('selection', { prop: 'setTempActObj', onPropertyChange: false,
|
|
20927
20875
|
value: { obj: extend({}, parent.activeObj, {}, true) } });
|
|
@@ -20938,10 +20886,10 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20938
20886
|
if (isNullOrUndefined(parent.activeObj.currIndex)) {
|
|
20939
20887
|
parent.notify('draw', { prop: 'setShapeTextInsert', onPropertyChange: false, value: { bool: true } });
|
|
20940
20888
|
}
|
|
20941
|
-
else if (
|
|
20889
|
+
else if (obj['prevActObj']) {
|
|
20942
20890
|
parent.notify('draw', { prop: 'setShapeTextInsert', onPropertyChange: false, value: { bool: true } });
|
|
20943
20891
|
}
|
|
20944
|
-
if (
|
|
20892
|
+
if (document.getElementById(parent.element.id + '_quickAccessToolbarArea')) {
|
|
20945
20893
|
document.getElementById(parent.element.id + '_quickAccessToolbarArea').style.display = 'none';
|
|
20946
20894
|
}
|
|
20947
20895
|
}
|
|
@@ -20962,7 +20910,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20962
20910
|
}
|
|
20963
20911
|
parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
20964
20912
|
}
|
|
20965
|
-
if (
|
|
20913
|
+
if (args.item) {
|
|
20966
20914
|
var type = args.item.id.replace(parent.element.id + '_', '').toLowerCase();
|
|
20967
20915
|
if (type === 'duplicate' || type === 'remove' || type === 'edittext') {
|
|
20968
20916
|
this.quickAccessToolbarClicked(args, true);
|
|
@@ -20972,11 +20920,11 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20972
20920
|
var isDisabledFilter = false;
|
|
20973
20921
|
var isDisabledAdjustment = false;
|
|
20974
20922
|
var adjustment = document.querySelector('#' + parent.element.id + '_adjustment');
|
|
20975
|
-
if (
|
|
20923
|
+
if (adjustment && adjustment.classList.contains('e-disabled')) {
|
|
20976
20924
|
isDisabledAdjustment = true;
|
|
20977
20925
|
}
|
|
20978
20926
|
var filter = document.querySelector('#' + parent.element.id + '_filter');
|
|
20979
|
-
if (
|
|
20927
|
+
if (filter && filter.classList.contains('e-disabled')) {
|
|
20980
20928
|
isDisabledFilter = true;
|
|
20981
20929
|
}
|
|
20982
20930
|
this.enableDisableTbrBtn();
|
|
@@ -21021,18 +20969,18 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
21021
20969
|
}
|
|
21022
20970
|
}
|
|
21023
20971
|
else {
|
|
21024
|
-
panBtn =
|
|
21025
|
-
if (
|
|
20972
|
+
panBtn = parent.element.querySelector('.e-img-pan .e-btn');
|
|
20973
|
+
if (panBtn) {
|
|
21026
20974
|
panBtn.classList.add('e-selected-btn');
|
|
21027
20975
|
}
|
|
21028
20976
|
parent.pan(true);
|
|
21029
20977
|
parent.notify('transform', { prop: 'setDisablePan', onPropertyChange: false, value: { bool: false } });
|
|
21030
20978
|
}
|
|
21031
|
-
if (
|
|
20979
|
+
if (zoomIn && parent.zoomSettings.zoomFactor >= parent.zoomSettings.maxZoomFactor) {
|
|
21032
20980
|
zoomIn.classList.add('e-disabled');
|
|
21033
20981
|
zoomIn.parentElement.classList.add('e-overlay');
|
|
21034
20982
|
}
|
|
21035
|
-
else if (
|
|
20983
|
+
else if (zoomIn) {
|
|
21036
20984
|
zoomIn.classList.remove('e-disabled');
|
|
21037
20985
|
zoomIn.parentElement.classList.remove('e-overlay');
|
|
21038
20986
|
}
|
|
@@ -21047,19 +20995,6 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
21047
20995
|
this.currentToolbar = 'main';
|
|
21048
20996
|
break;
|
|
21049
20997
|
case 'crop':
|
|
21050
|
-
if (!isNullOrUndefined(parent.currSelectionPoint)) {
|
|
21051
|
-
if (parent.currObjType.isUndoAction) {
|
|
21052
|
-
parent.notify('undo-redo', { prop: 'refreshUrc', value: { bool: null } });
|
|
21053
|
-
}
|
|
21054
|
-
if (!isNullOrUndefined(parent.cropObj.activeObj.shape)) {
|
|
21055
|
-
parent.select(parent.activeObj.shape);
|
|
21056
|
-
}
|
|
21057
|
-
this.refreshToolbar('main', true, true);
|
|
21058
|
-
getComponent(parent.element.querySelector('#' + this.parent.element.id + '_cropBtn'), 'dropdown-btn').toggle();
|
|
21059
|
-
if (!isNullOrUndefined(parent.activeObj.shape)) {
|
|
21060
|
-
document.getElementById(parent.activeObj.shape.split('-')[1]).classList.add('e-selected');
|
|
21061
|
-
}
|
|
21062
|
-
}
|
|
21063
20998
|
parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
|
|
21064
20999
|
break;
|
|
21065
21000
|
case 'reset':
|
|
@@ -21173,7 +21108,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
21173
21108
|
case 'rotateright':
|
|
21174
21109
|
case 'horizontalflip':
|
|
21175
21110
|
case 'verticalflip':
|
|
21176
|
-
|
|
21111
|
+
parent.transformSelect(type);
|
|
21177
21112
|
parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
|
|
21178
21113
|
break;
|
|
21179
21114
|
case 'save':
|
|
@@ -21198,7 +21133,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
21198
21133
|
}
|
|
21199
21134
|
var type = args.item.id.replace(parent.element.id, '').split('_')[1];
|
|
21200
21135
|
var imageFiltering = { filter: parent.toPascalCase(type), cancel: false };
|
|
21201
|
-
|
|
21136
|
+
parent.trigger('imageFiltering', imageFiltering);
|
|
21202
21137
|
if (imageFiltering.cancel) {
|
|
21203
21138
|
return;
|
|
21204
21139
|
}
|
|
@@ -21209,11 +21144,12 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
21209
21144
|
this.enableDisableTbrBtn();
|
|
21210
21145
|
};
|
|
21211
21146
|
ToolbarModule.prototype.refreshShapeDrawing = function () {
|
|
21147
|
+
var parent = this.parent;
|
|
21212
21148
|
var object = { shape: '' };
|
|
21213
|
-
|
|
21149
|
+
parent.notify('selection', { prop: 'getCurrentDrawingShape', onPropertyChange: false, value: { obj: object } });
|
|
21214
21150
|
if (object['shape'] !== '') {
|
|
21215
|
-
|
|
21216
|
-
|
|
21151
|
+
parent.notify('selection', { prop: 'setCurrentDrawingShape', onPropertyChange: false, value: { value: '' } });
|
|
21152
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
21217
21153
|
this.refreshToolbar('main', false);
|
|
21218
21154
|
}
|
|
21219
21155
|
};
|
|
@@ -21292,9 +21228,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
21292
21228
|
ToolbarModule.prototype.closeContextualToolbar = function () {
|
|
21293
21229
|
var parent = this.parent;
|
|
21294
21230
|
var isContextualToolbar = false;
|
|
21295
|
-
if ((
|
|
21231
|
+
if ((parent.element.querySelector('#' + parent.element.id + '_contextualToolbar') &&
|
|
21296
21232
|
!parent.element.querySelector('#' + parent.element.id + '_contextualToolbar').parentElement.classList.contains('e-hide')) ||
|
|
21297
|
-
(
|
|
21233
|
+
(parent.element.querySelector('#' + parent.element.id + '_headWrapper')
|
|
21298
21234
|
&& !parent.element.querySelector('#' + parent.element.id + '_headWrapper').parentElement.classList.contains('e-hide'))) {
|
|
21299
21235
|
parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
21300
21236
|
parent.okBtn();
|
|
@@ -21305,12 +21241,13 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
21305
21241
|
};
|
|
21306
21242
|
ToolbarModule.prototype.destroyQuickAccessToolbar = function () {
|
|
21307
21243
|
var parent = this.parent;
|
|
21308
|
-
|
|
21309
|
-
|
|
21310
|
-
getComponent(
|
|
21244
|
+
var quickToolbar = document.getElementById(parent.element.id + '_quickAccessToolbar');
|
|
21245
|
+
if (quickToolbar && quickToolbar.classList.contains('e-control')) {
|
|
21246
|
+
getComponent(quickToolbar, 'toolbar').destroy();
|
|
21311
21247
|
}
|
|
21312
|
-
|
|
21313
|
-
|
|
21248
|
+
var qatArea = document.getElementById(parent.element.id + '_quickAccessToolbarArea');
|
|
21249
|
+
if (qatArea) {
|
|
21250
|
+
qatArea.style.display = 'none';
|
|
21314
21251
|
}
|
|
21315
21252
|
};
|
|
21316
21253
|
ToolbarModule.prototype.renderSlider = function (type) {
|
|
@@ -21323,7 +21260,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
21323
21260
|
id: parent.element.id + '_headWrapper',
|
|
21324
21261
|
styles: 'position: relative'
|
|
21325
21262
|
}));
|
|
21326
|
-
labelWrapper = hdrWrapper.appendChild(
|
|
21263
|
+
labelWrapper = hdrWrapper.appendChild(parent.createElement('label', {
|
|
21327
21264
|
id: parent.element.id + '_labelWrapper',
|
|
21328
21265
|
styles: Browser.isDevice ? 'position: absolute; top: 25%; left: calc(50% - 150px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
|
|
21329
21266
|
: 'position: absolute; top: 25%; left: calc(50% - 226px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
|
|
@@ -21337,12 +21274,12 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
21337
21274
|
id: parent.element.id + '_sliderWrapper',
|
|
21338
21275
|
styles: 'position: absolute'
|
|
21339
21276
|
}));
|
|
21340
|
-
var value =
|
|
21277
|
+
var value = parent.getCurrAdjustmentValue(type);
|
|
21341
21278
|
var min;
|
|
21342
21279
|
var max;
|
|
21343
21280
|
var slider;
|
|
21344
21281
|
if (type === 'brightness' || type === 'contrast' || type === 'saturation' || type === 'exposure') {
|
|
21345
|
-
if (
|
|
21282
|
+
if (parent.finetuneSettings) {
|
|
21346
21283
|
if (type === 'brightness' && parent.finetuneSettings.brightness) {
|
|
21347
21284
|
min = parent.finetuneSettings.brightness.min;
|
|
21348
21285
|
max = parent.finetuneSettings.brightness.max;
|
|
@@ -21355,7 +21292,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
21355
21292
|
min = parent.finetuneSettings.saturation.min;
|
|
21356
21293
|
max = parent.finetuneSettings.saturation.max;
|
|
21357
21294
|
}
|
|
21358
|
-
else if (type === 'exposure' &&
|
|
21295
|
+
else if (type === 'exposure' && parent.finetuneSettings.exposure) {
|
|
21359
21296
|
min = parent.finetuneSettings.exposure.min;
|
|
21360
21297
|
max = parent.finetuneSettings.exposure.max;
|
|
21361
21298
|
}
|
|
@@ -21411,27 +21348,29 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
21411
21348
|
width: Browser.isDevice ? '200px' : '300px',
|
|
21412
21349
|
cssClass: 'e-slider',
|
|
21413
21350
|
change: function (args) {
|
|
21414
|
-
|
|
21351
|
+
parent.setCurrAdjustmentValue(type, args.value);
|
|
21415
21352
|
_this.enableDisableTbrBtn();
|
|
21416
21353
|
}
|
|
21417
21354
|
});
|
|
21418
21355
|
};
|
|
21419
21356
|
ToolbarModule.prototype.applyPreviewFilter = function () {
|
|
21420
|
-
|
|
21421
|
-
|
|
21422
|
-
|
|
21423
|
-
|
|
21357
|
+
var parent = this.parent;
|
|
21358
|
+
if (document.querySelector('#' + parent.element.id + '_sliderWrapper') ||
|
|
21359
|
+
parent.currObjType.isFiltered) {
|
|
21360
|
+
parent.initialAdjustmentValue = parent.canvasFilter = this.lowerContext.filter;
|
|
21361
|
+
parent.currObjType.isFiltered = false;
|
|
21424
21362
|
}
|
|
21425
21363
|
};
|
|
21426
21364
|
ToolbarModule.prototype.unselectBtn = function () {
|
|
21365
|
+
var parent = this.parent;
|
|
21427
21366
|
var selectors = [
|
|
21428
|
-
'#' +
|
|
21429
|
-
'#' +
|
|
21430
|
-
'#' +
|
|
21431
|
-
'#' +
|
|
21432
|
-
'#' +
|
|
21433
|
-
'#' +
|
|
21434
|
-
'#' +
|
|
21367
|
+
'#' + parent.element.id + '_brightness',
|
|
21368
|
+
'#' + parent.element.id + '_contrast',
|
|
21369
|
+
'#' + parent.element.id + '_hue',
|
|
21370
|
+
'#' + parent.element.id + '_saturation',
|
|
21371
|
+
'#' + parent.element.id + '_opacity',
|
|
21372
|
+
'#' + parent.element.id + '_blur',
|
|
21373
|
+
'#' + parent.element.id + '_exposure'
|
|
21435
21374
|
];
|
|
21436
21375
|
for (var _i = 0, selectors_1 = selectors; _i < selectors_1.length; _i++) {
|
|
21437
21376
|
var selector = selectors_1[_i];
|
|
@@ -21456,68 +21395,69 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
21456
21395
|
if (hdrWrapper) {
|
|
21457
21396
|
hdrWrapper.style.display = 'none';
|
|
21458
21397
|
}
|
|
21459
|
-
if (
|
|
21398
|
+
if (sliderWrapper && slider) {
|
|
21460
21399
|
slider.ej2_instances[0].destroy();
|
|
21461
21400
|
sliderWrapper.remove();
|
|
21462
21401
|
}
|
|
21463
21402
|
};
|
|
21464
21403
|
ToolbarModule.prototype.updateToolbarItems = function () {
|
|
21465
|
-
var
|
|
21466
|
-
var
|
|
21467
|
-
var
|
|
21468
|
-
var
|
|
21469
|
-
var
|
|
21470
|
-
var
|
|
21471
|
-
var
|
|
21472
|
-
var
|
|
21473
|
-
var
|
|
21474
|
-
|
|
21475
|
-
|
|
21404
|
+
var parent = this.parent;
|
|
21405
|
+
var selFillElem = parent.element.querySelector('.e-fill.e-template .e-dropdownbtn-preview');
|
|
21406
|
+
var selStrokeElem = parent.element.querySelector('.e-stroke.e-template .e-dropdownbtn-preview');
|
|
21407
|
+
var selTextStrokeElem = parent.element.querySelector('.e-text-font-color.e-template .e-dropdownbtn-preview');
|
|
21408
|
+
var selPenStrokeElem = parent.element.querySelector('.e-pen-stroke-color.e-template .e-dropdownbtn-preview');
|
|
21409
|
+
var strokeWidthElem = parent.element.querySelector('.e-shape-stroke-width');
|
|
21410
|
+
var fontFamilyElem = parent.element.querySelector('.e-text-font-family');
|
|
21411
|
+
var fontSizeElem = parent.element.querySelector('.e-text-font-size');
|
|
21412
|
+
var boldBtn = parent.element.querySelector('#' + parent.element.id + '_bold');
|
|
21413
|
+
var italicBtn = parent.element.querySelector('#' + parent.element.id + '_italic');
|
|
21414
|
+
if (isNullOrUndefined(parent.activeObj.strokeSettings.strokeWidth)) {
|
|
21415
|
+
parent.activeObj.strokeSettings.strokeWidth = 2;
|
|
21476
21416
|
}
|
|
21477
21417
|
if (selFillElem) {
|
|
21478
|
-
if (
|
|
21418
|
+
if (parent.activeObj.strokeSettings.fillColor === '') {
|
|
21479
21419
|
selFillElem.classList.add('e-nocolor-item');
|
|
21480
21420
|
}
|
|
21481
21421
|
else {
|
|
21482
21422
|
selFillElem.classList.remove('e-nocolor-item');
|
|
21483
|
-
selFillElem.style.background =
|
|
21423
|
+
selFillElem.style.background = parent.activeObj.strokeSettings.fillColor;
|
|
21484
21424
|
}
|
|
21485
|
-
getComponent(
|
|
21486
|
-
=
|
|
21425
|
+
getComponent(parent.element.id + '_shape_fill', 'colorpicker').value
|
|
21426
|
+
= parent.activeObj.strokeSettings.fillColor + 'ff';
|
|
21487
21427
|
}
|
|
21488
21428
|
if (selStrokeElem) {
|
|
21489
|
-
selStrokeElem.style.background =
|
|
21490
|
-
getComponent(
|
|
21491
|
-
=
|
|
21429
|
+
selStrokeElem.style.background = parent.activeObj.strokeSettings.strokeColor;
|
|
21430
|
+
getComponent(parent.element.id + '_shape_stroke', 'colorpicker').value
|
|
21431
|
+
= parent.activeObj.strokeSettings.strokeColor + 'ff';
|
|
21492
21432
|
}
|
|
21493
21433
|
if (selTextStrokeElem) {
|
|
21494
|
-
selTextStrokeElem.style.background =
|
|
21495
|
-
getComponent(
|
|
21496
|
-
=
|
|
21434
|
+
selTextStrokeElem.style.background = parent.activeObj.strokeSettings.strokeColor;
|
|
21435
|
+
getComponent(parent.element.id + '_text_font', 'colorpicker').value
|
|
21436
|
+
= parent.activeObj.strokeSettings.strokeColor + 'ff';
|
|
21497
21437
|
}
|
|
21498
21438
|
if (selPenStrokeElem) {
|
|
21499
|
-
selPenStrokeElem.style.background =
|
|
21500
|
-
getComponent(
|
|
21501
|
-
=
|
|
21439
|
+
selPenStrokeElem.style.background = parent.activeObj.strokeSettings.strokeColor;
|
|
21440
|
+
getComponent(parent.element.id + '_pen_stroke', 'colorpicker').value
|
|
21441
|
+
= parent.activeObj.strokeSettings.strokeColor + 'ff';
|
|
21502
21442
|
}
|
|
21503
21443
|
if (fontFamilyElem) {
|
|
21504
21444
|
if (Browser.isDevice) {
|
|
21505
|
-
fontFamilyElem.setAttribute('style', 'font-family:' +
|
|
21445
|
+
fontFamilyElem.setAttribute('style', 'font-family:' + parent.activeObj.textSettings.fontFamily.toLowerCase());
|
|
21506
21446
|
}
|
|
21507
21447
|
else {
|
|
21508
|
-
fontFamilyElem.textContent =
|
|
21448
|
+
fontFamilyElem.textContent = parent.activeObj.textSettings.fontFamily;
|
|
21509
21449
|
}
|
|
21510
21450
|
}
|
|
21511
21451
|
if (fontSizeElem) {
|
|
21512
|
-
for (var i = 0; i <
|
|
21513
|
-
if (parseInt(
|
|
21452
|
+
for (var i = 0; i < parent.fontSizeColl.length; i++) {
|
|
21453
|
+
if (parseInt(parent.fontSizeColl[i].text, 10) >= Math.round(parent.activeObj.textSettings.fontSize)) {
|
|
21514
21454
|
fontSizeElem.textContent = (i + 1).toString();
|
|
21515
21455
|
break;
|
|
21516
21456
|
}
|
|
21517
21457
|
}
|
|
21518
21458
|
}
|
|
21519
21459
|
if (boldBtn) {
|
|
21520
|
-
if (
|
|
21460
|
+
if (parent.activeObj.textSettings.bold) {
|
|
21521
21461
|
boldBtn.classList.add('e-selected-btn');
|
|
21522
21462
|
}
|
|
21523
21463
|
else {
|
|
@@ -21525,7 +21465,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
21525
21465
|
}
|
|
21526
21466
|
}
|
|
21527
21467
|
if (italicBtn) {
|
|
21528
|
-
if (
|
|
21468
|
+
if (parent.activeObj.textSettings.italic) {
|
|
21529
21469
|
italicBtn.classList.add('e-selected-btn');
|
|
21530
21470
|
}
|
|
21531
21471
|
else {
|
|
@@ -21533,7 +21473,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
21533
21473
|
}
|
|
21534
21474
|
}
|
|
21535
21475
|
if (strokeWidthElem) {
|
|
21536
|
-
var strokeWidth = Math.round((
|
|
21476
|
+
var strokeWidth = Math.round((parent.activeObj.strokeSettings.strokeWidth)).toString();
|
|
21537
21477
|
strokeWidthElem.textContent = this.getStrokeWidth(strokeWidth);
|
|
21538
21478
|
}
|
|
21539
21479
|
};
|
|
@@ -21563,7 +21503,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
21563
21503
|
var parent = this.parent;
|
|
21564
21504
|
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: true } });
|
|
21565
21505
|
var panBtn = parent.element.querySelector('.e-img-pan .e-btn');
|
|
21566
|
-
if (
|
|
21506
|
+
if (panBtn) {
|
|
21567
21507
|
panBtn.classList.remove('e-selected-btn');
|
|
21568
21508
|
}
|
|
21569
21509
|
parent.pan(false);
|
|
@@ -21574,22 +21514,23 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
21574
21514
|
}
|
|
21575
21515
|
};
|
|
21576
21516
|
ToolbarModule.prototype.destroySubComponents = function () {
|
|
21577
|
-
var
|
|
21578
|
-
var
|
|
21517
|
+
var parent = this.parent;
|
|
21518
|
+
var inputElement = parent.element.querySelectorAll('input.e-control');
|
|
21519
|
+
var btnElement = parent.element.querySelectorAll('button.e-control');
|
|
21579
21520
|
for (var i = 0, len = inputElement.length; i < len; i++) {
|
|
21580
21521
|
if (inputElement[i].classList.contains('e-color-picker')) {
|
|
21581
21522
|
getComponent(inputElement[i], 'color-picker').destroy();
|
|
21582
|
-
detach(select('input#' + inputElement[i].id,
|
|
21523
|
+
detach(select('input#' + inputElement[i].id, parent.element));
|
|
21583
21524
|
}
|
|
21584
21525
|
}
|
|
21585
21526
|
for (var i = 0, len = btnElement.length; i < len; i++) {
|
|
21586
21527
|
if (btnElement[i].classList.contains('e-dropdown-btn')) {
|
|
21587
21528
|
getComponent(btnElement[i], 'dropdown-btn').destroy();
|
|
21588
|
-
detach(select('button#' + btnElement[i].id,
|
|
21529
|
+
detach(select('button#' + btnElement[i].id, parent.element));
|
|
21589
21530
|
}
|
|
21590
21531
|
else if (btnElement[i].classList.contains('e-btn')) {
|
|
21591
21532
|
getComponent(btnElement[i], 'btn').destroy();
|
|
21592
|
-
detach(select('button#' + btnElement[i].id,
|
|
21533
|
+
detach(select('button#' + btnElement[i].id, parent.element));
|
|
21593
21534
|
}
|
|
21594
21535
|
}
|
|
21595
21536
|
};
|