@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
|
@@ -10,6 +10,7 @@ export declare class UndoRedo {
|
|
|
10
10
|
private tempUndoRedoColl;
|
|
11
11
|
private tempUndoRedoStep;
|
|
12
12
|
private tempActObj;
|
|
13
|
+
private isPreventing;
|
|
13
14
|
constructor(parent: ImageEditor);
|
|
14
15
|
destroy(): void;
|
|
15
16
|
private addEventListener;
|
|
@@ -41,4 +42,5 @@ export declare class UndoRedo {
|
|
|
41
42
|
private updateUrObj;
|
|
42
43
|
private updateUndoRedo;
|
|
43
44
|
private getZeroZoomObjPointValue;
|
|
45
|
+
private applyImgTranform;
|
|
44
46
|
}
|
|
@@ -6,6 +6,7 @@ var UndoRedo = /** @class */ (function () {
|
|
|
6
6
|
this.appliedUndoRedoColl = [];
|
|
7
7
|
this.tempUndoRedoColl = [];
|
|
8
8
|
this.tempUndoRedoStep = 0;
|
|
9
|
+
this.isPreventing = false;
|
|
9
10
|
this.parent = parent;
|
|
10
11
|
this.addEventListener();
|
|
11
12
|
}
|
|
@@ -73,6 +74,9 @@ var UndoRedo = /** @class */ (function () {
|
|
|
73
74
|
case 'undoDefault':
|
|
74
75
|
this.undoDefault(args.value['obj']);
|
|
75
76
|
break;
|
|
77
|
+
case 'setPreventUR':
|
|
78
|
+
this.isPreventing = args.value['bool'];
|
|
79
|
+
break;
|
|
76
80
|
case 'reset':
|
|
77
81
|
this.reset();
|
|
78
82
|
break;
|
|
@@ -89,6 +93,7 @@ var UndoRedo = /** @class */ (function () {
|
|
|
89
93
|
this.tempActObj = null;
|
|
90
94
|
this.tempUndoRedoColl = [];
|
|
91
95
|
this.tempUndoRedoStep = 0;
|
|
96
|
+
this.isPreventing = false;
|
|
92
97
|
};
|
|
93
98
|
UndoRedo.prototype.refreshUrc = function (refreshToolbar) {
|
|
94
99
|
var parent = this.parent;
|
|
@@ -115,7 +120,7 @@ var UndoRedo = /** @class */ (function () {
|
|
|
115
120
|
};
|
|
116
121
|
UndoRedo.prototype.updateCurrUrc = function (type) {
|
|
117
122
|
var parent = this.parent;
|
|
118
|
-
if (parent.isResize) {
|
|
123
|
+
if (parent.isResize || this.isPreventing) {
|
|
119
124
|
return;
|
|
120
125
|
}
|
|
121
126
|
if (!isBlazor()) {
|
|
@@ -127,7 +132,10 @@ var UndoRedo = /** @class */ (function () {
|
|
|
127
132
|
extend([], this.tempUndoRedoColl, [], true) :
|
|
128
133
|
extend([], this.undoRedoColl, [], true);
|
|
129
134
|
var prevObj = this.undoRedoColl[this.undoRedoColl.length - 1];
|
|
130
|
-
|
|
135
|
+
var appliedURColl = this.appliedUndoRedoColl[this.appliedUndoRedoColl.length - 1];
|
|
136
|
+
var prevTransform = prevObj ? extend({}, prevObj.previousObj, {}, true)
|
|
137
|
+
: null;
|
|
138
|
+
if (isNullOrUndefined(appliedURColl)) {
|
|
131
139
|
if (this.undoRedoColl[0]) {
|
|
132
140
|
prevObj.previousCropObj = collection[0].previousCropObj;
|
|
133
141
|
prevObj.previousObj = collection[0].previousObj;
|
|
@@ -137,17 +145,27 @@ var UndoRedo = /** @class */ (function () {
|
|
|
137
145
|
}
|
|
138
146
|
}
|
|
139
147
|
else if (prevObj.operation !== 'imageHFlip' && prevObj.operation !== 'imageVFlip') {
|
|
140
|
-
prevObj.previousCropObj =
|
|
141
|
-
prevObj.previousObj =
|
|
142
|
-
prevObj.previousObjColl =
|
|
143
|
-
prevObj.previousPointColl =
|
|
144
|
-
prevObj.previousText =
|
|
148
|
+
prevObj.previousCropObj = appliedURColl.currentCropObj;
|
|
149
|
+
prevObj.previousObj = appliedURColl.currentObj;
|
|
150
|
+
prevObj.previousObjColl = appliedURColl.currentObjColl;
|
|
151
|
+
prevObj.previousPointColl = appliedURColl.currentPointColl;
|
|
152
|
+
prevObj.previousText = appliedURColl.currentText;
|
|
153
|
+
if (prevObj.operation === 'frame' && prevObj.previousObj && prevTransform) {
|
|
154
|
+
prevObj.previousObj.defaultZoom = prevTransform.defaultZoom;
|
|
155
|
+
prevObj.previousObj.zoomFactor = prevTransform.zoomFactor;
|
|
156
|
+
prevObj.previousObj.cropZoom = prevTransform.cropZoom;
|
|
157
|
+
}
|
|
145
158
|
}
|
|
146
159
|
if (prevObj) {
|
|
147
160
|
if (prevObj.operation !== 'imageHFlip' && prevObj.operation !== 'imageVFlip') {
|
|
148
161
|
var obj = this.getZeroZoomObjPointValue(prevObj.currentObjColl, prevObj.currentPointColl);
|
|
149
162
|
prevObj.currentObjColl = obj['obj'];
|
|
150
163
|
prevObj.currentPointColl = obj['point'];
|
|
164
|
+
var adjObj = { adjustmentLevel: null };
|
|
165
|
+
parent.notify('filter', { prop: 'getAdjustmentLevel', onPropertyChange: false, value: { obj: adjObj } });
|
|
166
|
+
prevObj.currentObj.adjustmentLevel = extend({}, adjObj['adjustmentLevel'], {}, true);
|
|
167
|
+
parent.notify('filter', { prop: 'setTempAdjVal' });
|
|
168
|
+
prevObj.currentObj.currentFilter = parent.currentFilter;
|
|
151
169
|
}
|
|
152
170
|
this.appliedUndoRedoColl.push(prevObj);
|
|
153
171
|
}
|
|
@@ -274,7 +292,8 @@ var UndoRedo = /** @class */ (function () {
|
|
|
274
292
|
else {
|
|
275
293
|
parent.currObjType.isUndoAction = true;
|
|
276
294
|
}
|
|
277
|
-
if (obj.operation !== 'textAreaCustomization' &&
|
|
295
|
+
if (obj.operation !== 'textAreaCustomization' &&
|
|
296
|
+
(parent.textArea.style.display === 'block' || parent.textArea.style.display === 'inline-block')) {
|
|
278
297
|
parent.textArea.style.display = 'none';
|
|
279
298
|
}
|
|
280
299
|
parent.notify('draw', { prop: 'setCancelAction', onPropertyChange: false, value: { bool: true } });
|
|
@@ -282,7 +301,13 @@ var UndoRedo = /** @class */ (function () {
|
|
|
282
301
|
parent.cropObj = extend({}, obj.previousCropObj, {}, true);
|
|
283
302
|
parent.afterCropActions = obj.previousObj.afterCropActions;
|
|
284
303
|
this.lowerContext.filter = obj.previousObj.filter;
|
|
304
|
+
parent.notify('filter', { prop: 'setAdjustmentLevel', onPropertyChange: false, value: { adjustmentLevel: obj.previousObj.adjustmentLevel } });
|
|
305
|
+
parent.notify('filter', { prop: 'setTempAdjVal' });
|
|
306
|
+
parent.currentFilter = obj.previousObj.currentFilter;
|
|
307
|
+
parent.notify('filter', { prop: 'setTempFilVal' });
|
|
285
308
|
parent.canvasFilter = this.lowerContext.filter;
|
|
309
|
+
parent.initialAdjustmentValue = this.lowerContext.filter;
|
|
310
|
+
parent.notify('filter', { prop: 'setBevelFilter', onPropertyChange: false, value: { bevelFilter: this.lowerContext.filter } });
|
|
286
311
|
switch (obj.operation) {
|
|
287
312
|
case 'shapeTransform':
|
|
288
313
|
case 'brightness':
|
|
@@ -301,6 +326,7 @@ var UndoRedo = /** @class */ (function () {
|
|
|
301
326
|
case 'sepia':
|
|
302
327
|
case 'invert':
|
|
303
328
|
case 'sharpen':
|
|
329
|
+
case 'imageRotate':
|
|
304
330
|
this.shapeTransform(obj.previousObjColl);
|
|
305
331
|
break;
|
|
306
332
|
case 'freehanddraw':
|
|
@@ -312,9 +338,10 @@ var UndoRedo = /** @class */ (function () {
|
|
|
312
338
|
break;
|
|
313
339
|
case 'deleteFreehandDrawing':
|
|
314
340
|
case 'deleteObj':
|
|
315
|
-
this.updateDelete(obj.operation, obj.previousObjColl, obj.previousPointColl);
|
|
341
|
+
this.updateDelete(obj.operation, obj.previousObjColl, obj.previousPointColl, obj.previousSelPointColl);
|
|
316
342
|
break;
|
|
317
343
|
case 'textAreaCustomization':
|
|
344
|
+
this.shapeTransform(obj.previousObjColl);
|
|
318
345
|
this.updateTextAreaCustomization(activeObj, obj.previousObjColl);
|
|
319
346
|
break;
|
|
320
347
|
case 'text':
|
|
@@ -335,7 +362,7 @@ var UndoRedo = /** @class */ (function () {
|
|
|
335
362
|
this.imageFlip('vertical', obj.previousObjColl);
|
|
336
363
|
break;
|
|
337
364
|
default:
|
|
338
|
-
this.undoDefault(obj);
|
|
365
|
+
this.undoDefault(obj, true);
|
|
339
366
|
parent.notify('filter', { prop: 'set-adjustment', value: { operation: obj.operation } });
|
|
340
367
|
parent.notify('filter', { prop: 'update-filter', value: { operation: obj.operation, filter: obj.filter } });
|
|
341
368
|
break;
|
|
@@ -357,6 +384,12 @@ var UndoRedo = /** @class */ (function () {
|
|
|
357
384
|
}
|
|
358
385
|
parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
|
|
359
386
|
parent.currObjType.isActiveObj = false;
|
|
387
|
+
if (parent.transform.straighten !== 0) {
|
|
388
|
+
parent.notify('draw', { prop: 'setStraightenActObj', value: { activeObj: null } });
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
else if (obj.operation === 'resize' && parent.cropObj && parent.cropObj.activeObj) {
|
|
392
|
+
parent.currSelectionPoint = extend({}, parent.cropObj.activeObj, {}, true);
|
|
360
393
|
}
|
|
361
394
|
if ((this.undoRedoColl[this.undoRedoStep - 1]
|
|
362
395
|
&& this.undoRedoColl[this.undoRedoStep - 1].isCircleCrop)) {
|
|
@@ -389,7 +422,8 @@ var UndoRedo = /** @class */ (function () {
|
|
|
389
422
|
else {
|
|
390
423
|
parent.currObjType.isUndoAction = true;
|
|
391
424
|
}
|
|
392
|
-
if (obj.operation !== 'textAreaCustomization' &&
|
|
425
|
+
if (obj.operation !== 'textAreaCustomization' &&
|
|
426
|
+
(parent.textArea.style.display === 'block' || parent.textArea.style.display === 'inline-block')) {
|
|
393
427
|
parent.textArea.style.display = 'none';
|
|
394
428
|
}
|
|
395
429
|
parent.notify('draw', { prop: 'setCancelAction', onPropertyChange: false, value: { bool: true } });
|
|
@@ -399,7 +433,13 @@ var UndoRedo = /** @class */ (function () {
|
|
|
399
433
|
if (!isBlazor() && parent.element.querySelector('.e-contextual-toolbar-wrapper')) {
|
|
400
434
|
parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
401
435
|
}
|
|
436
|
+
parent.notify('filter', { prop: 'setAdjustmentLevel', onPropertyChange: false, value: { adjustmentLevel: obj.currentObj.adjustmentLevel } });
|
|
437
|
+
parent.notify('filter', { prop: 'setTempAdjVal' });
|
|
438
|
+
parent.currentFilter = obj.currentObj.currentFilter;
|
|
439
|
+
parent.notify('filter', { prop: 'setTempFilVal' });
|
|
402
440
|
parent.canvasFilter = this.lowerContext.filter;
|
|
441
|
+
parent.initialAdjustmentValue = this.lowerContext.filter;
|
|
442
|
+
parent.notify('filter', { prop: 'setBevelFilter', onPropertyChange: false, value: { bevelFilter: this.lowerContext.filter } });
|
|
403
443
|
var activeObj = void 0;
|
|
404
444
|
switch (obj.operation) {
|
|
405
445
|
case 'shapeTransform':
|
|
@@ -419,6 +459,7 @@ var UndoRedo = /** @class */ (function () {
|
|
|
419
459
|
case 'sepia':
|
|
420
460
|
case 'invert':
|
|
421
461
|
case 'sharpen':
|
|
462
|
+
case 'imageRotate':
|
|
422
463
|
this.shapeTransform(obj.currentObjColl);
|
|
423
464
|
break;
|
|
424
465
|
case 'freehanddraw':
|
|
@@ -430,9 +471,10 @@ var UndoRedo = /** @class */ (function () {
|
|
|
430
471
|
break;
|
|
431
472
|
case 'deleteFreehandDrawing':
|
|
432
473
|
case 'deleteObj':
|
|
433
|
-
this.updateDelete(obj.operation, obj.currentObjColl, obj.currentPointColl);
|
|
474
|
+
this.updateDelete(obj.operation, obj.currentObjColl, obj.currentPointColl, obj.currentSelPointColl);
|
|
434
475
|
break;
|
|
435
476
|
case 'textAreaCustomization':
|
|
477
|
+
this.shapeTransform(obj.currentObjColl);
|
|
436
478
|
this.updateTextAreaCustomization(activeObj, obj.currentObjColl);
|
|
437
479
|
break;
|
|
438
480
|
case 'text':
|
|
@@ -454,7 +496,7 @@ var UndoRedo = /** @class */ (function () {
|
|
|
454
496
|
parent.freehandCounter = 0;
|
|
455
497
|
parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
|
|
456
498
|
value: { obj: { selPointColl: [] } } });
|
|
457
|
-
parent.notify('draw', { prop: 'setCurrentObj', onPropertyChange: false, value: { obj: obj.currentObj } });
|
|
499
|
+
parent.notify('draw', { prop: 'setCurrentObj', onPropertyChange: false, value: { obj: obj.currentObj, isUndoRedo: true } });
|
|
458
500
|
parent.img.destLeft = obj.currentObj.destPoints.startX;
|
|
459
501
|
parent.img.destTop = obj.currentObj.destPoints.startY;
|
|
460
502
|
activeObj = extend({}, parent.activeObj, {}, true);
|
|
@@ -463,10 +505,12 @@ var UndoRedo = /** @class */ (function () {
|
|
|
463
505
|
parent.freehandCounter = parent.pointColl.length;
|
|
464
506
|
parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
|
|
465
507
|
value: { obj: { selPointColl: extend([], obj.currentSelPointColl, [], true) } } });
|
|
508
|
+
parent.transform.straighten = 0;
|
|
466
509
|
this.lowerContext.filter = 'none';
|
|
467
510
|
parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
468
511
|
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
469
512
|
this.lowerContext.filter = obj.currentObj.filter;
|
|
513
|
+
parent.prevStraightenedDegree = parent.transform.straighten;
|
|
470
514
|
parent.activeObj = activeObj;
|
|
471
515
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
472
516
|
if (parent.activeObj.activePoint.width !== 0 && parent.activeObj.activePoint.height !== 0) {
|
|
@@ -486,28 +530,33 @@ var UndoRedo = /** @class */ (function () {
|
|
|
486
530
|
}
|
|
487
531
|
if (obj.operation === 'crop' && obj.currentObj.currSelectionPoint) {
|
|
488
532
|
parent.currSelectionPoint = extend({}, obj.currentObj.currSelectionPoint, {}, true);
|
|
533
|
+
parent.notify('draw', { prop: 'setStraightenActObj', value: { activeObj: parent.currSelectionPoint } });
|
|
489
534
|
}
|
|
490
535
|
if (parent.currSelectionPoint && isNullOrUndefined(parent.currSelectionPoint.shape)) {
|
|
491
536
|
parent.currSelectionPoint = null;
|
|
492
537
|
}
|
|
538
|
+
if (obj.operation === 'resize' && parent.cropObj && parent.cropObj.activeObj) {
|
|
539
|
+
parent.currSelectionPoint = extend({}, parent.cropObj.activeObj, {}, true);
|
|
540
|
+
}
|
|
493
541
|
this.endUndoRedo(obj.operation, false);
|
|
494
542
|
}
|
|
495
543
|
}
|
|
496
544
|
};
|
|
497
545
|
UndoRedo.prototype.imageFlip = function (type, objColl) {
|
|
498
546
|
var parent = this.parent;
|
|
499
|
-
|
|
547
|
+
this.shapeTransform(objColl);
|
|
500
548
|
parent.activeObj = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
|
|
549
|
+
var _a = parent.activeObj, shape = _a.shape, isHorImageFlip = _a.isHorImageFlip, isVerImageFlip = _a.isVerImageFlip;
|
|
501
550
|
parent.objColl.pop();
|
|
502
|
-
if (
|
|
551
|
+
if (shape && shape === 'image') {
|
|
503
552
|
if (type === 'horizontal') {
|
|
504
|
-
if (isNullOrUndefined(
|
|
553
|
+
if (isNullOrUndefined(isHorImageFlip) && isVerImageFlip) {
|
|
505
554
|
parent.activeObj.isHorImageFlip = true;
|
|
506
555
|
parent.activeObj.isVerImageFlip = null;
|
|
507
556
|
parent.horizontalFlip(this.upperContext, true);
|
|
508
557
|
}
|
|
509
558
|
else {
|
|
510
|
-
if (isNullOrUndefined(
|
|
559
|
+
if (isNullOrUndefined(isHorImageFlip) || !isHorImageFlip) {
|
|
511
560
|
parent.activeObj.isHorImageFlip = true;
|
|
512
561
|
}
|
|
513
562
|
else {
|
|
@@ -517,13 +566,13 @@ var UndoRedo = /** @class */ (function () {
|
|
|
517
566
|
}
|
|
518
567
|
}
|
|
519
568
|
else if (type === 'vertical') {
|
|
520
|
-
if (isNullOrUndefined(
|
|
569
|
+
if (isNullOrUndefined(isVerImageFlip) && isHorImageFlip) {
|
|
521
570
|
parent.activeObj.isVerImageFlip = true;
|
|
522
571
|
parent.activeObj.isHorImageFlip = null;
|
|
523
572
|
parent.verticalFlip(this.upperContext, true);
|
|
524
573
|
}
|
|
525
574
|
else {
|
|
526
|
-
if (isNullOrUndefined(
|
|
575
|
+
if (isNullOrUndefined(isVerImageFlip) || !isVerImageFlip) {
|
|
527
576
|
parent.activeObj.isVerImageFlip = true;
|
|
528
577
|
}
|
|
529
578
|
else {
|
|
@@ -569,11 +618,13 @@ var UndoRedo = /** @class */ (function () {
|
|
|
569
618
|
parent.isUndoRedo = true;
|
|
570
619
|
parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
|
|
571
620
|
};
|
|
572
|
-
UndoRedo.prototype.updateDelete = function (operation, objColl, pointColl) {
|
|
621
|
+
UndoRedo.prototype.updateDelete = function (operation, objColl, pointColl, selPointColl) {
|
|
573
622
|
var parent = this.parent;
|
|
574
623
|
if (operation === 'deleteFreehandDrawing') {
|
|
575
624
|
parent.pointColl = pointColl;
|
|
576
625
|
parent.freehandCounter = parent.pointColl.length;
|
|
626
|
+
parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
|
|
627
|
+
value: { obj: { selPointColl: selPointColl } } });
|
|
577
628
|
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
578
629
|
}
|
|
579
630
|
else if (operation === 'deleteObj') {
|
|
@@ -609,7 +660,7 @@ var UndoRedo = /** @class */ (function () {
|
|
|
609
660
|
if (activeObj) {
|
|
610
661
|
this.updateTextBox(activeObj);
|
|
611
662
|
}
|
|
612
|
-
if (parent.textArea.style.display === 'block') {
|
|
663
|
+
if (parent.textArea.style.display === 'block' || parent.textArea.style.display === 'inline-block') {
|
|
613
664
|
parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
|
|
614
665
|
value: { x: null, y: null, isMouseDown: null } });
|
|
615
666
|
}
|
|
@@ -623,7 +674,7 @@ var UndoRedo = /** @class */ (function () {
|
|
|
623
674
|
this.tempActObj = extend({}, parent.objColl[0], {}, true);
|
|
624
675
|
}
|
|
625
676
|
else {
|
|
626
|
-
for (var i = 0
|
|
677
|
+
for (var i = 0, iLen = parent.objColl.length; i < iLen; i++) {
|
|
627
678
|
if (parent.objColl[i] && isNullOrUndefined(objColl[i])) {
|
|
628
679
|
this.tempActObj = extend({}, parent.objColl[i], {}, true);
|
|
629
680
|
break;
|
|
@@ -656,20 +707,21 @@ var UndoRedo = /** @class */ (function () {
|
|
|
656
707
|
else {
|
|
657
708
|
parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
|
|
658
709
|
}
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
710
|
+
var textArea = parent.textArea;
|
|
711
|
+
textArea.style.display = 'block';
|
|
712
|
+
textArea.style.fontFamily = obj.textSettings.fontFamily;
|
|
713
|
+
textArea.style.fontSize = obj.textSettings.fontSize + 'px';
|
|
714
|
+
textArea.style.color = obj.strokeSettings.strokeColor;
|
|
715
|
+
textArea.style.fontWeight = obj.textSettings.bold ? 'bold' : 'normal';
|
|
716
|
+
textArea.style.fontStyle = obj.textSettings.italic ? 'italic' : 'normal';
|
|
717
|
+
textArea.style.border = '2px solid ' + parent.themeColl[parent.theme]['primaryColor'];
|
|
718
|
+
textArea.value = obj.keyHistory;
|
|
667
719
|
parent.activeObj = extend({}, obj, {}, true);
|
|
668
720
|
parent.notify('shape', { prop: 'updateFontStyles', onPropertyChange: false,
|
|
669
721
|
value: { isTextBox: null } });
|
|
670
722
|
parent.textArea.style.width = parent.activeObj.activePoint.width + 'px';
|
|
671
723
|
};
|
|
672
|
-
UndoRedo.prototype.undoDefault = function (obj) {
|
|
724
|
+
UndoRedo.prototype.undoDefault = function (obj, isUndoRedo) {
|
|
673
725
|
this.lowerContext.filter = obj.previousObj.filter;
|
|
674
726
|
var parent = this.parent;
|
|
675
727
|
parent.objColl = [];
|
|
@@ -677,7 +729,8 @@ var UndoRedo = /** @class */ (function () {
|
|
|
677
729
|
parent.freehandCounter = 0;
|
|
678
730
|
parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
|
|
679
731
|
value: { obj: { selPointColl: [] } } });
|
|
680
|
-
parent.notify('draw', { prop: 'setCurrentObj', onPropertyChange: false, value: { obj: obj.previousObj } });
|
|
732
|
+
parent.notify('draw', { prop: 'setCurrentObj', onPropertyChange: false, value: { obj: obj.previousObj, isUndoRedo: isUndoRedo } });
|
|
733
|
+
parent.prevStraightenedDegree = parent.transform.straighten;
|
|
681
734
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
682
735
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
683
736
|
parent.img.destLeft = obj.previousObj.destPoints.startX;
|
|
@@ -688,6 +741,7 @@ var UndoRedo = /** @class */ (function () {
|
|
|
688
741
|
parent.freehandCounter = parent.pointColl.length;
|
|
689
742
|
parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
|
|
690
743
|
value: { obj: { selPointColl: extend([], obj.previousSelPointColl, [], true) } } });
|
|
744
|
+
parent.transform.straighten = 0;
|
|
691
745
|
this.lowerContext.filter = 'none';
|
|
692
746
|
parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
693
747
|
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
@@ -746,7 +800,7 @@ var UndoRedo = /** @class */ (function () {
|
|
|
746
800
|
};
|
|
747
801
|
UndoRedo.prototype.updateUrc = function (operation, previousObj, previousObjColl, previousPointColl, previousSelPointColl, previousCropObj, previousText, currentText, previousFilter, isCircleCrop) {
|
|
748
802
|
var parent = this.parent;
|
|
749
|
-
if (parent.isResize) {
|
|
803
|
+
if (parent.isResize || this.isPreventing) {
|
|
750
804
|
return;
|
|
751
805
|
}
|
|
752
806
|
var obj = { isInitialLoaded: false };
|
|
@@ -773,6 +827,23 @@ var UndoRedo = /** @class */ (function () {
|
|
|
773
827
|
width: parent.frameDestPoints.destWidth, height: parent.frameDestPoints.destHeight };
|
|
774
828
|
currentObj.destPoints = { startX: parent.frameDestPoints.destLeft, startY: parent.frameDestPoints.destTop,
|
|
775
829
|
width: parent.frameDestPoints.destWidth, height: parent.frameDestPoints.destHeight };
|
|
830
|
+
if (!isNullOrUndefined(parent.tempFrameZoomLevel)) {
|
|
831
|
+
previousObj.defaultZoom = currentObj.defaultZoom = parent.tempFrameZoomLevel;
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
else if ((operation === 'imageHFlip' || operation === 'imageVFlip') && this.appliedUndoRedoColl.length > 0) {
|
|
835
|
+
var index = previousObjColl[previousObjColl.length - 1].currIndex;
|
|
836
|
+
previousObjColl = this.appliedUndoRedoColl[this.appliedUndoRedoColl.length - 1].currentObjColl;
|
|
837
|
+
if (index) {
|
|
838
|
+
for (var i = 0, len = previousObjColl.length; i < len; i++) {
|
|
839
|
+
if (previousObjColl[i].currIndex === index) {
|
|
840
|
+
var actObj = extend({}, previousObjColl[i], {}, true);
|
|
841
|
+
previousObjColl.splice(i, 1);
|
|
842
|
+
previousObjColl.push(actObj);
|
|
843
|
+
break;
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
}
|
|
776
847
|
}
|
|
777
848
|
this.undoRedoColl.push({ operation: operation, previousObj: previousObj, currentObj: currentObj,
|
|
778
849
|
previousObjColl: previousObjColl, currentObjColl: currentObj.objColl,
|
|
@@ -785,7 +856,11 @@ var UndoRedo = /** @class */ (function () {
|
|
|
785
856
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
786
857
|
}
|
|
787
858
|
else if (parent.currentToolbar !== 'pen-toolbar') {
|
|
788
|
-
|
|
859
|
+
var toolbarValue = null;
|
|
860
|
+
if (parent.currentToolbar === 'text-toolbar' && operation === 'textAreaCustomization') {
|
|
861
|
+
toolbarValue = 'textAreaClicked';
|
|
862
|
+
}
|
|
863
|
+
parent.updateToolbar(parent.element, 'enableDisableToolbarBtn', toolbarValue);
|
|
789
864
|
}
|
|
790
865
|
}
|
|
791
866
|
};
|
|
@@ -795,6 +870,9 @@ var UndoRedo = /** @class */ (function () {
|
|
|
795
870
|
if (parent.currObjType.isUndoAction) {
|
|
796
871
|
this.refreshUrc(true);
|
|
797
872
|
}
|
|
873
|
+
if (isNullOrUndefined(parent.activeObj.imageRatio)) {
|
|
874
|
+
parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
|
|
875
|
+
}
|
|
798
876
|
parent.objColl.push(parent.activeObj);
|
|
799
877
|
var cropObj = extend({}, parent.cropObj, {}, true);
|
|
800
878
|
var object = { currObj: {} };
|
|
@@ -829,6 +907,9 @@ var UndoRedo = /** @class */ (function () {
|
|
|
829
907
|
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
830
908
|
value: { obj: selPointCollObj } });
|
|
831
909
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
910
|
+
if (isNullOrUndefined(parent.activeObj.imageRatio)) {
|
|
911
|
+
parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
|
|
912
|
+
}
|
|
832
913
|
parent.objColl.push(parent.activeObj);
|
|
833
914
|
this.updateUrc('shapeTransform', prevObj, prevObj.objColl, prevObj.pointColl, prevObj.selPointColl, prevCropObj);
|
|
834
915
|
parent.objColl.pop();
|
|
@@ -867,9 +948,13 @@ var UndoRedo = /** @class */ (function () {
|
|
|
867
948
|
parent.objColl = obj;
|
|
868
949
|
parent.pointColl = point;
|
|
869
950
|
var isUndoRedo = parent.isUndoRedo;
|
|
951
|
+
var isCropTab = parent.isCropTab;
|
|
870
952
|
if (parent.transform.zoomFactor !== 0) {
|
|
871
|
-
parent.isUndoRedo =
|
|
953
|
+
parent.isUndoRedo = true;
|
|
954
|
+
parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: true } });
|
|
955
|
+
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: true } });
|
|
872
956
|
parent.notify('freehand-draw', { prop: 'updateFHDColl', onPropertyChange: false });
|
|
957
|
+
parent.isCropTab = true;
|
|
873
958
|
var zoomSettings = extend({}, parent.zoomSettings, null, true);
|
|
874
959
|
if (parent.transform.zoomFactor > 0) {
|
|
875
960
|
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
@@ -880,7 +965,7 @@ var UndoRedo = /** @class */ (function () {
|
|
|
880
965
|
value: { zoomFactor: Math.abs(parent.transform.zoomFactor), zoomPoint: null, isResize: null } });
|
|
881
966
|
}
|
|
882
967
|
parent.zoomSettings = zoomSettings;
|
|
883
|
-
parent.isCropTab =
|
|
968
|
+
parent.isCropTab = isCropTab;
|
|
884
969
|
parent.isUndoRedo = isUndoRedo;
|
|
885
970
|
getZeroZoomObjColl = extend([], parent.objColl, [], true);
|
|
886
971
|
getZeroZoomPointColl = extend([], parent.pointColl, [], true);
|
|
@@ -908,6 +993,8 @@ var UndoRedo = /** @class */ (function () {
|
|
|
908
993
|
parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
|
|
909
994
|
value: { obj: { selPointColl: extend([], currentObj.selPointColl, [], true) } } });
|
|
910
995
|
this.lowerContext.filter = 'none';
|
|
996
|
+
parent.transform.straighten = 0;
|
|
997
|
+
this.applyImgTranform();
|
|
911
998
|
parent.notify('shape', { prop: 'iterateObjColl', onPropertyChange: false });
|
|
912
999
|
parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
|
|
913
1000
|
value: { context: this.lowerContext, points: null } });
|
|
@@ -926,6 +1013,20 @@ var UndoRedo = /** @class */ (function () {
|
|
|
926
1013
|
}
|
|
927
1014
|
return { obj: getZeroZoomObjColl, point: getZeroZoomPointColl };
|
|
928
1015
|
};
|
|
1016
|
+
UndoRedo.prototype.applyImgTranform = function () {
|
|
1017
|
+
var parent = this.parent;
|
|
1018
|
+
var obj = extend({}, parent.activeObj, {}, true);
|
|
1019
|
+
for (var i = 0, len = parent.objColl.length; i < len; i++) {
|
|
1020
|
+
if (parent.objColl[i].shape === 'image') {
|
|
1021
|
+
parent.activeObj = extend({}, parent.objColl[i], {}, true);
|
|
1022
|
+
var ctx = parent.objColl[i].imageCanvas.getContext('2d');
|
|
1023
|
+
parent.notify('selection', { prop: 'applyTransformToImg', onPropertyChange: false, value: { ctx: ctx } });
|
|
1024
|
+
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
1025
|
+
parent.notify('selection', { prop: 'setImageClarity', onPropertyChange: false, value: { bool: true } });
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
parent.activeObj = obj;
|
|
1029
|
+
};
|
|
929
1030
|
return UndoRedo;
|
|
930
1031
|
}());
|
|
931
1032
|
export { UndoRedo };
|
|
@@ -149,7 +149,8 @@ export declare enum ImageEditorCommand {
|
|
|
149
149
|
Warm = "Warm",
|
|
150
150
|
Grayscale = "Grayscale",
|
|
151
151
|
Sepia = "Sepia",
|
|
152
|
-
Invert = "Invert"
|
|
152
|
+
Invert = "Invert",
|
|
153
|
+
Straightening = "Straightening"
|
|
153
154
|
}
|
|
154
155
|
/**
|
|
155
156
|
* An enumeration of available image filter options.
|
|
@@ -156,6 +156,7 @@ export var ImageEditorCommand;
|
|
|
156
156
|
ImageEditorCommand["Grayscale"] = "Grayscale";
|
|
157
157
|
ImageEditorCommand["Sepia"] = "Sepia";
|
|
158
158
|
ImageEditorCommand["Invert"] = "Invert";
|
|
159
|
+
ImageEditorCommand["Straightening"] = "Straightening";
|
|
159
160
|
})(ImageEditorCommand || (ImageEditorCommand = {}));
|
|
160
161
|
/**
|
|
161
162
|
* An enumeration of available image filter options.
|
|
@@ -191,6 +191,27 @@ export interface SelectionSettingsModel {
|
|
|
191
191
|
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
+
/**
|
|
195
|
+
* Interface for a class FontFamily
|
|
196
|
+
*/
|
|
197
|
+
export interface FontFamilyModel {
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Specifies default font family selection
|
|
201
|
+
*
|
|
202
|
+
* @default 'Arial'
|
|
203
|
+
*/
|
|
204
|
+
default?: string;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Specifies default font family items
|
|
208
|
+
*
|
|
209
|
+
* @default null
|
|
210
|
+
*/
|
|
211
|
+
items?: DropDownButtonItemModel[];
|
|
212
|
+
|
|
213
|
+
}
|
|
214
|
+
|
|
194
215
|
/**
|
|
195
216
|
* Interface for a class ImageEditor
|
|
196
217
|
*/
|
|
@@ -457,6 +478,11 @@ export interface ImageEditorModel extends ComponentModel{
|
|
|
457
478
|
*/
|
|
458
479
|
selectionSettings?: SelectionSettingsModel;
|
|
459
480
|
|
|
481
|
+
/**
|
|
482
|
+
* Predefine the font families that populate in font family dropdown list from the toolbar.
|
|
483
|
+
*/
|
|
484
|
+
fontFamily?: FontFamilyModel;
|
|
485
|
+
|
|
460
486
|
/**
|
|
461
487
|
* Event callback that is raised before an image is saved.
|
|
462
488
|
*
|
|
@@ -586,6 +612,15 @@ export interface ImageEditorModel extends ComponentModel{
|
|
|
586
612
|
*/
|
|
587
613
|
click?: EmitType<ImageEditorClickEventArgs>
|
|
588
614
|
|
|
615
|
+
/**
|
|
616
|
+
* Event callback that is raised after shape changing action is performed in an image editor.
|
|
617
|
+
* @remarks
|
|
618
|
+
* This event is triggered after changing stroke color, fill Color, and stroke width property for the shapes and after the shape is applied to the canvas while clicking the OK button in toolbar.
|
|
619
|
+
*
|
|
620
|
+
* @event shapeChange
|
|
621
|
+
*/
|
|
622
|
+
shapeChange?: EmitType<ShapeChangeEventArgs>
|
|
623
|
+
|
|
589
624
|
/**
|
|
590
625
|
* Event callback that is raised when opening the quick access toolbar.
|
|
591
626
|
*
|
|
@@ -631,10 +666,10 @@ export interface ImageEditorModel extends ComponentModel{
|
|
|
631
666
|
quickAccessToolbarItemClick?: EmitType<ClickEventArgs>
|
|
632
667
|
|
|
633
668
|
/**
|
|
634
|
-
* Event callback that is raised while applying frames on an image.
|
|
669
|
+
* Event callback that is raised while applying frames on an image.
|
|
635
670
|
*
|
|
636
671
|
* @event frameChange
|
|
637
|
-
*/
|
|
672
|
+
*/
|
|
638
673
|
frameChange?: EmitType<FrameChangeEventArgs>
|
|
639
674
|
|
|
640
675
|
}
|