@syncfusion/ej2-image-editor 23.2.7 → 24.1.41
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 +3 -59
- 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 +7146 -4325
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +7215 -4381
- 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 +12 -12
- package/src/image-editor/action/crop.d.ts +6 -0
- package/src/image-editor/action/crop.js +347 -188
- package/src/image-editor/action/draw.d.ts +35 -2
- package/src/image-editor/action/draw.js +1682 -881
- package/src/image-editor/action/export.js +90 -29
- package/src/image-editor/action/filter.d.ts +3 -1
- package/src/image-editor/action/filter.js +74 -94
- package/src/image-editor/action/freehand-draw.d.ts +4 -0
- package/src/image-editor/action/freehand-draw.js +248 -147
- package/src/image-editor/action/selection.d.ts +6 -1
- package/src/image-editor/action/selection.js +1133 -1091
- package/src/image-editor/action/shape.d.ts +7 -0
- package/src/image-editor/action/shape.js +921 -550
- package/src/image-editor/action/transform.d.ts +2 -0
- package/src/image-editor/action/transform.js +514 -346
- package/src/image-editor/action/undo-redo.d.ts +2 -0
- package/src/image-editor/action/undo-redo.js +137 -36
- package/src/image-editor/base/enum.d.ts +2 -1
- package/src/image-editor/base/enum.js +1 -0
- package/src/image-editor/base/image-editor-model.d.ts +37 -2
- package/src/image-editor/base/image-editor.d.ts +124 -3
- package/src/image-editor/base/image-editor.js +672 -171
- package/src/image-editor/base/interface.d.ts +69 -15
- package/src/image-editor/renderer/toolbar.d.ts +10 -0
- package/src/image-editor/renderer/toolbar.js +1371 -822
- package/styles/bootstrap-dark.css +113 -8
- package/styles/bootstrap.css +112 -7
- package/styles/bootstrap4.css +113 -8
- package/styles/bootstrap5-dark.css +113 -8
- package/styles/bootstrap5.css +113 -8
- package/styles/fabric-dark.css +114 -9
- package/styles/fabric.css +113 -8
- package/styles/fluent-dark.css +118 -9
- package/styles/fluent.css +118 -9
- package/styles/highcontrast-light.css +112 -7
- package/styles/highcontrast.css +116 -7
- package/styles/image-editor/_bootstrap-dark-definition.scss +3 -0
- package/styles/image-editor/_bootstrap-definition.scss +3 -0
- package/styles/image-editor/_bootstrap4-definition.scss +3 -0
- package/styles/image-editor/_bootstrap5-definition.scss +3 -0
- package/styles/image-editor/_fabric-dark-definition.scss +3 -0
- package/styles/image-editor/_fabric-definition.scss +3 -0
- package/styles/image-editor/_fluent-definition.scss +3 -0
- package/styles/image-editor/_fusionnew-definition.scss +3 -0
- package/styles/image-editor/_highcontrast-definition.scss +3 -0
- package/styles/image-editor/_highcontrast-light-definition.scss +3 -0
- package/styles/image-editor/_layout.scss +138 -4
- package/styles/image-editor/_material-dark-definition.scss +3 -0
- package/styles/image-editor/_material-definition.scss +3 -0
- package/styles/image-editor/_material3-definition.scss +3 -0
- package/styles/image-editor/_tailwind-definition.scss +3 -0
- package/styles/image-editor/_theme.scss +2 -4
- package/styles/image-editor/bootstrap-dark.css +113 -8
- package/styles/image-editor/bootstrap.css +112 -7
- package/styles/image-editor/bootstrap4.css +113 -8
- package/styles/image-editor/bootstrap5-dark.css +113 -8
- package/styles/image-editor/bootstrap5.css +113 -8
- package/styles/image-editor/fabric-dark.css +114 -9
- package/styles/image-editor/fabric.css +113 -8
- package/styles/image-editor/fluent-dark.css +118 -9
- package/styles/image-editor/fluent.css +118 -9
- package/styles/image-editor/highcontrast-light.css +112 -7
- package/styles/image-editor/highcontrast.css +116 -7
- package/styles/image-editor/icons/_bootstrap-dark.scss +60 -0
- package/styles/image-editor/icons/_bootstrap.scss +60 -0
- package/styles/image-editor/icons/_bootstrap4.scss +60 -0
- package/styles/image-editor/icons/_bootstrap5.scss +60 -0
- package/styles/image-editor/icons/_fabric-dark.scss +60 -0
- package/styles/image-editor/icons/_fabric.scss +60 -0
- package/styles/image-editor/icons/_fluent.scss +66 -0
- package/styles/image-editor/icons/_highcontrast-light.scss +60 -0
- package/styles/image-editor/icons/_highcontrast.scss +60 -0
- package/styles/image-editor/icons/_material-dark.scss +60 -0
- package/styles/image-editor/icons/_material.scss +60 -0
- package/styles/image-editor/icons/_material3.scss +60 -0
- package/styles/image-editor/icons/_tailwind.scss +60 -0
- package/styles/image-editor/material-dark.css +113 -8
- package/styles/image-editor/material.css +113 -8
- package/styles/image-editor/material3-dark.css +126 -9
- package/styles/image-editor/material3.css +126 -9
- package/styles/image-editor/tailwind-dark.css +114 -9
- package/styles/image-editor/tailwind.css +114 -9
- package/styles/material-dark.css +113 -8
- package/styles/material.css +113 -8
- package/styles/material3-dark.css +126 -9
- package/styles/material3.css +126 -9
- package/styles/tailwind-dark.css +114 -9
- package/styles/tailwind.css +114 -9
|
@@ -102,6 +102,23 @@ var SelectionSettings = /** @class */ (function (_super) {
|
|
|
102
102
|
return SelectionSettings;
|
|
103
103
|
}(ChildProperty));
|
|
104
104
|
export { SelectionSettings };
|
|
105
|
+
/**
|
|
106
|
+
* Predefine the font families that populate in font family dropdown list from the toolbar.
|
|
107
|
+
*/
|
|
108
|
+
var FontFamily = /** @class */ (function (_super) {
|
|
109
|
+
__extends(FontFamily, _super);
|
|
110
|
+
function FontFamily() {
|
|
111
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
112
|
+
}
|
|
113
|
+
__decorate([
|
|
114
|
+
Property('Arial')
|
|
115
|
+
], FontFamily.prototype, "default", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
Property(null)
|
|
118
|
+
], FontFamily.prototype, "items", void 0);
|
|
119
|
+
return FontFamily;
|
|
120
|
+
}(ChildProperty));
|
|
121
|
+
export { FontFamily };
|
|
105
122
|
/**
|
|
106
123
|
* The Image Editor is a graphical user interface for editing images.
|
|
107
124
|
*
|
|
@@ -130,7 +147,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
130
147
|
_this.isImageLoaded = false;
|
|
131
148
|
/** @hidden */
|
|
132
149
|
_this.activeObj = { activePoint: { startX: 0, startY: 0, endX: 0, endY: 0, width: 0, height: 0 },
|
|
133
|
-
flipObjColl: [], triangle: [], triangleRatio: [], rotatedAngle: 0 };
|
|
150
|
+
flipObjColl: [], triangle: [], triangleRatio: [], rotatedAngle: 0, opacity: 1 };
|
|
134
151
|
// current object's ui interaction properties
|
|
135
152
|
/** @hidden */
|
|
136
153
|
_this.currObjType = { shape: '', isDragging: false, isActiveObj: false, isText: false, isInitialText: false, isLine: false, isInitialLine: false,
|
|
@@ -157,14 +174,16 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
157
174
|
/** @hidden */
|
|
158
175
|
_this.cropObj = { cropZoom: 0, defaultZoom: 0, totalPannedPoint: { x: 0, y: 0 }, totalPannedClientPoint: { x: 0, y: 0 },
|
|
159
176
|
totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {}, rotateFlipColl: [],
|
|
160
|
-
degree: 0, currFlipState: '', destPoints: { startX: 0, startY: 0, width: 0, height: 0 },
|
|
177
|
+
degree: 0, currFlipState: '', straighten: 0, destPoints: { startX: 0, startY: 0, width: 0, height: 0 },
|
|
161
178
|
srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '', isBrightAdjust: false,
|
|
162
|
-
zoomFactor: 0, previousZoomValue: 0, aspectWidth: null, aspectHeight: null, frame: 'none'
|
|
179
|
+
zoomFactor: 0, previousZoomValue: 0, aspectWidth: null, aspectHeight: null, frame: 'none', straightenZoom: 0,
|
|
180
|
+
adjustmentLevel: { brightness: 0, contrast: 0, hue: 0, opacity: 100, saturation: 0, blur: 0,
|
|
181
|
+
exposure: 0, transparency: 100, sharpen: false, bw: false }, currentFilter: '' };
|
|
163
182
|
// Stored transformations performed after cropping
|
|
164
183
|
/** @hidden */
|
|
165
184
|
_this.afterCropActions = [];
|
|
166
185
|
/** @hidden */
|
|
167
|
-
_this.transform = { degree: 0, currFlipState: '', zoomFactor: 0, cropZoomFactor: null, defaultZoomFactor: 0 };
|
|
186
|
+
_this.transform = { degree: 0, currFlipState: '', zoomFactor: 0, cropZoomFactor: null, defaultZoomFactor: 0, straighten: 0 };
|
|
168
187
|
/** @hidden */
|
|
169
188
|
_this.panPoint = { currentPannedPoint: { x: 0, y: 0 }, totalPannedPoint: { x: 0, y: 0 }, totalPannedInternalPoint: { x: 0, y: 0 },
|
|
170
189
|
totalPannedClientPoint: { x: 0, y: 0 } };
|
|
@@ -215,17 +234,25 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
215
234
|
_this.borderRadius = 0;
|
|
216
235
|
/** @hidden */
|
|
217
236
|
_this.lineCount = 0;
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
237
|
+
/** @hidden */
|
|
238
|
+
_this.prevStraightenedDegree = 0;
|
|
239
|
+
/** @hidden */
|
|
240
|
+
_this.tempStraighten = 0;
|
|
241
|
+
/** @hidden */
|
|
242
|
+
_this.isStraightening = false;
|
|
243
|
+
/** @hidden */
|
|
244
|
+
_this.isFinetuning = false;
|
|
245
|
+
/** @hidden */
|
|
246
|
+
_this.isZoomBtnClick = false;
|
|
247
|
+
/** @hidden */
|
|
248
|
+
_this.isFinetuneBtnClick = false;
|
|
249
|
+
/** @hidden */
|
|
250
|
+
_this.isFilterCanvasClick = false;
|
|
251
|
+
/** @hidden */
|
|
252
|
+
_this.isFrameBtnClick = false;
|
|
253
|
+
/** @hidden */
|
|
254
|
+
_this.isChangesSaved = false;
|
|
255
|
+
if (isBlazor()) {
|
|
229
256
|
new Crop(_this);
|
|
230
257
|
new Draw(_this);
|
|
231
258
|
new Filter(_this);
|
|
@@ -236,6 +263,16 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
236
263
|
new UndoRedo(_this);
|
|
237
264
|
new Export(_this);
|
|
238
265
|
}
|
|
266
|
+
else {
|
|
267
|
+
ImageEditor_1.Inject(Crop, Draw, Selection, Transform, Export, ToolbarModule);
|
|
268
|
+
ImageEditor_1.Inject(UndoRedo);
|
|
269
|
+
ImageEditor_1.Inject(Filter);
|
|
270
|
+
ImageEditor_1.Inject(Shape);
|
|
271
|
+
ImageEditor_1.Inject(FreehandDrawing);
|
|
272
|
+
if (element) {
|
|
273
|
+
_this.appendTo(element);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
239
276
|
return _this;
|
|
240
277
|
}
|
|
241
278
|
ImageEditor_1 = ImageEditor;
|
|
@@ -502,14 +539,14 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
502
539
|
if (!this.element.getAttribute('class')) {
|
|
503
540
|
this.element.removeAttribute('class');
|
|
504
541
|
}
|
|
505
|
-
if (
|
|
542
|
+
if (isBlazor()) {
|
|
543
|
+
this.element.classList.remove('e-image-editor');
|
|
544
|
+
}
|
|
545
|
+
else {
|
|
506
546
|
this.notify('toolbar', { prop: 'destroySubComponents', onPropertyChange: false });
|
|
507
547
|
this.notify('destroyed', null);
|
|
508
548
|
_super.prototype.destroy.call(this);
|
|
509
549
|
}
|
|
510
|
-
else {
|
|
511
|
-
this.element.classList.remove('e-image-editor');
|
|
512
|
-
}
|
|
513
550
|
this.unwireEvent();
|
|
514
551
|
this.element.innerHTML = '';
|
|
515
552
|
};
|
|
@@ -812,7 +849,8 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
812
849
|
};
|
|
813
850
|
ImageEditor.prototype.keyUpEventHandler = function (e) {
|
|
814
851
|
// eslint-disable-next-line
|
|
815
|
-
if (this.textArea.style.display === 'block'
|
|
852
|
+
if ((this.textArea.style.display === 'block' || this.textArea.style.display === 'inline-block')
|
|
853
|
+
&& e.target.id === this.element.id + '_textArea') {
|
|
816
854
|
this.notify('selection', { prop: 'textKeyDown', value: { e: e } });
|
|
817
855
|
}
|
|
818
856
|
};
|
|
@@ -900,6 +938,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
900
938
|
*/
|
|
901
939
|
ImageEditor.prototype.flip = function (direction) {
|
|
902
940
|
this.notify('transform', { prop: 'flip', value: { direction: direction } });
|
|
941
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
903
942
|
this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
904
943
|
};
|
|
905
944
|
/**
|
|
@@ -927,6 +966,9 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
927
966
|
* @returns {void}.
|
|
928
967
|
*/
|
|
929
968
|
ImageEditor.prototype.open = function (data) {
|
|
969
|
+
if (isNullOrUndefined(data)) {
|
|
970
|
+
return;
|
|
971
|
+
}
|
|
930
972
|
document.getElementById(this.element.id + '_dropArea').style.display = 'none';
|
|
931
973
|
this.notify('draw', { prop: 'open', value: { data: data } });
|
|
932
974
|
};
|
|
@@ -955,7 +997,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
955
997
|
}
|
|
956
998
|
}
|
|
957
999
|
var isImageLoaded = this.isImageLoaded;
|
|
958
|
-
this.currObjType.isUndoAction = this.isUndoRedo = this.togglePan = this.togglePen = this.isImageLoaded = false;
|
|
1000
|
+
this.currObjType.isUndoAction = this.isUndoRedo = this.togglePan = this.togglePen = this.isImageLoaded = this.isFinetuning = false;
|
|
959
1001
|
this.isCircleCrop = this.isCropTab = false;
|
|
960
1002
|
this.objColl = [];
|
|
961
1003
|
this.transform.degree = 0;
|
|
@@ -991,34 +1033,62 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
991
1033
|
isUndoAction: false, isFiltered: false, isSave: false, isResize: false };
|
|
992
1034
|
this.cropObj = { cropZoom: 0, defaultZoom: 0, totalPannedPoint: { x: 0, y: 0 }, totalPannedClientPoint: { x: 0, y: 0 },
|
|
993
1035
|
totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {},
|
|
994
|
-
rotateFlipColl: [], degree: 0, currFlipState: '', zoomFactor: 0, previousZoomValue: 0,
|
|
1036
|
+
rotateFlipColl: [], degree: 0, currFlipState: '', straighten: 0, zoomFactor: 0, previousZoomValue: 0,
|
|
995
1037
|
destPoints: { startX: 0, startY: 0, width: 0, height: 0 }, frame: 'none',
|
|
996
1038
|
srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '', isBrightAdjust: false,
|
|
997
|
-
aspectWidth: null, aspectHeight: null
|
|
1039
|
+
aspectWidth: null, aspectHeight: null, straightenZoom: 0,
|
|
1040
|
+
adjustmentLevel: { brightness: 0, contrast: 0, hue: 0, opacity: 100, saturation: 0, blur: 0,
|
|
1041
|
+
exposure: 0, transparency: 100, sharpen: false, bw: false }, currentFilter: '' };
|
|
998
1042
|
this.afterCropActions = [];
|
|
999
1043
|
this.currentFilter = '';
|
|
1000
1044
|
this.tempFrameZoomLevel = null;
|
|
1001
1045
|
this.cxtTbarHeight = null;
|
|
1046
|
+
this.straightenPoint = null;
|
|
1047
|
+
this.transform.straighten = 0;
|
|
1048
|
+
this.cancelCropSelection = null;
|
|
1002
1049
|
this.aspectWidth = this.aspectHeight = null;
|
|
1050
|
+
this.isResize = false;
|
|
1003
1051
|
var obj_1 = { initialZoomValue: false };
|
|
1004
1052
|
this.notify('draw', { prop: 'getInitialZoomValue', onPropertyChange: false, value: { obj: obj_1 } });
|
|
1005
1053
|
if (obj_1['initialZoomValue']) {
|
|
1006
1054
|
this.setProperties({ zoomSettings: { zoomFactor: obj_1['initialZoomValue'] } }, true);
|
|
1007
1055
|
}
|
|
1008
|
-
|
|
1009
|
-
|
|
1056
|
+
var qtArea = document.getElementById(this.element.id + '_quickAccessToolbarArea');
|
|
1057
|
+
if (qtArea) {
|
|
1058
|
+
qtArea.style.display = 'none';
|
|
1010
1059
|
}
|
|
1011
1060
|
this.notifyResetForAllModules();
|
|
1012
1061
|
this.notify('filter', { prop: 'update-finetunes' });
|
|
1062
|
+
if (!isBlazor()) {
|
|
1063
|
+
if (this.toolbarTemplate) {
|
|
1064
|
+
this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').clientHeight;
|
|
1065
|
+
}
|
|
1066
|
+
else if (this.element.querySelector('#' + this.element.id + '_toolbar')) {
|
|
1067
|
+
this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbar').clientHeight;
|
|
1068
|
+
}
|
|
1069
|
+
this.notify('toolbar', { prop: 'setToolbarHeight', value: { height: this.toolbarHeight } });
|
|
1070
|
+
}
|
|
1071
|
+
this.isImageLoaded = isImageLoaded;
|
|
1072
|
+
this.straightenBaseImageCanvas();
|
|
1013
1073
|
this.isImageLoaded = false;
|
|
1014
1074
|
this.notify('draw', { prop: 'update-canvas', onPropertyChange: false });
|
|
1015
1075
|
this.isImageLoaded = isImageLoaded;
|
|
1076
|
+
this.prevStraightenedDegree = 0;
|
|
1016
1077
|
if (!isBlazor()) {
|
|
1017
|
-
|
|
1018
|
-
|
|
1078
|
+
var ctWrapper = this.element.querySelector('.e-contextual-toolbar-wrapper');
|
|
1079
|
+
if (ctWrapper) {
|
|
1080
|
+
ctWrapper.classList.add('e-hide');
|
|
1019
1081
|
}
|
|
1020
1082
|
this.notify('toolbar', { prop: 'refresh-dropdown-btn', value: { isDisabled: false } });
|
|
1021
1083
|
this.notify('toolbar', { prop: 'enable-disable-btns' });
|
|
1084
|
+
var straightenObj = { bool: this.isStraightening };
|
|
1085
|
+
if (Browser.isDevice && straightenObj['bool']) {
|
|
1086
|
+
this.notify('crop', { prop: 'resizeWrapper' });
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
else {
|
|
1090
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
1091
|
+
this.activeObj.textSettings.fontFamily = this.defaultFontFamily;
|
|
1022
1092
|
}
|
|
1023
1093
|
}
|
|
1024
1094
|
};
|
|
@@ -1039,6 +1109,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1039
1109
|
ImageEditor.prototype.rotate = function (degree) {
|
|
1040
1110
|
var obj = { isRotate: false };
|
|
1041
1111
|
this.notify('transform', { prop: 'rotate', value: { degree: degree, obj: obj } });
|
|
1112
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1042
1113
|
this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
1043
1114
|
return obj['isRotate'];
|
|
1044
1115
|
};
|
|
@@ -1133,6 +1204,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1133
1204
|
ImageEditor.prototype.zoom = function (zoomFactor, zoomPoint) {
|
|
1134
1205
|
this.notify('transform', { prop: 'zoom', onPropertyChange: false,
|
|
1135
1206
|
value: { zoomFactor: zoomFactor, zoomPoint: zoomPoint } });
|
|
1207
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1136
1208
|
};
|
|
1137
1209
|
/**
|
|
1138
1210
|
* Draw ellipse on an image.
|
|
@@ -1157,6 +1229,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1157
1229
|
isEllipse = true;
|
|
1158
1230
|
this.notify('shape', { prop: 'drawEllipse', onPropertyChange: false, value: { x: x, y: y, radiusX: radiusX, radiusY: radiusY,
|
|
1159
1231
|
strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree } });
|
|
1232
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1160
1233
|
}
|
|
1161
1234
|
return isEllipse;
|
|
1162
1235
|
};
|
|
@@ -1178,6 +1251,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1178
1251
|
isLine = true;
|
|
1179
1252
|
this.notify('shape', { prop: 'drawLine', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
|
|
1180
1253
|
endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor } });
|
|
1254
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1181
1255
|
}
|
|
1182
1256
|
return isLine;
|
|
1183
1257
|
};
|
|
@@ -1201,6 +1275,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1201
1275
|
isArrow = true;
|
|
1202
1276
|
this.notify('shape', { prop: 'drawArrow', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
|
|
1203
1277
|
endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, arrowStart: arrowStart, arrowEnd: arrowEnd } });
|
|
1278
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1204
1279
|
}
|
|
1205
1280
|
return isArrow;
|
|
1206
1281
|
};
|
|
@@ -1212,7 +1287,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1212
1287
|
* @param {string} strokeColor - Specifies the stroke color of path.
|
|
1213
1288
|
* @returns {boolean}.
|
|
1214
1289
|
*/
|
|
1215
|
-
ImageEditor.prototype.drawPath = function (pointColl, strokeWidth, strokeColor) {
|
|
1290
|
+
ImageEditor.prototype.drawPath = function (pointColl, strokeWidth, strokeColor, opacity) {
|
|
1216
1291
|
this.isPublicMethod = true;
|
|
1217
1292
|
var obj = { inRange: false };
|
|
1218
1293
|
var isPath = false;
|
|
@@ -1229,6 +1304,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1229
1304
|
isPath = true;
|
|
1230
1305
|
this.notify('shape', { prop: 'drawPath', onPropertyChange: false, value: { pointColl: pointColl,
|
|
1231
1306
|
strokeWidth: strokeWidth, strokeColor: strokeColor } });
|
|
1307
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1232
1308
|
}
|
|
1233
1309
|
return isPath;
|
|
1234
1310
|
};
|
|
@@ -1252,6 +1328,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1252
1328
|
isRectangle = true;
|
|
1253
1329
|
this.notify('shape', { prop: 'drawRectangle', onPropertyChange: false, value: { x: x, y: y, width: width, height: height,
|
|
1254
1330
|
strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree } });
|
|
1331
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1255
1332
|
}
|
|
1256
1333
|
return isRectangle;
|
|
1257
1334
|
};
|
|
@@ -1278,6 +1355,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1278
1355
|
isText = true;
|
|
1279
1356
|
this.notify('shape', { prop: 'drawText', onPropertyChange: false, value: { x: x, y: y, text: text, fontFamily: fontFamily,
|
|
1280
1357
|
fontSize: fontSize, bold: bold, italic: italic, color: color } });
|
|
1358
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1281
1359
|
}
|
|
1282
1360
|
return isText;
|
|
1283
1361
|
};
|
|
@@ -1292,16 +1370,18 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1292
1370
|
* @param {number} height - Specifies the height of the image.
|
|
1293
1371
|
* @param {boolean} isAspectRatio - Specifies whether to maintain aspect ratio or not.
|
|
1294
1372
|
* @param {number} degree - Specifies the degree to rotate the image.
|
|
1373
|
+
* @param {number} opacity - Specifies the value for the image.
|
|
1295
1374
|
* @returns {boolean}.
|
|
1296
1375
|
*
|
|
1297
1376
|
*/
|
|
1298
|
-
ImageEditor.prototype.drawImage = function (data, x, y, width, height, isAspectRatio, degree) {
|
|
1377
|
+
ImageEditor.prototype.drawImage = function (data, x, y, width, height, isAspectRatio, degree, opacity) {
|
|
1299
1378
|
var isImage = false;
|
|
1300
1379
|
var isPointsInRange = this.allowShape(x, y);
|
|
1301
1380
|
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
1302
1381
|
var length_1 = this.objColl.length;
|
|
1303
1382
|
this.notify('shape', { prop: 'drawImage', onPropertyChange: false, value: { x: x, y: y, width: width, height: height,
|
|
1304
|
-
src: data, degree: degree, isAspectRatio: isAspectRatio } });
|
|
1383
|
+
src: data, degree: degree, isAspectRatio: isAspectRatio, opacity: opacity } });
|
|
1384
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1305
1385
|
if (this.objColl.length > length_1) {
|
|
1306
1386
|
isImage = true;
|
|
1307
1387
|
}
|
|
@@ -1321,6 +1401,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1321
1401
|
ImageEditor.prototype.selectShape = function (id) {
|
|
1322
1402
|
var obj = { isSelected: false };
|
|
1323
1403
|
this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: id, obj: obj } });
|
|
1404
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1324
1405
|
return obj['isSelected'];
|
|
1325
1406
|
};
|
|
1326
1407
|
/**
|
|
@@ -1335,6 +1416,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1335
1416
|
*/
|
|
1336
1417
|
ImageEditor.prototype.deleteShape = function (id) {
|
|
1337
1418
|
this.notify('shape', { prop: 'deleteShape', onPropertyChange: false, value: { id: id } });
|
|
1419
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1338
1420
|
};
|
|
1339
1421
|
/**
|
|
1340
1422
|
* Get particular shapes details based on id of the shape which is drawn on an image editor.
|
|
@@ -1349,6 +1431,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1349
1431
|
var shapeDetails = {};
|
|
1350
1432
|
this.notify('shape', { prop: 'getShapeSetting', onPropertyChange: false,
|
|
1351
1433
|
value: { id: id, obj: shapeDetails } });
|
|
1434
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1352
1435
|
return shapeDetails;
|
|
1353
1436
|
};
|
|
1354
1437
|
/**
|
|
@@ -1359,6 +1442,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1359
1442
|
ImageEditor.prototype.getShapeSettings = function () {
|
|
1360
1443
|
var obj = { shapeDetailsColl: [] };
|
|
1361
1444
|
this.notify('shape', { prop: 'getShapeSettings', onPropertyChange: false, value: { obj: obj } });
|
|
1445
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1362
1446
|
return obj['shapeDetailsColl'];
|
|
1363
1447
|
};
|
|
1364
1448
|
/**
|
|
@@ -1384,6 +1468,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1384
1468
|
ImageEditor.prototype.finetuneImage = function (finetuneOption, value) {
|
|
1385
1469
|
if (!this.disabled && this.isImageLoaded) {
|
|
1386
1470
|
this.notify('filter', { prop: 'finetuneImage', value: { value: value, option: finetuneOption } });
|
|
1471
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1387
1472
|
}
|
|
1388
1473
|
};
|
|
1389
1474
|
/**
|
|
@@ -1398,6 +1483,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1398
1483
|
ImageEditor.prototype.applyImageFilter = function (filterOption) {
|
|
1399
1484
|
if (!this.disabled && this.isImageLoaded) {
|
|
1400
1485
|
this.notify('filter', { prop: 'applyImageFilter', value: { option: filterOption.toString() } });
|
|
1486
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1401
1487
|
this.canvasFilter = this.lowerContext.filter;
|
|
1402
1488
|
this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
1403
1489
|
}
|
|
@@ -1412,6 +1498,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1412
1498
|
*/
|
|
1413
1499
|
ImageEditor.prototype.undo = function () {
|
|
1414
1500
|
this.notify('undo-redo', { prop: 'undo', onPropertyChange: false });
|
|
1501
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1415
1502
|
};
|
|
1416
1503
|
/**
|
|
1417
1504
|
* Redo the last user action that was undone by the user or `undo` method.
|
|
@@ -1422,6 +1509,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1422
1509
|
*/
|
|
1423
1510
|
ImageEditor.prototype.redo = function () {
|
|
1424
1511
|
this.notify('undo-redo', { prop: 'redo', onPropertyChange: false });
|
|
1512
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1425
1513
|
};
|
|
1426
1514
|
/**
|
|
1427
1515
|
* Get the dimension of an image in the image editor such as x, y, width, and height.
|
|
@@ -1479,6 +1567,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1479
1567
|
else {
|
|
1480
1568
|
this.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
|
|
1481
1569
|
}
|
|
1570
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1482
1571
|
}
|
|
1483
1572
|
return isResized;
|
|
1484
1573
|
};
|
|
@@ -1547,8 +1636,80 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1547
1636
|
extend(this.frameObj, this.tempFrameObj);
|
|
1548
1637
|
this.tempFrameZoomLevel = null;
|
|
1549
1638
|
}
|
|
1639
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1550
1640
|
return isFrame;
|
|
1551
1641
|
};
|
|
1642
|
+
/**
|
|
1643
|
+
* Straightens an image by rotating it clockwise or counterclockwise.
|
|
1644
|
+
*
|
|
1645
|
+
* @param {number} degree - The degree value specifying the amount of rotation for straightening the image.
|
|
1646
|
+
* Positive values indicate clockwise rotation, while negative values indicate counterclockwise rotation.
|
|
1647
|
+
*
|
|
1648
|
+
* @remarks
|
|
1649
|
+
* The degree value should be within the range of -45 to +45 degrees for accurate straightening.
|
|
1650
|
+
*
|
|
1651
|
+
* @returns {boolean} - A boolean value indicating the success of the straightening operation.
|
|
1652
|
+
*/
|
|
1653
|
+
ImageEditor.prototype.straightenImage = function (degree) {
|
|
1654
|
+
var isStraightened = false;
|
|
1655
|
+
if (degree >= -45 && degree <= 45) {
|
|
1656
|
+
isStraightened = true;
|
|
1657
|
+
this.notify('transform', { prop: 'straightenImage', value: { degree: degree } });
|
|
1658
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1659
|
+
}
|
|
1660
|
+
return isStraightened;
|
|
1661
|
+
};
|
|
1662
|
+
/**
|
|
1663
|
+
* This method is used to update the existing shapes by changing its height, width, color, and font styles in the component.
|
|
1664
|
+
* Use 'getShapeSettings' method to get the shape which is then passed to change the options of a shape.
|
|
1665
|
+
* {% codeBlock src='image-editor/updateShape/index.md' %}{% endcodeBlock %}
|
|
1666
|
+
*
|
|
1667
|
+
* @param {ShapeSettings} setting - Specifies the shape settings to be updated for the shape on an image.
|
|
1668
|
+
* @returns {boolean}.
|
|
1669
|
+
*
|
|
1670
|
+
*/
|
|
1671
|
+
ImageEditor.prototype.updateShape = function (setting) {
|
|
1672
|
+
var obj = { isSelected: false };
|
|
1673
|
+
this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: setting.id, obj: obj } });
|
|
1674
|
+
if (obj['isSelected']) {
|
|
1675
|
+
this.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
|
|
1676
|
+
value: { shapeSettings: setting } });
|
|
1677
|
+
var activeObj = extend({}, this.activeObj, {}, true);
|
|
1678
|
+
this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: null } });
|
|
1679
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
1680
|
+
this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: activeObj } });
|
|
1681
|
+
this.okBtn();
|
|
1682
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
1683
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1684
|
+
}
|
|
1685
|
+
return obj['isSelected'];
|
|
1686
|
+
};
|
|
1687
|
+
/**
|
|
1688
|
+
* Duplicates a shape based on the given shape ID in the ImageEditor.
|
|
1689
|
+
* Use 'getShapeSettings' method to get the shape and then pass a shapeId from the returned shape to clone a shape.
|
|
1690
|
+
*
|
|
1691
|
+
* @param {string} shapeId - Specifies the shape id to clone a shape on an image.
|
|
1692
|
+
* @returns {boolean}.
|
|
1693
|
+
*
|
|
1694
|
+
*/
|
|
1695
|
+
ImageEditor.prototype.cloneShape = function (shapeId) {
|
|
1696
|
+
var obj = { isSelected: false };
|
|
1697
|
+
if (shapeId.split('_')[0] === 'shape') {
|
|
1698
|
+
this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: shapeId, obj: obj } });
|
|
1699
|
+
if (obj['isSelected']) {
|
|
1700
|
+
if (isBlazor()) {
|
|
1701
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1702
|
+
this.duplicateShape(false, true);
|
|
1703
|
+
}
|
|
1704
|
+
else {
|
|
1705
|
+
this.notify('toolbar', { prop: 'duplicateShape', onPropertyChange: false, value: { isPreventUndoRedo: false } });
|
|
1706
|
+
}
|
|
1707
|
+
this.okBtn();
|
|
1708
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
return obj['isSelected'];
|
|
1712
|
+
};
|
|
1552
1713
|
// Toolbar related codes
|
|
1553
1714
|
ImageEditor.prototype.toolbarTemplateFn = function () {
|
|
1554
1715
|
var template;
|
|
@@ -1668,11 +1829,11 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1668
1829
|
this.isUndoRedo = true;
|
|
1669
1830
|
if (this.transform.cropZoomFactor && this.transform.cropZoomFactor > 0) {
|
|
1670
1831
|
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
1671
|
-
value: { zoomFactor: -this.transform.cropZoomFactor, zoomPoint: null, isResize:
|
|
1832
|
+
value: { zoomFactor: -this.transform.cropZoomFactor, zoomPoint: null, isResize: true } });
|
|
1672
1833
|
}
|
|
1673
1834
|
else {
|
|
1674
1835
|
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
1675
|
-
value: { zoomFactor: Math.abs(this.transform.cropZoomFactor), zoomPoint: null, isResize:
|
|
1836
|
+
value: { zoomFactor: Math.abs(this.transform.cropZoomFactor), zoomPoint: null, isResize: true } });
|
|
1676
1837
|
}
|
|
1677
1838
|
this.isUndoRedo = isUndoRedo;
|
|
1678
1839
|
this.panPoint.totalPannedPoint = { x: 0, y: 0 };
|
|
@@ -1691,23 +1852,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1691
1852
|
*/
|
|
1692
1853
|
ImageEditor.prototype.updateCropTransformItems = function () {
|
|
1693
1854
|
this.prevCurrSelectionPoint = extend({}, this.currSelectionPoint, {}, true);
|
|
1694
|
-
|
|
1695
|
-
this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
|
|
1696
|
-
var currentObj = object['currObj'];
|
|
1697
|
-
currentObj.objColl = extend([], this.objColl, [], true);
|
|
1698
|
-
currentObj.pointColl = extend([], this.pointColl, [], true);
|
|
1699
|
-
currentObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
1700
|
-
var selPointCollObj = { selPointColl: null };
|
|
1701
|
-
this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
1702
|
-
value: { obj: selPointCollObj } });
|
|
1703
|
-
currentObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
1704
|
-
this.cancelCropSelection = { operation: 'cropTransform', previousObj: currentObj, currentObj: currentObj,
|
|
1705
|
-
previousObjColl: currentObj.objColl, currentObjColl: currentObj.objColl,
|
|
1706
|
-
previousPointColl: currentObj.pointColl, currentPointColl: currentObj.pointColl,
|
|
1707
|
-
previousSelPointColl: currentObj.selPointColl, currentSelPointColl: currentObj.selPointColl,
|
|
1708
|
-
previousCropObj: extend({}, this.cropObj, {}, true),
|
|
1709
|
-
currentCropObj: extend({}, this.cropObj, {}, true),
|
|
1710
|
-
previousText: null, currentText: null, filter: null, isCircleCrop: this.isCircleCrop };
|
|
1855
|
+
this.notify('draw', { prop: 'updateCropSelection', onPropertyChange: false });
|
|
1711
1856
|
};
|
|
1712
1857
|
/**
|
|
1713
1858
|
* Get the pascal case.
|
|
@@ -1762,11 +1907,13 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1762
1907
|
* @returns {void}.
|
|
1763
1908
|
*/
|
|
1764
1909
|
ImageEditor.prototype.okBtn = function (isMouseDown) {
|
|
1765
|
-
|
|
1766
|
-
|
|
1910
|
+
var ctWrapper = this.element.querySelector('.e-contextual-toolbar-wrapper');
|
|
1911
|
+
if (ctWrapper) {
|
|
1912
|
+
ctWrapper.classList.remove('e-frame-wrapper');
|
|
1767
1913
|
}
|
|
1768
1914
|
var isCropSelection = false;
|
|
1769
1915
|
var splitWords;
|
|
1916
|
+
this.isResizeOkBtn = true;
|
|
1770
1917
|
var aspectIcon = this.element.querySelector('#' + this.element.id + '_aspectratio');
|
|
1771
1918
|
var nonAspectIcon = this.element.querySelector('#' + this.element.id + '_nonaspectratio');
|
|
1772
1919
|
var blrAspRatElem = this.element.querySelector('.e-ie-toolbar-aspect-ratio-btn');
|
|
@@ -1788,8 +1935,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1788
1935
|
if (this.togglePen) {
|
|
1789
1936
|
shapeSettings.type = ShapeType.FreehandDraw;
|
|
1790
1937
|
}
|
|
1791
|
-
var shapeChangedArgs = { action: 'apply',
|
|
1792
|
-
currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
1938
|
+
var shapeChangedArgs = { action: 'apply', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
1793
1939
|
this.triggerShapeChanged(shapeChangedArgs);
|
|
1794
1940
|
}
|
|
1795
1941
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
@@ -1826,6 +1972,18 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1826
1972
|
previousCropObj: obj1['prevCropObj'], previousText: null, currentText: null, previousFilter: null,
|
|
1827
1973
|
isCircleCrop: null } });
|
|
1828
1974
|
this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
1975
|
+
var obj_3 = this.cancelCropSelection;
|
|
1976
|
+
if ((!isBlazor() && obj_3 && (isNullOrUndefined(nonAspectIcon) || !nonAspectIcon)) || (isBlazor() && obj_3 && blrNAspRatElem && blrNAspRatElem.classList.contains('e-hidden'))) {
|
|
1977
|
+
obj_3.previousObj.aspectWidth = obj_3.currentObj.aspectWidth = this.aspectWidth;
|
|
1978
|
+
obj_3.previousObj.aspectHeight = obj_3.currentObj.aspectHeight = this.aspectHeight;
|
|
1979
|
+
obj_3.previousCropObj = extend({}, this.cropObj, {}, true);
|
|
1980
|
+
obj_3.currentCropObj = extend({}, this.cropObj, {}, true);
|
|
1981
|
+
this.notify('draw', { prop: 'updateCropSelObj' });
|
|
1982
|
+
}
|
|
1983
|
+
this.cancelCropSelection = null;
|
|
1984
|
+
}
|
|
1985
|
+
else if (point && (point.x === 0 || point.y === 0)) {
|
|
1986
|
+
this.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
|
|
1829
1987
|
}
|
|
1830
1988
|
else {
|
|
1831
1989
|
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
@@ -1842,27 +2000,41 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1842
2000
|
this.currentFilter = selElem.children[0].children[0].id.replace('Canvas', '');
|
|
1843
2001
|
}
|
|
1844
2002
|
if (isCropSelection) {
|
|
1845
|
-
this.
|
|
2003
|
+
if (this.transform.straighten !== 0 && (this.panPoint.totalPannedPoint.x !== 0 || this.panPoint.totalPannedPoint.y !== 0 ||
|
|
2004
|
+
this.panPoint.totalPannedClientPoint.x !== 0 || this.panPoint.totalPannedClientPoint.y !== 0)) {
|
|
2005
|
+
var temp = this.prevStraightenedDegree;
|
|
2006
|
+
this.prevStraightenedDegree = this.transform.straighten;
|
|
2007
|
+
this.setStraighten(this.transform.straighten - 3);
|
|
2008
|
+
this.setStraighten(this.transform.straighten + 3);
|
|
2009
|
+
this.prevStraightenedDegree = temp;
|
|
2010
|
+
}
|
|
2011
|
+
this.isCroppedEvent = this.crop();
|
|
1846
2012
|
}
|
|
1847
2013
|
else if (this.togglePen) {
|
|
1848
2014
|
this.freeHandDraw(false);
|
|
1849
2015
|
this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
2016
|
+
this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
2017
|
+
this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
|
|
1850
2018
|
}
|
|
1851
|
-
else if (this.textArea.style.display === 'block') {
|
|
2019
|
+
else if (this.textArea.style.display === 'block' || this.textArea.style.display === 'inline-block') {
|
|
1852
2020
|
this.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
|
|
1853
2021
|
value: { x: null, y: null, isMouseDown: null } });
|
|
2022
|
+
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
2023
|
+
this.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
|
|
1854
2024
|
if (isNullOrUndefined(isMouseDown)) {
|
|
1855
2025
|
this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
1856
2026
|
}
|
|
2027
|
+
this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
2028
|
+
this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
|
|
1857
2029
|
}
|
|
1858
2030
|
else if ((!isBlazor() && document.querySelector('#' + this.element.id + '_sliderWrapper')) ||
|
|
1859
2031
|
(isBlazor() && !this.element.querySelector('.e-ie-contextual-slider').classList.contains('e-hidden')) ||
|
|
1860
2032
|
this.currObjType.isFiltered) {
|
|
1861
2033
|
this.initialAdjustmentValue = this.canvasFilter = this.lowerContext.filter;
|
|
1862
2034
|
this.currObjType.isFiltered = false;
|
|
1863
|
-
var
|
|
1864
|
-
this.notify('draw', { prop: 'getTempAdjustmentValue', value: { obj:
|
|
1865
|
-
if (
|
|
2035
|
+
var obj_4 = { value: null };
|
|
2036
|
+
this.notify('draw', { prop: 'getTempAdjustmentValue', value: { obj: obj_4 } });
|
|
2037
|
+
if (obj_4['value'] !== this.lowerContext.filter) {
|
|
1866
2038
|
this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
1867
2039
|
}
|
|
1868
2040
|
if ((this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) ||
|
|
@@ -1873,11 +2045,11 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1873
2045
|
else if (obj['bool']) {
|
|
1874
2046
|
this.notify('freehand-draw', { prop: 'applyFhd', onPropertyChange: false });
|
|
1875
2047
|
this.notify('selection', { prop: 'setFreehandDrawCustomized', value: { isFreehandDrawCustomized: false } });
|
|
1876
|
-
if (
|
|
1877
|
-
this.
|
|
2048
|
+
if (isBlazor()) {
|
|
2049
|
+
this.updateToolbar(this.element, 'destroyQuickAccessToolbar');
|
|
1878
2050
|
}
|
|
1879
2051
|
else {
|
|
1880
|
-
this.
|
|
2052
|
+
this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
|
|
1881
2053
|
}
|
|
1882
2054
|
this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
1883
2055
|
}
|
|
@@ -1901,9 +2073,8 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1901
2073
|
this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
|
|
1902
2074
|
this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
1903
2075
|
this.tempFrameObj = extend({}, this.frameObj, {}, true);
|
|
1904
|
-
this.notify('draw', { prop: 'setTempFrame', onPropertyChange: false, value: { frame: this.frameObj.type } });
|
|
1905
2076
|
}
|
|
1906
|
-
this.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false });
|
|
2077
|
+
this.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: true } });
|
|
1907
2078
|
}
|
|
1908
2079
|
if (!isBlazor() && !obj['isCropToolbar']) {
|
|
1909
2080
|
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
@@ -1913,9 +2084,12 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1913
2084
|
this.updateToolbar(this.element, 'imageLoaded');
|
|
1914
2085
|
}
|
|
1915
2086
|
this.notify('draw', { prop: 'setNewPath', value: { bool: false } });
|
|
1916
|
-
this.isCropTab = false;
|
|
1917
2087
|
this.transform.zoomFactor = this.transform.defaultZoomFactor;
|
|
1918
2088
|
this.notify('selection', { prop: 'setCurrentDrawingShape', onPropertyChange: false, value: { value: '' } });
|
|
2089
|
+
this.isResizeOkBtn = false;
|
|
2090
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
2091
|
+
this.isChangesSaved = false;
|
|
2092
|
+
this.triggerActionComplete();
|
|
1919
2093
|
};
|
|
1920
2094
|
/**
|
|
1921
2095
|
* Set the temporary filter properties.
|
|
@@ -1967,12 +2141,13 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1967
2141
|
this.pointColl = [];
|
|
1968
2142
|
this.freehandCounter = 0;
|
|
1969
2143
|
this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
|
|
1970
|
-
|
|
1971
|
-
|
|
2144
|
+
var ctWrapper = this.element.querySelector('.e-contextual-toolbar-wrapper');
|
|
2145
|
+
if (ctWrapper) {
|
|
2146
|
+
ctWrapper.classList.add('e-hide');
|
|
1972
2147
|
}
|
|
1973
2148
|
var data = this.getImageData();
|
|
1974
|
-
if (
|
|
1975
|
-
|
|
2149
|
+
if (ctWrapper) {
|
|
2150
|
+
ctWrapper.classList.remove('e-hide');
|
|
1976
2151
|
if (isBlazor()) {
|
|
1977
2152
|
this.element.querySelector('.e-ie-toolbar-check-btn').classList.remove('e-hidden');
|
|
1978
2153
|
this.element.querySelector('.e-ie-toolbar-close-btn').classList.remove('e-hidden');
|
|
@@ -2006,8 +2181,9 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2006
2181
|
var finetuneValueChanging = { finetune: this.getFinetuneOption(type),
|
|
2007
2182
|
value: value, cancel: false };
|
|
2008
2183
|
if (isBlazor() && this.events && this.events.finetuneValueChanging.hasDelegate === true) {
|
|
2184
|
+
finetuneValueChanging.value = parseInt(finetuneValueChanging.value.toString());
|
|
2009
2185
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2010
|
-
this.dotNetRef.invokeMethodAsync('OnFinetuneValueChangeAsync', finetuneValueChanging).then(function (finetuneValueChanging) {
|
|
2186
|
+
this.dotNetRef.invokeMethodAsync('OnFinetuneValueChangeAsync', 'FinetuneValueChanging', finetuneValueChanging, null).then(function (finetuneValueChanging) {
|
|
2011
2187
|
if (finetuneValueChanging.cancel) {
|
|
2012
2188
|
return;
|
|
2013
2189
|
}
|
|
@@ -2063,7 +2239,8 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2063
2239
|
*/
|
|
2064
2240
|
ImageEditor.prototype.getSelectionType = function (type) {
|
|
2065
2241
|
var typeToSelectionType = { 'CropCustom': 'Custom', 'CropSquare': 'Square', 'CropCircle': 'Circle',
|
|
2066
|
-
'Crop3:2': '3:2', 'Crop4:3': '4:3', 'Crop5:4': '5:4', 'Crop7:5': '7:5', 'Crop16:9': '16:9'
|
|
2242
|
+
'Crop3:2': '3:2', 'Crop4:3': '4:3', 'Crop5:4': '5:4', 'Crop7:5': '7:5', 'Crop16:9': '16:9',
|
|
2243
|
+
'Crop2:3': '2:3', 'Crop3:4': '3:4', 'Crop4:5': '4:5', 'Crop5:7': '5:7', 'Crop9:16': '9:16' };
|
|
2067
2244
|
return typeToSelectionType["" + type];
|
|
2068
2245
|
};
|
|
2069
2246
|
/** Clears the context.
|
|
@@ -2106,10 +2283,12 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2106
2283
|
this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: null, fillColor: null,
|
|
2107
2284
|
strokeWidth: this.activeObj.strokeSettings.strokeWidth } });
|
|
2108
2285
|
this.objColl.push(this.activeObj);
|
|
2109
|
-
this.
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2286
|
+
if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
|
|
2287
|
+
this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
2288
|
+
value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
|
|
2289
|
+
previousPointColl: prevObj.pointColl, previousCropObj: prevCropObj, previousText: null,
|
|
2290
|
+
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
2291
|
+
}
|
|
2113
2292
|
this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
|
|
2114
2293
|
if (!isBlazor()) {
|
|
2115
2294
|
if (Browser.isDevice) {
|
|
@@ -2127,8 +2306,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2127
2306
|
}
|
|
2128
2307
|
}
|
|
2129
2308
|
}
|
|
2130
|
-
var shapeChangedArgs = { action: type,
|
|
2131
|
-
currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2309
|
+
var shapeChangedArgs = { action: type, currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2132
2310
|
this.triggerShapeChanged(shapeChangedArgs);
|
|
2133
2311
|
};
|
|
2134
2312
|
/**
|
|
@@ -2157,18 +2335,20 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2157
2335
|
value: { obj: selPointCollObj } });
|
|
2158
2336
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
2159
2337
|
this.objColl.pop();
|
|
2160
|
-
if (this.textArea.style.display === 'block') {
|
|
2338
|
+
if (this.textArea.style.display === 'block' || this.textArea.style.display === 'inline-block') {
|
|
2161
2339
|
this.notify('shape', { prop: 'updateFontRatio', onPropertyChange: false,
|
|
2162
2340
|
value: { obj: this.activeObj, isTextArea: true } });
|
|
2163
2341
|
var temp = this.activeObj.textSettings.fontFamily;
|
|
2164
2342
|
this.activeObj.textSettings.fontFamily = this.toPascalCase(id);
|
|
2165
2343
|
this.notify('shape', { prop: 'redraw-text' });
|
|
2166
2344
|
this.objColl.push(this.activeObj);
|
|
2167
|
-
this.
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2345
|
+
if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
|
|
2346
|
+
this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
2347
|
+
value: { operation: 'textAreaCustomization', previousObj: prevObj, previousObjColl: prevObj.objColl,
|
|
2348
|
+
previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
|
|
2349
|
+
previousCropObj: prevCropObj, previousText: null,
|
|
2350
|
+
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
2351
|
+
}
|
|
2172
2352
|
this.objColl.pop();
|
|
2173
2353
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
2174
2354
|
var width = this.activeObj.activePoint.width +
|
|
@@ -2187,15 +2367,16 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2187
2367
|
value: { textSettings: null, fontFamily: fontFamily, fontSize: null } });
|
|
2188
2368
|
this.notify('shape', { prop: 'redraw-text' });
|
|
2189
2369
|
this.objColl.push(this.activeObj);
|
|
2190
|
-
this.
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2370
|
+
if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
|
|
2371
|
+
this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
2372
|
+
value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: objColl,
|
|
2373
|
+
previousPointColl: extend([], this.pointColl, [], true),
|
|
2374
|
+
previousSelPointColl: prevObj.selPointColl, previousCropObj: prevCropObj, previousText: null,
|
|
2375
|
+
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
2376
|
+
}
|
|
2195
2377
|
this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
|
|
2196
2378
|
}
|
|
2197
|
-
var shapeChangedArgs = { action: 'font-family',
|
|
2198
|
-
currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2379
|
+
var shapeChangedArgs = { action: 'font-family', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2199
2380
|
shapeChangedArgs.currentShapeSettings.fontFamily = this.textArea.style.fontFamily;
|
|
2200
2381
|
this.triggerShapeChanged(shapeChangedArgs);
|
|
2201
2382
|
};
|
|
@@ -2225,17 +2406,19 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2225
2406
|
value: { obj: selPointCollObj } });
|
|
2226
2407
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
2227
2408
|
this.objColl.pop();
|
|
2228
|
-
if (this.textArea.style.display === 'block') {
|
|
2409
|
+
if (this.textArea.style.display === 'block' || this.textArea.style.display === 'inline-block') {
|
|
2229
2410
|
this.notify('shape', { prop: 'updateFontRatio', onPropertyChange: false,
|
|
2230
2411
|
value: { obj: this.activeObj, isTextArea: true } });
|
|
2231
2412
|
var temp = this.activeObj.textSettings.fontSize;
|
|
2232
2413
|
this.activeObj.textSettings.fontSize = parseInt(this.fontSizeColl[(parseInt(itemText, 10) - 1)].text, 10);
|
|
2233
2414
|
this.objColl.push(this.activeObj);
|
|
2234
|
-
this.
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2415
|
+
if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
|
|
2416
|
+
this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
2417
|
+
value: { operation: 'textAreaCustomization', previousObj: prevObj, previousObjColl: prevObj.objColl,
|
|
2418
|
+
previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
|
|
2419
|
+
previousCropObj: prevCropObj, previousText: null,
|
|
2420
|
+
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
2421
|
+
}
|
|
2239
2422
|
this.objColl.pop();
|
|
2240
2423
|
var textStyle = '';
|
|
2241
2424
|
if (this.textArea.style.fontWeight === 'bold') {
|
|
@@ -2286,15 +2469,16 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2286
2469
|
isMouseMove: null, x: null, y: null } });
|
|
2287
2470
|
this.notify('shape', { prop: 'redraw-text' });
|
|
2288
2471
|
this.objColl.push(this.activeObj);
|
|
2289
|
-
this.
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2472
|
+
if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
|
|
2473
|
+
this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
2474
|
+
value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
|
|
2475
|
+
previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
|
|
2476
|
+
previousCropObj: prevCropObj, previousText: null,
|
|
2477
|
+
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
2478
|
+
}
|
|
2294
2479
|
this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
|
|
2295
2480
|
}
|
|
2296
|
-
var shapeChangedArgs = { action: 'font-size',
|
|
2297
|
-
currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2481
|
+
var shapeChangedArgs = { action: 'font-size', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2298
2482
|
shapeChangedArgs.currentShapeSettings.fontSize = this.activeObj.textSettings.fontSize;
|
|
2299
2483
|
this.triggerShapeChanged(shapeChangedArgs);
|
|
2300
2484
|
};
|
|
@@ -2329,38 +2513,43 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2329
2513
|
strokeColor: this.activeObj.strokeSettings.strokeColor, fillColor: null, strokeWidth: null } });
|
|
2330
2514
|
if (!this.togglePen) {
|
|
2331
2515
|
this.objColl.push(this.activeObj);
|
|
2332
|
-
this.
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2516
|
+
if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
|
|
2517
|
+
this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
2518
|
+
value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
|
|
2519
|
+
previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
|
|
2520
|
+
previousCropObj: prevCropObj, previousText: null,
|
|
2521
|
+
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
2522
|
+
}
|
|
2337
2523
|
this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
|
|
2338
2524
|
}
|
|
2339
2525
|
}
|
|
2340
|
-
else if (this.textArea.style.display === 'block') {
|
|
2526
|
+
else if (this.textArea.style.display === 'block' || this.textArea.style.display === 'inline-block') {
|
|
2341
2527
|
this.textArea.style.color = value;
|
|
2342
2528
|
var temp = this.activeObj.strokeSettings.strokeColor;
|
|
2343
2529
|
this.activeObj.strokeSettings.strokeColor = value;
|
|
2344
2530
|
this.objColl.push(this.activeObj);
|
|
2345
|
-
this.
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2531
|
+
if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
|
|
2532
|
+
this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
2533
|
+
value: { operation: 'textAreaCustomization', previousObj: prevObj, previousObjColl: prevObj.objColl,
|
|
2534
|
+
previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
|
|
2535
|
+
previousCropObj: prevCropObj, previousText: null,
|
|
2536
|
+
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
2537
|
+
}
|
|
2350
2538
|
this.objColl.pop();
|
|
2351
2539
|
this.activeObj.strokeSettings.strokeColor = temp;
|
|
2352
2540
|
}
|
|
2353
2541
|
else if (!this.togglePen) {
|
|
2354
2542
|
this.objColl.push(this.activeObj);
|
|
2355
|
-
this.
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2543
|
+
if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
|
|
2544
|
+
this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
2545
|
+
value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
|
|
2546
|
+
previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
|
|
2547
|
+
previousCropObj: prevCropObj, previousText: null,
|
|
2548
|
+
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
2549
|
+
}
|
|
2360
2550
|
this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
|
|
2361
2551
|
}
|
|
2362
|
-
var shapeChangedArgs = { action: 'font-color',
|
|
2363
|
-
currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2552
|
+
var shapeChangedArgs = { action: 'font-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2364
2553
|
shapeChangedArgs.currentShapeSettings.fillColor = value;
|
|
2365
2554
|
this.triggerShapeChanged(shapeChangedArgs);
|
|
2366
2555
|
};
|
|
@@ -2395,14 +2584,19 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2395
2584
|
var obj = { bool: false };
|
|
2396
2585
|
this.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: obj } });
|
|
2397
2586
|
if (obj['bool']) {
|
|
2398
|
-
var
|
|
2399
|
-
this.notify('freehand-draw', { prop: 'getPenStrokeWidth', onPropertyChange: false, value: { obj:
|
|
2587
|
+
var obj_5 = { penStrokeWidth: null };
|
|
2588
|
+
this.notify('freehand-draw', { prop: 'getPenStrokeWidth', onPropertyChange: false, value: { obj: obj_5 } });
|
|
2400
2589
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
2590
|
+
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
2401
2591
|
this.notify('freehand-draw', { prop: 'hoverFhd', onPropertyChange: false,
|
|
2402
|
-
value: { strokeColor: null, strokeWidth:
|
|
2592
|
+
value: { strokeColor: null, strokeWidth: obj_5['penStrokeWidth'] } });
|
|
2403
2593
|
var indexObj = { freehandSelectedIndex: null };
|
|
2404
2594
|
this.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
|
|
2405
|
-
this.pointColl[indexObj['freehandSelectedIndex']].strokeWidth =
|
|
2595
|
+
this.pointColl[indexObj['freehandSelectedIndex']].strokeWidth = obj_5['penStrokeWidth'];
|
|
2596
|
+
this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null } });
|
|
2597
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
2598
|
+
this.notify('freehand-draw', { prop: 'hoverFhd', onPropertyChange: false,
|
|
2599
|
+
value: { strokeColor: null, strokeWidth: obj_5['penStrokeWidth'] } });
|
|
2406
2600
|
this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
2407
2601
|
value: { operation: 'freehanddrawCustomized', previousObj: prevObj, previousObjColl: prevObj.objColl,
|
|
2408
2602
|
previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
|
|
@@ -2410,8 +2604,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2410
2604
|
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
2411
2605
|
}
|
|
2412
2606
|
shapeSettings.type = ShapeType.FreehandDraw;
|
|
2413
|
-
var shapeChangedArgs = { action: 'stroke-width',
|
|
2414
|
-
currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2607
|
+
var shapeChangedArgs = { action: 'stroke-width', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2415
2608
|
shapeChangedArgs.currentShapeSettings.strokeWidth = this.activeObj.strokeSettings.strokeWidth;
|
|
2416
2609
|
this.triggerShapeChanged(shapeChangedArgs);
|
|
2417
2610
|
};
|
|
@@ -2443,13 +2636,32 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2443
2636
|
this.pointColl = temp;
|
|
2444
2637
|
this.notify('selection', { prop: 'setFreehandDrawCustomized', value: { isFreehandDrawCustomized: true } });
|
|
2445
2638
|
this.activeObj.strokeSettings.strokeColor = value;
|
|
2639
|
+
var indexObj = { freehandSelectedIndex: null };
|
|
2640
|
+
this.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
|
|
2641
|
+
if (indexObj['freehandSelectedIndex'] !== null && indexObj['freehandSelectedIndex'] !== undefined) {
|
|
2642
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
2643
|
+
// Temporary delete the selected freehand drawing from the collection
|
|
2644
|
+
var count = 0;
|
|
2645
|
+
var temp_1 = extend({}, this.pointColl, {}, true);
|
|
2646
|
+
for (var i = 0; i < this.freehandCounter; i++) {
|
|
2647
|
+
if (parseInt(temp_1[i].id.split('_')[1], 10) - 1 !== indexObj['freehandSelectedIndex']) {
|
|
2648
|
+
this.pointColl[count] = temp_1[i];
|
|
2649
|
+
count++;
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null } });
|
|
2653
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
2654
|
+
this.pointColl = temp_1;
|
|
2655
|
+
this.notify('freehand-draw', { prop: 'hoverFhd', onPropertyChange: false,
|
|
2656
|
+
value: { strokeColor: null, strokeWidth: null } });
|
|
2657
|
+
}
|
|
2446
2658
|
var obj = { bool: false };
|
|
2447
2659
|
this.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: obj } });
|
|
2448
2660
|
if (obj['bool']) {
|
|
2449
|
-
var
|
|
2450
|
-
this.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj:
|
|
2661
|
+
var indexObj_1 = { freehandSelectedIndex: null };
|
|
2662
|
+
this.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj_1 } });
|
|
2451
2663
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
2452
|
-
this.pointColl[
|
|
2664
|
+
this.pointColl[indexObj_1['freehandSelectedIndex']].strokeColor = value;
|
|
2453
2665
|
this.notify('freehand-draw', { prop: 'hoverFhd', onPropertyChange: false,
|
|
2454
2666
|
value: { strokeColor: value } });
|
|
2455
2667
|
this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
@@ -2462,8 +2674,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2462
2674
|
this.notify('selection', { prop: 'redrawShape', value: { obj: this.activeObj } });
|
|
2463
2675
|
}
|
|
2464
2676
|
shapeSettings.type = ShapeType.FreehandDraw;
|
|
2465
|
-
var shapeChangedArgs = { action: 'stroke-color',
|
|
2466
|
-
currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2677
|
+
var shapeChangedArgs = { action: 'stroke-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2467
2678
|
shapeChangedArgs.currentShapeSettings.strokeColor = value;
|
|
2468
2679
|
this.triggerShapeChanged(shapeChangedArgs);
|
|
2469
2680
|
};
|
|
@@ -2494,18 +2705,22 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2494
2705
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
2495
2706
|
this.objColl.pop();
|
|
2496
2707
|
this.activeObj.strokeSettings.strokeWidth = parseInt(id, 10);
|
|
2708
|
+
if (this.activeObj.shape === 'rectangle' || this.activeObj.shape === 'ellipse') {
|
|
2709
|
+
this.activeObj.strokeSettings.strokeWidth = parseInt(id, 10) - 1;
|
|
2710
|
+
}
|
|
2497
2711
|
this.activeObj.strokeSettings.strokeWidth *= 2;
|
|
2498
2712
|
this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: null, fillColor: null,
|
|
2499
2713
|
strokeWidth: this.activeObj.strokeSettings.strokeWidth } });
|
|
2500
2714
|
this.objColl.push(this.activeObj);
|
|
2501
|
-
this.
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2715
|
+
if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
|
|
2716
|
+
this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
2717
|
+
value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
|
|
2718
|
+
previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
|
|
2719
|
+
previousCropObj: prevCropObj, previousText: null,
|
|
2720
|
+
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
2721
|
+
}
|
|
2506
2722
|
this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
|
|
2507
|
-
var shapeChangedArgs = { action: 'stroke-width',
|
|
2508
|
-
currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2723
|
+
var shapeChangedArgs = { action: 'stroke-width', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2509
2724
|
shapeChangedArgs.currentShapeSettings.strokeWidth = this.activeObj.strokeSettings.strokeWidth;
|
|
2510
2725
|
this.triggerShapeChanged(shapeChangedArgs);
|
|
2511
2726
|
}
|
|
@@ -2547,11 +2762,13 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2547
2762
|
this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: this.activeObj.strokeSettings.strokeColor, fillColor: null, strokeWidth: null } });
|
|
2548
2763
|
if (!this.togglePen) {
|
|
2549
2764
|
this.objColl.push(this.activeObj);
|
|
2550
|
-
this.
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2765
|
+
if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
|
|
2766
|
+
this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
2767
|
+
value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
|
|
2768
|
+
previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
|
|
2769
|
+
previousCropObj: prevCropObj, previousText: null,
|
|
2770
|
+
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
2771
|
+
}
|
|
2555
2772
|
this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
|
|
2556
2773
|
}
|
|
2557
2774
|
}
|
|
@@ -2560,8 +2777,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2560
2777
|
this.activeObj.strokeSettings.strokeColor = value;
|
|
2561
2778
|
this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: this.activeObj.strokeSettings.strokeColor, fillColor: null, strokeWidth: null } });
|
|
2562
2779
|
}
|
|
2563
|
-
var shapeChangedArgs = { action: 'stroke-color',
|
|
2564
|
-
currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2780
|
+
var shapeChangedArgs = { action: 'stroke-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2565
2781
|
shapeChangedArgs.currentShapeSettings.strokeColor = value;
|
|
2566
2782
|
this.triggerShapeChanged(shapeChangedArgs);
|
|
2567
2783
|
};
|
|
@@ -2594,15 +2810,15 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2594
2810
|
value: { strokeSettings: null, strokeColor: null, fillColor: this.activeObj.strokeSettings.fillColor,
|
|
2595
2811
|
strokeWidth: null } });
|
|
2596
2812
|
this.objColl.push(this.activeObj);
|
|
2597
|
-
this.
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2813
|
+
if (this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
|
|
2814
|
+
this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
2815
|
+
value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
|
|
2816
|
+
previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
|
|
2817
|
+
previousCropObj: prevCropObj, previousText: null,
|
|
2818
|
+
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
2819
|
+
}
|
|
2602
2820
|
this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
|
|
2603
|
-
var shapeChangedArgs = { action: 'fill-color',
|
|
2604
|
-
currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2605
|
-
shapeChangedArgs.currentShapeSettings.fillColor = value;
|
|
2821
|
+
var shapeChangedArgs = { action: 'fill-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2606
2822
|
this.triggerShapeChanged(shapeChangedArgs);
|
|
2607
2823
|
};
|
|
2608
2824
|
/**
|
|
@@ -2617,6 +2833,9 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2617
2833
|
var prevCropObj;
|
|
2618
2834
|
var prevObj;
|
|
2619
2835
|
if (isNullOrUndefined(isPreventURC)) {
|
|
2836
|
+
if (isNullOrUndefined(this.activeObj.imageRatio)) {
|
|
2837
|
+
this.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
|
|
2838
|
+
}
|
|
2620
2839
|
this.notify('shape', { prop: 'pushActItemIntoObj' });
|
|
2621
2840
|
prevCropObj = extend({}, this.cropObj, {}, true);
|
|
2622
2841
|
var object = { currObj: {} };
|
|
@@ -2635,8 +2854,10 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2635
2854
|
this.notify('toolbar', { prop: 'refreshSlider' });
|
|
2636
2855
|
}
|
|
2637
2856
|
ctx.clearRect(0, 0, this.activeObj.imageCanvas.width, this.activeObj.imageCanvas.height);
|
|
2857
|
+
var activePoint = this.duplicateImage();
|
|
2638
2858
|
this.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
|
|
2639
2859
|
value: { ctx: this.activeObj.imageCanvas.getContext('2d'), isImgAnnotation: true, isHFlip: true, isVFlip: null } });
|
|
2860
|
+
this.activeObj.activePoint = activePoint;
|
|
2640
2861
|
this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
|
|
2641
2862
|
if (isNullOrUndefined(isPreventURC)) {
|
|
2642
2863
|
this.objColl.push(this.activeObj);
|
|
@@ -2660,6 +2881,9 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2660
2881
|
var prevCropObj;
|
|
2661
2882
|
var prevObj;
|
|
2662
2883
|
if (isNullOrUndefined(isPreventURC)) {
|
|
2884
|
+
if (isNullOrUndefined(this.activeObj.imageRatio)) {
|
|
2885
|
+
this.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
|
|
2886
|
+
}
|
|
2663
2887
|
this.notify('shape', { prop: 'pushActItemIntoObj' });
|
|
2664
2888
|
prevCropObj = extend({}, this.cropObj, {}, true);
|
|
2665
2889
|
var object = { currObj: {} };
|
|
@@ -2678,8 +2902,10 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2678
2902
|
this.notify('toolbar', { prop: 'refreshSlider' });
|
|
2679
2903
|
}
|
|
2680
2904
|
ctx.clearRect(0, 0, this.activeObj.imageCanvas.width, this.activeObj.imageCanvas.height);
|
|
2905
|
+
var activePoint = this.duplicateImage();
|
|
2681
2906
|
this.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
|
|
2682
2907
|
value: { ctx: this.activeObj.imageCanvas.getContext('2d'), isImgAnnotation: true, isHFlip: null, isVFlip: true } });
|
|
2908
|
+
this.activeObj.activePoint = activePoint;
|
|
2683
2909
|
this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
|
|
2684
2910
|
if (isNullOrUndefined(isPreventURC)) {
|
|
2685
2911
|
this.objColl.push(this.activeObj);
|
|
@@ -2695,10 +2921,29 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2695
2921
|
* Apply rotate image.
|
|
2696
2922
|
*
|
|
2697
2923
|
* @param { string } rotate - Specifies the direction of rotation.
|
|
2924
|
+
* @param { boolean } isPreventURC - Specifies to update undo redo collection.
|
|
2698
2925
|
* @hidden
|
|
2699
2926
|
* @returns {void}.
|
|
2700
2927
|
*/
|
|
2701
2928
|
ImageEditor.prototype.rotateImage = function (rotate) {
|
|
2929
|
+
var prevCropObj;
|
|
2930
|
+
var prevObj;
|
|
2931
|
+
if (isNullOrUndefined(this.activeObj.imageRatio)) {
|
|
2932
|
+
this.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
|
|
2933
|
+
}
|
|
2934
|
+
this.notify('shape', { prop: 'pushActItemIntoObj' });
|
|
2935
|
+
prevCropObj = extend({}, this.cropObj, {}, true);
|
|
2936
|
+
var object = { currObj: {} };
|
|
2937
|
+
this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
|
|
2938
|
+
prevObj = object['currObj'];
|
|
2939
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
2940
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
2941
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
2942
|
+
var selPointCollObj = { selPointColl: null };
|
|
2943
|
+
this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
2944
|
+
value: { obj: selPointCollObj } });
|
|
2945
|
+
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
2946
|
+
this.objColl.pop();
|
|
2702
2947
|
if (!isBlazor()) {
|
|
2703
2948
|
this.notify('toolbar', { prop: 'refreshSlider' });
|
|
2704
2949
|
}
|
|
@@ -2711,14 +2956,21 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2711
2956
|
this.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: this.activeObj } });
|
|
2712
2957
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
2713
2958
|
this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2959
|
+
this.objColl.push(this.activeObj);
|
|
2960
|
+
this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
2961
|
+
value: { operation: 'imageRotate', previousObj: prevObj, previousObjColl: prevObj.objColl,
|
|
2962
|
+
previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
|
|
2963
|
+
previousCropObj: prevCropObj, previousText: null,
|
|
2964
|
+
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
2965
|
+
this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
|
|
2966
|
+
if (isBlazor()) {
|
|
2719
2967
|
this.updateToolbar(this.element, 'destroyQuickAccessToolbar');
|
|
2720
2968
|
this.updateToolbar(this.element, 'quickAccessToolbar', 'image');
|
|
2721
2969
|
}
|
|
2970
|
+
else {
|
|
2971
|
+
this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
|
|
2972
|
+
this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
2973
|
+
}
|
|
2722
2974
|
};
|
|
2723
2975
|
/**
|
|
2724
2976
|
* Get pascalToSplitWords from string.
|
|
@@ -2745,15 +2997,29 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2745
2997
|
* @returns {number}.
|
|
2746
2998
|
*/
|
|
2747
2999
|
ImageEditor.prototype.getCurrAdjustmentValue = function (type) {
|
|
2748
|
-
var
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
'
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
3000
|
+
var value = 100;
|
|
3001
|
+
var indexObj = { freehandSelectedIndex: null };
|
|
3002
|
+
this.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
|
|
3003
|
+
if (type === 'transparency' && this.togglePen) {
|
|
3004
|
+
var obj = { penOpacity: 1 };
|
|
3005
|
+
this.notify('freehand-draw', { prop: 'getPenOpacity', onPropertyChange: false, value: { obj: obj } });
|
|
3006
|
+
value = obj['penOpacity'] * 100;
|
|
3007
|
+
}
|
|
3008
|
+
else if (type === 'transparency' && indexObj['freehandSelectedIndex'] !== null && indexObj['freehandSelectedIndex'] !== undefined) {
|
|
3009
|
+
value = this.pointColl[indexObj['freehandSelectedIndex']].opacity * 100;
|
|
3010
|
+
}
|
|
3011
|
+
else {
|
|
3012
|
+
var obj = { adjustmentLevel: null };
|
|
3013
|
+
this.notify('filter', { prop: 'getAdjustmentLevel', onPropertyChange: false,
|
|
3014
|
+
value: { obj: obj } });
|
|
3015
|
+
var typeToAdjustmentLevel = { 'brightness': obj['adjustmentLevel'].brightness,
|
|
3016
|
+
'contrast': obj['adjustmentLevel'].contrast, 'hue': obj['adjustmentLevel'].hue,
|
|
3017
|
+
'saturation': obj['adjustmentLevel'].saturation, 'opacity': obj['adjustmentLevel'].opacity,
|
|
3018
|
+
'blur': obj['adjustmentLevel'].blur, 'exposure': obj['adjustmentLevel'].exposure,
|
|
3019
|
+
'transparency': obj['adjustmentLevel'].transparency, 'straighten': this.transform.straighten };
|
|
3020
|
+
value = typeToAdjustmentLevel["" + type];
|
|
3021
|
+
}
|
|
3022
|
+
return value;
|
|
2757
3023
|
};
|
|
2758
3024
|
/**
|
|
2759
3025
|
* Apply transformSelect.
|
|
@@ -2765,14 +3031,80 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2765
3031
|
ImageEditor.prototype.transformSelect = function (type) {
|
|
2766
3032
|
this.isCropToolbar = true;
|
|
2767
3033
|
this.allowDownScale = false;
|
|
3034
|
+
var straighten = this.transform.straighten;
|
|
3035
|
+
var straightenObj = extend({}, this.activeObj, {}, true);
|
|
3036
|
+
var zoomFactor = this.transform.zoomFactor;
|
|
3037
|
+
this.prevEventSelectionPoint = extend({}, this.activeObj, {}, true);
|
|
3038
|
+
var object = { currObj: {} };
|
|
3039
|
+
this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
|
|
3040
|
+
this.prevEventObjPoint = object['currObj'];
|
|
3041
|
+
this.prevEventObjPoint.objColl = extend([], this.objColl, [], true);
|
|
3042
|
+
this.prevEventObjPoint.pointColl = extend([], this.pointColl, [], true);
|
|
3043
|
+
this.prevEventObjPoint.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
3044
|
+
var selPointCollObj = { selPointColl: null };
|
|
3045
|
+
this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
3046
|
+
value: { obj: selPointCollObj } });
|
|
3047
|
+
this.prevEventObjPoint.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
3048
|
+
if (this.transform.straighten !== 0) {
|
|
3049
|
+
this.transform.straighten = 0;
|
|
3050
|
+
this.straightenBaseImageCanvas();
|
|
3051
|
+
for (var i = 0, len = this.objColl.length; i < len; i++) {
|
|
3052
|
+
var shape = this.objColl[i].shape;
|
|
3053
|
+
if (shape !== 'line' && shape !== 'arrow' && shape !== 'path') {
|
|
3054
|
+
this.objColl[i].rotatedAngle -= (straighten * (Math.PI / 180));
|
|
3055
|
+
this.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: this.objColl[i] } });
|
|
3056
|
+
}
|
|
3057
|
+
}
|
|
3058
|
+
this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
|
|
3059
|
+
this.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
3060
|
+
this.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
3061
|
+
}
|
|
2768
3062
|
this.setInitialZoomState();
|
|
2769
3063
|
var activeObj = extend({}, this.activeObj, {}, true);
|
|
3064
|
+
this.notify('crop', { prop: 'setTransformCrop', onPropertyChange: false, value: { bool: true } });
|
|
2770
3065
|
this.cropSelectedState();
|
|
3066
|
+
this.notify('crop', { prop: 'setTransformCrop', onPropertyChange: false, value: { bool: false } });
|
|
2771
3067
|
this.notify('draw', { prop: 'resetCurrentSelectionPoint' });
|
|
2772
3068
|
this.updateImageTransformColl(type);
|
|
2773
3069
|
this.notify('transform', { prop: 'performTransformation', value: { text: type } });
|
|
3070
|
+
this.isCropTab = true;
|
|
2774
3071
|
this.notify('draw', { prop: 'moveToSelectionRange', value: { type: type, activeObj: activeObj } });
|
|
3072
|
+
if (this.isStraightening && (type === 'horizontalflip' || type === 'verticalflip')) {
|
|
3073
|
+
this.notify('draw', { prop: 'resetStraightenDestPoints' });
|
|
3074
|
+
this.notify('draw', { prop: 'setDestForStraighten' });
|
|
3075
|
+
}
|
|
3076
|
+
if (straighten !== 0) {
|
|
3077
|
+
this.transform.straighten = straighten;
|
|
3078
|
+
this.straightenBaseImageCanvas();
|
|
3079
|
+
for (var i = 0, len = this.objColl.length; i < len; i++) {
|
|
3080
|
+
var shape = this.objColl[i].shape;
|
|
3081
|
+
if (shape !== 'line' && shape !== 'arrow' && shape !== 'path') {
|
|
3082
|
+
this.objColl[i].rotatedAngle += (straighten * (Math.PI / 180));
|
|
3083
|
+
this.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: this.objColl[i] } });
|
|
3084
|
+
}
|
|
3085
|
+
}
|
|
3086
|
+
this.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
3087
|
+
this.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
3088
|
+
this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
|
|
3089
|
+
this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: straightenObj } });
|
|
3090
|
+
this.notify('draw', { prop: 'setStraightenActObj', value: { activeObj: null } });
|
|
3091
|
+
this.notify('draw', { prop: 'setStraightenInitZoom', value: { zoomFactor: zoomFactor } });
|
|
3092
|
+
if ((this.isStraightening && (type === 'horizontalflip' || type === 'verticalflip')) &&
|
|
3093
|
+
isNullOrUndefined(this.transform.zoomFactor) || this.transform.zoomFactor === 0) {
|
|
3094
|
+
if (this.transform.degree === 0) {
|
|
3095
|
+
this.transform.zoomFactor += 0.025;
|
|
3096
|
+
}
|
|
3097
|
+
else if (this.transform.zoomFactor === 0) {
|
|
3098
|
+
this.transform.zoomFactor = null;
|
|
3099
|
+
}
|
|
3100
|
+
}
|
|
3101
|
+
this.notify('draw', { prop: 'zoomToSel', value: { activeObj: straightenObj, isToolbar: false } });
|
|
3102
|
+
}
|
|
2775
3103
|
this.isCropToolbar = false;
|
|
3104
|
+
var stValPan = this.element.querySelector('.e-ie-straighten-value-span');
|
|
3105
|
+
if (stValPan) {
|
|
3106
|
+
stValPan.innerHTML = this.transform.straighten.toString() + '°';
|
|
3107
|
+
}
|
|
2776
3108
|
};
|
|
2777
3109
|
/**
|
|
2778
3110
|
* Returns default filter.
|
|
@@ -2785,6 +3117,144 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2785
3117
|
'saturate(' + 100 + '%) ' + 'opacity(' + 1 + ') ' + 'blur(' + 0 + 'px) ' + 'sepia(0%) ' +
|
|
2786
3118
|
'grayscale(0%) ' + 'invert(0%)';
|
|
2787
3119
|
};
|
|
3120
|
+
/**
|
|
3121
|
+
* Performs Straightening action.
|
|
3122
|
+
*
|
|
3123
|
+
* @hidden
|
|
3124
|
+
* @returns {void}.
|
|
3125
|
+
*/
|
|
3126
|
+
ImageEditor.prototype.setStraighten = function (value, isMethod) {
|
|
3127
|
+
var straightenEventArgs = { cancel: false, previousDegree: this.transform.straighten, currentDegree: value };
|
|
3128
|
+
if (isBlazor()) {
|
|
3129
|
+
this.prevStraightenEvent = this.transform.straighten;
|
|
3130
|
+
}
|
|
3131
|
+
else {
|
|
3132
|
+
this.trigger('rotating', straightenEventArgs);
|
|
3133
|
+
}
|
|
3134
|
+
if (!straightenEventArgs.cancel) {
|
|
3135
|
+
this.performStraighten(straightenEventArgs);
|
|
3136
|
+
}
|
|
3137
|
+
};
|
|
3138
|
+
ImageEditor.prototype.duplicateImage = function () {
|
|
3139
|
+
var activePoint = extend({}, this.activeObj.activePoint, {}, true);
|
|
3140
|
+
var dimObj = { width: 0, height: 0 };
|
|
3141
|
+
this.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
|
|
3142
|
+
value: { width: this.activeObj.imageElement.width, height: this.activeObj.imageElement.height, obj: dimObj, isImgShape: null } });
|
|
3143
|
+
this.activeObj.activePoint.width = dimObj['width'];
|
|
3144
|
+
this.activeObj.activePoint.height = dimObj['height'];
|
|
3145
|
+
return activePoint;
|
|
3146
|
+
};
|
|
3147
|
+
ImageEditor.prototype.performStraighten = function (straightenEventArgs) {
|
|
3148
|
+
var value = straightenEventArgs.currentDegree;
|
|
3149
|
+
var stValPan = this.element.querySelector('.e-ie-straighten-value-span');
|
|
3150
|
+
if (stValPan) {
|
|
3151
|
+
stValPan.innerHTML = value.toString() + '°';
|
|
3152
|
+
}
|
|
3153
|
+
var prevValue = this.transform.straighten;
|
|
3154
|
+
var obj = extend({}, this.activeObj, null, true);
|
|
3155
|
+
this.notify('freehand-draw', { prop: 'setCenterSelPoints' });
|
|
3156
|
+
this.transform.straighten = value;
|
|
3157
|
+
this.straightenPoint = { x: this.activeObj.activePoint.startX + (this.activeObj.activePoint.width / 2),
|
|
3158
|
+
y: this.activeObj.activePoint.startY + (this.activeObj.activePoint.height / 2) };
|
|
3159
|
+
this.straightenBaseImageCanvas();
|
|
3160
|
+
for (var i = 0, len = this.objColl.length; i < len; i++) {
|
|
3161
|
+
var shape = this.objColl[i].shape;
|
|
3162
|
+
if (shape !== 'line' && shape !== 'arrow' && shape !== 'path') {
|
|
3163
|
+
this.objColl[i].rotatedAngle += ((this.transform.straighten - this.prevStraightenedDegree) * (Math.PI / 180));
|
|
3164
|
+
this.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: this.objColl[i] } });
|
|
3165
|
+
}
|
|
3166
|
+
}
|
|
3167
|
+
if (this.transform.degree % 90 === 0 && this.transform.degree % 180 !== 0) {
|
|
3168
|
+
if (this.transform.straighten === 0) {
|
|
3169
|
+
this.transform.straighten = 360;
|
|
3170
|
+
}
|
|
3171
|
+
this.notify('draw', { prop: 'performPointZoom', onPropertyChange: false,
|
|
3172
|
+
value: { x: this.activeObj.activePoint.startX + (this.activeObj.activePoint.width / 2),
|
|
3173
|
+
y: this.activeObj.activePoint.startY + (this.activeObj.activePoint.height / 2), type: 'zoomIn', isResize: true } });
|
|
3174
|
+
this.notify('draw', { prop: 'performPointZoom', onPropertyChange: false,
|
|
3175
|
+
value: { x: this.activeObj.activePoint.startX + (this.activeObj.activePoint.width / 2),
|
|
3176
|
+
y: this.activeObj.activePoint.startY + (this.activeObj.activePoint.height / 2), type: 'zoomOut', isResize: true } });
|
|
3177
|
+
if (this.transform.straighten === 360) {
|
|
3178
|
+
this.transform.straighten = 0;
|
|
3179
|
+
}
|
|
3180
|
+
}
|
|
3181
|
+
else {
|
|
3182
|
+
this.notify('draw', { prop: 'render-image', value: { isMouseWheel: true, isPreventClearRect: null, isFrame: null, isStraighten: true } });
|
|
3183
|
+
}
|
|
3184
|
+
this.notify('draw', { prop: 'drawObject', onPropertyChange: false,
|
|
3185
|
+
value: { canvas: 'duplicate', obj: obj } });
|
|
3186
|
+
this.notify('draw', { prop: 'zoomToSel', value: { activeObj: obj, isToolbar: true } });
|
|
3187
|
+
this.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
|
|
3188
|
+
this.prevStraightenedDegree = this.transform.straighten;
|
|
3189
|
+
};
|
|
3190
|
+
/**
|
|
3191
|
+
* Straightens base image.
|
|
3192
|
+
*
|
|
3193
|
+
* @hidden
|
|
3194
|
+
* @returns {void}.
|
|
3195
|
+
*/
|
|
3196
|
+
ImageEditor.prototype.straightenBaseImageCanvas = function () {
|
|
3197
|
+
if (this.isImageLoaded) {
|
|
3198
|
+
var flipState = this.getStraightenFlipState();
|
|
3199
|
+
var straighten = flipState === 'horizontal' || flipState === 'vertical' ?
|
|
3200
|
+
-this.transform.straighten : this.transform.straighten;
|
|
3201
|
+
var ctx = this.baseImgCanvas.getContext('2d');
|
|
3202
|
+
if (ctx.canvas.width !== this.lowerContext.canvas.width &&
|
|
3203
|
+
ctx.canvas.height !== this.lowerContext.canvas.height) {
|
|
3204
|
+
var obj_6 = { width: 0, height: 0 };
|
|
3205
|
+
this.notify('crop', { prop: 'calcRatio', onPropertyChange: false,
|
|
3206
|
+
value: { obj: obj_6, dimension: { width: ctx.canvas.width, height: ctx.canvas.height } } });
|
|
3207
|
+
}
|
|
3208
|
+
var dimension = void 0;
|
|
3209
|
+
dimension = this.getRotatedCanvasDim(this.baseImg.width, this.baseImg.height, this.transform.straighten);
|
|
3210
|
+
this.img.srcWidth = ctx.canvas.width = dimension.width;
|
|
3211
|
+
this.img.srcHeight = ctx.canvas.height = dimension.height;
|
|
3212
|
+
var x = ctx.canvas.width / 2;
|
|
3213
|
+
var y = ctx.canvas.height / 2;
|
|
3214
|
+
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
3215
|
+
ctx.translate(x, y);
|
|
3216
|
+
ctx.rotate(straighten * Math.PI / 180);
|
|
3217
|
+
ctx.drawImage(this.baseImg, -this.baseImg.width / 2, -this.baseImg.height / 2, this.baseImg.width, this.baseImg.height);
|
|
3218
|
+
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
3219
|
+
var obj = { width: 0, height: 0 };
|
|
3220
|
+
this.notify('crop', { prop: 'calcRatio', onPropertyChange: false, value: { obj: obj, dimension: { width: ctx.canvas.width, height: ctx.canvas.height } } });
|
|
3221
|
+
}
|
|
3222
|
+
};
|
|
3223
|
+
/**
|
|
3224
|
+
* Returns rotated canvas dimension.
|
|
3225
|
+
*
|
|
3226
|
+
* @hidden
|
|
3227
|
+
* @returns {void}.
|
|
3228
|
+
*/
|
|
3229
|
+
ImageEditor.prototype.getRotatedCanvasDim = function (width, height, angle) {
|
|
3230
|
+
var angleRad = angle * Math.PI / 180;
|
|
3231
|
+
var cosAngle = Math.cos(angleRad);
|
|
3232
|
+
var sinAngle = Math.sin(angleRad);
|
|
3233
|
+
var minX = Math.min(0, width * cosAngle, height * Math.cos(Math.PI / 2 - angleRad), width * cosAngle + height * Math.cos(Math.PI / 2 - angleRad));
|
|
3234
|
+
var maxX = Math.max(0, width * cosAngle, height * Math.cos(Math.PI / 2 - angleRad), width * cosAngle + height * Math.cos(Math.PI / 2 - angleRad));
|
|
3235
|
+
var minY = Math.min(0, width * sinAngle, height * Math.sin(Math.PI / 2 - angleRad), width * sinAngle + height * Math.sin(Math.PI / 2 - angleRad));
|
|
3236
|
+
var maxY = Math.max(0, width * sinAngle, height * Math.sin(Math.PI / 2 - angleRad), width * sinAngle + height * Math.sin(Math.PI / 2 - angleRad));
|
|
3237
|
+
return { width: Math.ceil(maxX - minX), height: Math.ceil(maxY - minY) };
|
|
3238
|
+
};
|
|
3239
|
+
;
|
|
3240
|
+
ImageEditor.prototype.getStraightenFlipState = function () {
|
|
3241
|
+
var flipState = '';
|
|
3242
|
+
if (this.rotateFlipColl.length > 0) {
|
|
3243
|
+
for (var i = 0, len = this.rotateFlipColl.length; i < len; i++) {
|
|
3244
|
+
var curFlip = this.rotateFlipColl[i];
|
|
3245
|
+
if (curFlip === 'horizontal') {
|
|
3246
|
+
flipState += 'horizontal';
|
|
3247
|
+
}
|
|
3248
|
+
else if (curFlip === 'vertical') {
|
|
3249
|
+
flipState += 'vertical';
|
|
3250
|
+
}
|
|
3251
|
+
if (flipState === 'horizontalvertical' || flipState === 'verticalhorizontal') {
|
|
3252
|
+
flipState = '';
|
|
3253
|
+
}
|
|
3254
|
+
}
|
|
3255
|
+
}
|
|
3256
|
+
return flipState;
|
|
3257
|
+
};
|
|
2788
3258
|
// Blazor codes
|
|
2789
3259
|
/**
|
|
2790
3260
|
* To Initialize the component rendering
|
|
@@ -2812,7 +3282,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2812
3282
|
}
|
|
2813
3283
|
var canvasWrapper = this.element.querySelector('.e-canvas-wrapper');
|
|
2814
3284
|
if (this.element.querySelector('#' + this.element.id + '_toolbarArea')) {
|
|
2815
|
-
this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').
|
|
3285
|
+
this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').scrollHeight;
|
|
2816
3286
|
}
|
|
2817
3287
|
else {
|
|
2818
3288
|
this.toolbarHeight = 0;
|
|
@@ -2823,7 +3293,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2823
3293
|
this.upperCanvas = this.element.querySelector('.e-upper-canvas');
|
|
2824
3294
|
this.lowerCanvas.id = this.element.id + '_lowerCanvas';
|
|
2825
3295
|
this.upperCanvas.id = this.element.id + '_upperCanvas';
|
|
2826
|
-
this.textArea = this.element.querySelector('.e-
|
|
3296
|
+
this.textArea = this.element.querySelector('.e-textarea');
|
|
2827
3297
|
this.inMemoryCanvas = this.createElement('canvas', {
|
|
2828
3298
|
id: this.element.id + '_inMemoryCanvas', attrs: { name: 'canvasImage' }
|
|
2829
3299
|
});
|
|
@@ -2917,10 +3387,35 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2917
3387
|
*/
|
|
2918
3388
|
ImageEditor.prototype.triggerShapeChanged = function (shapeChangedArgs) {
|
|
2919
3389
|
if (isBlazor() && this.events && this.events.shapeChanged.hasDelegate === true) {
|
|
2920
|
-
|
|
2921
|
-
this.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'ShapeChanged',
|
|
3390
|
+
var args = { action: shapeChangedArgs.action, shapeSettings: shapeChangedArgs.currentShapeSettings };
|
|
3391
|
+
this.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'ShapeChanged', null, args);
|
|
3392
|
+
}
|
|
3393
|
+
else {
|
|
3394
|
+
this.trigger('shapeChange', shapeChangedArgs);
|
|
2922
3395
|
}
|
|
2923
3396
|
};
|
|
3397
|
+
ImageEditor.prototype.triggerActionComplete = function () {
|
|
3398
|
+
var frameChangedArgs = this.curFrameObjEvent;
|
|
3399
|
+
var finetuneValueChanged = this.curFinetuneObjEvent;
|
|
3400
|
+
var imageFiltered = this.curFilterObjEvent;
|
|
3401
|
+
if (isBlazor()) {
|
|
3402
|
+
if (this.isFrameBtnClick && this.events && this.events.frameChanged.hasDelegate === true) {
|
|
3403
|
+
var frameChangeArgs = { frameSettings: frameChangedArgs.currentFrameSetting };
|
|
3404
|
+
this.dotNetRef.invokeMethodAsync('OnFrameChangingAsync', 'FrameChanged', null, frameChangeArgs);
|
|
3405
|
+
}
|
|
3406
|
+
if (this.isFinetuneBtnClick && this.events && this.events.finetuneValueChanged.hasDelegate === true) {
|
|
3407
|
+
var finetuneValueChange = { finetune: this.toPascalCase(finetuneValueChanged.finetune),
|
|
3408
|
+
value: parseInt(finetuneValueChanged.value.toString()) };
|
|
3409
|
+
this.dotNetRef.invokeMethodAsync('OnFinetuneValueChangeAsync', 'FinetuneValueChanged', null, finetuneValueChange);
|
|
3410
|
+
}
|
|
3411
|
+
if (this.isFilterCanvasClick && this.events && this.events.imageFiltered.hasDelegate === true) {
|
|
3412
|
+
var imageFilter = { filter: this.toPascalCase(imageFiltered.filter) };
|
|
3413
|
+
this.dotNetRef.invokeMethodAsync('OnImageFilterEventAsync', 'ImageFiltered', null, imageFilter);
|
|
3414
|
+
}
|
|
3415
|
+
}
|
|
3416
|
+
else { }
|
|
3417
|
+
this.isFilterCanvasClick = this.isFinetuneBtnClick = this.isFrameBtnClick = false;
|
|
3418
|
+
};
|
|
2924
3419
|
var ImageEditor_1;
|
|
2925
3420
|
__decorate([
|
|
2926
3421
|
Property('')
|
|
@@ -2970,6 +3465,9 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2970
3465
|
__decorate([
|
|
2971
3466
|
Complex({}, SelectionSettings)
|
|
2972
3467
|
], ImageEditor.prototype, "selectionSettings", void 0);
|
|
3468
|
+
__decorate([
|
|
3469
|
+
Complex({}, FontFamily)
|
|
3470
|
+
], ImageEditor.prototype, "fontFamily", void 0);
|
|
2973
3471
|
__decorate([
|
|
2974
3472
|
Event()
|
|
2975
3473
|
], ImageEditor.prototype, "beforeSave", void 0);
|
|
@@ -3024,6 +3522,9 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
3024
3522
|
__decorate([
|
|
3025
3523
|
Event()
|
|
3026
3524
|
], ImageEditor.prototype, "click", void 0);
|
|
3525
|
+
__decorate([
|
|
3526
|
+
Event()
|
|
3527
|
+
], ImageEditor.prototype, "shapeChange", void 0);
|
|
3027
3528
|
__decorate([
|
|
3028
3529
|
Event()
|
|
3029
3530
|
], ImageEditor.prototype, "quickAccessToolbarOpen", void 0);
|