@syncfusion/ej2-image-editor 20.4.48 → 20.4.51
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 +24 -2
- package/GitLeaksReport.json +1 -0
- package/dist/ej2-image-editor.umd.min.js +2 -2
- package/dist/ej2-image-editor.umd.min.js.map +1 -1
- package/dist/es6/ej2-image-editor.es2015.js +1156 -878
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +1152 -874
- 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/gitleaks-ci/gitleaks +0 -0
- package/gitleaks-ci.tar.gz +0 -0
- package/package.json +11 -11
- package/src/image-editor/image-editor.d.ts +15 -4
- package/src/image-editor/image-editor.js +1152 -864
|
@@ -160,9 +160,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
160
160
|
this.isAllowCropPan = false;
|
|
161
161
|
this.tempPannedPoint = { x: 0, y: 0 };
|
|
162
162
|
this.cropObj = { cropZoom: 0, defaultZoom: 0, totalPannedPoint: { x: 0, y: 0 }, totalPannedClientPoint: { x: 0, y: 0 },
|
|
163
|
-
totalPannedInternalPoint: { x: 0, y: 0 }, activeObj: {}, rotateFlipColl: [],
|
|
164
|
-
currFlipState: '', destPoints: { startX: 0, startY: 0, width: 0, height: 0 },
|
|
165
|
-
srcPoints: { startX: 0, startY: 0, width: 0, height: 0 } };
|
|
163
|
+
totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {}, rotateFlipColl: [],
|
|
164
|
+
degree: 0, currFlipState: '', destPoints: { startX: 0, startY: 0, width: 0, height: 0 },
|
|
165
|
+
srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '' };
|
|
166
166
|
this.afterCropActions = [];
|
|
167
167
|
this.isCancelAction = false;
|
|
168
168
|
this.isFreehandPointMoved = false;
|
|
@@ -378,7 +378,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
378
378
|
this.unwireEvent();
|
|
379
379
|
super.destroy();
|
|
380
380
|
this.element.innerHTML = '';
|
|
381
|
-
this.trigger('destroyed');
|
|
382
381
|
}
|
|
383
382
|
initialize() {
|
|
384
383
|
this.updateFinetunes();
|
|
@@ -943,7 +942,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
943
942
|
redo.parentElement.classList.remove('e-overlay');
|
|
944
943
|
}
|
|
945
944
|
const zoomIn = document.querySelector('#' + this.element.id + '_zoomIn');
|
|
946
|
-
if (!isNullOrUndefined(zoomIn) && this.zoomFactor >=
|
|
945
|
+
if (!isNullOrUndefined(zoomIn) && this.zoomFactor >= 2) {
|
|
947
946
|
zoomIn.classList.add('e-disabled');
|
|
948
947
|
zoomIn.parentElement.classList.add('e-overlay');
|
|
949
948
|
}
|
|
@@ -1153,32 +1152,34 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
1153
1152
|
cropSelect(args) {
|
|
1154
1153
|
this.isCropTab = true;
|
|
1155
1154
|
this.zoomFactor = this.cropZoomFactor;
|
|
1156
|
-
const
|
|
1155
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
1156
|
+
const previousObj = this.getCurrentObj();
|
|
1157
|
+
previousObj.objColl = extend([], this.objColl, [], true);
|
|
1158
|
+
previousObj.pointColl = extend([], this.pointColl, [], true);
|
|
1159
|
+
previousObj.afterCropActions = this.afterCropActions;
|
|
1157
1160
|
const text = args.item.id;
|
|
1158
1161
|
this.currentToolbar = 'crop';
|
|
1159
1162
|
this.currSelectionPoint = null;
|
|
1160
1163
|
this.select(text);
|
|
1161
1164
|
this.refreshToolbar('main', true, true);
|
|
1162
1165
|
this.refreshDropDownBtn(true);
|
|
1163
|
-
this.
|
|
1164
|
-
currentObj: extend([], this.objColl, [], true),
|
|
1165
|
-
previousObj: extend([], this.objColl, [], true),
|
|
1166
|
-
previousSelectionObj: extend({}, activeObj, {}, true),
|
|
1167
|
-
currentSelectionObj: extend({}, this.activeObj, {}, true),
|
|
1168
|
-
zoomFactor: this.zoomFactor, sharpen: this.adjustmentLevel.sharpen, bw: this.adjustmentLevel.bw });
|
|
1169
|
-
this.undoRedoStep++;
|
|
1166
|
+
this.updateUndoRedoColl('selectionTransform', previousObj, previousObj.objColl, previousObj.pointColl, prevCropObj);
|
|
1170
1167
|
this.enableDisableToolbarBtn();
|
|
1171
1168
|
}
|
|
1172
1169
|
transformSelect(args) {
|
|
1173
1170
|
this.cropSelectedState();
|
|
1174
1171
|
this.currentSelectionPoint = null;
|
|
1175
1172
|
this.performTransformation(args.item.id);
|
|
1176
|
-
this.afterCropActions.push(args.item.id);
|
|
1177
1173
|
}
|
|
1178
1174
|
performTransformation(text) {
|
|
1179
1175
|
const tempZoomFactor = this.defaultZoomFactor;
|
|
1180
1176
|
const isUndoRedo = this.isUndoRedo;
|
|
1177
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
1181
1178
|
if (this.defaultZoomFactor !== 0) {
|
|
1179
|
+
this.transformCurrentObj = this.getCurrentObj();
|
|
1180
|
+
this.transformCurrentObj.objColl = extend([], this.objColl, null, true);
|
|
1181
|
+
this.transformCurrentObj.pointColl = extend({}, this.pointColl, null, true);
|
|
1182
|
+
this.transformCurrentObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
1182
1183
|
this.isUndoRedo = true;
|
|
1183
1184
|
if (this.defaultZoomFactor > 0) {
|
|
1184
1185
|
this.zoom(-this.defaultZoomFactor);
|
|
@@ -1193,10 +1194,19 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
1193
1194
|
this.isUndoRedo = true;
|
|
1194
1195
|
this.zoom(tempZoomFactor);
|
|
1195
1196
|
this.isUndoRedo = isUndoRedo;
|
|
1197
|
+
let state = '';
|
|
1198
|
+
if (text === 'rotateleft' || text === 'rotateright') {
|
|
1199
|
+
state = 'rotate';
|
|
1200
|
+
}
|
|
1201
|
+
else if (text === 'horizontalflip' || text === 'verticalflip') {
|
|
1202
|
+
state = 'flip';
|
|
1203
|
+
}
|
|
1204
|
+
this.updateUndoRedoColl(state, this.transformCurrentObj, this.transformCurrentObj.objColl, this.transformCurrentObj.pointColl, prevCropObj);
|
|
1205
|
+
this.transformCurrentObj = null;
|
|
1196
1206
|
}
|
|
1197
1207
|
}
|
|
1198
1208
|
updateTransform(text) {
|
|
1199
|
-
switch (text) {
|
|
1209
|
+
switch (text.toLowerCase()) {
|
|
1200
1210
|
case 'rotateleft':
|
|
1201
1211
|
this.rotate(-90);
|
|
1202
1212
|
break;
|
|
@@ -1296,15 +1306,16 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
1296
1306
|
showButtons: false, mode: 'Palette', cssClass: 'e-shape-fill-color',
|
|
1297
1307
|
change: (args) => {
|
|
1298
1308
|
this.pushActItemIntoObj();
|
|
1299
|
-
const
|
|
1309
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
1310
|
+
const prevObj = this.getCurrentObj();
|
|
1311
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
1312
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
1313
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
1300
1314
|
this.objColl.pop();
|
|
1301
1315
|
proxy.activeObj.strokeSettings.fillColor = args.currentValue.hex;
|
|
1302
1316
|
proxy.strokeSettings.fillColor = proxy.activeObj.strokeSettings.fillColor;
|
|
1303
1317
|
this.objColl.push(this.activeObj);
|
|
1304
|
-
|
|
1305
|
-
previousObj: objColl, zoomFactor: proxy.zoomFactor, sharpen: proxy.adjustmentLevel.sharpen,
|
|
1306
|
-
bw: proxy.adjustmentLevel.bw });
|
|
1307
|
-
proxy.undoRedoStep++;
|
|
1318
|
+
this.updateUndoRedoColl('shapeTransform', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
1308
1319
|
proxy.redrawShape(proxy.objColl[proxy.objColl.length - 1]);
|
|
1309
1320
|
if (args.currentValue.rgba === '') {
|
|
1310
1321
|
fillDDB.element.children[0].classList.add('e-nocolor-item');
|
|
@@ -1339,17 +1350,17 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
1339
1350
|
showButtons: false, mode: 'Palette', cssClass: 'e-shape-stroke-color',
|
|
1340
1351
|
change: (args) => {
|
|
1341
1352
|
this.pushActItemIntoObj();
|
|
1342
|
-
const
|
|
1353
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
1354
|
+
const prevObj = this.getCurrentObj();
|
|
1355
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
1356
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
1357
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
1343
1358
|
this.objColl.pop();
|
|
1344
1359
|
proxy.activeObj.strokeSettings.strokeColor = args.currentValue.hex;
|
|
1345
1360
|
proxy.strokeSettings.strokeColor = proxy.activeObj.strokeSettings.strokeColor;
|
|
1346
1361
|
if (!proxy.togglePen) {
|
|
1347
1362
|
this.objColl.push(this.activeObj);
|
|
1348
|
-
proxy.
|
|
1349
|
-
currentObj: extend([], proxy.objColl, [], true),
|
|
1350
|
-
previousObj: objColl, zoomFactor: proxy.zoomFactor,
|
|
1351
|
-
sharpen: proxy.adjustmentLevel.sharpen, bw: proxy.adjustmentLevel.bw });
|
|
1352
|
-
proxy.undoRedoStep++;
|
|
1363
|
+
proxy.updateUndoRedoColl('shapeTransform', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
1353
1364
|
proxy.redrawShape(proxy.objColl[proxy.objColl.length - 1]);
|
|
1354
1365
|
}
|
|
1355
1366
|
strokeDDB.element.children[0].style.backgroundColor = args.currentValue.rgba;
|
|
@@ -1399,18 +1410,18 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
1399
1410
|
},
|
|
1400
1411
|
select: (args) => {
|
|
1401
1412
|
this.pushActItemIntoObj();
|
|
1402
|
-
const
|
|
1413
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
1414
|
+
const prevObj = this.getCurrentObj();
|
|
1415
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
1416
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
1417
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
1403
1418
|
this.objColl.pop();
|
|
1404
1419
|
spanElem.textContent = args.item.text;
|
|
1405
1420
|
this.activeObj.strokeSettings.strokeWidth = parseInt(args.item.id, 10);
|
|
1406
1421
|
this.activeObj.strokeSettings.strokeWidth *= 2;
|
|
1407
1422
|
this.strokeSettings.strokeWidth = this.activeObj.strokeSettings.strokeWidth;
|
|
1408
1423
|
this.objColl.push(this.activeObj);
|
|
1409
|
-
this.
|
|
1410
|
-
currentObj: extend([], this.objColl, [], true),
|
|
1411
|
-
previousObj: objColl, zoomFactor: this.zoomFactor,
|
|
1412
|
-
sharpen: this.adjustmentLevel.sharpen, bw: this.adjustmentLevel.bw });
|
|
1413
|
-
this.undoRedoStep++;
|
|
1424
|
+
this.updateUndoRedoColl('shapeTransform', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
1414
1425
|
this.redrawShape(this.objColl[this.objColl.length - 1]);
|
|
1415
1426
|
if (Browser.isDevice) {
|
|
1416
1427
|
if (!isNullOrUndefined(document.getElementById(this.element.id + '_bottomToolbar'))) {
|
|
@@ -1539,17 +1550,17 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
1539
1550
|
showButtons: false, mode: 'Palette', cssClass: 'e-text-fontt-color',
|
|
1540
1551
|
change: (args) => {
|
|
1541
1552
|
this.pushActItemIntoObj();
|
|
1542
|
-
const
|
|
1553
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
1554
|
+
const prevObj = this.getCurrentObj();
|
|
1555
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
1556
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
1557
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
1543
1558
|
this.objColl.pop();
|
|
1544
1559
|
if (proxy.textArea.style.display === 'none') {
|
|
1545
1560
|
proxy.strokeSettings.strokeColor = proxy.activeObj.strokeSettings.strokeColor = args.currentValue.hex;
|
|
1546
1561
|
if (!proxy.togglePen) {
|
|
1547
1562
|
this.objColl.push(this.activeObj);
|
|
1548
|
-
proxy.
|
|
1549
|
-
value: null, currentObj: extend([], proxy.objColl, [], true),
|
|
1550
|
-
previousObj: objColl, zoomFactor: proxy.zoomFactor,
|
|
1551
|
-
sharpen: proxy.adjustmentLevel.sharpen, bw: proxy.adjustmentLevel.bw });
|
|
1552
|
-
proxy.undoRedoStep++;
|
|
1563
|
+
proxy.updateUndoRedoColl('shapeTransform', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
1553
1564
|
proxy.redrawShape(proxy.objColl[proxy.objColl.length - 1]);
|
|
1554
1565
|
}
|
|
1555
1566
|
}
|
|
@@ -1558,21 +1569,13 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
1558
1569
|
const temp = proxy.activeObj.strokeSettings.strokeColor;
|
|
1559
1570
|
proxy.activeObj.strokeSettings.strokeColor = args.currentValue.hex;
|
|
1560
1571
|
this.objColl.push(this.activeObj);
|
|
1561
|
-
this.
|
|
1562
|
-
currentObj: extend([], this.objColl, [], true),
|
|
1563
|
-
previousObj: objColl, zoomFactor: proxy.zoomFactor,
|
|
1564
|
-
sharpen: proxy.adjustmentLevel.sharpen, bw: proxy.adjustmentLevel.bw });
|
|
1565
|
-
this.undoRedoStep++;
|
|
1572
|
+
this.updateUndoRedoColl('textAreaCustomization', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
1566
1573
|
this.objColl.pop();
|
|
1567
1574
|
proxy.activeObj.strokeSettings.strokeColor = temp;
|
|
1568
1575
|
}
|
|
1569
1576
|
else if (!proxy.togglePen) {
|
|
1570
1577
|
this.objColl.push(this.activeObj);
|
|
1571
|
-
|
|
1572
|
-
currentObj: extend([], proxy.objColl, [], true),
|
|
1573
|
-
previousObj: objColl, zoomFactor: proxy.zoomFactor,
|
|
1574
|
-
sharpen: proxy.adjustmentLevel.sharpen, bw: proxy.adjustmentLevel.bw });
|
|
1575
|
-
proxy.undoRedoStep++;
|
|
1578
|
+
this.updateUndoRedoColl('shapeTransform', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
1576
1579
|
proxy.redrawShape(proxy.objColl[proxy.objColl.length - 1]);
|
|
1577
1580
|
}
|
|
1578
1581
|
strokeDDB.element.children[0].style.backgroundColor = args.currentValue.rgba;
|
|
@@ -1643,6 +1646,11 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
1643
1646
|
select: (args) => {
|
|
1644
1647
|
this.pushActItemIntoObj();
|
|
1645
1648
|
const objColl = extend([], this.objColl, [], true);
|
|
1649
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
1650
|
+
const prevObj = this.getCurrentObj();
|
|
1651
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
1652
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
1653
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
1646
1654
|
this.objColl.pop();
|
|
1647
1655
|
spanElem.textContent = args.item.text;
|
|
1648
1656
|
if (Browser.isDevice) {
|
|
@@ -1654,11 +1662,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
1654
1662
|
this.activeObj.textSettings.fontFamily = this.toPascalCase(args.item.id);
|
|
1655
1663
|
this.redrawText();
|
|
1656
1664
|
this.objColl.push(this.activeObj);
|
|
1657
|
-
this.
|
|
1658
|
-
currentObj: extend([], this.objColl, [], true),
|
|
1659
|
-
previousObj: objColl, zoomFactor: this.zoomFactor,
|
|
1660
|
-
sharpen: this.adjustmentLevel.sharpen, bw: this.adjustmentLevel.bw });
|
|
1661
|
-
this.undoRedoStep++;
|
|
1665
|
+
this.updateUndoRedoColl('textAreaCustomization', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
1662
1666
|
this.objColl.pop();
|
|
1663
1667
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
1664
1668
|
const width = this.activeObj.activePoint.width +
|
|
@@ -1673,11 +1677,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
1673
1677
|
this.textSettings.fontFamily = this.activeObj.textSettings.fontFamily = this.toPascalCase(args.item.id);
|
|
1674
1678
|
this.redrawText();
|
|
1675
1679
|
this.objColl.push(this.activeObj);
|
|
1676
|
-
this.
|
|
1677
|
-
currentObj: extend([], this.objColl, [], true),
|
|
1678
|
-
previousObj: objColl, zoomFactor: this.zoomFactor,
|
|
1679
|
-
sharpen: this.adjustmentLevel.sharpen, bw: this.adjustmentLevel.bw });
|
|
1680
|
-
this.undoRedoStep++;
|
|
1680
|
+
this.updateUndoRedoColl('shapeTransform', prevObj, objColl, extend([], this.pointColl, [], true), prevCropObj);
|
|
1681
1681
|
this.redrawShape(this.objColl[this.objColl.length - 1]);
|
|
1682
1682
|
}
|
|
1683
1683
|
}
|
|
@@ -1778,7 +1778,11 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
1778
1778
|
},
|
|
1779
1779
|
select: (args) => {
|
|
1780
1780
|
this.pushActItemIntoObj();
|
|
1781
|
-
const
|
|
1781
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
1782
|
+
const prevObj = this.getCurrentObj();
|
|
1783
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
1784
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
1785
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
1782
1786
|
this.objColl.pop();
|
|
1783
1787
|
fontSizeSpanElem.textContent = args.item.text;
|
|
1784
1788
|
if (this.textArea.style.display === 'block') {
|
|
@@ -1786,11 +1790,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
1786
1790
|
const temp = this.activeObj.textSettings.fontSize;
|
|
1787
1791
|
this.activeObj.textSettings.fontSize = parseInt(this.fontSizeColl[(parseInt(args.item.text, 10) - 1)].text, 10);
|
|
1788
1792
|
this.objColl.push(this.activeObj);
|
|
1789
|
-
this.
|
|
1790
|
-
currentObj: extend([], this.objColl, [], true),
|
|
1791
|
-
previousObj: objColl, zoomFactor: this.zoomFactor,
|
|
1792
|
-
sharpen: this.adjustmentLevel.sharpen, bw: this.adjustmentLevel.bw });
|
|
1793
|
-
this.undoRedoStep++;
|
|
1793
|
+
this.updateUndoRedoColl('textAreaCustomization', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
1794
1794
|
this.objColl.pop();
|
|
1795
1795
|
let textStyle = '';
|
|
1796
1796
|
if (this.textArea.style.fontWeight === 'bold') {
|
|
@@ -1830,11 +1830,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
1830
1830
|
this.updateActiveObject(this.activeObj.activePoint, this.activeObj);
|
|
1831
1831
|
this.redrawText();
|
|
1832
1832
|
this.objColl.push(this.activeObj);
|
|
1833
|
-
this.
|
|
1834
|
-
currentObj: extend([], this.objColl, [], true),
|
|
1835
|
-
previousObj: objColl, zoomFactor: this.zoomFactor,
|
|
1836
|
-
sharpen: this.adjustmentLevel.sharpen, bw: this.adjustmentLevel.bw });
|
|
1837
|
-
this.undoRedoStep++;
|
|
1833
|
+
this.updateUndoRedoColl('shapeTransform', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
1838
1834
|
this.redrawShape(this.objColl[this.objColl.length - 1]);
|
|
1839
1835
|
}
|
|
1840
1836
|
}
|
|
@@ -1894,14 +1890,27 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
1894
1890
|
return width;
|
|
1895
1891
|
}
|
|
1896
1892
|
updateUndoRedoObj(objColl) {
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1893
|
+
if (this.allowUndoRedo) {
|
|
1894
|
+
this.objColl.push(this.activeObj);
|
|
1895
|
+
const cropObj = extend({}, this.cropObj, {}, true);
|
|
1896
|
+
const obj = this.getCurrentObj();
|
|
1897
|
+
obj.objColl = extend([], this.objColl, [], true);
|
|
1898
|
+
obj.pointColl = extend([], this.pointColl, [], true);
|
|
1899
|
+
obj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
1900
|
+
this.undoRedoColl.push({ operation: 'shapeTransform', previousObj: obj, currentObj: obj,
|
|
1901
|
+
previousObjColl: objColl, currentObjColl: obj.objColl,
|
|
1902
|
+
previousPointColl: obj.pointColl, currentPointColl: obj.pointColl,
|
|
1903
|
+
previousCropObj: cropObj, currentCropObj: cropObj });
|
|
1904
|
+
this.undoRedoStep++;
|
|
1905
|
+
this.redrawShape(this.objColl[this.objColl.length - 1]);
|
|
1906
|
+
}
|
|
1903
1907
|
}
|
|
1904
1908
|
updateObjColl(item, objColl) {
|
|
1909
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
1910
|
+
const prevObj = this.getCurrentObj();
|
|
1911
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
1912
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
1913
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
1905
1914
|
const tempBold = this.activeObj.textSettings.bold;
|
|
1906
1915
|
const tempItalic = this.activeObj.textSettings.italic;
|
|
1907
1916
|
switch (item) {
|
|
@@ -1923,10 +1932,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
1923
1932
|
break;
|
|
1924
1933
|
}
|
|
1925
1934
|
this.objColl.push(this.activeObj);
|
|
1926
|
-
this.
|
|
1927
|
-
currentObj: extend([], this.objColl, [], true), previousObj: objColl, zoomFactor: this.zoomFactor,
|
|
1928
|
-
sharpen: this.adjustmentLevel.sharpen, bw: this.adjustmentLevel.bw });
|
|
1929
|
-
this.undoRedoStep++;
|
|
1935
|
+
this.updateUndoRedoColl('textAreaCustomization', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
1930
1936
|
this.objColl.pop();
|
|
1931
1937
|
this.activeObj.textSettings.bold = tempBold;
|
|
1932
1938
|
this.activeObj.textSettings.italic = tempItalic;
|
|
@@ -2154,7 +2160,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
2154
2160
|
this.disablePan = false;
|
|
2155
2161
|
}
|
|
2156
2162
|
zoomIn = document.querySelector('#' + this.element.id + '_zoomIn');
|
|
2157
|
-
if (!isNullOrUndefined(zoomIn) && this.zoomFactor >=
|
|
2163
|
+
if (!isNullOrUndefined(zoomIn) && this.zoomFactor >= 2) {
|
|
2158
2164
|
zoomIn.classList.add('e-disabled');
|
|
2159
2165
|
zoomIn.parentElement.classList.add('e-overlay');
|
|
2160
2166
|
}
|
|
@@ -2174,7 +2180,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
2174
2180
|
break;
|
|
2175
2181
|
case 'crop':
|
|
2176
2182
|
if (!isNullOrUndefined(this.currSelectionPoint)) {
|
|
2177
|
-
this.
|
|
2183
|
+
if (this.currObjType.isUndoAction) {
|
|
2184
|
+
this.refreshUndoRedoColl();
|
|
2185
|
+
}
|
|
2186
|
+
if (!isNullOrUndefined(this.cropObj.activeObj.shape)) {
|
|
2187
|
+
this.select(this.cropObj.activeObj.shape);
|
|
2188
|
+
}
|
|
2178
2189
|
this.refreshToolbar('main', true, true);
|
|
2179
2190
|
getComponent(this.element.querySelector('#' + this.element.id + '_cropBtn'), 'dropdown-btn').toggle();
|
|
2180
2191
|
if (!isNullOrUndefined(this.activeObj.shape)) {
|
|
@@ -2186,12 +2197,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
2186
2197
|
imageEditorObj.reset();
|
|
2187
2198
|
this.currentToolbar = 'main';
|
|
2188
2199
|
break;
|
|
2189
|
-
case 'undo':
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
case 'redo':
|
|
2193
|
-
|
|
2194
|
-
|
|
2200
|
+
// case 'undo':
|
|
2201
|
+
// this.callUndo();
|
|
2202
|
+
// break;
|
|
2203
|
+
// case 'redo':
|
|
2204
|
+
// this.callRedo();
|
|
2205
|
+
// break;
|
|
2195
2206
|
case 'adjustment':
|
|
2196
2207
|
if (!isDisabledAdjustment) {
|
|
2197
2208
|
this.refreshToolbar('adjustment');
|
|
@@ -2223,6 +2234,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
2223
2234
|
case 'sepia':
|
|
2224
2235
|
case 'invert':
|
|
2225
2236
|
case 'sharpen':
|
|
2237
|
+
if (this.currObjType.isUndoAction) {
|
|
2238
|
+
this.refreshUndoRedoColl();
|
|
2239
|
+
}
|
|
2226
2240
|
this.currObjType.isFiltered = true;
|
|
2227
2241
|
this.setFilter(type);
|
|
2228
2242
|
break;
|
|
@@ -2255,7 +2269,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
2255
2269
|
this.currObjType.isFiltered = false;
|
|
2256
2270
|
this.adjustmentLevel = extend({}, this.tempAdjustmentLevel, {}, true);
|
|
2257
2271
|
this.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
2258
|
-
this.undoRedoColl = extend([], this.tempUndoRedoColl, [], true);
|
|
2259
2272
|
this.undoRedoStep = this.tempUndoRedoStep;
|
|
2260
2273
|
this.upperCanvas.style.cursor = 'default';
|
|
2261
2274
|
this.currObjType.isCustomCrop = false;
|
|
@@ -2294,7 +2307,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
2294
2307
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
2295
2308
|
this.renderImage();
|
|
2296
2309
|
this.refreshToolbar('main');
|
|
2297
|
-
this.pointColl[this.freehandDrawSelectedIndex]
|
|
2310
|
+
if (!isNullOrUndefined(this.pointColl[this.freehandDrawSelectedIndex])) {
|
|
2311
|
+
this.pointColl[this.freehandDrawSelectedIndex].isSelected = false;
|
|
2312
|
+
}
|
|
2298
2313
|
this.isFreehandDrawEditing = this.isFreehandDrawingPoint = false;
|
|
2299
2314
|
this.freehandDrawHoveredIndex = this.freehandDrawSelectedIndex = null;
|
|
2300
2315
|
}
|
|
@@ -2306,8 +2321,10 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
2306
2321
|
this.pointColl[n].strokeWidth = this.tempFreeHandDrawEditingStyles.strokeWidth;
|
|
2307
2322
|
}
|
|
2308
2323
|
this.pointCounter = 0;
|
|
2309
|
-
this.pointColl[this.freehandDrawSelectedIndex]
|
|
2310
|
-
|
|
2324
|
+
if (!isNullOrUndefined(this.pointColl[this.freehandDrawSelectedIndex])) {
|
|
2325
|
+
this.pointColl[this.freehandDrawSelectedIndex].isSelected = false;
|
|
2326
|
+
}
|
|
2327
|
+
this.freehandDrawHoveredIndex = this.freehandDrawSelectedIndex = this.freehandDrawSelectedId = null;
|
|
2311
2328
|
this.isFreehandDrawEditing = this.isFreehandDrawingPoint = false;
|
|
2312
2329
|
this.tempFreeHandDrawEditingStyles = { strokeColor: null, strokeWidth: null, fillColor: null };
|
|
2313
2330
|
this.refreshToolbar('main');
|
|
@@ -2842,6 +2859,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
2842
2859
|
width: Browser.isDevice ? '200px' : '300px',
|
|
2843
2860
|
cssClass: 'e-slider',
|
|
2844
2861
|
change: (args) => {
|
|
2862
|
+
if (this.currObjType.isUndoAction) {
|
|
2863
|
+
this.refreshUndoRedoColl();
|
|
2864
|
+
}
|
|
2845
2865
|
this.setCurrAdjustmentValue(type, args.value);
|
|
2846
2866
|
this.enableDisableToolbarBtn();
|
|
2847
2867
|
}
|
|
@@ -2946,11 +2966,80 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
2946
2966
|
this.iterateObjColl();
|
|
2947
2967
|
this.freehandRedraw(this.lowerContext);
|
|
2948
2968
|
this.lowerContext.filter = temp;
|
|
2969
|
+
this.currSelectionPoint = null;
|
|
2970
|
+
}
|
|
2971
|
+
else {
|
|
2972
|
+
if (this.cropObj.cropZoom > 0) {
|
|
2973
|
+
const cropObjColl = extend([], this.objColl, null, true);
|
|
2974
|
+
const cropPointColl = extend([], this.pointColl, null, true);
|
|
2975
|
+
this.objColl = [];
|
|
2976
|
+
this.pointColl = [];
|
|
2977
|
+
this.freehandCounter = 0;
|
|
2978
|
+
this.zoom(this.cropObj.cropZoom);
|
|
2979
|
+
this.objColl = cropObjColl;
|
|
2980
|
+
this.pointColl = cropPointColl;
|
|
2981
|
+
this.freehandCounter = this.pointColl.length;
|
|
2982
|
+
this.currSelectionPoint = extend({}, this.cropObj.activeObj, null, true);
|
|
2983
|
+
if (this.cropObj.currFlipState !== '') {
|
|
2984
|
+
this.cropObj.totalPannedPoint.x += this.cropObj.tempFlipPanPoint.x;
|
|
2985
|
+
this.cropObj.totalPannedPoint.y += this.cropObj.tempFlipPanPoint.y;
|
|
2986
|
+
}
|
|
2987
|
+
}
|
|
2988
|
+
const destPoints = { startX: this.destLeft, startY: this.destTop, width: this.destWidth, height: this.destHeight };
|
|
2989
|
+
this.destLeft = this.currSelectionPoint.activePoint.startX;
|
|
2990
|
+
this.destTop = this.currSelectionPoint.activePoint.startY;
|
|
2991
|
+
this.destWidth = this.currSelectionPoint.activePoint.width;
|
|
2992
|
+
this.destHeight = this.currSelectionPoint.activePoint.height;
|
|
2993
|
+
this.zoomObjColl();
|
|
2994
|
+
this.zoomFreehandDrawColl();
|
|
2995
|
+
this.destLeft = destPoints.startX;
|
|
2996
|
+
this.destTop = destPoints.startY;
|
|
2997
|
+
this.destWidth = destPoints.width;
|
|
2998
|
+
this.destHeight = destPoints.height;
|
|
2999
|
+
this.updatePannedRegion();
|
|
3000
|
+
this.updateObjAndFreeHandDrawColl();
|
|
3001
|
+
const cropObjColl = extend([], this.objColl, null, true);
|
|
3002
|
+
const cropPointColl = extend([], this.pointColl, null, true);
|
|
3003
|
+
this.objColl = [];
|
|
3004
|
+
this.pointColl = [];
|
|
3005
|
+
this.freehandCounter = 0;
|
|
3006
|
+
this.setCurrentObj();
|
|
3007
|
+
const activeObj = extend({}, this.activeObj, null, true);
|
|
3008
|
+
this.refreshActiveObj();
|
|
3009
|
+
this.objColl = cropObjColl;
|
|
3010
|
+
this.pointColl = cropPointColl;
|
|
3011
|
+
this.freehandCounter = this.pointColl.length;
|
|
3012
|
+
this.zoomObjColl();
|
|
3013
|
+
this.zoomFreehandDrawColl();
|
|
3014
|
+
this.currSelectionPoint = null;
|
|
3015
|
+
if (this.degree === 0) {
|
|
3016
|
+
this.drawPannImage({ x: 0, y: 0 });
|
|
3017
|
+
}
|
|
3018
|
+
this.activeObj = activeObj;
|
|
3019
|
+
this.drawObject('duplicate');
|
|
3020
|
+
}
|
|
3021
|
+
}
|
|
3022
|
+
updatePannedRegion() {
|
|
3023
|
+
let pannedPoint = this.degree === 0 ? this.cropObj.totalPannedPoint : this.cropObj.totalPannedClientPoint;
|
|
3024
|
+
if (this.currFlipState === this.cropObj.currFlipState) {
|
|
3025
|
+
this.panObjColl(-pannedPoint.x, -pannedPoint.y, '');
|
|
3026
|
+
this.panFreehandDrawColl(-pannedPoint.x, -pannedPoint.y, '');
|
|
2949
3027
|
}
|
|
2950
3028
|
else {
|
|
2951
|
-
this.
|
|
3029
|
+
if (this.currFlipState === 'horizontal' && this.cropObj.currFlipState === '' ||
|
|
3030
|
+
this.currFlipState === 'vertical' && this.cropObj.currFlipState === '') {
|
|
3031
|
+
this.panObjColl(-pannedPoint.x, -pannedPoint.y, '');
|
|
3032
|
+
this.panFreehandDrawColl(-pannedPoint.x, -pannedPoint.y, '');
|
|
3033
|
+
}
|
|
3034
|
+
else if (this.currFlipState === '' && this.cropObj.currFlipState === 'horizontal') {
|
|
3035
|
+
this.panObjColl(pannedPoint.x, -pannedPoint.y, '');
|
|
3036
|
+
this.panFreehandDrawColl(pannedPoint.x, -pannedPoint.y, '');
|
|
3037
|
+
}
|
|
3038
|
+
else if (this.currFlipState === '' && this.cropObj.currFlipState === 'vertical') {
|
|
3039
|
+
this.panObjColl(-pannedPoint.x, pannedPoint.y, '');
|
|
3040
|
+
this.panFreehandDrawColl(-pannedPoint.x, pannedPoint.y, '');
|
|
3041
|
+
}
|
|
2952
3042
|
}
|
|
2953
|
-
this.currSelectionPoint = null;
|
|
2954
3043
|
}
|
|
2955
3044
|
updateObjAndFreeHandDrawColl() {
|
|
2956
3045
|
for (let i = 0; i < this.objColl.length; i++) {
|
|
@@ -3070,7 +3159,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
3070
3159
|
const activeObj = extend({}, this.activeObj, {});
|
|
3071
3160
|
this.destLeft += (-this.totalPannedPoint.x);
|
|
3072
3161
|
this.destTop += (-this.totalPannedPoint.y);
|
|
3073
|
-
this.drawPannImage({ x: -this.totalPannedPoint.x, y: -this.totalPannedPoint.y }
|
|
3162
|
+
this.drawPannImage({ x: -this.totalPannedPoint.x, y: -this.totalPannedPoint.y });
|
|
3074
3163
|
this.updateFlipPan(activeObj);
|
|
3075
3164
|
this.totalPannedPoint = { x: 0, y: 0 };
|
|
3076
3165
|
}
|
|
@@ -3090,6 +3179,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
3090
3179
|
else {
|
|
3091
3180
|
this.zoom(Math.abs(length));
|
|
3092
3181
|
}
|
|
3182
|
+
this.cropZoomFactor = this.tempZoomFactor;
|
|
3093
3183
|
}
|
|
3094
3184
|
else {
|
|
3095
3185
|
this.isCancelAction = true;
|
|
@@ -3099,7 +3189,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
3099
3189
|
this.freehandCounter = 0;
|
|
3100
3190
|
const cropObj = extend({}, this.cropObj, {});
|
|
3101
3191
|
const afterCropActions = extend([], this.afterCropActions, {}, true);
|
|
3102
|
-
this.
|
|
3192
|
+
this.setCurrentObj();
|
|
3103
3193
|
this.cropImg();
|
|
3104
3194
|
this.cropObj = cropObj;
|
|
3105
3195
|
this.afterCropActions = afterCropActions;
|
|
@@ -3152,6 +3242,11 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
3152
3242
|
}
|
|
3153
3243
|
}
|
|
3154
3244
|
context.closePath();
|
|
3245
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
3246
|
+
const prevObj = this.getCurrentObj();
|
|
3247
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
3248
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
3249
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
3155
3250
|
this.pointColl[this.freehandCounter] = {};
|
|
3156
3251
|
this.pointColl[this.freehandCounter].points = extend([], this.points);
|
|
3157
3252
|
this.pointColl[this.freehandCounter].strokeColor = this.activeObj.strokeSettings.strokeColor;
|
|
@@ -3163,16 +3258,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
3163
3258
|
this.freehandCounter++;
|
|
3164
3259
|
this.currentFreehandDrawIndex++;
|
|
3165
3260
|
this.isFreehandDrawing = false;
|
|
3166
|
-
|
|
3167
|
-
const currentObj = extend([], this.pointColl, [], true);
|
|
3168
|
-
this.pointColl = {};
|
|
3169
|
-
for (let i = 0; i < this.freehandCounter - 1; i++) {
|
|
3170
|
-
this.pointColl[i] = currentObj[i];
|
|
3171
|
-
}
|
|
3172
|
-
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3173
|
-
const previousObj = extend([], this.pointColl, [], true);
|
|
3174
|
-
this.updateUndoRedoColl('freehanddraw', null, previousObj, currentObj, this.zoomFactor);
|
|
3175
|
-
this.pointColl = currentObj;
|
|
3261
|
+
this.updateUndoRedoColl('freehanddraw', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
3176
3262
|
}
|
|
3177
3263
|
freehandMoveHandler(e) {
|
|
3178
3264
|
this.isFreehandPointMoved = true;
|
|
@@ -3654,8 +3740,11 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
3654
3740
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3655
3741
|
const temp = extend([], this.pointColl, [], true);
|
|
3656
3742
|
this.updateFreehandDrawColorChange();
|
|
3657
|
-
|
|
3658
|
-
const
|
|
3743
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
3744
|
+
const prevObj = this.getCurrentObj();
|
|
3745
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
3746
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
3747
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
3659
3748
|
this.pointColl = temp;
|
|
3660
3749
|
proxy.isFreehandDrawCustomized = true;
|
|
3661
3750
|
proxy.activeObj.strokeSettings.strokeColor = proxy.selectedFreehandColor = args.currentValue.hex;
|
|
@@ -3663,7 +3752,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
3663
3752
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
3664
3753
|
this.pointColl[this.freehandDrawSelectedIndex].strokeColor = args.currentValue.hex;
|
|
3665
3754
|
this.hoverFreehandraw(args.currentValue.hex);
|
|
3666
|
-
this.updateUndoRedoColl('freehanddrawCustomized',
|
|
3755
|
+
this.updateUndoRedoColl('freehanddrawCustomized', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
3667
3756
|
}
|
|
3668
3757
|
else if (!proxy.togglePen) {
|
|
3669
3758
|
proxy.redrawShape(this.activeObj);
|
|
@@ -3727,8 +3816,11 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
3727
3816
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3728
3817
|
const temp = extend([], this.pointColl, [], true);
|
|
3729
3818
|
this.updateFreehandDrawColorChange();
|
|
3730
|
-
|
|
3731
|
-
const
|
|
3819
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
3820
|
+
const prevObj = this.getCurrentObj();
|
|
3821
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
3822
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
3823
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
3732
3824
|
this.pointColl = temp;
|
|
3733
3825
|
this.isFreehandDrawCustomized = true;
|
|
3734
3826
|
spanElem.textContent = args.item.text;
|
|
@@ -3737,7 +3829,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
3737
3829
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
3738
3830
|
this.hoverFreehandraw(null, this.penStrokeWidth);
|
|
3739
3831
|
this.pointColl[this.freehandDrawSelectedIndex].strokeWidth = this.penStrokeWidth;
|
|
3740
|
-
this.updateUndoRedoColl('freehanddrawCustomized',
|
|
3832
|
+
this.updateUndoRedoColl('freehanddrawCustomized', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
3741
3833
|
}
|
|
3742
3834
|
if (Browser.isDevice) {
|
|
3743
3835
|
if (!isNullOrUndefined(document.getElementById(this.element.id + '_bottomToolbar'))) {
|
|
@@ -3944,6 +4036,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
3944
4036
|
this.destLeft += this.totalPannedInternalPoint.x;
|
|
3945
4037
|
this.destTop += this.totalPannedInternalPoint.y;
|
|
3946
4038
|
const temp = this.lowerContext.filter;
|
|
4039
|
+
if (this.degree === 0) {
|
|
4040
|
+
this.setDestPointsForFlipState();
|
|
4041
|
+
}
|
|
3947
4042
|
this.updateBrightnessFilter();
|
|
3948
4043
|
this.lowerContext.drawImage(this.baseImg, this.srcLeft, this.srcTop, this.srcWidth, this.srcHeight, this.destLeft, this.destTop, this.destWidth, this.destHeight);
|
|
3949
4044
|
this.updateCurrentTransformedState('reverse');
|
|
@@ -4187,6 +4282,10 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
4187
4282
|
context.strokeStyle = '#fff';
|
|
4188
4283
|
minStrokeWidth = maxStrokeWidth = this.penStrokeWidth = strokeWidth ?
|
|
4189
4284
|
strokeWidth : this.pointColl[idx].strokeWidth;
|
|
4285
|
+
if (len === 1) {
|
|
4286
|
+
controlPoint1 = controlPoint2 = startPoint = endPoint = this.points[0];
|
|
4287
|
+
this.startDraw(context, controlPoint1, controlPoint2, startPoint, endPoint, minStrokeWidth, maxStrokeWidth);
|
|
4288
|
+
}
|
|
4190
4289
|
for (let l = 0; l < len - 3; l++) {
|
|
4191
4290
|
if (this.points[l + 1] && this.points[l + 2] && this.points[l + 2]) {
|
|
4192
4291
|
controlPoint1 = (this.calcCurveControlPoints(this.points[l + 0], this.points[l + 1], this.points[l + 2])).controlPoint2;
|
|
@@ -4195,53 +4294,62 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
4195
4294
|
endPoint = this.points[l + 2];
|
|
4196
4295
|
this.startDraw(context, controlPoint1, controlPoint2, startPoint, endPoint, minStrokeWidth, maxStrokeWidth);
|
|
4197
4296
|
}
|
|
4198
|
-
if (len === 1) {
|
|
4199
|
-
controlPoint1 = controlPoint2 = startPoint = endPoint = this.points[0];
|
|
4200
|
-
this.startDraw(context, controlPoint1, controlPoint2, startPoint, endPoint, minStrokeWidth, maxStrokeWidth);
|
|
4201
|
-
}
|
|
4202
4297
|
}
|
|
4203
4298
|
context.closePath();
|
|
4204
4299
|
}
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
this.points[l].x = this.destLeft + (this.destLeft + this.destWidth - this.points[l].x);
|
|
4218
|
-
}
|
|
4219
|
-
this.points[l].ratioX = (this.points[l].x - this.destLeft) / this.destWidth;
|
|
4220
|
-
this.points[l].ratioY = (this.points[l].y - this.destTop) / this.destHeight;
|
|
4300
|
+
pointsHorizontalFlip() {
|
|
4301
|
+
for (let n = 0; n < this.freehandCounter; n++) {
|
|
4302
|
+
if (this.pointColl[n].shapeFlip !== this.currFlipState) {
|
|
4303
|
+
this.points = extend([], this.pointColl[n].points, []);
|
|
4304
|
+
this.pointCounter = 0;
|
|
4305
|
+
const len = this.points.length;
|
|
4306
|
+
for (let l = 0; l < len; l++) {
|
|
4307
|
+
if (this.points[l].x <= this.destLeft + (this.destWidth / 2)) {
|
|
4308
|
+
this.points[l].x = (this.destLeft + this.destWidth) - (this.points[l].x - this.destLeft);
|
|
4309
|
+
}
|
|
4310
|
+
else if (this.points[l].x >= this.destLeft + (this.destWidth / 2)) {
|
|
4311
|
+
this.points[l].x = this.destLeft + (this.destLeft + this.destWidth - this.points[l].x);
|
|
4221
4312
|
}
|
|
4222
|
-
this.
|
|
4313
|
+
this.points[l].ratioX = (this.points[l].x - this.destLeft) / this.destWidth;
|
|
4314
|
+
this.points[l].ratioY = (this.points[l].y - this.destTop) / this.destHeight;
|
|
4223
4315
|
}
|
|
4316
|
+
this.pointColl[n].shapeFlip = this.currFlipState;
|
|
4224
4317
|
}
|
|
4225
4318
|
}
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
else if (this.points[l].y >= this.destTop + (this.destHeight / 2)) {
|
|
4237
|
-
this.points[l].y = this.destTop + (this.destTop + this.destHeight - this.points[l].y);
|
|
4238
|
-
}
|
|
4239
|
-
this.points[l].ratioX = (this.points[l].x - this.destLeft) / this.destWidth;
|
|
4240
|
-
this.points[l].ratioY = (this.points[l].y - this.destTop) / this.destHeight;
|
|
4319
|
+
}
|
|
4320
|
+
pointsVerticalFlip() {
|
|
4321
|
+
for (let n = 0; n < this.freehandCounter; n++) {
|
|
4322
|
+
if (this.pointColl[n].shapeFlip !== this.currFlipState) {
|
|
4323
|
+
this.points = extend([], this.pointColl[n].points, []);
|
|
4324
|
+
this.pointCounter = 0;
|
|
4325
|
+
const len = this.points.length;
|
|
4326
|
+
for (let l = 0; l < len; l++) {
|
|
4327
|
+
if (this.points[l].y <= this.destTop + (this.destHeight / 2)) {
|
|
4328
|
+
this.points[l].y = (this.destTop + this.destHeight) - (this.points[l].y - this.destTop);
|
|
4241
4329
|
}
|
|
4242
|
-
this.
|
|
4330
|
+
else if (this.points[l].y >= this.destTop + (this.destHeight / 2)) {
|
|
4331
|
+
this.points[l].y = this.destTop + (this.destTop + this.destHeight - this.points[l].y);
|
|
4332
|
+
}
|
|
4333
|
+
this.points[l].ratioX = (this.points[l].x - this.destLeft) / this.destWidth;
|
|
4334
|
+
this.points[l].ratioY = (this.points[l].y - this.destTop) / this.destHeight;
|
|
4243
4335
|
}
|
|
4336
|
+
this.pointColl[n].shapeFlip = this.currFlipState;
|
|
4337
|
+
}
|
|
4338
|
+
}
|
|
4339
|
+
}
|
|
4340
|
+
flipFreehandrawColl(value) {
|
|
4341
|
+
if (value.toLowerCase() === 'horizontal') {
|
|
4342
|
+
this.pointsHorizontalFlip();
|
|
4343
|
+
}
|
|
4344
|
+
else if (value.toLowerCase() === 'vertical') {
|
|
4345
|
+
this.pointsVerticalFlip();
|
|
4346
|
+
}
|
|
4347
|
+
else {
|
|
4348
|
+
this.pointsHorizontalFlip();
|
|
4349
|
+
for (let i = 0; i < this.freehandCounter; i++) {
|
|
4350
|
+
this.pointColl[i].shapeFlip = '';
|
|
4244
4351
|
}
|
|
4352
|
+
this.pointsVerticalFlip();
|
|
4245
4353
|
}
|
|
4246
4354
|
}
|
|
4247
4355
|
rotateFreehandDrawColl() {
|
|
@@ -4265,7 +4373,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
4265
4373
|
}
|
|
4266
4374
|
}
|
|
4267
4375
|
}
|
|
4268
|
-
zoomFreehandDrawColl() {
|
|
4376
|
+
zoomFreehandDrawColl(isPreventApply) {
|
|
4269
4377
|
for (let n = 0; n < this.freehandCounter; n++) {
|
|
4270
4378
|
this.points = extend([], this.pointColl[n].points, []);
|
|
4271
4379
|
this.pointCounter = 0;
|
|
@@ -4275,7 +4383,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
4275
4383
|
this.points[l].y = this.zoomY(this.points[l].ratioY);
|
|
4276
4384
|
}
|
|
4277
4385
|
}
|
|
4278
|
-
|
|
4386
|
+
if (isNullOrUndefined(isPreventApply)) {
|
|
4387
|
+
this.freehandRedraw(this.lowerContext);
|
|
4388
|
+
}
|
|
4279
4389
|
}
|
|
4280
4390
|
zoomX(x) {
|
|
4281
4391
|
return (x * this.destWidth) + this.destLeft;
|
|
@@ -4444,170 +4554,154 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
4444
4554
|
}
|
|
4445
4555
|
updateCropObj() {
|
|
4446
4556
|
this.afterCropActions = [];
|
|
4447
|
-
|
|
4448
|
-
this.cropObj
|
|
4449
|
-
this.cropObj.totalPannedPoint = extend({}, this.totalPannedPoint, {}, true);
|
|
4450
|
-
this.cropObj.totalPannedClientPoint = extend({}, this.totalPannedClientPoint, {}, true);
|
|
4451
|
-
this.cropObj.totalPannedInternalPoint = extend({}, this.totalPannedInternalPoint, {}, true);
|
|
4452
|
-
this.cropObj.activeObj = extend({}, this.activeObj, {}, true);
|
|
4453
|
-
this.cropObj.rotateFlipColl = extend([], this.rotateFlipColl, [], true);
|
|
4454
|
-
this.cropObj.degree = this.degree;
|
|
4455
|
-
this.cropObj.currFlipState = this.currFlipState;
|
|
4456
|
-
this.cropObj.destPoints = { startX: this.destLeft, startY: this.destTop, endX: 0, endY: 0,
|
|
4457
|
-
width: this.destWidth, height: this.destHeight };
|
|
4458
|
-
this.cropObj.srcPoints = { startX: this.srcLeft, startY: this.srcTop, endX: 0, endY: 0,
|
|
4459
|
-
width: this.srcWidth, height: this.srcHeight };
|
|
4557
|
+
const obj = this.getCurrentObj();
|
|
4558
|
+
this.cropObj = extend({}, obj, {}, true);
|
|
4460
4559
|
}
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
this.
|
|
4465
|
-
this.
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
this.
|
|
4478
|
-
this.
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4560
|
+
setCurrentObj(obj) {
|
|
4561
|
+
const isObj = obj ? true : false;
|
|
4562
|
+
obj = obj ? obj : this.cropObj;
|
|
4563
|
+
this.cropZoomFactor = obj.cropZoom;
|
|
4564
|
+
this.defaultZoomFactor = obj.defaultZoom;
|
|
4565
|
+
if (!isObj) {
|
|
4566
|
+
this.zoomFactor = obj.cropZoom;
|
|
4567
|
+
}
|
|
4568
|
+
else {
|
|
4569
|
+
if (!isNullOrUndefined(obj.activeObj.shape) && obj.activeObj.shape.split('-')[0] === 'crop') {
|
|
4570
|
+
this.zoomFactor = obj.cropZoom;
|
|
4571
|
+
}
|
|
4572
|
+
else {
|
|
4573
|
+
this.zoomFactor = obj.defaultZoom;
|
|
4574
|
+
}
|
|
4575
|
+
}
|
|
4576
|
+
this.totalPannedPoint = extend({}, obj.totalPannedPoint, {}, true);
|
|
4577
|
+
this.totalPannedClientPoint = extend({}, obj.totalPannedClientPoint, {}, true);
|
|
4578
|
+
this.totalPannedInternalPoint = extend({}, obj.totalPannedInternalPoint, {}, true);
|
|
4579
|
+
this.tempFlipPanPoint = extend({}, obj.tempFlipPanPoint, {}, true);
|
|
4580
|
+
this.rotateFlipColl = extend([], obj.rotateFlipColl, [], true);
|
|
4581
|
+
this.degree = obj.degree;
|
|
4582
|
+
this.currFlipState = obj.currFlipState;
|
|
4583
|
+
this.destLeft = obj.destPoints.startX;
|
|
4584
|
+
this.destTop = obj.destPoints.startY;
|
|
4585
|
+
this.destWidth = obj.destPoints.width;
|
|
4586
|
+
this.destHeight = obj.destPoints.height;
|
|
4587
|
+
this.srcLeft = obj.srcPoints.startX;
|
|
4588
|
+
this.srcTop = obj.srcPoints.startY;
|
|
4589
|
+
this.srcWidth = obj.srcPoints.width;
|
|
4590
|
+
this.srcHeight = obj.srcPoints.height;
|
|
4591
|
+
this.lowerContext.filter = obj.filter;
|
|
4592
|
+
if (this.lowerContext.filter.split(' ').length > 1) {
|
|
4593
|
+
if (this.lowerContext.filter.split(' ')[0].split('(')[1].split(')')[0] === '1') {
|
|
4594
|
+
this.isBrightnessAdjusted = false;
|
|
4595
|
+
}
|
|
4596
|
+
else {
|
|
4597
|
+
this.isBrightnessAdjusted = true;
|
|
4483
4598
|
}
|
|
4599
|
+
}
|
|
4600
|
+
const isCircleCrop = this.isCircleCrop;
|
|
4601
|
+
const currSelectionPoint = extend({}, this.currSelectionPoint, {}, true);
|
|
4602
|
+
this.currSelectionPoint = null;
|
|
4603
|
+
this.isCircleCrop = false;
|
|
4604
|
+
this.drawCropSelectionImage(obj, false);
|
|
4605
|
+
if (this.degree !== 0) {
|
|
4484
4606
|
this.currentPannedPoint = { x: 0, y: 0 };
|
|
4485
4607
|
this.rotatePan();
|
|
4486
4608
|
}
|
|
4487
|
-
this.activeObj = extend({},
|
|
4609
|
+
this.activeObj = extend({}, obj.activeObj, {}, true);
|
|
4488
4610
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
4489
|
-
this.
|
|
4490
|
-
|
|
4611
|
+
if (this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) {
|
|
4612
|
+
this.drawObject('duplicate');
|
|
4613
|
+
}
|
|
4614
|
+
let activeObj = extend({}, obj.activeObj, {}, true);
|
|
4491
4615
|
let isAfterCropAction = false;
|
|
4492
|
-
|
|
4616
|
+
this.afterCropActions = this.alignRotateFlipColl(this.afterCropActions);
|
|
4617
|
+
const afterCropActions = extend([], this.afterCropActions, [], true);
|
|
4618
|
+
if (!isObj && afterCropActions.length > 0) {
|
|
4493
4619
|
isAfterCropAction = true;
|
|
4494
|
-
|
|
4495
|
-
const pointColl = extend([], this.pointColl, {}, true);
|
|
4496
|
-
const freehandCounter = this.freehandCounter;
|
|
4497
|
-
this.objColl = [];
|
|
4498
|
-
this.pointColl = [];
|
|
4499
|
-
this.freehandCounter = 0;
|
|
4500
|
-
const isCircleCrop = this.isCircleCrop;
|
|
4501
|
-
const currSelectionPoint = extend({}, this.currSelectionPoint, {}, true);
|
|
4502
|
-
this.currSelectionPoint = null;
|
|
4503
|
-
this.isCircleCrop = false;
|
|
4504
|
-
let isFlip = false;
|
|
4505
|
-
for (let i = 0; i < this.afterCropActions.length; i++) {
|
|
4620
|
+
for (let i = 0; i < afterCropActions.length; i++) {
|
|
4506
4621
|
if (this.degree % 90 === 0 && this.degree % 180 !== 0 &&
|
|
4507
|
-
(
|
|
4622
|
+
(afterCropActions[i] === 'horizontalflip' || afterCropActions[i] === 'verticalflip')) {
|
|
4508
4623
|
this.rotatedFlipCropSelection = true;
|
|
4509
4624
|
}
|
|
4510
|
-
this.updateTransform(
|
|
4511
|
-
if (
|
|
4512
|
-
if (
|
|
4513
|
-
this.
|
|
4514
|
-
this.
|
|
4625
|
+
this.updateTransform(afterCropActions[i]);
|
|
4626
|
+
if (afterCropActions[i] === 'horizontalflip' || afterCropActions[i] === 'verticalflip') {
|
|
4627
|
+
if (afterCropActions.length === 1) {
|
|
4628
|
+
this.activeObj = extend({}, this.cropObj.activeObj, {}, true);
|
|
4629
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
4630
|
+
this.drawObject('duplicate');
|
|
4515
4631
|
}
|
|
4516
|
-
isFlip = true;
|
|
4517
4632
|
}
|
|
4518
4633
|
}
|
|
4519
|
-
this.isCircleCrop = isCircleCrop;
|
|
4520
|
-
this.currSelectionPoint = currSelectionPoint;
|
|
4521
|
-
const destPoints = { startX: this.destLeft, startY: this.destTop, width: this.destWidth, height: this.destHeight };
|
|
4522
4634
|
activeObj = extend({}, this.activeObj, {}, true);
|
|
4523
|
-
this.refreshActiveObj();
|
|
4524
|
-
this.objColl = objColl;
|
|
4525
|
-
this.pointColl = pointColl;
|
|
4526
|
-
this.freehandCounter = freehandCounter;
|
|
4527
|
-
if (this.rotateFlipColl.length > 1 && typeof (this.rotateFlipColl[this.rotateFlipColl.length - 1]) === 'string') {
|
|
4528
|
-
this.iterateObjColl();
|
|
4529
|
-
this.freehandRedraw(this.lowerContext);
|
|
4530
|
-
}
|
|
4531
|
-
else if (this.rotateFlipColl.length > 1 && typeof (this.rotateFlipColl[this.rotateFlipColl.length - 1]) === 'number' ||
|
|
4532
|
-
this.rotateFlipColl.length >= 0) {
|
|
4533
|
-
this.destLeft = activeObj.activePoint.startX;
|
|
4534
|
-
this.destTop = activeObj.activePoint.startY;
|
|
4535
|
-
this.destWidth = activeObj.activePoint.width;
|
|
4536
|
-
this.destHeight = activeObj.activePoint.height;
|
|
4537
|
-
this.zoomObjColl();
|
|
4538
|
-
this.zoomFreehandDrawColl();
|
|
4539
|
-
}
|
|
4540
|
-
this.destLeft = destPoints.startX;
|
|
4541
|
-
this.destTop = destPoints.startY;
|
|
4542
|
-
this.destWidth = destPoints.width;
|
|
4543
|
-
this.destHeight = destPoints.height;
|
|
4544
4635
|
this.totalPannedPoint = { x: 0, y: 0 };
|
|
4545
4636
|
this.totalPannedClientPoint = { x: 0, y: 0 };
|
|
4546
4637
|
this.totalPannedInternalPoint = { x: 0, y: 0 };
|
|
4547
4638
|
this.activeObj = activeObj;
|
|
4548
4639
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
4549
|
-
this.
|
|
4550
|
-
|
|
4640
|
+
if (this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) {
|
|
4641
|
+
this.drawObject('duplicate');
|
|
4642
|
+
}
|
|
4643
|
+
if (obj.degree !== this.degree) {
|
|
4551
4644
|
this.cropZoomFactor = this.zoomFactor = 0;
|
|
4552
4645
|
}
|
|
4553
4646
|
this.updateObjAndFreeHandDrawColl();
|
|
4554
|
-
if (isFlip) {
|
|
4555
|
-
if (this.degree === 0) {
|
|
4556
|
-
const currSelectionPoint = extend({}, this.currSelectionPoint, {}, true);
|
|
4557
|
-
this.currSelectionPoint = null;
|
|
4558
|
-
this.isCircleCrop = false;
|
|
4559
|
-
this.drawPannImage({ x: 0, y: 0 }, this.getCurrentPanRegion());
|
|
4560
|
-
this.updateFlipPan(activeObj);
|
|
4561
|
-
this.isCircleCrop = isCircleCrop;
|
|
4562
|
-
this.currSelectionPoint = currSelectionPoint;
|
|
4563
|
-
}
|
|
4564
|
-
this.activeObj = activeObj;
|
|
4565
|
-
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
4566
|
-
this.drawObject('duplicate');
|
|
4567
|
-
}
|
|
4568
4647
|
if (this.rotatedFlipCropSelection) {
|
|
4569
4648
|
// this.totalPannedInternalPoint = extend({}, this.cropObj.totalPannedInternalPoint, {}, true) as Point;
|
|
4570
4649
|
this.rotatedFlipCropSelection = false;
|
|
4571
4650
|
}
|
|
4572
4651
|
}
|
|
4652
|
+
this.afterCropActions = afterCropActions;
|
|
4573
4653
|
if (!this.isCancelAction && !isAfterCropAction) {
|
|
4574
|
-
this.setDestPointsForFlipState();
|
|
4575
4654
|
this.updateObjAndFreeHandDrawColl();
|
|
4576
4655
|
this.zoomFreehandDrawColl();
|
|
4577
|
-
this.destLeft =
|
|
4578
|
-
this.destTop =
|
|
4656
|
+
this.destLeft = obj.destPoints.startX;
|
|
4657
|
+
this.destTop = obj.destPoints.startY;
|
|
4579
4658
|
}
|
|
4580
4659
|
this.activeObj = activeObj;
|
|
4660
|
+
this.isCircleCrop = isCircleCrop;
|
|
4661
|
+
this.currSelectionPoint = currSelectionPoint;
|
|
4581
4662
|
}
|
|
4582
|
-
drawCropSelectionImage() {
|
|
4663
|
+
drawCropSelectionImage(obj, isObj) {
|
|
4583
4664
|
const temp = this.lowerContext.filter;
|
|
4584
4665
|
this.upperContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
4585
4666
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
4586
4667
|
this.reverseTransformedState();
|
|
4587
|
-
|
|
4668
|
+
if (isObj) {
|
|
4669
|
+
this.updateCurrentTransformedState('initial');
|
|
4670
|
+
}
|
|
4671
|
+
else {
|
|
4672
|
+
this.iterateRotateFlipColl(this.lowerContext, 'initial');
|
|
4673
|
+
}
|
|
4674
|
+
this.setDestPointsForFlipState();
|
|
4588
4675
|
this.updateBrightnessFilter();
|
|
4589
4676
|
this.lowerContext.drawImage(this.baseImg, this.srcLeft, this.srcTop, this.srcWidth, this.srcHeight, this.destLeft, this.destTop, this.destWidth, this.destHeight);
|
|
4590
|
-
|
|
4591
|
-
|
|
4677
|
+
if (isObj) {
|
|
4678
|
+
this.updateCurrentTransformedState('reverse');
|
|
4679
|
+
}
|
|
4680
|
+
else {
|
|
4681
|
+
this.iterateRotateFlipColl(this.lowerContext, 'reverse');
|
|
4682
|
+
}
|
|
4683
|
+
this.destLeft = this.cropObj.destPoints.startX;
|
|
4684
|
+
this.destTop = this.cropObj.destPoints.startY;
|
|
4685
|
+
const activeObj = extend({}, obj.activeObj, {}, true);
|
|
4592
4686
|
this.lowerContext.filter = 'none';
|
|
4593
4687
|
if (this.isCancelAction) {
|
|
4594
4688
|
this.zoomObjColl();
|
|
4595
4689
|
this.zoomFreehandDrawColl();
|
|
4596
4690
|
}
|
|
4597
4691
|
else {
|
|
4598
|
-
this.destLeft =
|
|
4599
|
-
this.destTop =
|
|
4600
|
-
this.destWidth =
|
|
4601
|
-
this.destHeight =
|
|
4602
|
-
this.srcLeft =
|
|
4603
|
-
this.srcTop =
|
|
4604
|
-
this.srcWidth =
|
|
4605
|
-
this.srcHeight =
|
|
4692
|
+
this.destLeft = obj.destPoints.startX;
|
|
4693
|
+
this.destTop = obj.destPoints.startY;
|
|
4694
|
+
this.destWidth = obj.destPoints.width;
|
|
4695
|
+
this.destHeight = obj.destPoints.height;
|
|
4696
|
+
this.srcLeft = obj.srcPoints.startX;
|
|
4697
|
+
this.srcTop = obj.srcPoints.startY;
|
|
4698
|
+
this.srcWidth = obj.srcPoints.width;
|
|
4699
|
+
this.srcHeight = obj.srcPoints.height;
|
|
4606
4700
|
const destPoints = { startX: this.destLeft, startY: this.destTop, width: this.destWidth, height: this.destHeight };
|
|
4607
|
-
this.destLeft =
|
|
4608
|
-
this.destTop =
|
|
4609
|
-
this.destWidth =
|
|
4610
|
-
this.destHeight =
|
|
4701
|
+
this.destLeft = obj.activeObj.activePoint.startX;
|
|
4702
|
+
this.destTop = obj.activeObj.activePoint.startY;
|
|
4703
|
+
this.destWidth = obj.activeObj.activePoint.width;
|
|
4704
|
+
this.destHeight = obj.activeObj.activePoint.height;
|
|
4611
4705
|
this.zoomObjColl();
|
|
4612
4706
|
this.zoomFreehandDrawColl();
|
|
4613
4707
|
this.destLeft = destPoints.startX;
|
|
@@ -4624,10 +4718,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
4624
4718
|
}
|
|
4625
4719
|
if (isNullOrUndefined(isRotateCrop) && this.degree !== 0) {
|
|
4626
4720
|
this.updateCropObj();
|
|
4721
|
+
this.currDestinationPoint = { startX: this.destLeft, startY: this.destTop, width: this.destWidth, height: this.destHeight };
|
|
4627
4722
|
this.rotateCrop();
|
|
4628
4723
|
}
|
|
4629
4724
|
else if (isNullOrUndefined(isRotateCrop) && this.currFlipState !== '') {
|
|
4630
4725
|
this.updateCropObj();
|
|
4726
|
+
this.currDestinationPoint = { startX: this.destLeft, startY: this.destTop, width: this.destWidth, height: this.destHeight };
|
|
4631
4727
|
this.flipCrop();
|
|
4632
4728
|
}
|
|
4633
4729
|
else {
|
|
@@ -4637,6 +4733,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
4637
4733
|
this.updateCropObj();
|
|
4638
4734
|
this.resetPanPoints();
|
|
4639
4735
|
this.updateImageRatioForActObj();
|
|
4736
|
+
this.currDestinationPoint = { startX: this.destLeft, startY: this.destTop, width: this.destWidth, height: this.destHeight };
|
|
4640
4737
|
this.currSelectionPoint = extend({}, this.activeObj, {}, true);
|
|
4641
4738
|
this.cropDestPoints = { startX: this.destLeft, startY: this.destTop, width: this.destWidth, height: this.destHeight };
|
|
4642
4739
|
}
|
|
@@ -4826,21 +4923,35 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
4826
4923
|
}
|
|
4827
4924
|
return panRegion;
|
|
4828
4925
|
}
|
|
4829
|
-
drawPannImage(point
|
|
4926
|
+
drawPannImage(point) {
|
|
4927
|
+
const destPoints = { startX: this.destLeft, startY: this.destTop, width: this.destWidth, height: this.destHeight };
|
|
4830
4928
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
4929
|
+
this.updateCurrentTransformedState('initial');
|
|
4930
|
+
this.destLeft = destPoints.startX;
|
|
4931
|
+
this.destTop = destPoints.startY;
|
|
4932
|
+
this.destWidth = destPoints.width;
|
|
4933
|
+
this.destHeight = destPoints.height;
|
|
4934
|
+
this.setDestPointsForFlipState();
|
|
4831
4935
|
this.updateBrightnessFilter();
|
|
4832
4936
|
this.lowerContext.drawImage(this.baseImg, this.srcLeft, this.srcTop, this.srcWidth, this.srcHeight, this.destLeft, this.destTop, this.destWidth, this.destHeight);
|
|
4833
4937
|
if ((!isNullOrUndefined(this.currSelectionPoint) && this.currSelectionPoint.shape === 'crop-circle') || this.isCircleCrop) {
|
|
4834
4938
|
this.cropCircle(this.lowerContext, null, true);
|
|
4835
4939
|
}
|
|
4940
|
+
this.updateCurrentTransformedState('reverse');
|
|
4941
|
+
this.destLeft = destPoints.startX;
|
|
4942
|
+
this.destTop = destPoints.startY;
|
|
4943
|
+
this.destWidth = destPoints.width;
|
|
4944
|
+
this.destHeight = destPoints.height;
|
|
4836
4945
|
this.lowerContext.filter = 'none';
|
|
4837
|
-
this.panObjColl(point.x, point.y,
|
|
4838
|
-
this.panFreehandDrawColl(point.x, point.y,
|
|
4946
|
+
this.panObjColl(point.x, point.y, '');
|
|
4947
|
+
this.panFreehandDrawColl(point.x, point.y, '');
|
|
4839
4948
|
if (this.isCircleCrop) {
|
|
4840
4949
|
this.cropCircle(this.lowerContext, null, true);
|
|
4841
4950
|
}
|
|
4842
4951
|
}
|
|
4843
4952
|
drawPannedImage(xDiff, yDiff) {
|
|
4953
|
+
const panEventArgs = { startPoint: this.panDown, endPoint: this.panMove };
|
|
4954
|
+
this.trigger('panning', panEventArgs);
|
|
4844
4955
|
let isObjCreated = false;
|
|
4845
4956
|
if (isNullOrUndefined(this.activeObj.shape)) {
|
|
4846
4957
|
isObjCreated = true;
|
|
@@ -4865,11 +4976,10 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
4865
4976
|
this.updateActiveObject(this.activeObj.activePoint, this.activeObj);
|
|
4866
4977
|
this.isCropTab = true;
|
|
4867
4978
|
}
|
|
4868
|
-
const panRegion = this.getCurrentPanRegion();
|
|
4869
4979
|
if (this.degree === 0) {
|
|
4870
4980
|
let point;
|
|
4871
4981
|
if (isNullOrUndefined(xDiff) && isNullOrUndefined(yDiff)) {
|
|
4872
|
-
point = this.updatePanPoints(
|
|
4982
|
+
point = this.updatePanPoints('');
|
|
4873
4983
|
}
|
|
4874
4984
|
else {
|
|
4875
4985
|
point = { x: xDiff, y: yDiff };
|
|
@@ -4878,7 +4988,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
4878
4988
|
this.totalPannedPoint.y += point.y;
|
|
4879
4989
|
const tempSelectionObj = extend({}, this.activeObj, {}, true);
|
|
4880
4990
|
const temp = this.lowerContext.filter;
|
|
4881
|
-
this.drawPannImage(point
|
|
4991
|
+
this.drawPannImage(point);
|
|
4882
4992
|
this.lowerContext.filter = temp;
|
|
4883
4993
|
this.tempPanMove = extend({}, this.panMove, {}, true);
|
|
4884
4994
|
this.activeObj = extend({}, tempSelectionObj, {}, true);
|
|
@@ -4886,13 +4996,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
4886
4996
|
if (!isNullOrUndefined(this.activeObj.shape)) {
|
|
4887
4997
|
this.drawObject('duplicate', this.activeObj);
|
|
4888
4998
|
}
|
|
4889
|
-
this.updateFlipPan(tempSelectionObj);
|
|
4890
4999
|
}
|
|
4891
5000
|
else {
|
|
4892
5001
|
const tempFlipState = this.currFlipState;
|
|
4893
5002
|
this.isCropTab = true;
|
|
4894
5003
|
if (isNullOrUndefined(xDiff) && isNullOrUndefined(yDiff)) {
|
|
4895
|
-
this.currentPannedPoint = this.updatePanPoints(
|
|
5004
|
+
this.currentPannedPoint = this.updatePanPoints('');
|
|
4896
5005
|
}
|
|
4897
5006
|
else {
|
|
4898
5007
|
this.currentPannedPoint = { x: xDiff, y: yDiff };
|
|
@@ -4976,45 +5085,23 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
4976
5085
|
const tempFlipColl = this.flipColl;
|
|
4977
5086
|
this.flipColl = [];
|
|
4978
5087
|
this.updateImageRatioForActObj();
|
|
4979
|
-
this.
|
|
5088
|
+
this.objColl.push(this.activeObj);
|
|
5089
|
+
if (this.zoomFactor > 0) {
|
|
5090
|
+
const zoomFactor = this.zoomFactor;
|
|
5091
|
+
const isUndoRedo = this.isUndoRedo;
|
|
5092
|
+
for (let i = 0; i < (zoomFactor * 10); i++) {
|
|
5093
|
+
this.isUndoRedo = true;
|
|
5094
|
+
this.zoom(-0.1);
|
|
5095
|
+
}
|
|
5096
|
+
this.isUndoRedo = isUndoRedo;
|
|
5097
|
+
this.resetPanPoints();
|
|
5098
|
+
}
|
|
5099
|
+
this.currSelectionPoint = extend({}, this.objColl[this.objColl.length - 1], {}, true);
|
|
4980
5100
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
4981
5101
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
4982
5102
|
const temp = this.lowerContext.filter;
|
|
4983
5103
|
this.updateBrightnessFilter();
|
|
4984
|
-
if (!isNullOrUndefined(this.tempPannedPoint) && this.totalPannedPoint.x === 0 && this.totalPannedPoint.y === 0) {
|
|
4985
|
-
this.totalPannedPoint = extend({}, this.tempPannedPoint, {}, true);
|
|
4986
|
-
this.tempPannedPoint = { x: 0, y: 0 };
|
|
4987
|
-
}
|
|
4988
|
-
let isPrevent = true;
|
|
4989
|
-
if (!isNullOrUndefined(this.activeObj.shape) && this.activeObj.shape.split('-')[0] === 'crop' &&
|
|
4990
|
-
this.zoomFactor === 0 && this.cropObj.cropZoom !== 0) {
|
|
4991
|
-
isPrevent = false;
|
|
4992
|
-
}
|
|
4993
|
-
if (this.zoomFactor === 0 && isPrevent) {
|
|
4994
|
-
if (this.totalPannedPoint.x > 0) {
|
|
4995
|
-
this.destLeft -= Math.abs(this.totalPannedPoint.x);
|
|
4996
|
-
}
|
|
4997
|
-
else {
|
|
4998
|
-
this.destLeft += Math.abs(this.totalPannedPoint.x);
|
|
4999
|
-
}
|
|
5000
|
-
if (this.totalPannedPoint.y > 0) {
|
|
5001
|
-
this.destTop -= Math.abs(this.totalPannedPoint.y);
|
|
5002
|
-
}
|
|
5003
|
-
else {
|
|
5004
|
-
this.destTop += Math.abs(this.totalPannedPoint.y);
|
|
5005
|
-
}
|
|
5006
|
-
}
|
|
5007
5104
|
this.lowerContext.drawImage(this.baseImg, this.srcLeft, this.srcTop, this.srcWidth, this.srcHeight, this.destLeft, this.destTop, this.destWidth, this.destHeight);
|
|
5008
|
-
const destLeft = this.destLeft;
|
|
5009
|
-
const destTop = this.destTop;
|
|
5010
|
-
if (this.currFlipState === 'horizontal' && this.zoomFactor > 0 && this.totalPannedPoint.x !== 0) {
|
|
5011
|
-
this.destLeft = destLeft - this.totalPannedPoint.x;
|
|
5012
|
-
}
|
|
5013
|
-
else if (this.currFlipState === 'vertical' && this.zoomFactor > 0 && this.totalPannedPoint.y !== 0) {
|
|
5014
|
-
this.destTop = destTop - this.totalPannedPoint.y;
|
|
5015
|
-
}
|
|
5016
|
-
this.updateImageRatioForActObj();
|
|
5017
|
-
this.objColl.push(this.activeObj);
|
|
5018
5105
|
for (let i = 0; i < this.objColl.length; i++) {
|
|
5019
5106
|
this.objColl[i].shapeFlip = '';
|
|
5020
5107
|
}
|
|
@@ -5022,37 +5109,21 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
5022
5109
|
this.pointColl[i].shapeFlip = '';
|
|
5023
5110
|
}
|
|
5024
5111
|
this.redrawObj(this.getCurrentPanRegion());
|
|
5025
|
-
this.flipFreehandrawColl(this.
|
|
5026
|
-
if (this.zoomFactor === 0 && isPrevent) {
|
|
5027
|
-
if (this.getCurrentPanRegion() === 'horizontal') {
|
|
5028
|
-
this.panObjColl(this.totalPannedPoint.x, -this.totalPannedPoint.y, this.getCurrentPanRegion());
|
|
5029
|
-
this.panFreehandDrawColl(this.totalPannedPoint.x, -this.totalPannedPoint.y, this.getCurrentPanRegion());
|
|
5030
|
-
}
|
|
5031
|
-
else if (this.getCurrentPanRegion() === 'vertical') {
|
|
5032
|
-
this.panObjColl(-this.totalPannedPoint.x, this.totalPannedPoint.y, this.getCurrentPanRegion());
|
|
5033
|
-
this.panFreehandDrawColl(-this.totalPannedPoint.x, this.totalPannedPoint.y, this.getCurrentPanRegion());
|
|
5034
|
-
}
|
|
5035
|
-
else {
|
|
5036
|
-
this.panObjColl(-this.totalPannedPoint.x, -this.totalPannedPoint.y, this.getCurrentPanRegion());
|
|
5037
|
-
this.panFreehandDrawColl(-this.totalPannedPoint.x, -this.totalPannedPoint.y, this.getCurrentPanRegion());
|
|
5038
|
-
}
|
|
5039
|
-
}
|
|
5112
|
+
this.flipFreehandrawColl(this.getCurrentPanRegion());
|
|
5040
5113
|
this.activeObj = extend({}, this.objColl[this.objColl.length - 1], {}, true);
|
|
5041
5114
|
this.objColl.pop();
|
|
5115
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
5042
5116
|
this.drawObject('duplicate');
|
|
5043
|
-
this.destLeft = destLeft;
|
|
5044
|
-
this.destTop = destTop;
|
|
5045
5117
|
this.cropImg(true);
|
|
5046
|
-
this.
|
|
5118
|
+
this.isReverseRotate = true;
|
|
5119
|
+
this.reverseTransformedState();
|
|
5047
5120
|
this.setDestinationPoints();
|
|
5121
|
+
this.currentTransformedState('initial');
|
|
5048
5122
|
this.updateBrightnessFilter();
|
|
5049
5123
|
this.lowerContext.drawImage(this.baseImg, this.srcLeft, this.srcTop, this.srcWidth, this.srcHeight, this.destLeft, this.destTop, this.destWidth, this.destHeight);
|
|
5050
5124
|
this.lowerContext.filter = temp;
|
|
5051
5125
|
this.isRotateZoom = false;
|
|
5052
5126
|
this.updateCurrentTransformedState('reverse');
|
|
5053
|
-
if (tempCurrFlipState === '' && this.currFlipState !== '') {
|
|
5054
|
-
tempCurrFlipState = this.currFlipState;
|
|
5055
|
-
}
|
|
5056
5127
|
this.currFlipState = tempCurrFlipState;
|
|
5057
5128
|
this.flipColl = tempFlipColl;
|
|
5058
5129
|
this.lowerContext.filter = 'none';
|
|
@@ -5063,9 +5134,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
5063
5134
|
this.pointColl[i].shapeFlip = '';
|
|
5064
5135
|
}
|
|
5065
5136
|
this.redrawObj(this.getCurrentPanRegion());
|
|
5066
|
-
this.flipFreehandrawColl(this.
|
|
5067
|
-
this.
|
|
5068
|
-
this.
|
|
5137
|
+
this.flipFreehandrawColl(this.getCurrentPanRegion());
|
|
5138
|
+
this.zoomObjColl();
|
|
5139
|
+
this.zoomFreehandDrawColl();
|
|
5069
5140
|
this.lowerContext.filter = temp;
|
|
5070
5141
|
if ((!isNullOrUndefined(this.currSelectionPoint) && this.currSelectionPoint.shape === 'crop-circle') || this.isCircleCrop) {
|
|
5071
5142
|
this.cropCircle(this.lowerContext);
|
|
@@ -5076,6 +5147,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
5076
5147
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
5077
5148
|
this.isReverseFlip = false;
|
|
5078
5149
|
this.resetPanPoints();
|
|
5150
|
+
this.tempFlipPanPoint = { x: 0, y: 0 };
|
|
5079
5151
|
}
|
|
5080
5152
|
rotateCrop() {
|
|
5081
5153
|
let shape = '';
|
|
@@ -5116,33 +5188,21 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
5116
5188
|
this.rotateObjColl();
|
|
5117
5189
|
this.rotateFreehandDrawColl();
|
|
5118
5190
|
}
|
|
5119
|
-
|
|
5191
|
+
let activeObj = extend({}, this.objColl[this.objColl.length - 1], {}, true);
|
|
5120
5192
|
if (this.currFlipState !== '') {
|
|
5121
|
-
let flipState = '';
|
|
5122
5193
|
for (let i = 0; i < this.objColl.length; i++) {
|
|
5123
5194
|
this.objColl[i].shapeFlip = '';
|
|
5124
5195
|
}
|
|
5125
|
-
if (this.currFlipState === 'horizontal') {
|
|
5126
|
-
flipState = this.degree % 90 === 0 && this.degree % 180 !== 0 ? 'vertical' : 'horizontal';
|
|
5127
|
-
this.redrawObj(flipState);
|
|
5128
|
-
}
|
|
5129
|
-
else if (this.currFlipState === 'vertical') {
|
|
5130
|
-
flipState = this.degree % 90 === 0 && this.degree % 180 !== 0 ? 'horizontal' : 'vertical';
|
|
5131
|
-
this.redrawObj(flipState);
|
|
5132
|
-
}
|
|
5133
5196
|
for (let i = 0; i < this.freehandCounter; i++) {
|
|
5134
5197
|
this.pointColl[i].shapeFlip = '';
|
|
5135
5198
|
}
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
}
|
|
5140
|
-
else if (this.currFlipState === 'vertical') {
|
|
5141
|
-
flipState = this.degree % 90 === 0 && this.degree % 180 !== 0 ? 'horizontal' : 'vertical';
|
|
5142
|
-
this.flipFreehandrawColl(flipState);
|
|
5143
|
-
}
|
|
5199
|
+
let flipState = this.getCurrentCropState('initial');
|
|
5200
|
+
this.redrawObj(flipState);
|
|
5201
|
+
this.flipFreehandrawColl(flipState);
|
|
5144
5202
|
}
|
|
5203
|
+
this.zoomObjColl();
|
|
5145
5204
|
this.zoomFreehandDrawColl();
|
|
5205
|
+
activeObj = extend({}, this.objColl[this.objColl.length - 1], {}, true);
|
|
5146
5206
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
5147
5207
|
this.drawObject('duplicate', activeObj);
|
|
5148
5208
|
this.objColl.pop();
|
|
@@ -5171,25 +5231,16 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
5171
5231
|
this.rotateObjColl();
|
|
5172
5232
|
this.rotateFreehandDrawColl();
|
|
5173
5233
|
}
|
|
5174
|
-
if (this.
|
|
5234
|
+
if (this.getCurrentPanRegion() !== '') {
|
|
5175
5235
|
for (let i = 0; i < this.objColl.length; i++) {
|
|
5176
5236
|
this.objColl[i].shapeFlip = '';
|
|
5177
5237
|
}
|
|
5178
|
-
if (this.currFlipState === 'horizontal') {
|
|
5179
|
-
this.redrawObj('horizontal');
|
|
5180
|
-
}
|
|
5181
|
-
else if (this.currFlipState === 'vertical') {
|
|
5182
|
-
this.redrawObj('vertical');
|
|
5183
|
-
}
|
|
5184
5238
|
for (let i = 0; i < this.freehandCounter; i++) {
|
|
5185
5239
|
this.pointColl[i].shapeFlip = '';
|
|
5186
5240
|
}
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
else if (this.currFlipState === 'vertical') {
|
|
5191
|
-
this.flipFreehandrawColl('vertical');
|
|
5192
|
-
}
|
|
5241
|
+
let flipState = this.getCurrentCropState('reverse');
|
|
5242
|
+
this.redrawObj(flipState);
|
|
5243
|
+
this.flipFreehandrawColl(flipState);
|
|
5193
5244
|
}
|
|
5194
5245
|
this.isReverseRotate = false;
|
|
5195
5246
|
if (shape === 'crop-circle') {
|
|
@@ -5212,37 +5263,141 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
5212
5263
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
5213
5264
|
this.resetPanPoints();
|
|
5214
5265
|
}
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5266
|
+
getCurrentCropState(type, isAllowInvert) {
|
|
5267
|
+
let flipState = '';
|
|
5268
|
+
let state = [];
|
|
5269
|
+
if (type === 'initial') {
|
|
5270
|
+
if (this.degree === 180 || this.degree === -180) {
|
|
5271
|
+
flipState = this.flipColl.length > 1 ? this.getCurrentPanRegion() : this.currFlipState;
|
|
5220
5272
|
}
|
|
5221
|
-
else
|
|
5222
|
-
|
|
5223
|
-
|
|
5273
|
+
else {
|
|
5274
|
+
for (let i = 0; i < this.rotateFlipColl.length; i++) {
|
|
5275
|
+
if (typeof (this.rotateFlipColl[i]) === 'number') {
|
|
5276
|
+
state.push('number');
|
|
5277
|
+
}
|
|
5278
|
+
else if (typeof (this.rotateFlipColl[i]) === 'string') {
|
|
5279
|
+
state.push('string');
|
|
5280
|
+
}
|
|
5281
|
+
}
|
|
5282
|
+
if (state.length > 1 && state[state.length - 1] === 'string' && state[state.length - 2] === 'number') {
|
|
5283
|
+
if (this.currFlipState === 'horizontal') {
|
|
5284
|
+
flipState = 'vertical';
|
|
5285
|
+
}
|
|
5286
|
+
else if (this.currFlipState === 'vertical') {
|
|
5287
|
+
flipState = 'horizontal';
|
|
5288
|
+
}
|
|
5289
|
+
}
|
|
5290
|
+
else if (state.length > 1 && state[state.length - 1] === 'number' && state[state.length - 2] === 'string') {
|
|
5291
|
+
flipState = this.flipColl.length > 1 ? this.getCurrentPanRegion() : this.currFlipState;
|
|
5292
|
+
}
|
|
5224
5293
|
}
|
|
5225
5294
|
}
|
|
5226
5295
|
else {
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
this.
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5296
|
+
flipState = this.getCurrentPanRegion();
|
|
5297
|
+
if (isAllowInvert || !this.isInitialRotate()) {
|
|
5298
|
+
if (this.degree === -90 || this.degree === -270) {
|
|
5299
|
+
if (flipState === 'horizontal') {
|
|
5300
|
+
flipState = 'vertical';
|
|
5301
|
+
}
|
|
5302
|
+
else if (flipState === 'vertical') {
|
|
5303
|
+
flipState = 'horizontal';
|
|
5304
|
+
}
|
|
5305
|
+
}
|
|
5234
5306
|
}
|
|
5235
5307
|
}
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
this.isReverseRotate = true;
|
|
5239
|
-
const tempDegree = this.degree;
|
|
5240
|
-
let rotatePanActiveObj;
|
|
5241
|
-
if (!isNullOrUndefined(this.activeObj.activePoint) && !isNullOrUndefined(this.activeObj.shape)) {
|
|
5242
|
-
rotatePanActiveObj = extend({}, this.activeObj, {}, true);
|
|
5308
|
+
if (flipState === '') {
|
|
5309
|
+
flipState = this.flipColl.length > 1 ? this.getCurrentPanRegion() : this.currFlipState;
|
|
5243
5310
|
}
|
|
5244
|
-
|
|
5311
|
+
return flipState;
|
|
5312
|
+
}
|
|
5313
|
+
isInitialRotate() {
|
|
5314
|
+
let isRotate = false;
|
|
5315
|
+
if (this.rotateFlipColl.length > 0 && typeof (this.rotateFlipColl[0]) === 'number') {
|
|
5316
|
+
isRotate = true;
|
|
5317
|
+
}
|
|
5318
|
+
return isRotate;
|
|
5319
|
+
}
|
|
5320
|
+
updateRotatePanPoints() {
|
|
5321
|
+
let panRegion = '';
|
|
5322
|
+
if (this.isInitialRotate() && this.degree < 0) {
|
|
5323
|
+
panRegion = this.getCurrentCropState('reverse', true);
|
|
5324
|
+
}
|
|
5325
|
+
else {
|
|
5326
|
+
panRegion = this.getCurrentPanRegion();
|
|
5327
|
+
}
|
|
5328
|
+
if (this.degree % 90 === 0 && this.degree % 180 !== 0) {
|
|
5329
|
+
if (this.degree === 90 || (this.degree === -90 && (panRegion === 'horizontal' || panRegion === 'vertical'))
|
|
5330
|
+
|| (this.degree === -270 && (panRegion === '' || panRegion === 'verticalHorizontal' || panRegion === 'horizontalVertical'))) {
|
|
5331
|
+
if (panRegion === '') {
|
|
5332
|
+
this.destLeft += this.currentPannedPoint.y;
|
|
5333
|
+
this.destTop -= this.currentPannedPoint.x;
|
|
5334
|
+
}
|
|
5335
|
+
else if (panRegion === 'horizontal') {
|
|
5336
|
+
this.destLeft += this.currentPannedPoint.y;
|
|
5337
|
+
this.destTop += this.currentPannedPoint.x;
|
|
5338
|
+
}
|
|
5339
|
+
else if (panRegion === 'vertical') {
|
|
5340
|
+
this.destLeft -= this.currentPannedPoint.y;
|
|
5341
|
+
this.destTop -= this.currentPannedPoint.x;
|
|
5342
|
+
}
|
|
5343
|
+
else {
|
|
5344
|
+
this.destLeft -= this.currentPannedPoint.y;
|
|
5345
|
+
this.destTop += this.currentPannedPoint.x;
|
|
5346
|
+
}
|
|
5347
|
+
}
|
|
5348
|
+
else if (this.degree === 270 || (this.degree === -270 && (panRegion === 'horizontal' || panRegion === 'vertical'))
|
|
5349
|
+
|| (this.degree === -90 && (panRegion === '' || panRegion === 'verticalHorizontal' || panRegion === 'horizontalVertical'))) {
|
|
5350
|
+
if (panRegion === '') {
|
|
5351
|
+
this.destLeft -= this.currentPannedPoint.y;
|
|
5352
|
+
this.destTop += this.currentPannedPoint.x;
|
|
5353
|
+
}
|
|
5354
|
+
else if (panRegion === 'horizontal') {
|
|
5355
|
+
this.destLeft -= this.currentPannedPoint.y;
|
|
5356
|
+
this.destTop -= this.currentPannedPoint.x;
|
|
5357
|
+
}
|
|
5358
|
+
else if (panRegion === 'vertical') {
|
|
5359
|
+
this.destLeft += this.currentPannedPoint.y;
|
|
5360
|
+
this.destTop += this.currentPannedPoint.x;
|
|
5361
|
+
}
|
|
5362
|
+
else {
|
|
5363
|
+
this.destLeft += this.currentPannedPoint.y;
|
|
5364
|
+
this.destTop -= this.currentPannedPoint.x;
|
|
5365
|
+
}
|
|
5366
|
+
}
|
|
5367
|
+
}
|
|
5368
|
+
else {
|
|
5369
|
+
if (this.degree === 180 || this.degree === -180) {
|
|
5370
|
+
if (panRegion === '') {
|
|
5371
|
+
this.destLeft -= this.currentPannedPoint.x;
|
|
5372
|
+
this.destTop -= this.currentPannedPoint.y;
|
|
5373
|
+
}
|
|
5374
|
+
else if (panRegion === 'horizontal') {
|
|
5375
|
+
this.destLeft += this.currentPannedPoint.x;
|
|
5376
|
+
this.destTop -= this.currentPannedPoint.y;
|
|
5377
|
+
}
|
|
5378
|
+
else if (panRegion === 'vertical') {
|
|
5379
|
+
this.destLeft -= this.currentPannedPoint.x;
|
|
5380
|
+
this.destTop += this.currentPannedPoint.y;
|
|
5381
|
+
}
|
|
5382
|
+
else {
|
|
5383
|
+
this.destLeft += this.currentPannedPoint.x;
|
|
5384
|
+
this.destTop += this.currentPannedPoint.y;
|
|
5385
|
+
}
|
|
5386
|
+
}
|
|
5387
|
+
}
|
|
5388
|
+
}
|
|
5389
|
+
rotatePan(isCropSelection, isDefaultZoom) {
|
|
5390
|
+
this.isReverseRotate = true;
|
|
5391
|
+
const tempDegree = this.degree;
|
|
5392
|
+
let rotatePanActiveObj;
|
|
5393
|
+
if (!isNullOrUndefined(this.activeObj.activePoint) && !isNullOrUndefined(this.activeObj.shape)) {
|
|
5394
|
+
rotatePanActiveObj = extend({}, this.activeObj, {}, true);
|
|
5395
|
+
}
|
|
5396
|
+
const tempObjColl = extend([], this.objColl, [], true);
|
|
5397
|
+
const tempPointColl = extend([], this.pointColl, [], true);
|
|
5245
5398
|
this.objColl = [];
|
|
5399
|
+
this.pointColl = [];
|
|
5400
|
+
this.freehandCounter = 0;
|
|
5246
5401
|
this.refreshActiveObj();
|
|
5247
5402
|
this.isRotateZoom = true;
|
|
5248
5403
|
this.updateCurrentTransformedState('initial');
|
|
@@ -5271,15 +5426,25 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
5271
5426
|
this.totalPannedClientPoint.x = this.destLeft - destLeft;
|
|
5272
5427
|
this.totalPannedClientPoint.y = this.destTop - destTop;
|
|
5273
5428
|
this.objColl = tempObjColl;
|
|
5429
|
+
this.pointColl = tempPointColl;
|
|
5430
|
+
this.freehandCounter = this.pointColl.length;
|
|
5274
5431
|
this.degree = tempDegree;
|
|
5275
|
-
this.objColl = extend([], tempObjColl, [], true);
|
|
5276
5432
|
this.lowerContext.filter = 'none';
|
|
5277
|
-
const panRegion = this.getCurrentPanRegion();
|
|
5278
5433
|
if (isCropSelection) {
|
|
5279
|
-
|
|
5434
|
+
if (isDefaultZoom) {
|
|
5435
|
+
this.totalPannedClientPoint.x = -this.totalPannedClientPoint.x;
|
|
5436
|
+
this.totalPannedClientPoint.y = -this.totalPannedClientPoint.y;
|
|
5437
|
+
this.currentPannedPoint = extend({}, this.totalPannedClientPoint, {}, true);
|
|
5438
|
+
this.totalPannedClientPoint = { x: 0, y: 0 };
|
|
5439
|
+
this.destLeft += this.currentPannedPoint.x;
|
|
5440
|
+
this.destTop += this.currentPannedPoint.y;
|
|
5441
|
+
}
|
|
5442
|
+
else {
|
|
5443
|
+
this.currentPannedPoint = extend({}, this.totalPannedClientPoint, {}, true);
|
|
5444
|
+
}
|
|
5280
5445
|
}
|
|
5281
|
-
this.panObjColl(this.currentPannedPoint.x, this.currentPannedPoint.y,
|
|
5282
|
-
this.panFreehandDrawColl(this.currentPannedPoint.x, this.currentPannedPoint.y,
|
|
5446
|
+
this.panObjColl(this.currentPannedPoint.x, this.currentPannedPoint.y, '');
|
|
5447
|
+
this.panFreehandDrawColl(this.currentPannedPoint.x, this.currentPannedPoint.y, '');
|
|
5283
5448
|
this.lowerContext.filter = temp;
|
|
5284
5449
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
5285
5450
|
this.activeObj = extend({}, rotatePanActiveObj, {}, true);
|
|
@@ -5327,7 +5492,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
5327
5492
|
this.zoomFactor += value;
|
|
5328
5493
|
}
|
|
5329
5494
|
if (this.isCropTab) {
|
|
5330
|
-
this.cropZoomFactor
|
|
5495
|
+
this.cropZoomFactor = this.zoomFactor;
|
|
5331
5496
|
}
|
|
5332
5497
|
else {
|
|
5333
5498
|
this.defaultZoomFactor = this.zoomFactor;
|
|
@@ -5346,8 +5511,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
5346
5511
|
this.drawImgToCanvas(maxDimension);
|
|
5347
5512
|
}
|
|
5348
5513
|
cropZoom(value, selectionObj) {
|
|
5349
|
-
|
|
5350
|
-
|
|
5514
|
+
let destLeft = this.destLeft;
|
|
5515
|
+
let destTop = this.destTop;
|
|
5351
5516
|
let maxDimension = { width: 0, height: 0 };
|
|
5352
5517
|
if (this.srcLeft === 0 || this.srcTop === 0) {
|
|
5353
5518
|
if (isNullOrUndefined(selectionObj)) {
|
|
@@ -5369,18 +5534,32 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
5369
5534
|
}
|
|
5370
5535
|
this.destLeft = destLeft - ((maxDimension.width - this.destWidth) / 2);
|
|
5371
5536
|
this.destTop = destTop - ((maxDimension.height - this.destHeight) / 2);
|
|
5537
|
+
destLeft = this.destLeft;
|
|
5538
|
+
destTop = this.destTop;
|
|
5372
5539
|
if (!isNullOrUndefined(selectionObj)) {
|
|
5373
5540
|
if (this.destLeft > selectionObj.activePoint.startX) {
|
|
5374
5541
|
this.destLeft = selectionObj.activePoint.startX;
|
|
5542
|
+
if (this.degree === 0) {
|
|
5543
|
+
this.totalPannedPoint.x -= (destLeft - this.destLeft);
|
|
5544
|
+
}
|
|
5375
5545
|
}
|
|
5376
5546
|
if (this.destTop > selectionObj.activePoint.startY) {
|
|
5377
5547
|
this.destTop = selectionObj.activePoint.startY;
|
|
5548
|
+
if (this.degree === 0) {
|
|
5549
|
+
this.totalPannedPoint.y -= (destTop - this.destTop);
|
|
5550
|
+
}
|
|
5378
5551
|
}
|
|
5379
5552
|
if (this.destLeft + maxDimension.width < selectionObj.activePoint.endX) {
|
|
5380
5553
|
this.destLeft = selectionObj.activePoint.endX - maxDimension.width;
|
|
5554
|
+
if (this.degree === 0) {
|
|
5555
|
+
this.totalPannedPoint.x -= (destLeft - this.destLeft);
|
|
5556
|
+
}
|
|
5381
5557
|
}
|
|
5382
5558
|
if (this.destTop + maxDimension.height < selectionObj.activePoint.endY) {
|
|
5383
5559
|
this.destTop = selectionObj.activePoint.endY - maxDimension.height;
|
|
5560
|
+
if (this.degree === 0) {
|
|
5561
|
+
this.totalPannedPoint.y -= (destTop - this.destTop);
|
|
5562
|
+
}
|
|
5384
5563
|
}
|
|
5385
5564
|
}
|
|
5386
5565
|
return maxDimension;
|
|
@@ -5601,11 +5780,44 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
5601
5780
|
this.degree = 0;
|
|
5602
5781
|
}
|
|
5603
5782
|
}
|
|
5604
|
-
|
|
5605
|
-
|
|
5783
|
+
getCurrentObj() {
|
|
5784
|
+
const obj = { cropZoom: 0, defaultZoom: 0, totalPannedPoint: { x: 0, y: 0 }, totalPannedClientPoint: { x: 0, y: 0 },
|
|
5785
|
+
totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {},
|
|
5786
|
+
rotateFlipColl: [], degree: 0, currFlipState: '',
|
|
5787
|
+
destPoints: { startX: 0, startY: 0, width: 0, height: 0 },
|
|
5788
|
+
srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '' };
|
|
5789
|
+
obj.cropZoom = this.cropZoomFactor;
|
|
5790
|
+
obj.defaultZoom = this.defaultZoomFactor;
|
|
5791
|
+
obj.totalPannedPoint = extend({}, this.totalPannedPoint, {}, true);
|
|
5792
|
+
obj.totalPannedClientPoint = extend({}, this.totalPannedClientPoint, {}, true);
|
|
5793
|
+
obj.totalPannedInternalPoint = extend({}, this.totalPannedInternalPoint, {}, true);
|
|
5794
|
+
obj.tempFlipPanPoint = extend({}, this.tempFlipPanPoint, {}, true);
|
|
5795
|
+
obj.activeObj = extend({}, this.activeObj, {}, true);
|
|
5796
|
+
obj.rotateFlipColl = extend([], this.rotateFlipColl, [], true);
|
|
5797
|
+
obj.degree = this.degree;
|
|
5798
|
+
obj.currFlipState = this.currFlipState;
|
|
5799
|
+
obj.destPoints = { startX: this.destLeft, startY: this.destTop, endX: 0, endY: 0,
|
|
5800
|
+
width: this.destWidth, height: this.destHeight };
|
|
5801
|
+
obj.srcPoints = { startX: this.srcLeft, startY: this.srcTop, endX: 0, endY: 0,
|
|
5802
|
+
width: this.srcWidth, height: this.srcHeight };
|
|
5803
|
+
obj.filter = this.lowerContext.filter;
|
|
5804
|
+
return obj;
|
|
5805
|
+
}
|
|
5806
|
+
updateUndoRedoColl(operation, previousObj, previousObjColl, previousPointColl, previousCropObj, previousText, currentText, previousFilter) {
|
|
5807
|
+
if (!this.isInitialLoading && this.allowUndoRedo) {
|
|
5808
|
+
if (this.currObjType.isUndoAction) {
|
|
5809
|
+
this.refreshUndoRedoColl();
|
|
5810
|
+
}
|
|
5606
5811
|
this.undoRedoStep++;
|
|
5607
|
-
this.
|
|
5608
|
-
|
|
5812
|
+
const currentObj = this.getCurrentObj();
|
|
5813
|
+
currentObj.objColl = extend([], this.objColl, [], true);
|
|
5814
|
+
currentObj.pointColl = extend([], this.pointColl, [], true);
|
|
5815
|
+
currentObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
5816
|
+
this.undoRedoColl.push({ operation: operation, previousObj: previousObj, currentObj: currentObj,
|
|
5817
|
+
previousObjColl: previousObjColl, currentObjColl: currentObj.objColl,
|
|
5818
|
+
previousPointColl: previousPointColl, currentPointColl: currentObj.pointColl,
|
|
5819
|
+
previousCropObj: previousCropObj, currentCropObj: extend({}, this.cropObj, {}, true),
|
|
5820
|
+
previousText: previousText, currentText: currentText, filter: previousFilter });
|
|
5609
5821
|
if (this.undoRedoColl.length > 16) {
|
|
5610
5822
|
this.undoRedoColl.splice(0, 1);
|
|
5611
5823
|
this.undoRedoStep--;
|
|
@@ -5880,6 +6092,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
5880
6092
|
}
|
|
5881
6093
|
this.freehandDrawSelectedIndex = this.freehandDrawHoveredIndex;
|
|
5882
6094
|
this.pointColl[this.freehandDrawSelectedIndex].isSelected = true;
|
|
6095
|
+
this.freehandDrawSelectedId = this.pointColl[this.freehandDrawSelectedIndex].id;
|
|
5883
6096
|
if (this.pointColl[this.freehandDrawHoveredIndex].strokeColor !== '#42a5f5') {
|
|
5884
6097
|
this.tempFreeHandDrawEditingStyles.strokeColor = this.pointColl[this.freehandDrawHoveredIndex].strokeColor;
|
|
5885
6098
|
}
|
|
@@ -6172,15 +6385,16 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
6172
6385
|
}
|
|
6173
6386
|
if (e.currentTarget === this.upperCanvas) {
|
|
6174
6387
|
this.currObjType.shape = this.currObjType.shape.toLowerCase();
|
|
6175
|
-
|
|
6388
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
6389
|
+
const prevObj = this.getCurrentObj();
|
|
6390
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
6391
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
6392
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
6393
|
+
if (!this.togglePen && !isCropSelection) {
|
|
6176
6394
|
if (!isNullOrUndefined(this.tempObjColl) && this.activeObj.activePoint.width !== 0) {
|
|
6177
6395
|
this.objColl.push(this.activeObj);
|
|
6178
6396
|
if (JSON.stringify(this.activeObj.activePoint) !== JSON.stringify(this.tempActiveObj.activePoint)) {
|
|
6179
|
-
this.
|
|
6180
|
-
currentObj: extend([], this.objColl, [], true),
|
|
6181
|
-
previousObj: this.tempObjColl, zoomFactor: this.zoomFactor,
|
|
6182
|
-
sharpen: this.adjustmentLevel.sharpen, bw: this.adjustmentLevel.bw });
|
|
6183
|
-
this.undoRedoStep++;
|
|
6397
|
+
this.updateUndoRedoColl('shapeTransform', prevObj, this.tempObjColl, prevObj.pointColl, prevCropObj);
|
|
6184
6398
|
}
|
|
6185
6399
|
this.redrawShape(this.objColl[this.objColl.length - 1]);
|
|
6186
6400
|
this.tempObjColl = undefined;
|
|
@@ -6191,13 +6405,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
6191
6405
|
}
|
|
6192
6406
|
else if (isCropSelection && !this.togglePen) {
|
|
6193
6407
|
if (JSON.stringify(this.activeObj.activePoint) !== JSON.stringify(this.tempActiveObj.activePoint)) {
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
previousObj: this.objColl, zoomFactor: this.zoomFactor,
|
|
6197
|
-
currentSelectionObj: extend([], this.activeObj, {}, true),
|
|
6198
|
-
previousSelectionObj: extend([], this.tempActiveObj, {}, true),
|
|
6199
|
-
sharpen: this.adjustmentLevel.sharpen, bw: this.adjustmentLevel.bw });
|
|
6200
|
-
this.undoRedoStep++;
|
|
6408
|
+
prevObj.activeObj = extend([], this.tempActiveObj, {}, true);
|
|
6409
|
+
this.updateUndoRedoColl('selectionTransform', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
6201
6410
|
}
|
|
6202
6411
|
}
|
|
6203
6412
|
}
|
|
@@ -6227,27 +6436,34 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
6227
6436
|
e.preventDefault();
|
|
6228
6437
|
e.stopImmediatePropagation();
|
|
6229
6438
|
break;
|
|
6230
|
-
case (e.ctrlKey && 'z'):
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
case (e.ctrlKey && 'y'):
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6439
|
+
// case (e.ctrlKey && 'z'):
|
|
6440
|
+
// if (this.allowUndoRedo) {
|
|
6441
|
+
// this.callUndo();
|
|
6442
|
+
// }
|
|
6443
|
+
// break;
|
|
6444
|
+
// case (e.ctrlKey && 'y'):
|
|
6445
|
+
// if (this.allowUndoRedo) {
|
|
6446
|
+
// this.callRedo();
|
|
6447
|
+
// }
|
|
6448
|
+
// break;
|
|
6240
6449
|
case 'Delete':
|
|
6241
6450
|
if (this.isFreehandDrawEditing) {
|
|
6242
6451
|
this.updateFreehandDrawColorChange();
|
|
6243
|
-
|
|
6244
|
-
const
|
|
6245
|
-
|
|
6246
|
-
|
|
6452
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
6453
|
+
const prevObj = this.getCurrentObj();
|
|
6454
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
6455
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
6456
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
6457
|
+
this.deleteFreehandDraw(parseInt(this.freehandDrawSelectedId.split('_')[1], 10) - 1, true);
|
|
6458
|
+
this.updateUndoRedoColl('deleteFreehandDrawing', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
6247
6459
|
}
|
|
6248
6460
|
else if (this.textArea.style.display === 'none') {
|
|
6249
6461
|
this.objColl.push(this.activeObj);
|
|
6250
|
-
const
|
|
6462
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
6463
|
+
const prevObj = this.getCurrentObj();
|
|
6464
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
6465
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
6466
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
6251
6467
|
this.objColl.pop();
|
|
6252
6468
|
previousShapeSettings = this.updatePreviousShapeSettings();
|
|
6253
6469
|
shapeChangingArgs = { action: 'delete', previousShapeSettings: previousShapeSettings, currentShapeSettings: null };
|
|
@@ -6255,7 +6471,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
6255
6471
|
this.clearSelection();
|
|
6256
6472
|
this.trigger('shapeChanging', shapeChangingArgs);
|
|
6257
6473
|
this.refreshToolbar('main');
|
|
6258
|
-
this.updateUndoRedoColl('
|
|
6474
|
+
this.updateUndoRedoColl('deleteObj', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
6259
6475
|
}
|
|
6260
6476
|
break;
|
|
6261
6477
|
case 'Escape':
|
|
@@ -6310,6 +6526,10 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
6310
6526
|
this.lastPan = { x: this.destLeft, y: this.destTop };
|
|
6311
6527
|
if (isNullOrUndefined(this.tempPanMove)) {
|
|
6312
6528
|
this.tempPanMove = { x: x, y: y };
|
|
6529
|
+
this.panStartObj = this.getCurrentObj();
|
|
6530
|
+
this.panStartObj.objColl = extend([], this.objColl, [], true);
|
|
6531
|
+
this.panStartObj.pointColl = extend([], this.pointColl, [], true);
|
|
6532
|
+
this.panStartObj.afterCropActions = this.afterCropActions;
|
|
6313
6533
|
}
|
|
6314
6534
|
}
|
|
6315
6535
|
canvasMouseMoveHandler(e) {
|
|
@@ -6342,10 +6562,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
6342
6562
|
e.preventDefault();
|
|
6343
6563
|
if (this.togglePan) {
|
|
6344
6564
|
if (this.panDown && this.panMove && this.togglePan && this.dragCanvas) {
|
|
6565
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
6566
|
+
this.updateUndoRedoColl('pan', this.panStartObj, this.panStartObj.objColl, this.panStartObj.pointColl, prevCropObj);
|
|
6345
6567
|
this.panDown = null;
|
|
6346
6568
|
this.panMove = null;
|
|
6347
6569
|
this.tempPanMove = null;
|
|
6348
|
-
this.
|
|
6570
|
+
this.panStartObj = null;
|
|
6349
6571
|
}
|
|
6350
6572
|
}
|
|
6351
6573
|
this.currObjType.isDragging = false;
|
|
@@ -6387,7 +6609,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
6387
6609
|
adjustToScreen() {
|
|
6388
6610
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
6389
6611
|
const proxy = this;
|
|
6390
|
-
if (!this.element.querySelector('#' + this.element.id + '_contextualToolbar')
|
|
6612
|
+
if ((!isNullOrUndefined(this.element.querySelector('#' + this.element.id + '_contextualToolbar')) &&
|
|
6613
|
+
!this.element.querySelector('#' + this.element.id + '_contextualToolbar').parentElement.classList.contains('e-hide')) ||
|
|
6391
6614
|
(!isNullOrUndefined(this.element.querySelector('#' + this.element.id + '_headWrapper'))
|
|
6392
6615
|
&& !this.element.querySelector('#' + this.element.id + '_headWrapper').parentElement.classList.contains('e-hide'))) {
|
|
6393
6616
|
this.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
@@ -6657,7 +6880,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
6657
6880
|
}
|
|
6658
6881
|
updateTextFromTextArea() {
|
|
6659
6882
|
if (this.activeObj.keyHistory !== this.textArea.value) {
|
|
6660
|
-
|
|
6883
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
6884
|
+
const prevObj = this.getCurrentObj();
|
|
6885
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
6886
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
6887
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
6888
|
+
this.updateUndoRedoColl('text', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj, this.activeObj.keyHistory, this.textArea.value);
|
|
6661
6889
|
}
|
|
6662
6890
|
this.activeObj.keyHistory = this.textArea.value;
|
|
6663
6891
|
this.textArea.style.display = 'none';
|
|
@@ -6938,7 +7166,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
6938
7166
|
this.refreshActiveObj();
|
|
6939
7167
|
this.lowerContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
6940
7168
|
this.redrawImgWithObj();
|
|
6941
|
-
//this.zoomFreehandDrawColl();
|
|
6942
7169
|
if ((!isNullOrUndefined(this.currSelectionPoint) && this.currSelectionPoint.shape === 'crop-circle') || this.isCircleCrop) {
|
|
6943
7170
|
this.cropCircle(this.lowerContext);
|
|
6944
7171
|
}
|
|
@@ -8142,6 +8369,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
8142
8369
|
this.activeObj = extend({}, tempObj, {}, true);
|
|
8143
8370
|
}
|
|
8144
8371
|
drawObject(canvas, obj, isCropRatio, points, isPreventDrag, saveContext) {
|
|
8372
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
8145
8373
|
let canvasDraw;
|
|
8146
8374
|
if (canvas.toLowerCase() === 'original') {
|
|
8147
8375
|
canvasDraw = this.lowerContext;
|
|
@@ -9892,28 +10120,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
9892
10120
|
height: this.destHeight / this.objColl[i].activePoint.height };
|
|
9893
10121
|
}
|
|
9894
10122
|
}
|
|
9895
|
-
setTextFontSize(obj) {
|
|
9896
|
-
if (obj.shape === 'text') {
|
|
9897
|
-
const maxText = this.getMaxText(null, obj.keyHistory);
|
|
9898
|
-
let degree;
|
|
9899
|
-
if (obj.shapeDegree === 0) {
|
|
9900
|
-
degree = this.degree;
|
|
9901
|
-
}
|
|
9902
|
-
else {
|
|
9903
|
-
degree = this.degree - obj.shapeDegree;
|
|
9904
|
-
}
|
|
9905
|
-
let multiplier = 2;
|
|
9906
|
-
if (maxText.length === 1) {
|
|
9907
|
-
multiplier = 1;
|
|
9908
|
-
}
|
|
9909
|
-
if (degree === 0 || degree === 180 || degree === -180) {
|
|
9910
|
-
obj.textSettings.fontSize = (obj.activePoint.width / maxText.length) * multiplier;
|
|
9911
|
-
}
|
|
9912
|
-
else {
|
|
9913
|
-
obj.textSettings.fontSize = (obj.activePoint.height / maxText.length) * multiplier;
|
|
9914
|
-
}
|
|
9915
|
-
}
|
|
9916
|
-
}
|
|
9917
10123
|
redrawShape(obj) {
|
|
9918
10124
|
for (let i = 0; i < this.objColl.length; i++) {
|
|
9919
10125
|
if (JSON.stringify(obj) === JSON.stringify(this.objColl[i])) {
|
|
@@ -10114,7 +10320,10 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10114
10320
|
}
|
|
10115
10321
|
this.togglePen = false;
|
|
10116
10322
|
this.redrawActObj();
|
|
10117
|
-
const
|
|
10323
|
+
const prevObj = this.getCurrentObj();
|
|
10324
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
10325
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
10326
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
10118
10327
|
this.keyHistory = '';
|
|
10119
10328
|
this.refreshActiveObj();
|
|
10120
10329
|
this.activeObj.shape = 'text';
|
|
@@ -10178,10 +10387,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10178
10387
|
this.activeObj.textFlip = this.currFlipState;
|
|
10179
10388
|
this.updateFontRatio(this.activeObj);
|
|
10180
10389
|
this.objColl.push(this.activeObj);
|
|
10181
|
-
|
|
10182
|
-
|
|
10183
|
-
sharpen: this.adjustmentLevel.sharpen, bw: this.adjustmentLevel.bw });
|
|
10184
|
-
this.undoRedoStep++;
|
|
10390
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
10391
|
+
this.updateUndoRedoColl('shapeTransform', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10185
10392
|
this.redrawShape(this.objColl[this.objColl.length - 1]);
|
|
10186
10393
|
this.isShapeInserted = true;
|
|
10187
10394
|
this.refreshToolbar('text');
|
|
@@ -10326,6 +10533,43 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10326
10533
|
}
|
|
10327
10534
|
}
|
|
10328
10535
|
this.freehandRedraw(this.lowerContext);
|
|
10536
|
+
this.updateCurrSelectionPoint(degree);
|
|
10537
|
+
}
|
|
10538
|
+
updateCurrSelectionPoint(degree) {
|
|
10539
|
+
if (!isNullOrUndefined(this.currSelectionPoint) && !isNullOrUndefined(this.currDestinationPoint)) {
|
|
10540
|
+
const activeObj = extend({}, this.activeObj, {}, true);
|
|
10541
|
+
const objColl = extend([], this.objColl, [], true);
|
|
10542
|
+
const srcPoints = { startX: this.srcLeft, startY: this.srcTop, width: this.srcWidth, height: this.srcHeight };
|
|
10543
|
+
const destPoints = { startX: this.destLeft, startY: this.destTop, width: this.destWidth, height: this.destHeight };
|
|
10544
|
+
this.objColl = [];
|
|
10545
|
+
this.objColl.push(extend({}, this.currSelectionPoint, {}, true));
|
|
10546
|
+
this.srcLeft = 0;
|
|
10547
|
+
this.srcTop = 0;
|
|
10548
|
+
this.srcWidth = this.baseImg.width;
|
|
10549
|
+
this.srcHeight = this.baseImg.height;
|
|
10550
|
+
this.destLeft = this.currDestinationPoint.startX;
|
|
10551
|
+
this.destTop = this.currDestinationPoint.startY;
|
|
10552
|
+
this.destWidth = this.currDestinationPoint.width;
|
|
10553
|
+
this.destHeight = this.currDestinationPoint.height;
|
|
10554
|
+
if (typeof (degree) === 'number') {
|
|
10555
|
+
this.setDestinationPoints();
|
|
10556
|
+
this.setClientTransformedDimension();
|
|
10557
|
+
}
|
|
10558
|
+
this.objColl[0].shapeFlip = '';
|
|
10559
|
+
this.redrawObj(degree);
|
|
10560
|
+
this.currSelectionPoint = extend({}, this.objColl[0], {}, true);
|
|
10561
|
+
this.currDestinationPoint = { startX: this.destLeft, startY: this.destTop, width: this.destWidth, height: this.destHeight };
|
|
10562
|
+
this.objColl = objColl;
|
|
10563
|
+
this.activeObj = activeObj;
|
|
10564
|
+
this.srcLeft = srcPoints.startX;
|
|
10565
|
+
this.srcTop = srcPoints.startY;
|
|
10566
|
+
this.srcWidth = srcPoints.width;
|
|
10567
|
+
this.srcHeight = srcPoints.height;
|
|
10568
|
+
this.destLeft = destPoints.startX;
|
|
10569
|
+
this.destTop = destPoints.startY;
|
|
10570
|
+
this.destWidth = destPoints.width;
|
|
10571
|
+
this.destHeight = destPoints.height;
|
|
10572
|
+
}
|
|
10329
10573
|
}
|
|
10330
10574
|
setClientTransformedDimension(isPreventDimension) {
|
|
10331
10575
|
if (this.degree % 90 === 0 && this.degree % 180 !== 0) {
|
|
@@ -10342,100 +10586,110 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10342
10586
|
}
|
|
10343
10587
|
}
|
|
10344
10588
|
}
|
|
10345
|
-
popForDefaultTransformedState() {
|
|
10589
|
+
popForDefaultTransformedState(collection) {
|
|
10346
10590
|
let rotateRight = 0;
|
|
10347
10591
|
let rotateleft = 0;
|
|
10348
10592
|
let horizontal = 0;
|
|
10349
10593
|
let vertical = 0;
|
|
10350
|
-
for (let i = 0; i <
|
|
10351
|
-
if (
|
|
10594
|
+
for (let i = 0; i < collection.length; i++) {
|
|
10595
|
+
if (collection[i] === 90 || collection[i] === 'rotateRight') {
|
|
10352
10596
|
rotateRight++;
|
|
10353
10597
|
rotateleft = 0;
|
|
10354
10598
|
horizontal = 0;
|
|
10355
10599
|
vertical = 0;
|
|
10356
10600
|
if (rotateRight === 4) {
|
|
10357
|
-
|
|
10358
|
-
|
|
10359
|
-
|
|
10360
|
-
|
|
10601
|
+
collection.pop();
|
|
10602
|
+
collection.pop();
|
|
10603
|
+
collection.pop();
|
|
10604
|
+
collection.pop();
|
|
10361
10605
|
}
|
|
10362
10606
|
}
|
|
10363
|
-
else if (
|
|
10607
|
+
else if (collection[i] === -90 || collection[i] === 'rotateLeft') {
|
|
10364
10608
|
rotateleft++;
|
|
10365
10609
|
rotateRight = 0;
|
|
10366
10610
|
horizontal = 0;
|
|
10367
10611
|
vertical = 0;
|
|
10368
10612
|
if (rotateleft === 4) {
|
|
10369
|
-
|
|
10370
|
-
|
|
10371
|
-
|
|
10372
|
-
|
|
10613
|
+
collection.pop();
|
|
10614
|
+
collection.pop();
|
|
10615
|
+
collection.pop();
|
|
10616
|
+
collection.pop();
|
|
10373
10617
|
}
|
|
10374
10618
|
}
|
|
10375
|
-
else if (
|
|
10619
|
+
else if (collection[i] === 'horizontal' || collection[i] === 'horizontalflip') {
|
|
10376
10620
|
horizontal++;
|
|
10377
10621
|
rotateleft = 0;
|
|
10378
10622
|
rotateRight = 0;
|
|
10379
10623
|
vertical = 0;
|
|
10380
10624
|
if (horizontal === 2) {
|
|
10381
|
-
|
|
10382
|
-
|
|
10625
|
+
collection.pop();
|
|
10626
|
+
collection.pop();
|
|
10383
10627
|
}
|
|
10384
10628
|
}
|
|
10385
|
-
else if (
|
|
10629
|
+
else if (collection[i] === 'vertical' || collection[i] === 'verticalflip') {
|
|
10386
10630
|
vertical++;
|
|
10387
10631
|
horizontal = 0;
|
|
10388
10632
|
rotateleft = 0;
|
|
10389
10633
|
rotateRight = 0;
|
|
10390
10634
|
if (vertical === 2) {
|
|
10391
|
-
|
|
10392
|
-
|
|
10635
|
+
collection.pop();
|
|
10636
|
+
collection.pop();
|
|
10393
10637
|
}
|
|
10394
10638
|
}
|
|
10395
10639
|
}
|
|
10640
|
+
return collection;
|
|
10396
10641
|
}
|
|
10397
|
-
popForDefaultFlipState() {
|
|
10398
|
-
for (let i = 0; i <
|
|
10399
|
-
if (!isNullOrUndefined(
|
|
10400
|
-
if (
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10642
|
+
popForDefaultFlipState(collection) {
|
|
10643
|
+
for (let i = 0; i < collection.length; i++) {
|
|
10644
|
+
if (!isNullOrUndefined(collection[i + 3])) {
|
|
10645
|
+
if ((collection[i] === 'horizontal' || collection[i] === 'horizontalFlip')
|
|
10646
|
+
&& (collection[i + 1] === 'vertical' || collection[i] === 'verticalFlip') &&
|
|
10647
|
+
(collection[i + 2] === 'horizontal' || collection[i] === 'horizontalFlip') &&
|
|
10648
|
+
(collection[i + 3] === 'vertical' || collection[i] === 'verticalFlip')) {
|
|
10649
|
+
collection.pop();
|
|
10650
|
+
collection.pop();
|
|
10651
|
+
collection.pop();
|
|
10652
|
+
collection.pop();
|
|
10406
10653
|
}
|
|
10407
|
-
else if (
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10412
|
-
|
|
10654
|
+
else if ((collection[i] === 'vertical' || collection[i] === 'verticalFlip')
|
|
10655
|
+
&& (collection[i + 1] === 'horizontal' || collection[i + 1] === 'horizontalFlip') &&
|
|
10656
|
+
(collection[i + 2] === 'vertical' || collection[i] === 'verticalFlip') &&
|
|
10657
|
+
(collection[i + 3] === 'horizontal' || collection[i] === 'horizontalFlip')) {
|
|
10658
|
+
collection.pop();
|
|
10659
|
+
collection.pop();
|
|
10660
|
+
collection.pop();
|
|
10661
|
+
collection.pop();
|
|
10413
10662
|
}
|
|
10414
10663
|
}
|
|
10415
10664
|
}
|
|
10665
|
+
return collection;
|
|
10416
10666
|
}
|
|
10417
|
-
popForDefaultRotateState() {
|
|
10418
|
-
for (let i = 0; i <
|
|
10419
|
-
if (!isNullOrUndefined(
|
|
10420
|
-
if (
|
|
10421
|
-
|
|
10422
|
-
|
|
10667
|
+
popForDefaultRotateState(collection) {
|
|
10668
|
+
for (let i = 0; i < collection.length; i++) {
|
|
10669
|
+
if (!isNullOrUndefined(collection[i + 1])) {
|
|
10670
|
+
if ((collection[i] === 90 || collection[i] === 'rotateRight') &&
|
|
10671
|
+
(collection[i + 1] === -90 || collection[i] === 'rotateLeft')) {
|
|
10672
|
+
collection.pop();
|
|
10673
|
+
collection.pop();
|
|
10423
10674
|
}
|
|
10424
|
-
else if (
|
|
10425
|
-
|
|
10426
|
-
|
|
10675
|
+
else if ((collection[i] === -90 || collection[i] === 'rotateLeft') &&
|
|
10676
|
+
(collection[i + 1] === 90 || collection[i] === 'rotateRight')) {
|
|
10677
|
+
collection.pop();
|
|
10678
|
+
collection.pop();
|
|
10427
10679
|
}
|
|
10428
10680
|
}
|
|
10429
10681
|
}
|
|
10682
|
+
return collection;
|
|
10430
10683
|
}
|
|
10431
|
-
alignRotateFlipColl() {
|
|
10432
|
-
this.popForDefaultTransformedState();
|
|
10433
|
-
this.popForDefaultFlipState();
|
|
10434
|
-
this.popForDefaultRotateState();
|
|
10435
|
-
if (
|
|
10684
|
+
alignRotateFlipColl(collection, isRotateFlipCollection) {
|
|
10685
|
+
collection = this.popForDefaultTransformedState(collection);
|
|
10686
|
+
collection = this.popForDefaultFlipState(collection);
|
|
10687
|
+
collection = this.popForDefaultRotateState(collection);
|
|
10688
|
+
if (collection.length === 0 && isRotateFlipCollection) {
|
|
10436
10689
|
this.degree = 0;
|
|
10437
10690
|
this.currFlipState = '';
|
|
10438
10691
|
}
|
|
10692
|
+
return collection;
|
|
10439
10693
|
}
|
|
10440
10694
|
updateFlipColl(direction) {
|
|
10441
10695
|
if (this.flipColl.length === 0) {
|
|
@@ -10606,35 +10860,51 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10606
10860
|
this.applyPenDraw();
|
|
10607
10861
|
this.adjustmentLevel.brightness = value;
|
|
10608
10862
|
value = this.getFilterValue(value);
|
|
10609
|
-
const
|
|
10863
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
10864
|
+
const prevObj = this.getCurrentObj();
|
|
10865
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
10866
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
10867
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
10610
10868
|
this.updateAdjustment('brightness', value);
|
|
10611
|
-
this.updateUndoRedoColl('brightness',
|
|
10869
|
+
this.updateUndoRedoColl('brightness', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10612
10870
|
}
|
|
10613
10871
|
setContrast(value) {
|
|
10614
10872
|
this.applyPenDraw();
|
|
10615
10873
|
this.adjustmentLevel.contrast = value;
|
|
10616
|
-
const temp = this.lowerContext.filter;
|
|
10617
10874
|
value = this.getFilterValue(value);
|
|
10618
10875
|
value *= 100;
|
|
10876
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
10877
|
+
const prevObj = this.getCurrentObj();
|
|
10878
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
10879
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
10880
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
10619
10881
|
this.updateAdjustment('contrast', value);
|
|
10620
|
-
this.updateUndoRedoColl('contrast',
|
|
10882
|
+
this.updateUndoRedoColl('contrast', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10621
10883
|
}
|
|
10622
10884
|
setHue(value) {
|
|
10623
10885
|
this.applyPenDraw();
|
|
10624
10886
|
this.adjustmentLevel.hue = value;
|
|
10625
10887
|
value *= 3;
|
|
10626
|
-
const
|
|
10888
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
10889
|
+
const prevObj = this.getCurrentObj();
|
|
10890
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
10891
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
10892
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
10627
10893
|
this.updateAdjustment('hue', value);
|
|
10628
|
-
this.updateUndoRedoColl('hue',
|
|
10894
|
+
this.updateUndoRedoColl('hue', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10629
10895
|
}
|
|
10630
10896
|
setSaturation(value) {
|
|
10631
10897
|
this.applyPenDraw();
|
|
10632
10898
|
this.adjustmentLevel.saturation = value;
|
|
10633
10899
|
value = this.getSaturationFilterValue(value);
|
|
10634
10900
|
value *= 100;
|
|
10635
|
-
const
|
|
10901
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
10902
|
+
const prevObj = this.getCurrentObj();
|
|
10903
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
10904
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
10905
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
10636
10906
|
this.updateAdjustment('saturation', value);
|
|
10637
|
-
this.updateUndoRedoColl('saturation',
|
|
10907
|
+
this.updateUndoRedoColl('saturation', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10638
10908
|
}
|
|
10639
10909
|
setOpacity(value) {
|
|
10640
10910
|
this.applyPenDraw();
|
|
@@ -10657,9 +10927,13 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10657
10927
|
else if (value === 0) {
|
|
10658
10928
|
value = 0.25;
|
|
10659
10929
|
}
|
|
10660
|
-
const
|
|
10930
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
10931
|
+
const prevObj = this.getCurrentObj();
|
|
10932
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
10933
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
10934
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
10661
10935
|
this.updateAdjustment('opacity', value);
|
|
10662
|
-
this.updateUndoRedoColl('opacity',
|
|
10936
|
+
this.updateUndoRedoColl('opacity', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10663
10937
|
}
|
|
10664
10938
|
setBlur(value) {
|
|
10665
10939
|
this.applyPenDraw();
|
|
@@ -10667,25 +10941,37 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10667
10941
|
value /= 20;
|
|
10668
10942
|
// Since 0.5 is not working in blur we consider from 1
|
|
10669
10943
|
value += 0.5;
|
|
10670
|
-
const
|
|
10944
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
10945
|
+
const prevObj = this.getCurrentObj();
|
|
10946
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
10947
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
10948
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
10671
10949
|
this.updateAdjustment('blur', value);
|
|
10672
|
-
this.updateUndoRedoColl('blur',
|
|
10950
|
+
this.updateUndoRedoColl('blur', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10673
10951
|
}
|
|
10674
10952
|
setExposure(value) {
|
|
10675
10953
|
this.applyPenDraw();
|
|
10676
10954
|
this.adjustmentLevel.exposure = value;
|
|
10677
10955
|
value = this.getFilterValue(value);
|
|
10678
|
-
const
|
|
10956
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
10957
|
+
const prevObj = this.getCurrentObj();
|
|
10958
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
10959
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
10960
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
10679
10961
|
this.updateAdjustment('exposure', value);
|
|
10680
|
-
this.updateUndoRedoColl('exposure',
|
|
10962
|
+
this.updateUndoRedoColl('exposure', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10681
10963
|
}
|
|
10682
10964
|
setFilter(type) {
|
|
10683
10965
|
type = type.toLowerCase();
|
|
10684
10966
|
this.applyPenDraw();
|
|
10685
|
-
const tempFilter = this.lowerContext.filter;
|
|
10686
10967
|
const prevFilter = this.currentFilter;
|
|
10968
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
10969
|
+
const prevObj = this.getCurrentObj();
|
|
10970
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
10971
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
10972
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
10687
10973
|
this.updateAdjustment(type, null);
|
|
10688
|
-
this.updateUndoRedoColl(type,
|
|
10974
|
+
this.updateUndoRedoColl(type, prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj, null, null, prevFilter);
|
|
10689
10975
|
}
|
|
10690
10976
|
renderImage() {
|
|
10691
10977
|
const temp = this.lowerContext.filter;
|
|
@@ -10720,8 +11006,81 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10720
11006
|
this.updateFontStyles();
|
|
10721
11007
|
this.textArea.style.width = this.activeObj.activePoint.width + 'px';
|
|
10722
11008
|
}
|
|
11009
|
+
drawNewSelection(type, startX, startY, width, height) {
|
|
11010
|
+
let points;
|
|
11011
|
+
const cropShape = 'crop-' + type;
|
|
11012
|
+
if (cropShape.toLowerCase() === 'crop-custom') {
|
|
11013
|
+
if (this.currObjType.shape === '') {
|
|
11014
|
+
this.drawCustomSelection('crop-custom');
|
|
11015
|
+
}
|
|
11016
|
+
if (startX && startY) {
|
|
11017
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
11018
|
+
this.currObjType.shape = this.activeObj.shape = cropShape.toLowerCase();
|
|
11019
|
+
this.activeObj.activePoint.startX = startX;
|
|
11020
|
+
this.activeObj.activePoint.startY = startY;
|
|
11021
|
+
this.activeObj.activePoint.endX = this.lowerCanvas.width;
|
|
11022
|
+
this.activeObj.activePoint.endY = this.lowerCanvas.height;
|
|
11023
|
+
this.activeObj.activePoint.width = this.activeObj.activePoint.endX - this.activeObj.activePoint.startX;
|
|
11024
|
+
this.activeObj.activePoint.height = this.activeObj.activePoint.endY - this.activeObj.activePoint.startY;
|
|
11025
|
+
this.drawObject('duplicate');
|
|
11026
|
+
}
|
|
11027
|
+
}
|
|
11028
|
+
else if (cropShape.toLowerCase() === 'crop-canvas') {
|
|
11029
|
+
this.upperCanvas.style.display = 'none';
|
|
11030
|
+
this.dragCanvas = true;
|
|
11031
|
+
}
|
|
11032
|
+
else {
|
|
11033
|
+
this.currObjType.isCustomCrop = false;
|
|
11034
|
+
this.currObjType.shape = cropShape.toLowerCase();
|
|
11035
|
+
if (width && height) {
|
|
11036
|
+
points = { startX: startX, startY: startY, endX: startX + width, endY: startY + height,
|
|
11037
|
+
width: width, height: height };
|
|
11038
|
+
}
|
|
11039
|
+
else if (width && cropShape === 'crop-circle') {
|
|
11040
|
+
points = { startX: startX, startY: startY, endX: startX + width, endY: startY + width,
|
|
11041
|
+
width: width, height: width };
|
|
11042
|
+
}
|
|
11043
|
+
this.activeObj.shape = cropShape.toLowerCase();
|
|
11044
|
+
this.drawObject('duplicate', null, true, points);
|
|
11045
|
+
}
|
|
11046
|
+
}
|
|
11047
|
+
setDestPointsForFlipState(isUpdate) {
|
|
11048
|
+
if (this.getCurrentPanRegion() !== '') {
|
|
11049
|
+
if (this.getCurrentPanRegion() === 'horizontal') {
|
|
11050
|
+
this.destLeft = this.lowerCanvas.clientWidth - (this.destWidth + this.destLeft);
|
|
11051
|
+
}
|
|
11052
|
+
else if (this.getCurrentPanRegion() === 'vertical') {
|
|
11053
|
+
this.destTop = this.lowerCanvas.clientHeight - (this.destHeight + this.destTop);
|
|
11054
|
+
}
|
|
11055
|
+
else {
|
|
11056
|
+
this.destLeft = this.lowerCanvas.clientWidth - (this.destWidth + this.destLeft);
|
|
11057
|
+
this.destTop = this.lowerCanvas.clientHeight - (this.destHeight + this.destTop);
|
|
11058
|
+
}
|
|
11059
|
+
}
|
|
11060
|
+
}
|
|
11061
|
+
performUndoDefaultAction(obj) {
|
|
11062
|
+
this.lowerContext.filter = obj.previousObj.filter;
|
|
11063
|
+
this.objColl = [];
|
|
11064
|
+
this.pointColl = [];
|
|
11065
|
+
this.freehandCounter = 0;
|
|
11066
|
+
this.setCurrentObj(obj.previousObj);
|
|
11067
|
+
this.destLeft = obj.previousObj.destPoints.startX;
|
|
11068
|
+
this.destTop = obj.previousObj.destPoints.startY;
|
|
11069
|
+
const activeObj = extend({}, this.activeObj, {}, true);
|
|
11070
|
+
this.objColl = extend([], obj.previousObjColl, [], true);
|
|
11071
|
+
this.pointColl = extend([], obj.previousPointColl, [], true);
|
|
11072
|
+
this.freehandCounter = this.pointColl.length;
|
|
11073
|
+
this.lowerContext.filter = 'none';
|
|
11074
|
+
this.iterateObjColl();
|
|
11075
|
+
this.freehandRedraw(this.lowerContext);
|
|
11076
|
+
this.lowerContext.filter = obj.previousObj.filter;
|
|
11077
|
+
this.activeObj = activeObj;
|
|
11078
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
11079
|
+
if (this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) {
|
|
11080
|
+
this.drawObject('duplicate');
|
|
11081
|
+
}
|
|
11082
|
+
}
|
|
10723
11083
|
setAdjustment(type) {
|
|
10724
|
-
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
10725
11084
|
const splitWords = this.lowerContext.filter.split(' ');
|
|
10726
11085
|
let value;
|
|
10727
11086
|
let valueArr;
|
|
@@ -10784,59 +11143,25 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10784
11143
|
this.adjustmentLevel.exposure = this.setFilterValue(value);
|
|
10785
11144
|
break;
|
|
10786
11145
|
}
|
|
10787
|
-
this.callUpdateCurrentTransformedState();
|
|
10788
|
-
}
|
|
10789
|
-
updateFilter(obj) {
|
|
10790
|
-
const selEle = this.element.querySelector('.e-contextual-toolbar-wrapper .e-toolbar-item.e-selected');
|
|
10791
|
-
if (selEle) {
|
|
10792
|
-
selEle.classList.remove('e-selected');
|
|
10793
|
-
}
|
|
10794
|
-
const filterCanvas = document.getElementById(obj.value + 'Canvas');
|
|
10795
|
-
if (filterCanvas) {
|
|
10796
|
-
filterCanvas.parentElement.classList.add('e-selected');
|
|
10797
|
-
}
|
|
10798
|
-
this.currentFilter = obj.value;
|
|
10799
|
-
this.lowerContext.filter = this.canvasFilter = obj.previousObj;
|
|
10800
|
-
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
10801
|
-
this.isUndoRedo = true;
|
|
10802
|
-
this.redrawImgWithObj();
|
|
10803
11146
|
}
|
|
10804
|
-
|
|
10805
|
-
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
|
|
10809
|
-
|
|
11147
|
+
updateFilter(type, previousFilter) {
|
|
11148
|
+
if (type === 'default' || type === 'chrome' || type === 'cold' ||
|
|
11149
|
+
type === 'warm' || type === 'grayscale' || type === 'blackandwhite' ||
|
|
11150
|
+
type === 'sepia' || type === 'invert' || type === 'sharpen') {
|
|
11151
|
+
const selEle = this.element.querySelector('.e-contextual-toolbar-wrapper .e-toolbar-item.e-selected');
|
|
11152
|
+
if (selEle) {
|
|
11153
|
+
selEle.classList.remove('e-selected');
|
|
10810
11154
|
}
|
|
10811
|
-
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
this.activeObj.activePoint.startX = startX;
|
|
10815
|
-
this.activeObj.activePoint.startY = startY;
|
|
10816
|
-
this.activeObj.activePoint.endX = this.lowerCanvas.width;
|
|
10817
|
-
this.activeObj.activePoint.endY = this.lowerCanvas.height;
|
|
10818
|
-
this.activeObj.activePoint.width = this.activeObj.activePoint.endX - this.activeObj.activePoint.startX;
|
|
10819
|
-
this.activeObj.activePoint.height = this.activeObj.activePoint.endY - this.activeObj.activePoint.startY;
|
|
10820
|
-
this.drawObject('duplicate');
|
|
11155
|
+
const filterCanvas = document.getElementById(this.element.id + '_' + type + 'Canvas');
|
|
11156
|
+
if (filterCanvas) {
|
|
11157
|
+
filterCanvas.parentElement.classList.add('e-selected');
|
|
10821
11158
|
}
|
|
10822
|
-
|
|
10823
|
-
|
|
10824
|
-
this.upperCanvas.style.display = 'none';
|
|
10825
|
-
this.dragCanvas = true;
|
|
10826
|
-
}
|
|
10827
|
-
else {
|
|
10828
|
-
this.currObjType.isCustomCrop = false;
|
|
10829
|
-
this.currObjType.shape = cropShape.toLowerCase();
|
|
10830
|
-
if (width && height) {
|
|
10831
|
-
points = { startX: startX, startY: startY, endX: startX + width, endY: startY + height,
|
|
10832
|
-
width: width, height: height };
|
|
11159
|
+
if (!isNullOrUndefined(previousFilter)) {
|
|
11160
|
+
this.currentFilter = previousFilter;
|
|
10833
11161
|
}
|
|
10834
|
-
else
|
|
10835
|
-
|
|
10836
|
-
width: width, height: width };
|
|
11162
|
+
else {
|
|
11163
|
+
this.currentFilter = this.element.id + '_' + type;
|
|
10837
11164
|
}
|
|
10838
|
-
this.activeObj.shape = cropShape.toLowerCase();
|
|
10839
|
-
this.drawObject('duplicate', null, true, points);
|
|
10840
11165
|
}
|
|
10841
11166
|
}
|
|
10842
11167
|
/**
|
|
@@ -10877,11 +11202,15 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10877
11202
|
}
|
|
10878
11203
|
if (!this.disabled && this.activeObj.horTopLine !== undefined && (this.currObjType.isCustomCrop || splitWords[0] === 'crop')) {
|
|
10879
11204
|
isCrop = true;
|
|
10880
|
-
const
|
|
11205
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
11206
|
+
const prevObj = this.getCurrentObj();
|
|
11207
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
11208
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
11209
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
10881
11210
|
this.cropImg();
|
|
10882
11211
|
this.zoomFactor = 0;
|
|
10883
11212
|
this.enableDisableToolbarBtn();
|
|
10884
|
-
this.updateUndoRedoColl('crop',
|
|
11213
|
+
this.updateUndoRedoColl('crop', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10885
11214
|
}
|
|
10886
11215
|
}
|
|
10887
11216
|
return isCrop;
|
|
@@ -10894,9 +11223,17 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10894
11223
|
*/
|
|
10895
11224
|
flip(direction) {
|
|
10896
11225
|
if (!this.disabled && this.isImageLoaded) {
|
|
10897
|
-
const zoomFactor = this.zoomFactor;
|
|
10898
11226
|
const transitionArgs = { direction: direction };
|
|
10899
11227
|
this.trigger('flipping', transitionArgs);
|
|
11228
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
11229
|
+
let prevObj;
|
|
11230
|
+
if (isNullOrUndefined(this.transformCurrentObj)) {
|
|
11231
|
+
prevObj = this.getCurrentObj();
|
|
11232
|
+
prevObj.objColl = extend([], this.objColl, null, true);
|
|
11233
|
+
prevObj.pointColl = extend({}, this.pointColl, null, true);
|
|
11234
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
11235
|
+
}
|
|
11236
|
+
this.afterCropActions.push(direction.toLowerCase() === 'horizontal' ? 'horizontalflip' : 'verticalflip');
|
|
10900
11237
|
let splitWords = [];
|
|
10901
11238
|
let activeObjShape;
|
|
10902
11239
|
if (!isNullOrUndefined(this.activeObj.activePoint)) {
|
|
@@ -10955,7 +11292,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10955
11292
|
this.rotateFlipColl.push(direction.toLowerCase());
|
|
10956
11293
|
}
|
|
10957
11294
|
if (this.rotateFlipColl.length === 1) {
|
|
10958
|
-
this.
|
|
11295
|
+
if (this.getCurrentPanRegion() === '') {
|
|
11296
|
+
this.setClientTransformedDimension();
|
|
11297
|
+
}
|
|
11298
|
+
else {
|
|
11299
|
+
this.setDestPointsForFlipState();
|
|
11300
|
+
}
|
|
10959
11301
|
}
|
|
10960
11302
|
if (this.isCircleCrop) {
|
|
10961
11303
|
this.cropCircle(this.lowerContext);
|
|
@@ -10994,8 +11336,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10994
11336
|
}
|
|
10995
11337
|
this.lowerContext.filter = tempFilter;
|
|
10996
11338
|
this.refreshActiveObj();
|
|
10997
|
-
|
|
10998
|
-
|
|
11339
|
+
this.updateCurrSelectionPoint(direction.toLowerCase());
|
|
11340
|
+
if (!this.isUndoRedo && isNullOrUndefined(this.transformCurrentObj)) {
|
|
11341
|
+
this.updateUndoRedoColl('flip', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10999
11342
|
}
|
|
11000
11343
|
this.isUndoRedo = false;
|
|
11001
11344
|
this.clearOuterCanvas(this.lowerContext);
|
|
@@ -11015,7 +11358,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11015
11358
|
else if (!this.isReverseFlip) {
|
|
11016
11359
|
this.refreshToolbar('main', true, true);
|
|
11017
11360
|
}
|
|
11018
|
-
this.alignRotateFlipColl();
|
|
11361
|
+
this.rotateFlipColl = this.alignRotateFlipColl(this.rotateFlipColl, true);
|
|
11019
11362
|
}
|
|
11020
11363
|
}
|
|
11021
11364
|
/**
|
|
@@ -11177,17 +11520,16 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11177
11520
|
this.selectedFreehandColor = '#42a5f5';
|
|
11178
11521
|
this.isFreehandDrawCustomized = false;
|
|
11179
11522
|
this.isShapeInserted = false;
|
|
11180
|
-
this.
|
|
11181
|
-
this.
|
|
11523
|
+
this.isAllowCropPan = false;
|
|
11524
|
+
this.tempPannedPoint = { x: 0, y: 0 };
|
|
11182
11525
|
this.currObjType = { shape: '', isDragging: false, isActiveObj: false, isText: false, isInitialText: false, isLine: false,
|
|
11183
11526
|
isInitialLine: false, isCustomCrop: false, isZoomed: false, isUndoZoom: false,
|
|
11184
11527
|
isUndoAction: false, isFiltered: false, isSave: false };
|
|
11185
|
-
this.isAllowCropPan = false;
|
|
11186
|
-
this.tempPannedPoint = { x: 0, y: 0 };
|
|
11187
11528
|
this.cropObj = { cropZoom: 0, defaultZoom: 0, totalPannedPoint: { x: 0, y: 0 }, totalPannedClientPoint: { x: 0, y: 0 },
|
|
11188
|
-
totalPannedInternalPoint: { x: 0, y: 0 },
|
|
11189
|
-
|
|
11190
|
-
|
|
11529
|
+
totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {},
|
|
11530
|
+
rotateFlipColl: [], degree: 0, currFlipState: '',
|
|
11531
|
+
destPoints: { startX: 0, startY: 0, width: 0, height: 0 },
|
|
11532
|
+
srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '' };
|
|
11191
11533
|
this.afterCropActions = [];
|
|
11192
11534
|
this.isCancelAction = this.preventZoomBtn = this.isFreehandPointMoved = false;
|
|
11193
11535
|
this.isTouch = false;
|
|
@@ -11197,6 +11539,11 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11197
11539
|
this.tempCurrentFreehandDrawIndex = 0;
|
|
11198
11540
|
this.cancelObjColl = [];
|
|
11199
11541
|
this.cancelPointColl = [];
|
|
11542
|
+
this.freehandDrawSelectedId = null;
|
|
11543
|
+
this.transformCurrentObj = null;
|
|
11544
|
+
this.rotatedFlipCropSelection = false;
|
|
11545
|
+
this.panStartObj = null;
|
|
11546
|
+
this.currDestinationPoint = null;
|
|
11200
11547
|
this.updateCanvas();
|
|
11201
11548
|
this.refreshDropDownBtn(false);
|
|
11202
11549
|
this.enableDisableToolbarBtn();
|
|
@@ -11216,6 +11563,15 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11216
11563
|
isRotate = true;
|
|
11217
11564
|
const transitionArgs = { degree: degree };
|
|
11218
11565
|
this.trigger('rotating', transitionArgs);
|
|
11566
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
11567
|
+
let prevObj;
|
|
11568
|
+
if (isNullOrUndefined(this.transformCurrentObj)) {
|
|
11569
|
+
prevObj = this.getCurrentObj();
|
|
11570
|
+
prevObj.objColl = extend([], this.objColl, null, true);
|
|
11571
|
+
prevObj.pointColl = extend({}, this.pointColl, null, true);
|
|
11572
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
11573
|
+
}
|
|
11574
|
+
this.afterCropActions.push(degree === 90 ? 'rotateRight' : 'rotateLeft');
|
|
11219
11575
|
let splitWords = [];
|
|
11220
11576
|
let activeObjShape;
|
|
11221
11577
|
if (!isNullOrUndefined(this.activeObj.activePoint) && !isNullOrUndefined(this.activeObj.shape)) {
|
|
@@ -11231,7 +11587,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11231
11587
|
}
|
|
11232
11588
|
this.redrawActObj();
|
|
11233
11589
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
11234
|
-
const zoomFactor = this.zoomFactor;
|
|
11235
11590
|
this.drawRotatedImage(degree);
|
|
11236
11591
|
this.clearOuterCanvas(this.lowerContext);
|
|
11237
11592
|
this.clearOuterCanvas(this.upperContext);
|
|
@@ -11244,8 +11599,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11244
11599
|
this.refreshToolbar('main', true, true);
|
|
11245
11600
|
}
|
|
11246
11601
|
}
|
|
11247
|
-
if (!this.isUndoRedo) {
|
|
11248
|
-
this.updateUndoRedoColl('rotate',
|
|
11602
|
+
if (!this.isUndoRedo && isNullOrUndefined(this.transformCurrentObj)) {
|
|
11603
|
+
this.updateUndoRedoColl('rotate', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
11249
11604
|
}
|
|
11250
11605
|
this.isUndoRedo = false;
|
|
11251
11606
|
if (isNullOrUndefined(this.activeObj.shape) && !this.isReverseRotate) {
|
|
@@ -11254,7 +11609,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11254
11609
|
else if (!this.isReverseRotate) {
|
|
11255
11610
|
this.refreshToolbar('main', true, true);
|
|
11256
11611
|
}
|
|
11257
|
-
this.alignRotateFlipColl();
|
|
11612
|
+
this.rotateFlipColl = this.alignRotateFlipColl(this.rotateFlipColl, true);
|
|
11258
11613
|
}
|
|
11259
11614
|
return isRotate;
|
|
11260
11615
|
}
|
|
@@ -11350,6 +11705,11 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11350
11705
|
else if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
11351
11706
|
isPrevent = true;
|
|
11352
11707
|
}
|
|
11708
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
11709
|
+
const prevObj = this.getCurrentObj();
|
|
11710
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
11711
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
11712
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
11353
11713
|
this.redrawActObj();
|
|
11354
11714
|
this.refreshActiveObj();
|
|
11355
11715
|
this.keyHistory = '';
|
|
@@ -11361,19 +11721,26 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11361
11721
|
if (this.defaultZoomFactor > 0) {
|
|
11362
11722
|
const zoomFactor = this.zoomFactor = this.defaultZoomFactor;
|
|
11363
11723
|
this.isCropTab = false;
|
|
11724
|
+
const isUndoRedo = this.isUndoRedo;
|
|
11364
11725
|
for (let i = 0; i < (zoomFactor * 10); i++) {
|
|
11726
|
+
this.isUndoRedo = true;
|
|
11365
11727
|
this.zoom(-0.1);
|
|
11366
11728
|
}
|
|
11729
|
+
this.isUndoRedo = isUndoRedo;
|
|
11367
11730
|
this.resetPanPoints();
|
|
11368
11731
|
}
|
|
11369
11732
|
this.cancelObjColl = extend([], this.objColl, [], true);
|
|
11370
11733
|
this.cancelPointColl = extend([], this.pointColl, [], true);
|
|
11734
|
+
this.updateObjAndFreeHandDrawColl();
|
|
11371
11735
|
this.isCropTab = true;
|
|
11372
11736
|
this.setCurrSelectionPoints(true);
|
|
11373
11737
|
this.zoomFactor = this.cropZoomFactor;
|
|
11374
11738
|
if (isNullOrUndefined(this.cropObj.activeObj.shape)) {
|
|
11375
11739
|
this.drawNewSelection(type, startX, startY, width, height);
|
|
11376
11740
|
}
|
|
11741
|
+
else {
|
|
11742
|
+
this.updateUndoRedoColl('crop-selection', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
11743
|
+
}
|
|
11377
11744
|
}
|
|
11378
11745
|
else {
|
|
11379
11746
|
if (type === 'custom') {
|
|
@@ -11448,23 +11815,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11448
11815
|
}
|
|
11449
11816
|
}
|
|
11450
11817
|
}
|
|
11451
|
-
setDestPointsForFlipState(isUpdate) {
|
|
11452
|
-
if (this.getCurrentPanRegion() !== '') {
|
|
11453
|
-
if (this.getCurrentPanRegion() === 'horizontal') {
|
|
11454
|
-
this.destLeft = this.lowerCanvas.clientWidth - (this.destWidth + this.destLeft);
|
|
11455
|
-
}
|
|
11456
|
-
else if (this.getCurrentPanRegion() === 'vertical') {
|
|
11457
|
-
this.destTop = this.lowerCanvas.clientHeight - (this.destHeight + this.destTop);
|
|
11458
|
-
}
|
|
11459
|
-
else {
|
|
11460
|
-
this.destLeft = this.lowerCanvas.clientWidth - (this.destWidth + this.destLeft);
|
|
11461
|
-
this.destTop = this.lowerCanvas.clientHeight - (this.destHeight + this.destTop);
|
|
11462
|
-
}
|
|
11463
|
-
if (!isNullOrUndefined(isUpdate)) {
|
|
11464
|
-
this.updateObjAndFreeHandDrawColl();
|
|
11465
|
-
}
|
|
11466
|
-
}
|
|
11467
|
-
}
|
|
11468
11818
|
/**
|
|
11469
11819
|
* Increase / Decrease the magnification of an image.
|
|
11470
11820
|
*
|
|
@@ -11473,7 +11823,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11473
11823
|
*/
|
|
11474
11824
|
zoom(value) {
|
|
11475
11825
|
if (!this.disabled && this.isImageLoaded) {
|
|
11476
|
-
if ((this.zoomFactor === 0 && value < 0) || (this.zoomFactor >
|
|
11826
|
+
if ((this.zoomFactor === 0 && value < 0) || (this.zoomFactor > 2 && value > 0 ||
|
|
11477
11827
|
(this.zoomFactor > 0 && value < 0 && this.disableZoomOutBtn()))) {
|
|
11478
11828
|
return;
|
|
11479
11829
|
}
|
|
@@ -11490,29 +11840,37 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11490
11840
|
else if (!isNullOrUndefined(this.activeObj.shape) && splitWords[0] !== 'crop') {
|
|
11491
11841
|
isShape = true;
|
|
11492
11842
|
}
|
|
11843
|
+
let zoomPoint;
|
|
11844
|
+
let zoomLevel;
|
|
11845
|
+
if (this.isCropTab && !isNullOrUndefined(tempActiveObj)) {
|
|
11846
|
+
zoomLevel = this.cropZoomFactor;
|
|
11847
|
+
zoomPoint = { x: this.activeObj.activePoint.startX + (this.activeObj.activePoint.width / 2),
|
|
11848
|
+
y: this.activeObj.activePoint.startY + (this.activeObj.activePoint.height / 2) };
|
|
11849
|
+
}
|
|
11850
|
+
else {
|
|
11851
|
+
zoomLevel = this.defaultZoomFactor;
|
|
11852
|
+
zoomPoint = { x: this.lowerCanvas.clientWidth / 2, y: this.lowerCanvas.clientHeight / 2 };
|
|
11853
|
+
}
|
|
11854
|
+
const zoomEventArgs = { zoomPoint: zoomPoint, zoomLevel: zoomLevel };
|
|
11855
|
+
this.trigger('zooming', zoomEventArgs);
|
|
11856
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
11857
|
+
const prevObj = this.getCurrentObj();
|
|
11858
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
11859
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
11860
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
11493
11861
|
this.redrawActObj();
|
|
11494
11862
|
this.refreshActiveObj();
|
|
11495
11863
|
this.upperContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
11496
11864
|
this.lowerContext.filter = this.canvasFilter;
|
|
11497
11865
|
this.upperCanvas.style.cursor = 'default';
|
|
11498
|
-
let zoomState;
|
|
11499
11866
|
let objColl = extend([], this.objColl, [], true);
|
|
11500
|
-
if (value === 3.75 || value === 1) {
|
|
11501
|
-
zoomState = 0.1;
|
|
11502
|
-
}
|
|
11503
|
-
else if (value === -3.75) {
|
|
11504
|
-
zoomState = -0.1;
|
|
11505
|
-
}
|
|
11506
|
-
else {
|
|
11507
|
-
zoomState = value;
|
|
11508
|
-
}
|
|
11509
11867
|
if (!this.isCropTab) {
|
|
11510
11868
|
if (this.degree !== 0) {
|
|
11511
11869
|
this.redrawActObj();
|
|
11512
11870
|
this.currentPannedPoint = { x: 0, y: 0 };
|
|
11513
|
-
this.rotatePan();
|
|
11871
|
+
this.rotatePan(true, true);
|
|
11514
11872
|
}
|
|
11515
|
-
this.
|
|
11873
|
+
this.updateObjAndFreeHandDrawColl();
|
|
11516
11874
|
}
|
|
11517
11875
|
if (this.degree === 0) {
|
|
11518
11876
|
this.drawZoomImgToCanvas(value, tempActiveObj);
|
|
@@ -11521,13 +11879,19 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11521
11879
|
this.tempFlipPanPoint.y += this.totalPannedPoint.y;
|
|
11522
11880
|
objColl = extend([], this.objColl, [], true);
|
|
11523
11881
|
this.objColl = [];
|
|
11882
|
+
const destLeft = this.destLeft;
|
|
11883
|
+
const destTop = this.destTop;
|
|
11884
|
+
this.setDestPointsForFlipState();
|
|
11524
11885
|
this.rotatedFlip();
|
|
11525
|
-
|
|
11526
|
-
|
|
11527
|
-
|
|
11528
|
-
|
|
11529
|
-
|
|
11530
|
-
|
|
11886
|
+
this.destLeft = destLeft;
|
|
11887
|
+
this.destTop = destTop;
|
|
11888
|
+
this.objColl = objColl;
|
|
11889
|
+
this.zoomObjColl();
|
|
11890
|
+
this.zoomFreehandDrawColl();
|
|
11891
|
+
this.updateObjAndFreeHandDrawColl();
|
|
11892
|
+
}
|
|
11893
|
+
if (this.zoomFactor === 0 && !this.isCropTab) {
|
|
11894
|
+
this.totalPannedPoint = { x: 0, y: 0 };
|
|
11531
11895
|
}
|
|
11532
11896
|
}
|
|
11533
11897
|
else {
|
|
@@ -11550,19 +11914,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11550
11914
|
this.zoomFreehandDrawColl();
|
|
11551
11915
|
this.lowerContext.filter = temp;
|
|
11552
11916
|
}
|
|
11553
|
-
else if (this.degree === 0) {
|
|
11554
|
-
const temp = this.lowerContext.filter;
|
|
11555
|
-
this.lowerContext.filter = 'none';
|
|
11556
|
-
const destLeft = this.destLeft;
|
|
11557
|
-
const destTop = this.destTop;
|
|
11558
|
-
this.setDestPointsForFlipState();
|
|
11559
|
-
this.objColl = objColl;
|
|
11560
|
-
this.zoomObjColl();
|
|
11561
|
-
this.zoomFreehandDrawColl();
|
|
11562
|
-
this.destLeft = destLeft;
|
|
11563
|
-
this.destTop = destTop;
|
|
11564
|
-
this.lowerContext.filter = temp;
|
|
11565
|
-
}
|
|
11566
11917
|
if ((!isNullOrUndefined(this.currSelectionPoint) && this.currSelectionPoint.shape === 'crop-circle') || this.isCircleCrop) {
|
|
11567
11918
|
this.cropCircle(this.lowerContext);
|
|
11568
11919
|
}
|
|
@@ -11571,18 +11922,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11571
11922
|
if (!isNullOrUndefined(tempActiveObj)) {
|
|
11572
11923
|
this.activeObj = extend({}, tempActiveObj, {}, true);
|
|
11573
11924
|
this.drawObject('duplicate', this.activeObj);
|
|
11574
|
-
if (this.currentToolbar === 'crop') {
|
|
11575
|
-
this.refreshToolbar('main', true, true);
|
|
11576
|
-
}
|
|
11577
|
-
else {
|
|
11578
|
-
this.refreshToolbar(this.currentToolbar, true, true);
|
|
11579
|
-
}
|
|
11580
11925
|
if (this.zoomFactor === 0) {
|
|
11581
11926
|
this.currSelectionPoint = null;
|
|
11582
11927
|
}
|
|
11583
11928
|
}
|
|
11584
11929
|
if (!this.isUndoRedo) {
|
|
11585
|
-
this.updateUndoRedoColl('zoom',
|
|
11930
|
+
this.updateUndoRedoColl('zoom', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
11586
11931
|
}
|
|
11587
11932
|
this.isUndoRedo = false;
|
|
11588
11933
|
const zoomOut = document.querySelector('#' + this.element.id + '_zoomOut');
|
|
@@ -11594,9 +11939,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11594
11939
|
zoomOut.classList.remove('e-disabled');
|
|
11595
11940
|
zoomOut.parentElement.classList.remove('e-overlay');
|
|
11596
11941
|
}
|
|
11597
|
-
if (!this.togglePan) {
|
|
11598
|
-
this.callMainToolbar(false, true);
|
|
11599
|
-
}
|
|
11600
11942
|
this.autoEnablePan();
|
|
11601
11943
|
if (!isNullOrUndefined(tempActiveObj)) {
|
|
11602
11944
|
this.activeObj = extend({}, tempActiveObj, {}, true);
|
|
@@ -11604,24 +11946,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11604
11946
|
if (this.activeObj.shape === 'crop-custom') {
|
|
11605
11947
|
this.currObjType.isCustomCrop = true;
|
|
11606
11948
|
}
|
|
11607
|
-
if (isNullOrUndefined(this.activeObj.activePoint) || this.activeObj.activePoint.width === 0) {
|
|
11608
|
-
if (this.currentToolbar === 'crop' || !isNullOrUndefined(tempActiveObj)) {
|
|
11609
|
-
this.refreshToolbar('main', true, true);
|
|
11610
|
-
}
|
|
11611
|
-
else {
|
|
11612
|
-
this.refreshToolbar('main');
|
|
11613
|
-
this.currentToolbar = 'main';
|
|
11614
|
-
}
|
|
11615
|
-
}
|
|
11616
|
-
else {
|
|
11617
|
-
if (this.currentToolbar === 'crop' || !isNullOrUndefined(tempActiveObj)) {
|
|
11618
|
-
this.refreshToolbar('main', true, true);
|
|
11619
|
-
}
|
|
11620
|
-
else {
|
|
11621
|
-
this.refreshToolbar('main');
|
|
11622
|
-
this.currentToolbar = 'main';
|
|
11623
|
-
}
|
|
11624
|
-
}
|
|
11625
11949
|
const panBtn = this.element.querySelector('.e-img-pan .e-btn');
|
|
11626
11950
|
if (!isNullOrUndefined(panBtn) && this.togglePan) {
|
|
11627
11951
|
panBtn.classList.add('e-selected-btn');
|
|
@@ -11633,12 +11957,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11633
11957
|
this.activeObj = extend({}, this.objColl[this.objColl.length - 1], {}, true);
|
|
11634
11958
|
this.objColl.pop();
|
|
11635
11959
|
this.drawObject('duplicate', this.activeObj);
|
|
11636
|
-
if (this.activeObj.shape === 'text') {
|
|
11637
|
-
this.refreshToolbar('text');
|
|
11638
|
-
}
|
|
11639
|
-
else {
|
|
11640
|
-
this.refreshToolbar('shapes');
|
|
11641
|
-
}
|
|
11642
11960
|
this.updateToolbarItems();
|
|
11643
11961
|
}
|
|
11644
11962
|
}
|
|
@@ -12042,14 +12360,13 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
12042
12360
|
else {
|
|
12043
12361
|
this.refreshToolbar('main');
|
|
12044
12362
|
}
|
|
12045
|
-
if (this.activeObj.activePoint.width !== 0) {
|
|
12363
|
+
if (!isNullOrUndefined(this.activeObj.activePoint) && this.activeObj.activePoint.width !== 0) {
|
|
12046
12364
|
this.tempActObj = this.activeObj;
|
|
12047
12365
|
}
|
|
12048
|
-
|
|
12366
|
+
this.refreshActiveObj();
|
|
12049
12367
|
this.undoRedoStep--;
|
|
12050
12368
|
this.enableDisableToolbarBtn();
|
|
12051
12369
|
this.isUndoRedo = true;
|
|
12052
|
-
this.lowerContext.filter = this.canvasFilter;
|
|
12053
12370
|
const obj = this.undoRedoColl[this.undoRedoStep];
|
|
12054
12371
|
if (this.undoRedoColl.length === this.undoRedoStep) {
|
|
12055
12372
|
this.currObjType.isUndoAction = false;
|
|
@@ -12057,82 +12374,47 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
12057
12374
|
else {
|
|
12058
12375
|
this.currObjType.isUndoAction = true;
|
|
12059
12376
|
}
|
|
12060
|
-
if (obj.operation !== '
|
|
12377
|
+
if (obj.operation !== 'textAreaCustomization' && this.textArea.style.display === 'block') {
|
|
12061
12378
|
this.textArea.style.display = 'none';
|
|
12062
12379
|
}
|
|
12063
12380
|
this.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
12064
|
-
|
|
12065
|
-
let
|
|
12066
|
-
|
|
12067
|
-
|
|
12068
|
-
|
|
12381
|
+
this.isCancelAction = true;
|
|
12382
|
+
let activeObj;
|
|
12383
|
+
this.cropObj = extend({}, obj.previousCropObj, {}, true);
|
|
12384
|
+
this.afterCropActions = obj.previousObj.afterCropActions;
|
|
12385
|
+
this.lowerContext.filter = this.canvasFilter = obj.previousObj.filter;
|
|
12069
12386
|
switch (obj.operation) {
|
|
12070
|
-
case '
|
|
12071
|
-
|
|
12072
|
-
|
|
12073
|
-
|
|
12074
|
-
else if (obj.value === -90) {
|
|
12075
|
-
value = 'rotateright';
|
|
12076
|
-
}
|
|
12077
|
-
this.performTransformation(value);
|
|
12078
|
-
break;
|
|
12079
|
-
case 'flip':
|
|
12080
|
-
if (obj.value.toLowerCase() === 'horizontal') {
|
|
12081
|
-
value = 'horizontalflip';
|
|
12082
|
-
}
|
|
12083
|
-
else if (obj.value.toLowerCase() === 'vertical') {
|
|
12084
|
-
value = 'verticalflip';
|
|
12085
|
-
}
|
|
12086
|
-
this.performTransformation(value);
|
|
12087
|
-
break;
|
|
12088
|
-
case 'zoom':
|
|
12089
|
-
if (this.zoomFactor === 0 && obj.zoomFactor !== 0) {
|
|
12090
|
-
this.zoomFactor = obj.zoomFactor;
|
|
12091
|
-
}
|
|
12092
|
-
this.zoom(-obj.value);
|
|
12387
|
+
case 'shapeTransform':
|
|
12388
|
+
this.objColl = extend([], obj.previousObjColl, [], true);
|
|
12389
|
+
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12390
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12093
12391
|
this.isUndoRedo = true;
|
|
12094
|
-
|
|
12095
|
-
|
|
12096
|
-
xDiff = this.destLeft;
|
|
12097
|
-
yDiff = this.destTop;
|
|
12098
|
-
this.destLeft = obj.previousObj.x;
|
|
12099
|
-
this.destTop = obj.previousObj.y;
|
|
12100
|
-
xDiff += this.destLeft;
|
|
12101
|
-
yDiff += this.destTop;
|
|
12102
|
-
this.drawPannedImage(xDiff, yDiff);
|
|
12103
|
-
break;
|
|
12104
|
-
case 'crop':
|
|
12105
|
-
if (!isNullOrUndefined(this.currSelectionPoint)) {
|
|
12106
|
-
tempUndoRedoColl = extend([], this.undoRedoColl, [], true);
|
|
12107
|
-
this.select('Custom');
|
|
12108
|
-
this.refreshToolbar('main', true, true);
|
|
12109
|
-
getComponent(this.element.querySelector('#' + this.element.id + '_cropBtn'), 'dropdown-btn').toggle();
|
|
12110
|
-
this.undoRedoColl = tempUndoRedoColl;
|
|
12111
|
-
this.enableDisableToolbarBtn();
|
|
12112
|
-
}
|
|
12392
|
+
this.redrawImgWithObj();
|
|
12393
|
+
this.refreshActiveObj();
|
|
12113
12394
|
break;
|
|
12114
12395
|
case 'freehanddraw':
|
|
12115
|
-
this.pointColl = obj.
|
|
12116
|
-
this.freehandCounter
|
|
12396
|
+
this.pointColl = obj.previousPointColl;
|
|
12397
|
+
this.freehandCounter = this.pointColl.length;
|
|
12117
12398
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12118
12399
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12119
12400
|
this.isUndoRedo = true;
|
|
12120
12401
|
this.redrawImgWithObj();
|
|
12121
12402
|
break;
|
|
12122
12403
|
case 'freehanddrawCustomized':
|
|
12123
|
-
this.pointColl = obj.
|
|
12404
|
+
this.pointColl = obj.previousPointColl;
|
|
12124
12405
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12125
12406
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12126
12407
|
this.isUndoRedo = true;
|
|
12127
12408
|
this.redrawImgWithObj();
|
|
12128
12409
|
break;
|
|
12129
|
-
case '
|
|
12130
|
-
|
|
12131
|
-
|
|
12132
|
-
this.
|
|
12410
|
+
case 'deleteFreehandDrawing':
|
|
12411
|
+
case 'deleteObj':
|
|
12412
|
+
if (obj.operation === 'deleteFreehandDrawing') {
|
|
12413
|
+
this.pointColl = obj.previousPointColl;
|
|
12414
|
+
this.freehandCounter = this.pointColl.length;
|
|
12133
12415
|
}
|
|
12134
|
-
else if (obj.
|
|
12135
|
-
this.objColl = obj.
|
|
12416
|
+
else if (obj.operation === 'deleteObj') {
|
|
12417
|
+
this.objColl = obj.previousObjColl;
|
|
12136
12418
|
}
|
|
12137
12419
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12138
12420
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
@@ -12140,7 +12422,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
12140
12422
|
this.redrawImgWithObj();
|
|
12141
12423
|
break;
|
|
12142
12424
|
case 'selectionTransform':
|
|
12143
|
-
this.activeObj = extend({}, obj.
|
|
12425
|
+
this.activeObj = extend({}, obj.previousObj.activeObj, {}, true);
|
|
12144
12426
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12145
12427
|
if (this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) {
|
|
12146
12428
|
this.drawObject('duplicate', this.activeObj);
|
|
@@ -12148,83 +12430,84 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
12148
12430
|
}
|
|
12149
12431
|
else {
|
|
12150
12432
|
this.refreshToolbar('main');
|
|
12433
|
+
this.performUndoDefaultAction(obj);
|
|
12151
12434
|
}
|
|
12152
12435
|
this.currObjType.isCustomCrop = false;
|
|
12153
12436
|
break;
|
|
12154
|
-
case '
|
|
12155
|
-
this.objColl = extend([], obj.
|
|
12156
|
-
|
|
12157
|
-
|
|
12158
|
-
|
|
12159
|
-
|
|
12160
|
-
|
|
12161
|
-
|
|
12162
|
-
|
|
12163
|
-
|
|
12164
|
-
|
|
12165
|
-
|
|
12166
|
-
prevObj = extend({}, obj.previousObj[i], {}, true);
|
|
12437
|
+
case 'textAreaCustomization':
|
|
12438
|
+
this.objColl = extend([], obj.previousObjColl, [], true);
|
|
12439
|
+
for (let i = 0; i < obj.previousObjColl.length; i++) {
|
|
12440
|
+
if (!isNullOrUndefined(this.tempActObj)) {
|
|
12441
|
+
if (this.tempActObj.currIndex === obj.previousObjColl[i].currIndex) {
|
|
12442
|
+
activeObj = extend({}, obj.previousObjColl[i], {}, true);
|
|
12443
|
+
this.objColl.splice(i, 1);
|
|
12444
|
+
break;
|
|
12445
|
+
}
|
|
12446
|
+
}
|
|
12447
|
+
else {
|
|
12448
|
+
activeObj = extend({}, obj.previousObjColl[obj.previousObjColl.length - 1], {}, true);
|
|
12167
12449
|
this.objColl.splice(i, 1);
|
|
12168
12450
|
break;
|
|
12169
12451
|
}
|
|
12170
12452
|
}
|
|
12171
|
-
if (!isNullOrUndefined(
|
|
12172
|
-
this.updateTextBox(
|
|
12453
|
+
if (!isNullOrUndefined(activeObj)) {
|
|
12454
|
+
this.updateTextBox(activeObj);
|
|
12173
12455
|
}
|
|
12174
12456
|
break;
|
|
12175
12457
|
case 'text':
|
|
12176
12458
|
if (!isNullOrUndefined(this.tempActObj)) {
|
|
12177
12459
|
this.activeObj = extend({}, this.tempActObj, {}, true);
|
|
12178
12460
|
}
|
|
12179
|
-
if (obj.
|
|
12461
|
+
if (obj.previousObjColl.length === 0 && this.objColl.length === 1) {
|
|
12180
12462
|
this.tempActObj = extend({}, this.objColl[0], {}, true);
|
|
12181
12463
|
}
|
|
12182
12464
|
else {
|
|
12183
12465
|
for (let i = 0; i < this.objColl.length; i++) {
|
|
12184
12466
|
if (!isNullOrUndefined(this.objColl[i]) &&
|
|
12185
|
-
isNullOrUndefined(obj.
|
|
12186
|
-
this.tempActObj = extend({},
|
|
12467
|
+
isNullOrUndefined(obj.previousObjColl[i])) {
|
|
12468
|
+
this.tempActObj = extend({}, this.objColl[i], {}, true);
|
|
12187
12469
|
break;
|
|
12188
12470
|
}
|
|
12189
|
-
if (obj.
|
|
12471
|
+
if (obj.previousObjColl[i].currIndex !== this.objColl[i].currIndex) {
|
|
12190
12472
|
this.tempActObj = extend({}, this.objColl[i], {}, true);
|
|
12191
12473
|
break;
|
|
12192
12474
|
}
|
|
12193
12475
|
}
|
|
12194
12476
|
}
|
|
12195
12477
|
this.activeObj = extend({}, this.tempActObj, {}, true);
|
|
12196
|
-
this.objColl = extend([], obj.
|
|
12478
|
+
this.objColl = extend([], obj.previousObjColl, [], true);
|
|
12197
12479
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12198
12480
|
this.isUndoRedo = true;
|
|
12199
12481
|
this.redrawImgWithObj();
|
|
12200
|
-
this.
|
|
12201
|
-
|
|
12202
|
-
|
|
12203
|
-
|
|
12204
|
-
|
|
12205
|
-
|
|
12206
|
-
|
|
12207
|
-
case 'opacity':
|
|
12208
|
-
case 'blur':
|
|
12209
|
-
case 'exposure':
|
|
12210
|
-
this.lowerContext.filter = this.canvasFilter = obj.previousObj;
|
|
12211
|
-
if (this.lowerContext.filter.split(' ').length > 1 &&
|
|
12212
|
-
this.lowerContext.filter.split(' ')[0].split('(')[1].split(')')[0] === '1') {
|
|
12213
|
-
this.isBrightnessAdjusted = false;
|
|
12482
|
+
if (!isNullOrUndefined(this.activeObj) && this.activeObj.activePoint.width !== 0
|
|
12483
|
+
&& this.activeObj.activePoint.height !== 0) {
|
|
12484
|
+
this.drawObject('duplicate');
|
|
12485
|
+
}
|
|
12486
|
+
else {
|
|
12487
|
+
this.textArea.style.display = 'block';
|
|
12488
|
+
this.textArea.value = obj.previousText;
|
|
12214
12489
|
}
|
|
12215
|
-
this.setAdjustment(obj.operation);
|
|
12216
|
-
this.isUndoRedo = true;
|
|
12217
12490
|
break;
|
|
12218
|
-
|
|
12219
|
-
|
|
12220
|
-
|
|
12221
|
-
|
|
12222
|
-
case 'grayscale':
|
|
12223
|
-
case 'sepia':
|
|
12224
|
-
case 'invert':
|
|
12225
|
-
this.updateFilter(obj);
|
|
12491
|
+
default:
|
|
12492
|
+
this.performUndoDefaultAction(obj);
|
|
12493
|
+
this.setAdjustment(obj.operation);
|
|
12494
|
+
this.updateFilter(obj.operation, obj.filter);
|
|
12226
12495
|
break;
|
|
12227
12496
|
}
|
|
12497
|
+
this.clearOuterCanvas(this.lowerContext);
|
|
12498
|
+
if (this.isCircleCrop && obj.operation !== 'crop') {
|
|
12499
|
+
this.cropCircle(this.lowerContext);
|
|
12500
|
+
}
|
|
12501
|
+
if (this.zoomFactor > 0) {
|
|
12502
|
+
this.dragCanvas = true;
|
|
12503
|
+
}
|
|
12504
|
+
this.isCancelAction = false;
|
|
12505
|
+
if (!isNullOrUndefined(this.activeObj.shape) && this.activeObj.shape.split('-')[0] === 'crop') {
|
|
12506
|
+
this.refreshToolbar('main', true, true);
|
|
12507
|
+
}
|
|
12508
|
+
else {
|
|
12509
|
+
this.refreshToolbar('main');
|
|
12510
|
+
}
|
|
12228
12511
|
}
|
|
12229
12512
|
}
|
|
12230
12513
|
}
|
|
@@ -12246,7 +12529,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
12246
12529
|
this.undoRedoStep++;
|
|
12247
12530
|
this.enableDisableToolbarBtn();
|
|
12248
12531
|
this.isUndoRedo = true;
|
|
12249
|
-
this.lowerContext.filter = this.canvasFilter;
|
|
12250
12532
|
const obj = this.undoRedoColl[this.undoRedoStep - 1];
|
|
12251
12533
|
if (this.undoRedoColl.length === this.undoRedoStep) {
|
|
12252
12534
|
this.currObjType.isUndoAction = false;
|
|
@@ -12254,74 +12536,49 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
12254
12536
|
else {
|
|
12255
12537
|
this.currObjType.isUndoAction = true;
|
|
12256
12538
|
}
|
|
12257
|
-
if (obj.operation !== '
|
|
12539
|
+
if (obj.operation !== 'textAreaCustomization' && this.textArea.style.display === 'block') {
|
|
12258
12540
|
this.textArea.style.display = 'none';
|
|
12259
12541
|
}
|
|
12260
12542
|
this.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
12261
|
-
|
|
12262
|
-
|
|
12263
|
-
|
|
12543
|
+
this.isCancelAction = true;
|
|
12544
|
+
this.cropObj = extend({}, obj.currentCropObj, {}, true);
|
|
12545
|
+
this.afterCropActions = obj.currentObj.afterCropActions;
|
|
12546
|
+
this.lowerContext.filter = this.canvasFilter = obj.currentObj.filter;
|
|
12547
|
+
let activeObj;
|
|
12264
12548
|
let tempUndoRedoColl;
|
|
12265
12549
|
let tempUndoRedoStep;
|
|
12266
|
-
let value = '';
|
|
12267
|
-
let currObj;
|
|
12268
12550
|
switch (obj.operation) {
|
|
12269
|
-
case '
|
|
12270
|
-
|
|
12271
|
-
|
|
12272
|
-
|
|
12273
|
-
|
|
12274
|
-
|
|
12275
|
-
|
|
12276
|
-
this.performTransformation(value);
|
|
12277
|
-
break;
|
|
12278
|
-
case 'flip':
|
|
12279
|
-
if (obj.value.toLowerCase() === 'horizontal') {
|
|
12280
|
-
value = 'horizontalflip';
|
|
12281
|
-
}
|
|
12282
|
-
else if (obj.value.toLowerCase() === 'vertical') {
|
|
12283
|
-
value = 'verticalflip';
|
|
12284
|
-
}
|
|
12285
|
-
this.performTransformation(value);
|
|
12286
|
-
break;
|
|
12287
|
-
case 'zoom':
|
|
12288
|
-
this.zoom(obj.value);
|
|
12289
|
-
break;
|
|
12290
|
-
case 'pan':
|
|
12291
|
-
xDiff = this.destLeft;
|
|
12292
|
-
yDiff = this.destTop;
|
|
12293
|
-
this.destLeft = obj.currentObj.x;
|
|
12294
|
-
this.destTop = obj.currentObj.y;
|
|
12295
|
-
xDiff += this.destLeft;
|
|
12296
|
-
yDiff += this.destTop;
|
|
12297
|
-
this.drawPannedImage(xDiff, yDiff);
|
|
12298
|
-
break;
|
|
12299
|
-
case 'crop':
|
|
12300
|
-
this.cropImg();
|
|
12301
|
-
this.refreshToolbar('main');
|
|
12551
|
+
case 'shapeTransform':
|
|
12552
|
+
this.objColl = extend([], obj.currentObjColl, [], true);
|
|
12553
|
+
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12554
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12555
|
+
this.isUndoRedo = true;
|
|
12556
|
+
this.redrawImgWithObj();
|
|
12557
|
+
this.refreshActiveObj();
|
|
12302
12558
|
break;
|
|
12303
12559
|
case 'freehanddraw':
|
|
12304
|
-
this.pointColl = obj.
|
|
12305
|
-
this.freehandCounter
|
|
12560
|
+
this.pointColl = obj.currentPointColl;
|
|
12561
|
+
this.freehandCounter = this.pointColl.length;
|
|
12306
12562
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12307
12563
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12308
12564
|
this.isUndoRedo = true;
|
|
12309
12565
|
this.redrawImgWithObj();
|
|
12310
12566
|
break;
|
|
12311
12567
|
case 'freehanddrawCustomized':
|
|
12312
|
-
this.pointColl = obj.
|
|
12568
|
+
this.pointColl = obj.currentPointColl;
|
|
12313
12569
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12314
12570
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12315
12571
|
this.isUndoRedo = true;
|
|
12316
12572
|
this.redrawImgWithObj();
|
|
12317
12573
|
break;
|
|
12318
|
-
case '
|
|
12319
|
-
|
|
12320
|
-
|
|
12321
|
-
this.
|
|
12574
|
+
case 'deleteFreehandDrawing':
|
|
12575
|
+
case 'deleteObj':
|
|
12576
|
+
if (obj.operation === 'deleteFreehandDrawing') {
|
|
12577
|
+
this.pointColl = obj.currentPointColl;
|
|
12578
|
+
this.freehandCounter = this.pointColl.length;
|
|
12322
12579
|
}
|
|
12323
|
-
else if (obj.
|
|
12324
|
-
this.objColl = obj.
|
|
12580
|
+
else if (obj.operation === 'deleteObj') {
|
|
12581
|
+
this.objColl = obj.currentObjColl;
|
|
12325
12582
|
}
|
|
12326
12583
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12327
12584
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
@@ -12329,15 +12586,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
12329
12586
|
this.redrawImgWithObj();
|
|
12330
12587
|
break;
|
|
12331
12588
|
case 'selectionTransform':
|
|
12332
|
-
|
|
12333
|
-
if (this.zoomFactor > 0) {
|
|
12334
|
-
this.zoom(-this.zoomFactor);
|
|
12335
|
-
}
|
|
12336
|
-
else {
|
|
12337
|
-
this.zoom(Math.abs(this.zoomFactor));
|
|
12338
|
-
}
|
|
12339
|
-
}
|
|
12340
|
-
this.activeObj = extend({}, obj.currentSelectionObj, {}, true);
|
|
12589
|
+
this.activeObj = extend({}, obj.currentObj.activeObj, {}, true);
|
|
12341
12590
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12342
12591
|
if (this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) {
|
|
12343
12592
|
this.drawObject('duplicate', this.activeObj);
|
|
@@ -12346,38 +12595,57 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
12346
12595
|
else {
|
|
12347
12596
|
this.refreshToolbar('main');
|
|
12348
12597
|
}
|
|
12598
|
+
this.currObjType.isCustomCrop = false;
|
|
12349
12599
|
break;
|
|
12350
|
-
case '
|
|
12351
|
-
this.objColl = extend([], obj.
|
|
12352
|
-
|
|
12353
|
-
|
|
12354
|
-
|
|
12355
|
-
|
|
12356
|
-
|
|
12357
|
-
|
|
12358
|
-
|
|
12359
|
-
|
|
12360
|
-
|
|
12361
|
-
|
|
12362
|
-
currObj = extend({}, obj.currentObj[i], {}, true);
|
|
12600
|
+
case 'textAreaCustomization':
|
|
12601
|
+
this.objColl = extend([], obj.currentObjColl, [], true);
|
|
12602
|
+
for (let i = 0; i < obj.currentObjColl.length; i++) {
|
|
12603
|
+
if (!isNullOrUndefined(this.tempActObj)) {
|
|
12604
|
+
if (this.tempActObj.currIndex === obj.currentObjColl[i].currIndex) {
|
|
12605
|
+
activeObj = extend({}, obj.currentObjColl[i], {}, true);
|
|
12606
|
+
this.objColl.splice(i, 1);
|
|
12607
|
+
break;
|
|
12608
|
+
}
|
|
12609
|
+
}
|
|
12610
|
+
else {
|
|
12611
|
+
activeObj = extend({}, obj.currentObjColl[obj.currentObjColl.length - 1], {}, true);
|
|
12363
12612
|
this.objColl.splice(i, 1);
|
|
12364
12613
|
break;
|
|
12365
12614
|
}
|
|
12366
12615
|
}
|
|
12367
|
-
if (!isNullOrUndefined(
|
|
12368
|
-
this.updateTextBox(
|
|
12616
|
+
if (!isNullOrUndefined(activeObj)) {
|
|
12617
|
+
this.updateTextBox(activeObj);
|
|
12369
12618
|
}
|
|
12370
12619
|
break;
|
|
12371
12620
|
case 'text':
|
|
12372
12621
|
if (!isNullOrUndefined(this.tempActObj)) {
|
|
12373
12622
|
this.activeObj = extend({}, this.tempActObj, {}, true);
|
|
12374
12623
|
}
|
|
12375
|
-
|
|
12624
|
+
if (obj.previousObjColl.length === 0 && this.objColl.length === 1) {
|
|
12625
|
+
this.tempActObj = extend({}, this.objColl[0], {}, true);
|
|
12626
|
+
}
|
|
12627
|
+
else {
|
|
12628
|
+
for (let i = 0; i < this.objColl.length; i++) {
|
|
12629
|
+
if (!isNullOrUndefined(this.objColl[i]) &&
|
|
12630
|
+
isNullOrUndefined(obj.previousObjColl[i])) {
|
|
12631
|
+
this.tempActObj = extend({}, this.objColl[i], {}, true);
|
|
12632
|
+
break;
|
|
12633
|
+
}
|
|
12634
|
+
if (obj.previousObjColl[i].currIndex !== this.objColl[i].currIndex) {
|
|
12635
|
+
this.tempActObj = extend({}, this.objColl[i], {}, true);
|
|
12636
|
+
break;
|
|
12637
|
+
}
|
|
12638
|
+
}
|
|
12639
|
+
}
|
|
12640
|
+
this.objColl = extend([], obj.currentObjColl, [], true);
|
|
12376
12641
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12377
12642
|
this.isUndoRedo = true;
|
|
12378
12643
|
this.redrawImgWithObj();
|
|
12644
|
+
if (!isNullOrUndefined(this.tempActObj)) {
|
|
12645
|
+
this.activeObj = extend({}, this.tempActObj, {}, true);
|
|
12646
|
+
}
|
|
12379
12647
|
this.textArea.style.display = 'block';
|
|
12380
|
-
this.textArea.value = obj.
|
|
12648
|
+
this.textArea.value = obj.currentText;
|
|
12381
12649
|
tempUndoRedoColl = extend([], this.undoRedoColl, [], true);
|
|
12382
12650
|
tempUndoRedoStep = this.undoRedoStep;
|
|
12383
12651
|
this.redrawActObj();
|
|
@@ -12385,39 +12653,49 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
12385
12653
|
this.undoRedoStep = tempUndoRedoStep;
|
|
12386
12654
|
this.textArea.style.display = 'none';
|
|
12387
12655
|
this.textArea.value = '';
|
|
12656
|
+
this.redrawActObj();
|
|
12388
12657
|
break;
|
|
12389
|
-
|
|
12390
|
-
|
|
12391
|
-
|
|
12392
|
-
|
|
12393
|
-
|
|
12394
|
-
|
|
12395
|
-
|
|
12396
|
-
|
|
12397
|
-
this.
|
|
12398
|
-
|
|
12399
|
-
|
|
12400
|
-
|
|
12401
|
-
|
|
12402
|
-
|
|
12403
|
-
|
|
12404
|
-
|
|
12405
|
-
|
|
12406
|
-
if (
|
|
12407
|
-
|
|
12408
|
-
}
|
|
12409
|
-
if (document.getElementById(this.element.id + '_' + obj.operation + 'Canvas')) {
|
|
12410
|
-
document.getElementById(this.element.id + '_' + obj.operation + 'Canvas').parentElement.classList.add('e-selected');
|
|
12658
|
+
default:
|
|
12659
|
+
this.objColl = [];
|
|
12660
|
+
this.pointColl = [];
|
|
12661
|
+
this.freehandCounter = 0;
|
|
12662
|
+
this.setCurrentObj(obj.currentObj);
|
|
12663
|
+
this.destLeft = obj.currentObj.destPoints.startX;
|
|
12664
|
+
this.destTop = obj.currentObj.destPoints.startY;
|
|
12665
|
+
activeObj = extend({}, this.activeObj, {}, true);
|
|
12666
|
+
this.objColl = extend([], obj.currentObjColl, [], true);
|
|
12667
|
+
this.pointColl = extend([], obj.currentPointColl, [], true);
|
|
12668
|
+
this.freehandCounter = this.pointColl.length;
|
|
12669
|
+
this.lowerContext.filter = 'none';
|
|
12670
|
+
this.iterateObjColl();
|
|
12671
|
+
this.freehandRedraw(this.lowerContext);
|
|
12672
|
+
this.lowerContext.filter = obj.currentObj.filter;
|
|
12673
|
+
this.activeObj = activeObj;
|
|
12674
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12675
|
+
if (this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) {
|
|
12676
|
+
this.drawObject('duplicate');
|
|
12411
12677
|
}
|
|
12412
|
-
this.
|
|
12413
|
-
this.
|
|
12414
|
-
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12415
|
-
this.redrawImgWithObj();
|
|
12678
|
+
this.setAdjustment(obj.operation);
|
|
12679
|
+
this.updateFilter(obj.operation);
|
|
12416
12680
|
break;
|
|
12417
12681
|
}
|
|
12682
|
+
this.clearOuterCanvas(this.lowerContext);
|
|
12683
|
+
if (this.isCircleCrop) {
|
|
12684
|
+
this.cropCircle(this.lowerContext);
|
|
12685
|
+
}
|
|
12686
|
+
if (this.zoomFactor > 0) {
|
|
12687
|
+
this.dragCanvas = true;
|
|
12688
|
+
}
|
|
12689
|
+
this.isCancelAction = false;
|
|
12418
12690
|
if (this.undoRedoStep === this.undoRedoColl.length) {
|
|
12419
12691
|
this.isUndoRedo = false;
|
|
12420
12692
|
}
|
|
12693
|
+
if (!isNullOrUndefined(this.activeObj.shape) && this.activeObj.shape.split('-')[0] === 'crop') {
|
|
12694
|
+
this.refreshToolbar('main', true, true);
|
|
12695
|
+
}
|
|
12696
|
+
else {
|
|
12697
|
+
this.refreshToolbar('main');
|
|
12698
|
+
}
|
|
12421
12699
|
}
|
|
12422
12700
|
}
|
|
12423
12701
|
}
|