@syncfusion/ej2-image-editor 23.2.6 → 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 -51
- 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 +7151 -4321
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +7269 -4426
- 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 +259 -149
- 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
|
@@ -42,6 +42,9 @@ var Export = /** @class */ (function () {
|
|
|
42
42
|
case 'drawAnnotation':
|
|
43
43
|
this.drawAnnotation(args.value['context'], args.value['ratio']);
|
|
44
44
|
break;
|
|
45
|
+
case 'updateSaveContext':
|
|
46
|
+
this.updateSaveContext(args.value['context']);
|
|
47
|
+
break;
|
|
45
48
|
}
|
|
46
49
|
};
|
|
47
50
|
Export.prototype.getModuleName = function () {
|
|
@@ -69,7 +72,7 @@ var Export = /** @class */ (function () {
|
|
|
69
72
|
parent.currObjType.isZoomed = true;
|
|
70
73
|
parent.notify('shape', { prop: 'apply', onPropertyChange: false, value: { shape: null, obj: null, canvas: null } });
|
|
71
74
|
}
|
|
72
|
-
if (parent.textArea.style.display === 'block') {
|
|
75
|
+
if (parent.textArea.style.display === 'block' || parent.textArea.style.display === 'inline-block') {
|
|
73
76
|
parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
|
|
74
77
|
value: { x: null, y: null, isMouseDown: null } });
|
|
75
78
|
}
|
|
@@ -168,13 +171,26 @@ var Export = /** @class */ (function () {
|
|
|
168
171
|
var parent = this.parent;
|
|
169
172
|
var width;
|
|
170
173
|
var height;
|
|
174
|
+
var tempCropObj = extend({}, parent.cropObj, {}, true);
|
|
175
|
+
var tempObj = { currObj: {} };
|
|
176
|
+
parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: tempObj } });
|
|
177
|
+
var prevObj = tempObj['currObj'];
|
|
178
|
+
prevObj.objColl = extend([], parent.objColl, [], true);
|
|
179
|
+
prevObj.pointColl = extend([], parent.pointColl, [], true);
|
|
180
|
+
prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
|
|
181
|
+
var selPointCollObj = { selPointColl: null };
|
|
182
|
+
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
183
|
+
value: { obj: selPointCollObj } });
|
|
171
184
|
if (this.parent.aspectWidth) {
|
|
185
|
+
parent.notify('undo-redo', { prop: 'setPreventUR', value: { bool: true } });
|
|
172
186
|
if (!isBlazor()) {
|
|
173
187
|
parent.notify('toolbar', { prop: 'resizeClick', value: { bool: false } });
|
|
174
188
|
}
|
|
175
189
|
else {
|
|
190
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
176
191
|
parent.performResizeClick();
|
|
177
192
|
}
|
|
193
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
178
194
|
parent.currentToolbar = 'resize-toolbar';
|
|
179
195
|
parent.okBtn();
|
|
180
196
|
if (parent.transform.degree % 90 === 0 && parent.transform.degree % 180 !== 0) {
|
|
@@ -185,6 +201,7 @@ var Export = /** @class */ (function () {
|
|
|
185
201
|
width = this.parent.aspectWidth;
|
|
186
202
|
height = this.parent.aspectHeight;
|
|
187
203
|
}
|
|
204
|
+
parent.notify('undo-redo', { prop: 'setPreventUR', value: { bool: false } });
|
|
188
205
|
}
|
|
189
206
|
else if (parent.currSelectionPoint) {
|
|
190
207
|
width = parent.img.srcWidth;
|
|
@@ -222,9 +239,8 @@ var Export = /** @class */ (function () {
|
|
|
222
239
|
var temp = this.lowerContext.filter;
|
|
223
240
|
tempContext.filter = this.lowerContext.filter;
|
|
224
241
|
this.downScaleImgCanvas(tempContext, width, height);
|
|
225
|
-
this.updateFrame(tempContext);
|
|
226
242
|
this.lowerContext.filter = temp;
|
|
227
|
-
if (parent.transform.degree !== 0 || parent.transform.currFlipState !== '') {
|
|
243
|
+
if (parent.transform.degree !== 0 || parent.transform.currFlipState !== '' || parent.transform.straighten !== 0) {
|
|
228
244
|
this.updateSaveContext(tempContext);
|
|
229
245
|
this.exportTransformedImage(tempContext);
|
|
230
246
|
}
|
|
@@ -239,6 +255,31 @@ var Export = /** @class */ (function () {
|
|
|
239
255
|
if (object) {
|
|
240
256
|
object['canvas'] = tempCanvas;
|
|
241
257
|
}
|
|
258
|
+
if (parent.aspectWidth) {
|
|
259
|
+
parent.objColl = [];
|
|
260
|
+
parent.pointColl = [];
|
|
261
|
+
parent.freehandCounter = 0;
|
|
262
|
+
parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
|
|
263
|
+
value: { obj: { selPointColl: [] } } });
|
|
264
|
+
parent.notify('draw', { prop: 'setCurrentObj', onPropertyChange: false, value: { obj: prevObj } });
|
|
265
|
+
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
266
|
+
parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
|
|
267
|
+
value: { obj: { selPointColl: prevObj.selPointColl } } });
|
|
268
|
+
parent.cropObj = tempCropObj;
|
|
269
|
+
parent.objColl = extend([], prevObj.objColl, [], true);
|
|
270
|
+
parent.pointColl = extend([], prevObj.pointColl, [], true);
|
|
271
|
+
parent.freehandCounter = parent.pointColl.length;
|
|
272
|
+
parent.transform.straighten = 0;
|
|
273
|
+
this.lowerContext.filter = 'none';
|
|
274
|
+
parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
275
|
+
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
276
|
+
this.lowerContext.filter = prevObj.filter;
|
|
277
|
+
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
278
|
+
if (parent.isCircleCrop || (parent.currSelectionPoint && parent.currSelectionPoint.shape === 'crop-circle')) {
|
|
279
|
+
parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
|
|
280
|
+
value: { context: this.lowerContext, isSave: null, isFlip: null } });
|
|
281
|
+
}
|
|
282
|
+
}
|
|
242
283
|
return tempCanvas;
|
|
243
284
|
};
|
|
244
285
|
Export.prototype.drawAnnotation = function (tempContext, ratio) {
|
|
@@ -248,7 +289,8 @@ var Export = /** @class */ (function () {
|
|
|
248
289
|
tempContext.filter = 'none';
|
|
249
290
|
var tempObjColl = extend([], parent.objColl, [], true);
|
|
250
291
|
for (var i = 0, len = parent.objColl.length; i < len; i++) {
|
|
251
|
-
var
|
|
292
|
+
var currObj = parent.objColl[i];
|
|
293
|
+
var activePoint = currObj.activePoint;
|
|
252
294
|
// Subtracting destination left and top points
|
|
253
295
|
activePoint.startX -= parent.img.destLeft;
|
|
254
296
|
activePoint.startY -= parent.img.destTop;
|
|
@@ -263,19 +305,19 @@ var Export = /** @class */ (function () {
|
|
|
263
305
|
activePoint.endY *= ratio.height;
|
|
264
306
|
activePoint.width = activePoint.endX - activePoint.startX;
|
|
265
307
|
activePoint.height = activePoint.endY - activePoint.startY;
|
|
266
|
-
|
|
267
|
-
if (
|
|
268
|
-
|
|
308
|
+
currObj.strokeSettings.strokeWidth *= ((ratio.width + ratio.height) / 2);
|
|
309
|
+
if (currObj.shape === 'text') {
|
|
310
|
+
currObj.textSettings.fontSize *= ((ratio.width + ratio.height) / 2);
|
|
269
311
|
}
|
|
270
|
-
else if (
|
|
271
|
-
for (var l = 0; l <
|
|
272
|
-
|
|
273
|
-
(
|
|
274
|
-
|
|
275
|
-
(
|
|
312
|
+
else if (currObj.shape === 'path') {
|
|
313
|
+
for (var l = 0; l < currObj.pointColl.length; l++) {
|
|
314
|
+
currObj.pointColl[l].x =
|
|
315
|
+
(currObj.pointColl[l].x - parent.img.destLeft) * ratio.width;
|
|
316
|
+
currObj.pointColl[l].y =
|
|
317
|
+
(currObj.pointColl[l].y - parent.img.destTop) * ratio.height;
|
|
276
318
|
}
|
|
277
319
|
}
|
|
278
|
-
else if (
|
|
320
|
+
else if (currObj.shape === 'image') {
|
|
279
321
|
parent.activeObj = extend({}, parent.objColl[i], {}, true);
|
|
280
322
|
parent.notify('selection', { prop: 'upgradeImageQuality', onPropertyChange: false });
|
|
281
323
|
parent.objColl[i] = extend({}, parent.activeObj, {}, true);
|
|
@@ -288,6 +330,8 @@ var Export = /** @class */ (function () {
|
|
|
288
330
|
parent.objColl = tempObjColl;
|
|
289
331
|
}
|
|
290
332
|
if (parent.freehandCounter > 0) {
|
|
333
|
+
var widthObj = { penStrokeWidth: null };
|
|
334
|
+
parent.notify('freehand-draw', { prop: 'getPenStrokeWidth', onPropertyChange: false, value: { obj: widthObj } });
|
|
291
335
|
// eslint-disable-next-line
|
|
292
336
|
var tempPointColl = extend({}, parent.pointColl, {}, true);
|
|
293
337
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
@@ -303,6 +347,7 @@ var Export = /** @class */ (function () {
|
|
|
303
347
|
parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
|
|
304
348
|
value: { context: tempContext, points: null } });
|
|
305
349
|
parent.pointColl = tempPointColl;
|
|
350
|
+
parent.notify('freehand-draw', { prop: 'setPenStrokeWidth', onPropertyChange: false, value: { value: widthObj['penStrokeWidth'] } });
|
|
306
351
|
}
|
|
307
352
|
};
|
|
308
353
|
Export.prototype.downScaleImgCanvas = function (ctx, width, height) {
|
|
@@ -346,23 +391,26 @@ var Export = /** @class */ (function () {
|
|
|
346
391
|
Export.prototype.exportTransformedImage = function (tempContext) {
|
|
347
392
|
var parent = this.parent;
|
|
348
393
|
var degree = parent.transform.degree;
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
394
|
+
if (parent.rotateFlipColl.length > 0) {
|
|
395
|
+
for (var i = 0, len = parent.rotateFlipColl.length; i < len; i++) {
|
|
396
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
397
|
+
var flip = parent.rotateFlipColl[i];
|
|
398
|
+
if (typeof flip === 'number') {
|
|
399
|
+
this.exportRotate(tempContext, flip);
|
|
400
|
+
}
|
|
401
|
+
else if (flip === 'horizontal') {
|
|
402
|
+
this.exportFlip(tempContext, true, false);
|
|
403
|
+
}
|
|
404
|
+
else if (flip === 'vertical') {
|
|
405
|
+
this.exportFlip(tempContext, false, true);
|
|
406
|
+
}
|
|
360
407
|
}
|
|
361
408
|
}
|
|
362
409
|
parent.transform.degree = degree;
|
|
363
410
|
};
|
|
364
411
|
Export.prototype.exportRotate = function (tempContext, degree) {
|
|
365
412
|
var parent = this.parent;
|
|
413
|
+
tempContext.clearRect(0, 0, tempContext.canvas.width, tempContext.canvas.height);
|
|
366
414
|
this.setMaxDim(parent.transform.degree, tempContext.canvas);
|
|
367
415
|
tempContext.translate(tempContext.canvas.width / 2, tempContext.canvas.height / 2);
|
|
368
416
|
tempContext.rotate(Math.PI / 180 * degree);
|
|
@@ -370,6 +418,7 @@ var Export = /** @class */ (function () {
|
|
|
370
418
|
this.updateSaveContext(tempContext);
|
|
371
419
|
};
|
|
372
420
|
Export.prototype.exportFlip = function (tempContext, flipHorizontal, flipVertical) {
|
|
421
|
+
tempContext.clearRect(0, 0, tempContext.canvas.width, tempContext.canvas.height);
|
|
373
422
|
if (flipHorizontal) {
|
|
374
423
|
tempContext.translate(tempContext.canvas.width, 0);
|
|
375
424
|
tempContext.scale(-1, 1);
|
|
@@ -393,12 +442,24 @@ var Export = /** @class */ (function () {
|
|
|
393
442
|
var newWidth;
|
|
394
443
|
var newHeight;
|
|
395
444
|
if (degree % 90 === 0 && degree % 180 !== 0) {
|
|
396
|
-
|
|
397
|
-
|
|
445
|
+
if (isNullOrUndefined(this.parent.currSelectionPoint)) {
|
|
446
|
+
newWidth = this.parent.baseImgCanvas.height;
|
|
447
|
+
newHeight = this.parent.baseImgCanvas.width;
|
|
448
|
+
}
|
|
449
|
+
else {
|
|
450
|
+
newWidth = this.parent.img.srcHeight;
|
|
451
|
+
newHeight = this.parent.img.srcWidth;
|
|
452
|
+
}
|
|
398
453
|
}
|
|
399
454
|
else if (degree % 180 === 0 || degree === 0) {
|
|
400
|
-
|
|
401
|
-
|
|
455
|
+
if (isNullOrUndefined(this.parent.currSelectionPoint)) {
|
|
456
|
+
newWidth = this.parent.baseImgCanvas.width;
|
|
457
|
+
newHeight = this.parent.baseImgCanvas.height;
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
newWidth = this.parent.img.srcWidth;
|
|
461
|
+
newHeight = this.parent.img.srcHeight;
|
|
462
|
+
}
|
|
402
463
|
}
|
|
403
464
|
if (!isNullOrUndefined(this.parent.aspectWidth)) {
|
|
404
465
|
newWidth = this.parent.aspectWidth;
|
|
@@ -6,7 +6,9 @@ export declare class Filter {
|
|
|
6
6
|
private tempAdjustmentLevel;
|
|
7
7
|
private adjustmentValue;
|
|
8
8
|
private isBrightnessAdjusted;
|
|
9
|
-
private
|
|
9
|
+
private bevelFilter;
|
|
10
|
+
private tempAdjVal;
|
|
11
|
+
private tempFilVal;
|
|
10
12
|
constructor(parent: ImageEditor);
|
|
11
13
|
destroy(): void;
|
|
12
14
|
private addEventListener;
|
|
@@ -7,7 +7,10 @@ var Filter = /** @class */ (function () {
|
|
|
7
7
|
exposure: 0, transparency: 100, sharpen: false, bw: false }; // for temp toolbar slider value
|
|
8
8
|
this.adjustmentValue = ''; // for internal slider value
|
|
9
9
|
this.isBrightnessAdjusted = false;
|
|
10
|
-
this.
|
|
10
|
+
this.bevelFilter = 'none';
|
|
11
|
+
this.tempAdjVal = { brightness: 0, contrast: 0, hue: 0, opacity: 100, saturation: 0, blur: 0,
|
|
12
|
+
exposure: 0, transparency: 100, sharpen: false, bw: false };
|
|
13
|
+
this.tempFilVal = '';
|
|
11
14
|
this.parent = parent;
|
|
12
15
|
this.addEventListener();
|
|
13
16
|
}
|
|
@@ -56,11 +59,11 @@ var Filter = /** @class */ (function () {
|
|
|
56
59
|
this.getCurrentObj(args.value['object']);
|
|
57
60
|
break;
|
|
58
61
|
case 'getAdjustmentLevel':
|
|
59
|
-
if (isNullOrUndefined(this.parent.activeObj.
|
|
62
|
+
if (isNullOrUndefined(this.parent.activeObj.opacity)) {
|
|
60
63
|
this.adjustmentLevel.transparency = 100;
|
|
61
64
|
}
|
|
62
65
|
else {
|
|
63
|
-
this.adjustmentLevel.transparency = this.parent.activeObj.
|
|
66
|
+
this.adjustmentLevel.transparency = this.parent.activeObj.opacity * 100;
|
|
64
67
|
}
|
|
65
68
|
args.value['obj']['adjustmentLevel'] = this.adjustmentLevel;
|
|
66
69
|
break;
|
|
@@ -85,6 +88,18 @@ var Filter = /** @class */ (function () {
|
|
|
85
88
|
this.isBrightnessAdjusted = false;
|
|
86
89
|
}
|
|
87
90
|
break;
|
|
91
|
+
case 'getBevelFilter':
|
|
92
|
+
args.value['obj']['bevelFilter'] = this.bevelFilter;
|
|
93
|
+
break;
|
|
94
|
+
case 'setBevelFilter':
|
|
95
|
+
this.bevelFilter = args.value['bevelFilter'];
|
|
96
|
+
break;
|
|
97
|
+
case 'setTempAdjVal':
|
|
98
|
+
this.tempAdjVal = extend({}, this.adjustmentLevel, {}, true);
|
|
99
|
+
break;
|
|
100
|
+
case 'setTempFilVal':
|
|
101
|
+
this.tempFilVal = this.parent.currentFilter;
|
|
102
|
+
break;
|
|
88
103
|
case 'reset':
|
|
89
104
|
this.reset();
|
|
90
105
|
break;
|
|
@@ -106,40 +121,23 @@ var Filter = /** @class */ (function () {
|
|
|
106
121
|
blur: 0, exposure: 0, transparency: 100, sharpen: false, bw: false };
|
|
107
122
|
this.adjustmentValue = this.parent.getDefaultFilter();
|
|
108
123
|
this.isBrightnessAdjusted = false;
|
|
109
|
-
this.
|
|
124
|
+
this.bevelFilter = 'none';
|
|
125
|
+
this.tempFilVal = '';
|
|
126
|
+
this.tempAdjVal = { brightness: 0, contrast: 0, hue: 0, opacity: 100, saturation: 0,
|
|
127
|
+
blur: 0, exposure: 0, transparency: 100, sharpen: false, bw: false };
|
|
110
128
|
};
|
|
111
129
|
Filter.prototype.updateFinetunes = function () {
|
|
130
|
+
var _this = this;
|
|
112
131
|
var parent = this.parent;
|
|
113
132
|
var fs = parent.finetuneSettings;
|
|
114
133
|
if (fs) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
if (fs.hue) {
|
|
124
|
-
this.adjustmentLevel.hue = fs.hue.defaultValue;
|
|
125
|
-
this.tempAdjustmentLevel.hue = fs.hue.defaultValue;
|
|
126
|
-
}
|
|
127
|
-
if (fs.saturation) {
|
|
128
|
-
this.adjustmentLevel.saturation = fs.saturation.defaultValue;
|
|
129
|
-
this.tempAdjustmentLevel.saturation = fs.saturation.defaultValue;
|
|
130
|
-
}
|
|
131
|
-
if (fs.exposure) {
|
|
132
|
-
this.adjustmentLevel.exposure = fs.exposure.defaultValue;
|
|
133
|
-
this.tempAdjustmentLevel.exposure = fs.exposure.defaultValue;
|
|
134
|
-
}
|
|
135
|
-
if (fs.opacity) {
|
|
136
|
-
this.adjustmentLevel.opacity = fs.opacity.defaultValue;
|
|
137
|
-
this.tempAdjustmentLevel.opacity = fs.opacity.defaultValue;
|
|
138
|
-
}
|
|
139
|
-
if (fs.blur) {
|
|
140
|
-
this.adjustmentLevel.blur = fs.blur.defaultValue;
|
|
141
|
-
this.tempAdjustmentLevel.blur = fs.blur.defaultValue;
|
|
142
|
-
}
|
|
134
|
+
var propertiesToSet = ['brightness', 'contrast', 'hue', 'saturation', 'exposure', 'opacity', 'blur'];
|
|
135
|
+
propertiesToSet.forEach(function (property) {
|
|
136
|
+
if (fs[property]) {
|
|
137
|
+
_this.adjustmentLevel[property] = fs[property].defaultValue;
|
|
138
|
+
_this.tempAdjustmentLevel[property] = fs[property].defaultValue;
|
|
139
|
+
}
|
|
140
|
+
});
|
|
143
141
|
parent.notify('draw', { prop: 'isInitialLoading', onPropertyChange: false, value: { isInitialLoading: true } });
|
|
144
142
|
}
|
|
145
143
|
};
|
|
@@ -157,14 +155,6 @@ var Filter = /** @class */ (function () {
|
|
|
157
155
|
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
158
156
|
var splitWords = this.lowerContext.filter.split(' ');
|
|
159
157
|
var values = [];
|
|
160
|
-
var opacityValue;
|
|
161
|
-
var brightnessValue;
|
|
162
|
-
if (splitWords[4]) {
|
|
163
|
-
opacityValue = parseFloat(splitWords[4].split('(')[1]);
|
|
164
|
-
}
|
|
165
|
-
if (splitWords[0]) {
|
|
166
|
-
brightnessValue = parseFloat(splitWords[0].split('(')[1]);
|
|
167
|
-
}
|
|
168
158
|
var brightness = this.getFilterValue(this.adjustmentLevel.brightness);
|
|
169
159
|
var excludedTypes = ['brightness', 'contrast', 'hue', 'saturation', 'exposure', 'opacity', 'blur'];
|
|
170
160
|
if (excludedTypes.indexOf(type) === -1) {
|
|
@@ -214,8 +204,10 @@ var Filter = /** @class */ (function () {
|
|
|
214
204
|
if (parseFloat(splitWords[0].split('(')[1]) !== 1) {
|
|
215
205
|
value -= 0.2;
|
|
216
206
|
}
|
|
207
|
+
if (value < 0) {
|
|
208
|
+
value = 0;
|
|
209
|
+
}
|
|
217
210
|
splitWords[4] = 'opacity(' + value + ')';
|
|
218
|
-
opacityValue = value;
|
|
219
211
|
this.adjustmentValue = splitWords.join(' ');
|
|
220
212
|
break;
|
|
221
213
|
case 'blur':
|
|
@@ -337,19 +329,37 @@ var Filter = /** @class */ (function () {
|
|
|
337
329
|
parent.notify('draw', { prop: 'setRotateZoom', onPropertyChange: false, value: { isRotateZoom: true } });
|
|
338
330
|
parent.notify('draw', { prop: 'updateCurrTransState', onPropertyChange: false,
|
|
339
331
|
value: { type: 'initial', isPreventDestination: null, isRotatePan: null } });
|
|
340
|
-
|
|
332
|
+
var tempFilter = void 0;
|
|
333
|
+
if (parent.frameObj.type === 'bevel') {
|
|
334
|
+
tempFilter = this.lowerContext.filter;
|
|
335
|
+
this.bevelFilter = tempFilter;
|
|
336
|
+
}
|
|
337
|
+
if (parent.transform.degree === 0 && parent.rotateFlipColl.length > 0) {
|
|
338
|
+
parent.img.destLeft += parent.panPoint.totalPannedPoint.x;
|
|
339
|
+
parent.img.destTop += parent.panPoint.totalPannedPoint.y;
|
|
340
|
+
}
|
|
341
|
+
parent.img.destLeft += parent.panPoint.totalPannedInternalPoint.x;
|
|
342
|
+
parent.img.destTop += parent.panPoint.totalPannedInternalPoint.y;
|
|
343
|
+
if (parent.transform.degree === 0) {
|
|
344
|
+
parent.notify('transform', { prop: 'setDestPointsForFlipState', onPropertyChange: false });
|
|
345
|
+
}
|
|
341
346
|
parent.notify('draw', { prop: 'drawImage', onPropertyChange: false });
|
|
342
347
|
parent.notify('draw', { prop: 'updateCurrTransState', onPropertyChange: false,
|
|
343
348
|
value: { type: 'reverse', isPreventDestination: null, isRotatePan: null } });
|
|
344
349
|
parent.notify('draw', { prop: 'setRotateZoom', onPropertyChange: false, value: { isRotateZoom: false } });
|
|
350
|
+
if (parent.transform.degree === 0 && parent.rotateFlipColl.length > 0) {
|
|
351
|
+
parent.img.destLeft += parent.panPoint.totalPannedPoint.x;
|
|
352
|
+
parent.img.destTop += parent.panPoint.totalPannedPoint.y;
|
|
353
|
+
}
|
|
345
354
|
splitWords = this.setTempFilterValue(brightness, isPreview, splitWords, type);
|
|
346
355
|
if (isNullOrUndefined(isPreview)) {
|
|
347
356
|
this.lowerContext.filter = splitWords.join(' ');
|
|
348
357
|
}
|
|
349
358
|
parent.initialAdjustmentValue = splitWords.join(' ');
|
|
350
|
-
|
|
359
|
+
tempFilter = this.lowerContext.filter;
|
|
351
360
|
this.lowerContext.filter = 'brightness(' + 1 + ') ' + 'contrast(' + 100 + '%) ' + 'hue-rotate(' + 0 + 'deg) ' +
|
|
352
361
|
'saturate(' + 100 + '%) ' + 'opacity(' + 1 + ') ' + 'blur(' + 0 + 'px) ' + 'sepia(0%) ' + 'grayscale(0%) ' + 'invert(0%)';
|
|
362
|
+
this.bevelFilter = tempFilter;
|
|
353
363
|
parent.notify('shape', { prop: 'iterateObjColl', onPropertyChange: false });
|
|
354
364
|
parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
|
|
355
365
|
value: { context: this.lowerContext, points: null } });
|
|
@@ -381,17 +391,7 @@ var Filter = /** @class */ (function () {
|
|
|
381
391
|
};
|
|
382
392
|
Filter.prototype.getDefaultCurrentFilter = function (splitWords) {
|
|
383
393
|
var values = this.adjustmentValue.split(' ');
|
|
384
|
-
splitWords = [
|
|
385
|
-
values[0],
|
|
386
|
-
values[1],
|
|
387
|
-
values[2],
|
|
388
|
-
values[3],
|
|
389
|
-
values[4],
|
|
390
|
-
values[5],
|
|
391
|
-
'sepia(0%)',
|
|
392
|
-
'grayscale(0%)',
|
|
393
|
-
'invert(0%)'
|
|
394
|
-
];
|
|
394
|
+
splitWords = [values[0], values[1], values[2], values[3], values[4], values[5], 'sepia(0%)', 'grayscale(0%)', 'invert(0%)'];
|
|
395
395
|
return splitWords;
|
|
396
396
|
};
|
|
397
397
|
Filter.prototype.getFilterValue = function (value) {
|
|
@@ -419,24 +419,10 @@ var Filter = /** @class */ (function () {
|
|
|
419
419
|
value = this.getSaturationFilterValue(value) * 100;
|
|
420
420
|
break;
|
|
421
421
|
case 'opacity':
|
|
422
|
-
if (value
|
|
423
|
-
value
|
|
424
|
-
}
|
|
425
|
-
else if (value === 40) {
|
|
426
|
-
value = 0.45;
|
|
427
|
-
}
|
|
428
|
-
else if (value === 30) {
|
|
429
|
-
value = 0.40;
|
|
430
|
-
}
|
|
431
|
-
else if (value === 20) {
|
|
432
|
-
value = 0.35;
|
|
433
|
-
}
|
|
434
|
-
else if (value === 10) {
|
|
435
|
-
value = 0.30;
|
|
436
|
-
}
|
|
437
|
-
else if (value === 0) {
|
|
438
|
-
value = 0.25;
|
|
422
|
+
if (value < 10) {
|
|
423
|
+
value += 1;
|
|
439
424
|
}
|
|
425
|
+
value /= 100;
|
|
440
426
|
break;
|
|
441
427
|
case 'blur':
|
|
442
428
|
if (value !== 0) {
|
|
@@ -455,22 +441,10 @@ var Filter = /** @class */ (function () {
|
|
|
455
441
|
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false, value: { obj: selPointCollObj } });
|
|
456
442
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
457
443
|
this.updateAdj(type, value);
|
|
458
|
-
parent.notify('undo-redo', {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
operation: type,
|
|
463
|
-
previousObj: prevObj,
|
|
464
|
-
previousObjColl: prevObj.objColl,
|
|
465
|
-
previousPointColl: prevObj.pointColl,
|
|
466
|
-
previousSelPointColl: prevObj.selPointColl,
|
|
467
|
-
previousCropObj: prevCropObj,
|
|
468
|
-
previousText: null,
|
|
469
|
-
currentText: null,
|
|
470
|
-
previousFilter: null,
|
|
471
|
-
isCircleCrop: null
|
|
472
|
-
}
|
|
473
|
-
});
|
|
444
|
+
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false, value: { operation: type, previousObj: prevObj,
|
|
445
|
+
previousObjColl: prevObj.objColl, previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
|
|
446
|
+
previousCropObj: prevCropObj, previousText: null, currentText: null, previousFilter: null, isCircleCrop: null
|
|
447
|
+
} });
|
|
474
448
|
};
|
|
475
449
|
Filter.prototype.setFilter = function (type) {
|
|
476
450
|
var parent = this.parent;
|
|
@@ -484,15 +458,13 @@ var Filter = /** @class */ (function () {
|
|
|
484
458
|
prevObj.pointColl = extend([], parent.pointColl, [], true);
|
|
485
459
|
prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
|
|
486
460
|
var selPointCollObj = { selPointColl: null };
|
|
487
|
-
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
488
|
-
value: { obj: selPointCollObj } });
|
|
461
|
+
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false, value: { obj: selPointCollObj } });
|
|
489
462
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
490
463
|
this.updateAdj(type, null);
|
|
491
464
|
parent.notify('draw', { prop: 'setImageEdited', onPropertyChange: false });
|
|
492
465
|
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
493
|
-
value: { operation: type, previousObj: prevObj, previousObjColl: prevObj.objColl,
|
|
494
|
-
|
|
495
|
-
previousCropObj: prevCropObj, previousText: null,
|
|
466
|
+
value: { operation: type, previousObj: prevObj, previousObjColl: prevObj.objColl, previousPointColl: prevObj.pointColl,
|
|
467
|
+
previousSelPointColl: prevObj.selPointColl, previousCropObj: prevCropObj, previousText: null,
|
|
496
468
|
currentText: null, previousFilter: prevFilter, isCircleCrop: null } });
|
|
497
469
|
};
|
|
498
470
|
Filter.prototype.setAdjustment = function (type) {
|
|
@@ -611,6 +583,7 @@ var Filter = /** @class */ (function () {
|
|
|
611
583
|
}
|
|
612
584
|
};
|
|
613
585
|
Filter.prototype.setCurrAdjValue = function (type, value) {
|
|
586
|
+
var parent = this.parent;
|
|
614
587
|
this.parent.notify('draw', { prop: 'setImageEdited', onPropertyChange: false });
|
|
615
588
|
switch (type) {
|
|
616
589
|
case 'brightness':
|
|
@@ -635,6 +608,8 @@ var Filter = /** @class */ (function () {
|
|
|
635
608
|
this.setFilterAdj('exposure', value);
|
|
636
609
|
break;
|
|
637
610
|
}
|
|
611
|
+
parent.isFinetuneBtnClick = true;
|
|
612
|
+
parent.curFinetuneObjEvent = { finetune: parent.toPascalCase(type), value: value };
|
|
638
613
|
};
|
|
639
614
|
Filter.prototype.getCurrentObj = function (dummyObj) {
|
|
640
615
|
var parent = this.parent;
|
|
@@ -642,16 +617,20 @@ var Filter = /** @class */ (function () {
|
|
|
642
617
|
parent.notify('crop', { prop: 'getTempFlipPanPoint', value: { obj: tempFlipPanPointObj } });
|
|
643
618
|
var zoomObj = { previousZoomValue: null };
|
|
644
619
|
parent.notify('transform', { prop: 'getPreviousZoomValue', value: { obj: zoomObj } });
|
|
620
|
+
var straightenObj = { zoomFactor: null };
|
|
621
|
+
parent.notify('draw', { prop: 'getStraightenInitZoom', value: { obj: straightenObj } });
|
|
645
622
|
var obj = { cropZoom: 0, defaultZoom: 0, totalPannedPoint: { x: 0, y: 0 }, totalPannedClientPoint: { x: 0, y: 0 },
|
|
646
623
|
totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {},
|
|
647
|
-
rotateFlipColl: [], degree: 0, currFlipState: '', zoomFactor: 0, previousZoomValue: 0,
|
|
624
|
+
rotateFlipColl: [], degree: 0, currFlipState: '', zoomFactor: 0, previousZoomValue: 0, straighten: 0,
|
|
648
625
|
destPoints: { startX: 0, startY: 0, width: 0, height: 0 }, frame: 'none',
|
|
649
626
|
srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '', isBrightAdjust: this.isBrightnessAdjusted,
|
|
650
|
-
aspectWidth: null, aspectHeight: null }
|
|
627
|
+
aspectWidth: null, aspectHeight: null, straightenZoom: 0, adjustmentLevel: extend({}, this.tempAdjVal, {}, true),
|
|
628
|
+
currentFilter: this.tempFilVal };
|
|
651
629
|
obj.cropZoom = parent.transform.cropZoomFactor;
|
|
652
630
|
obj.defaultZoom = parent.transform.defaultZoomFactor;
|
|
653
631
|
obj.zoomFactor = parent.zoomSettings.zoomFactor;
|
|
654
632
|
obj.previousZoomValue = zoomObj['previousZoomValue'];
|
|
633
|
+
obj.straightenZoom = straightenObj['zoomFactor'];
|
|
655
634
|
obj.totalPannedPoint = extend({}, parent.panPoint.totalPannedPoint, {}, true);
|
|
656
635
|
obj.totalPannedClientPoint = extend({}, parent.panPoint.totalPannedClientPoint, {}, true);
|
|
657
636
|
obj.totalPannedInternalPoint = extend({}, parent.panPoint.totalPannedInternalPoint, {}, true);
|
|
@@ -659,6 +638,7 @@ var Filter = /** @class */ (function () {
|
|
|
659
638
|
obj.activeObj = extend({}, parent.activeObj, {}, true);
|
|
660
639
|
obj.rotateFlipColl = extend([], parent.rotateFlipColl, [], true);
|
|
661
640
|
obj.degree = parent.transform.degree;
|
|
641
|
+
obj.straighten = parent.cropObj.straighten;
|
|
662
642
|
obj.currFlipState = parent.transform.currFlipState;
|
|
663
643
|
obj.destPoints = { startX: parent.img.destLeft, startY: parent.img.destTop, endX: 0, endY: 0,
|
|
664
644
|
width: parent.img.destWidth, height: parent.img.destHeight };
|
|
@@ -17,6 +17,9 @@ export declare class FreehandDrawing {
|
|
|
17
17
|
private fhdSelID;
|
|
18
18
|
private tempFHDStyles;
|
|
19
19
|
private fhdSelIdx;
|
|
20
|
+
private straightenPoint;
|
|
21
|
+
private prevStraightenObj;
|
|
22
|
+
private straightenPointAngle;
|
|
20
23
|
constructor(parent: ImageEditor);
|
|
21
24
|
destroy(): void;
|
|
22
25
|
private addEventListener;
|
|
@@ -60,4 +63,5 @@ export declare class FreehandDrawing {
|
|
|
60
63
|
private isFHDIdx;
|
|
61
64
|
private updateCropPtsForSel;
|
|
62
65
|
private triggerShapeChanging;
|
|
66
|
+
private setCenterSelPoints;
|
|
63
67
|
}
|