@syncfusion/ej2-image-editor 20.4.49 → 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 +16 -0
- 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 +1154 -877
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +1150 -873
- 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 +1150 -863
|
@@ -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;
|
|
@@ -6658,7 +6880,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
6658
6880
|
}
|
|
6659
6881
|
updateTextFromTextArea() {
|
|
6660
6882
|
if (this.activeObj.keyHistory !== this.textArea.value) {
|
|
6661
|
-
|
|
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);
|
|
6662
6889
|
}
|
|
6663
6890
|
this.activeObj.keyHistory = this.textArea.value;
|
|
6664
6891
|
this.textArea.style.display = 'none';
|
|
@@ -6939,7 +7166,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
6939
7166
|
this.refreshActiveObj();
|
|
6940
7167
|
this.lowerContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
6941
7168
|
this.redrawImgWithObj();
|
|
6942
|
-
//this.zoomFreehandDrawColl();
|
|
6943
7169
|
if ((!isNullOrUndefined(this.currSelectionPoint) && this.currSelectionPoint.shape === 'crop-circle') || this.isCircleCrop) {
|
|
6944
7170
|
this.cropCircle(this.lowerContext);
|
|
6945
7171
|
}
|
|
@@ -8143,6 +8369,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
8143
8369
|
this.activeObj = extend({}, tempObj, {}, true);
|
|
8144
8370
|
}
|
|
8145
8371
|
drawObject(canvas, obj, isCropRatio, points, isPreventDrag, saveContext) {
|
|
8372
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
8146
8373
|
let canvasDraw;
|
|
8147
8374
|
if (canvas.toLowerCase() === 'original') {
|
|
8148
8375
|
canvasDraw = this.lowerContext;
|
|
@@ -9893,28 +10120,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
9893
10120
|
height: this.destHeight / this.objColl[i].activePoint.height };
|
|
9894
10121
|
}
|
|
9895
10122
|
}
|
|
9896
|
-
setTextFontSize(obj) {
|
|
9897
|
-
if (obj.shape === 'text') {
|
|
9898
|
-
const maxText = this.getMaxText(null, obj.keyHistory);
|
|
9899
|
-
let degree;
|
|
9900
|
-
if (obj.shapeDegree === 0) {
|
|
9901
|
-
degree = this.degree;
|
|
9902
|
-
}
|
|
9903
|
-
else {
|
|
9904
|
-
degree = this.degree - obj.shapeDegree;
|
|
9905
|
-
}
|
|
9906
|
-
let multiplier = 2;
|
|
9907
|
-
if (maxText.length === 1) {
|
|
9908
|
-
multiplier = 1;
|
|
9909
|
-
}
|
|
9910
|
-
if (degree === 0 || degree === 180 || degree === -180) {
|
|
9911
|
-
obj.textSettings.fontSize = (obj.activePoint.width / maxText.length) * multiplier;
|
|
9912
|
-
}
|
|
9913
|
-
else {
|
|
9914
|
-
obj.textSettings.fontSize = (obj.activePoint.height / maxText.length) * multiplier;
|
|
9915
|
-
}
|
|
9916
|
-
}
|
|
9917
|
-
}
|
|
9918
10123
|
redrawShape(obj) {
|
|
9919
10124
|
for (let i = 0; i < this.objColl.length; i++) {
|
|
9920
10125
|
if (JSON.stringify(obj) === JSON.stringify(this.objColl[i])) {
|
|
@@ -10115,7 +10320,10 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10115
10320
|
}
|
|
10116
10321
|
this.togglePen = false;
|
|
10117
10322
|
this.redrawActObj();
|
|
10118
|
-
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);
|
|
10119
10327
|
this.keyHistory = '';
|
|
10120
10328
|
this.refreshActiveObj();
|
|
10121
10329
|
this.activeObj.shape = 'text';
|
|
@@ -10179,10 +10387,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10179
10387
|
this.activeObj.textFlip = this.currFlipState;
|
|
10180
10388
|
this.updateFontRatio(this.activeObj);
|
|
10181
10389
|
this.objColl.push(this.activeObj);
|
|
10182
|
-
|
|
10183
|
-
|
|
10184
|
-
sharpen: this.adjustmentLevel.sharpen, bw: this.adjustmentLevel.bw });
|
|
10185
|
-
this.undoRedoStep++;
|
|
10390
|
+
const prevCropObj = extend({}, this.cropObj, {}, true);
|
|
10391
|
+
this.updateUndoRedoColl('shapeTransform', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10186
10392
|
this.redrawShape(this.objColl[this.objColl.length - 1]);
|
|
10187
10393
|
this.isShapeInserted = true;
|
|
10188
10394
|
this.refreshToolbar('text');
|
|
@@ -10327,6 +10533,43 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10327
10533
|
}
|
|
10328
10534
|
}
|
|
10329
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
|
+
}
|
|
10330
10573
|
}
|
|
10331
10574
|
setClientTransformedDimension(isPreventDimension) {
|
|
10332
10575
|
if (this.degree % 90 === 0 && this.degree % 180 !== 0) {
|
|
@@ -10343,100 +10586,110 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10343
10586
|
}
|
|
10344
10587
|
}
|
|
10345
10588
|
}
|
|
10346
|
-
popForDefaultTransformedState() {
|
|
10589
|
+
popForDefaultTransformedState(collection) {
|
|
10347
10590
|
let rotateRight = 0;
|
|
10348
10591
|
let rotateleft = 0;
|
|
10349
10592
|
let horizontal = 0;
|
|
10350
10593
|
let vertical = 0;
|
|
10351
|
-
for (let i = 0; i <
|
|
10352
|
-
if (
|
|
10594
|
+
for (let i = 0; i < collection.length; i++) {
|
|
10595
|
+
if (collection[i] === 90 || collection[i] === 'rotateRight') {
|
|
10353
10596
|
rotateRight++;
|
|
10354
10597
|
rotateleft = 0;
|
|
10355
10598
|
horizontal = 0;
|
|
10356
10599
|
vertical = 0;
|
|
10357
10600
|
if (rotateRight === 4) {
|
|
10358
|
-
|
|
10359
|
-
|
|
10360
|
-
|
|
10361
|
-
|
|
10601
|
+
collection.pop();
|
|
10602
|
+
collection.pop();
|
|
10603
|
+
collection.pop();
|
|
10604
|
+
collection.pop();
|
|
10362
10605
|
}
|
|
10363
10606
|
}
|
|
10364
|
-
else if (
|
|
10607
|
+
else if (collection[i] === -90 || collection[i] === 'rotateLeft') {
|
|
10365
10608
|
rotateleft++;
|
|
10366
10609
|
rotateRight = 0;
|
|
10367
10610
|
horizontal = 0;
|
|
10368
10611
|
vertical = 0;
|
|
10369
10612
|
if (rotateleft === 4) {
|
|
10370
|
-
|
|
10371
|
-
|
|
10372
|
-
|
|
10373
|
-
|
|
10613
|
+
collection.pop();
|
|
10614
|
+
collection.pop();
|
|
10615
|
+
collection.pop();
|
|
10616
|
+
collection.pop();
|
|
10374
10617
|
}
|
|
10375
10618
|
}
|
|
10376
|
-
else if (
|
|
10619
|
+
else if (collection[i] === 'horizontal' || collection[i] === 'horizontalflip') {
|
|
10377
10620
|
horizontal++;
|
|
10378
10621
|
rotateleft = 0;
|
|
10379
10622
|
rotateRight = 0;
|
|
10380
10623
|
vertical = 0;
|
|
10381
10624
|
if (horizontal === 2) {
|
|
10382
|
-
|
|
10383
|
-
|
|
10625
|
+
collection.pop();
|
|
10626
|
+
collection.pop();
|
|
10384
10627
|
}
|
|
10385
10628
|
}
|
|
10386
|
-
else if (
|
|
10629
|
+
else if (collection[i] === 'vertical' || collection[i] === 'verticalflip') {
|
|
10387
10630
|
vertical++;
|
|
10388
10631
|
horizontal = 0;
|
|
10389
10632
|
rotateleft = 0;
|
|
10390
10633
|
rotateRight = 0;
|
|
10391
10634
|
if (vertical === 2) {
|
|
10392
|
-
|
|
10393
|
-
|
|
10635
|
+
collection.pop();
|
|
10636
|
+
collection.pop();
|
|
10394
10637
|
}
|
|
10395
10638
|
}
|
|
10396
10639
|
}
|
|
10640
|
+
return collection;
|
|
10397
10641
|
}
|
|
10398
|
-
popForDefaultFlipState() {
|
|
10399
|
-
for (let i = 0; i <
|
|
10400
|
-
if (!isNullOrUndefined(
|
|
10401
|
-
if (
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
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();
|
|
10407
10653
|
}
|
|
10408
|
-
else if (
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
|
|
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();
|
|
10414
10662
|
}
|
|
10415
10663
|
}
|
|
10416
10664
|
}
|
|
10665
|
+
return collection;
|
|
10417
10666
|
}
|
|
10418
|
-
popForDefaultRotateState() {
|
|
10419
|
-
for (let i = 0; i <
|
|
10420
|
-
if (!isNullOrUndefined(
|
|
10421
|
-
if (
|
|
10422
|
-
|
|
10423
|
-
|
|
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();
|
|
10424
10674
|
}
|
|
10425
|
-
else if (
|
|
10426
|
-
|
|
10427
|
-
|
|
10675
|
+
else if ((collection[i] === -90 || collection[i] === 'rotateLeft') &&
|
|
10676
|
+
(collection[i + 1] === 90 || collection[i] === 'rotateRight')) {
|
|
10677
|
+
collection.pop();
|
|
10678
|
+
collection.pop();
|
|
10428
10679
|
}
|
|
10429
10680
|
}
|
|
10430
10681
|
}
|
|
10682
|
+
return collection;
|
|
10431
10683
|
}
|
|
10432
|
-
alignRotateFlipColl() {
|
|
10433
|
-
this.popForDefaultTransformedState();
|
|
10434
|
-
this.popForDefaultFlipState();
|
|
10435
|
-
this.popForDefaultRotateState();
|
|
10436
|
-
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) {
|
|
10437
10689
|
this.degree = 0;
|
|
10438
10690
|
this.currFlipState = '';
|
|
10439
10691
|
}
|
|
10692
|
+
return collection;
|
|
10440
10693
|
}
|
|
10441
10694
|
updateFlipColl(direction) {
|
|
10442
10695
|
if (this.flipColl.length === 0) {
|
|
@@ -10607,35 +10860,51 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10607
10860
|
this.applyPenDraw();
|
|
10608
10861
|
this.adjustmentLevel.brightness = value;
|
|
10609
10862
|
value = this.getFilterValue(value);
|
|
10610
|
-
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);
|
|
10611
10868
|
this.updateAdjustment('brightness', value);
|
|
10612
|
-
this.updateUndoRedoColl('brightness',
|
|
10869
|
+
this.updateUndoRedoColl('brightness', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10613
10870
|
}
|
|
10614
10871
|
setContrast(value) {
|
|
10615
10872
|
this.applyPenDraw();
|
|
10616
10873
|
this.adjustmentLevel.contrast = value;
|
|
10617
|
-
const temp = this.lowerContext.filter;
|
|
10618
10874
|
value = this.getFilterValue(value);
|
|
10619
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);
|
|
10620
10881
|
this.updateAdjustment('contrast', value);
|
|
10621
|
-
this.updateUndoRedoColl('contrast',
|
|
10882
|
+
this.updateUndoRedoColl('contrast', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10622
10883
|
}
|
|
10623
10884
|
setHue(value) {
|
|
10624
10885
|
this.applyPenDraw();
|
|
10625
10886
|
this.adjustmentLevel.hue = value;
|
|
10626
10887
|
value *= 3;
|
|
10627
|
-
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);
|
|
10628
10893
|
this.updateAdjustment('hue', value);
|
|
10629
|
-
this.updateUndoRedoColl('hue',
|
|
10894
|
+
this.updateUndoRedoColl('hue', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10630
10895
|
}
|
|
10631
10896
|
setSaturation(value) {
|
|
10632
10897
|
this.applyPenDraw();
|
|
10633
10898
|
this.adjustmentLevel.saturation = value;
|
|
10634
10899
|
value = this.getSaturationFilterValue(value);
|
|
10635
10900
|
value *= 100;
|
|
10636
|
-
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);
|
|
10637
10906
|
this.updateAdjustment('saturation', value);
|
|
10638
|
-
this.updateUndoRedoColl('saturation',
|
|
10907
|
+
this.updateUndoRedoColl('saturation', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10639
10908
|
}
|
|
10640
10909
|
setOpacity(value) {
|
|
10641
10910
|
this.applyPenDraw();
|
|
@@ -10658,9 +10927,13 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10658
10927
|
else if (value === 0) {
|
|
10659
10928
|
value = 0.25;
|
|
10660
10929
|
}
|
|
10661
|
-
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);
|
|
10662
10935
|
this.updateAdjustment('opacity', value);
|
|
10663
|
-
this.updateUndoRedoColl('opacity',
|
|
10936
|
+
this.updateUndoRedoColl('opacity', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10664
10937
|
}
|
|
10665
10938
|
setBlur(value) {
|
|
10666
10939
|
this.applyPenDraw();
|
|
@@ -10668,25 +10941,37 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10668
10941
|
value /= 20;
|
|
10669
10942
|
// Since 0.5 is not working in blur we consider from 1
|
|
10670
10943
|
value += 0.5;
|
|
10671
|
-
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);
|
|
10672
10949
|
this.updateAdjustment('blur', value);
|
|
10673
|
-
this.updateUndoRedoColl('blur',
|
|
10950
|
+
this.updateUndoRedoColl('blur', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10674
10951
|
}
|
|
10675
10952
|
setExposure(value) {
|
|
10676
10953
|
this.applyPenDraw();
|
|
10677
10954
|
this.adjustmentLevel.exposure = value;
|
|
10678
10955
|
value = this.getFilterValue(value);
|
|
10679
|
-
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);
|
|
10680
10961
|
this.updateAdjustment('exposure', value);
|
|
10681
|
-
this.updateUndoRedoColl('exposure',
|
|
10962
|
+
this.updateUndoRedoColl('exposure', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10682
10963
|
}
|
|
10683
10964
|
setFilter(type) {
|
|
10684
10965
|
type = type.toLowerCase();
|
|
10685
10966
|
this.applyPenDraw();
|
|
10686
|
-
const tempFilter = this.lowerContext.filter;
|
|
10687
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);
|
|
10688
10973
|
this.updateAdjustment(type, null);
|
|
10689
|
-
this.updateUndoRedoColl(type,
|
|
10974
|
+
this.updateUndoRedoColl(type, prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj, null, null, prevFilter);
|
|
10690
10975
|
}
|
|
10691
10976
|
renderImage() {
|
|
10692
10977
|
const temp = this.lowerContext.filter;
|
|
@@ -10721,8 +11006,81 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10721
11006
|
this.updateFontStyles();
|
|
10722
11007
|
this.textArea.style.width = this.activeObj.activePoint.width + 'px';
|
|
10723
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
|
+
}
|
|
10724
11083
|
setAdjustment(type) {
|
|
10725
|
-
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
10726
11084
|
const splitWords = this.lowerContext.filter.split(' ');
|
|
10727
11085
|
let value;
|
|
10728
11086
|
let valueArr;
|
|
@@ -10785,59 +11143,25 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10785
11143
|
this.adjustmentLevel.exposure = this.setFilterValue(value);
|
|
10786
11144
|
break;
|
|
10787
11145
|
}
|
|
10788
|
-
this.callUpdateCurrentTransformedState();
|
|
10789
11146
|
}
|
|
10790
|
-
updateFilter(
|
|
10791
|
-
|
|
10792
|
-
|
|
10793
|
-
|
|
10794
|
-
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
filterCanvas.parentElement.classList.add('e-selected');
|
|
10798
|
-
}
|
|
10799
|
-
this.currentFilter = obj.value;
|
|
10800
|
-
this.lowerContext.filter = this.canvasFilter = obj.previousObj;
|
|
10801
|
-
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
10802
|
-
this.isUndoRedo = true;
|
|
10803
|
-
this.redrawImgWithObj();
|
|
10804
|
-
}
|
|
10805
|
-
drawNewSelection(type, startX, startY, width, height) {
|
|
10806
|
-
let points;
|
|
10807
|
-
const cropShape = 'crop-' + type;
|
|
10808
|
-
if (cropShape.toLowerCase() === 'crop-custom') {
|
|
10809
|
-
if (this.currObjType.shape === '') {
|
|
10810
|
-
this.drawCustomSelection('crop-custom');
|
|
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');
|
|
10811
11154
|
}
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
this.activeObj.activePoint.startX = startX;
|
|
10816
|
-
this.activeObj.activePoint.startY = startY;
|
|
10817
|
-
this.activeObj.activePoint.endX = this.lowerCanvas.width;
|
|
10818
|
-
this.activeObj.activePoint.endY = this.lowerCanvas.height;
|
|
10819
|
-
this.activeObj.activePoint.width = this.activeObj.activePoint.endX - this.activeObj.activePoint.startX;
|
|
10820
|
-
this.activeObj.activePoint.height = this.activeObj.activePoint.endY - this.activeObj.activePoint.startY;
|
|
10821
|
-
this.drawObject('duplicate');
|
|
11155
|
+
const filterCanvas = document.getElementById(this.element.id + '_' + type + 'Canvas');
|
|
11156
|
+
if (filterCanvas) {
|
|
11157
|
+
filterCanvas.parentElement.classList.add('e-selected');
|
|
10822
11158
|
}
|
|
10823
|
-
|
|
10824
|
-
|
|
10825
|
-
this.upperCanvas.style.display = 'none';
|
|
10826
|
-
this.dragCanvas = true;
|
|
10827
|
-
}
|
|
10828
|
-
else {
|
|
10829
|
-
this.currObjType.isCustomCrop = false;
|
|
10830
|
-
this.currObjType.shape = cropShape.toLowerCase();
|
|
10831
|
-
if (width && height) {
|
|
10832
|
-
points = { startX: startX, startY: startY, endX: startX + width, endY: startY + height,
|
|
10833
|
-
width: width, height: height };
|
|
11159
|
+
if (!isNullOrUndefined(previousFilter)) {
|
|
11160
|
+
this.currentFilter = previousFilter;
|
|
10834
11161
|
}
|
|
10835
|
-
else
|
|
10836
|
-
|
|
10837
|
-
width: width, height: width };
|
|
11162
|
+
else {
|
|
11163
|
+
this.currentFilter = this.element.id + '_' + type;
|
|
10838
11164
|
}
|
|
10839
|
-
this.activeObj.shape = cropShape.toLowerCase();
|
|
10840
|
-
this.drawObject('duplicate', null, true, points);
|
|
10841
11165
|
}
|
|
10842
11166
|
}
|
|
10843
11167
|
/**
|
|
@@ -10878,11 +11202,15 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10878
11202
|
}
|
|
10879
11203
|
if (!this.disabled && this.activeObj.horTopLine !== undefined && (this.currObjType.isCustomCrop || splitWords[0] === 'crop')) {
|
|
10880
11204
|
isCrop = true;
|
|
10881
|
-
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);
|
|
10882
11210
|
this.cropImg();
|
|
10883
11211
|
this.zoomFactor = 0;
|
|
10884
11212
|
this.enableDisableToolbarBtn();
|
|
10885
|
-
this.updateUndoRedoColl('crop',
|
|
11213
|
+
this.updateUndoRedoColl('crop', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10886
11214
|
}
|
|
10887
11215
|
}
|
|
10888
11216
|
return isCrop;
|
|
@@ -10895,9 +11223,17 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10895
11223
|
*/
|
|
10896
11224
|
flip(direction) {
|
|
10897
11225
|
if (!this.disabled && this.isImageLoaded) {
|
|
10898
|
-
const zoomFactor = this.zoomFactor;
|
|
10899
11226
|
const transitionArgs = { direction: direction };
|
|
10900
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');
|
|
10901
11237
|
let splitWords = [];
|
|
10902
11238
|
let activeObjShape;
|
|
10903
11239
|
if (!isNullOrUndefined(this.activeObj.activePoint)) {
|
|
@@ -10956,7 +11292,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10956
11292
|
this.rotateFlipColl.push(direction.toLowerCase());
|
|
10957
11293
|
}
|
|
10958
11294
|
if (this.rotateFlipColl.length === 1) {
|
|
10959
|
-
this.
|
|
11295
|
+
if (this.getCurrentPanRegion() === '') {
|
|
11296
|
+
this.setClientTransformedDimension();
|
|
11297
|
+
}
|
|
11298
|
+
else {
|
|
11299
|
+
this.setDestPointsForFlipState();
|
|
11300
|
+
}
|
|
10960
11301
|
}
|
|
10961
11302
|
if (this.isCircleCrop) {
|
|
10962
11303
|
this.cropCircle(this.lowerContext);
|
|
@@ -10995,8 +11336,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
10995
11336
|
}
|
|
10996
11337
|
this.lowerContext.filter = tempFilter;
|
|
10997
11338
|
this.refreshActiveObj();
|
|
10998
|
-
|
|
10999
|
-
|
|
11339
|
+
this.updateCurrSelectionPoint(direction.toLowerCase());
|
|
11340
|
+
if (!this.isUndoRedo && isNullOrUndefined(this.transformCurrentObj)) {
|
|
11341
|
+
this.updateUndoRedoColl('flip', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
11000
11342
|
}
|
|
11001
11343
|
this.isUndoRedo = false;
|
|
11002
11344
|
this.clearOuterCanvas(this.lowerContext);
|
|
@@ -11016,7 +11358,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11016
11358
|
else if (!this.isReverseFlip) {
|
|
11017
11359
|
this.refreshToolbar('main', true, true);
|
|
11018
11360
|
}
|
|
11019
|
-
this.alignRotateFlipColl();
|
|
11361
|
+
this.rotateFlipColl = this.alignRotateFlipColl(this.rotateFlipColl, true);
|
|
11020
11362
|
}
|
|
11021
11363
|
}
|
|
11022
11364
|
/**
|
|
@@ -11178,17 +11520,16 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11178
11520
|
this.selectedFreehandColor = '#42a5f5';
|
|
11179
11521
|
this.isFreehandDrawCustomized = false;
|
|
11180
11522
|
this.isShapeInserted = false;
|
|
11181
|
-
this.
|
|
11182
|
-
this.
|
|
11523
|
+
this.isAllowCropPan = false;
|
|
11524
|
+
this.tempPannedPoint = { x: 0, y: 0 };
|
|
11183
11525
|
this.currObjType = { shape: '', isDragging: false, isActiveObj: false, isText: false, isInitialText: false, isLine: false,
|
|
11184
11526
|
isInitialLine: false, isCustomCrop: false, isZoomed: false, isUndoZoom: false,
|
|
11185
11527
|
isUndoAction: false, isFiltered: false, isSave: false };
|
|
11186
|
-
this.isAllowCropPan = false;
|
|
11187
|
-
this.tempPannedPoint = { x: 0, y: 0 };
|
|
11188
11528
|
this.cropObj = { cropZoom: 0, defaultZoom: 0, totalPannedPoint: { x: 0, y: 0 }, totalPannedClientPoint: { x: 0, y: 0 },
|
|
11189
|
-
totalPannedInternalPoint: { x: 0, y: 0 },
|
|
11190
|
-
|
|
11191
|
-
|
|
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: '' };
|
|
11192
11533
|
this.afterCropActions = [];
|
|
11193
11534
|
this.isCancelAction = this.preventZoomBtn = this.isFreehandPointMoved = false;
|
|
11194
11535
|
this.isTouch = false;
|
|
@@ -11198,6 +11539,11 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11198
11539
|
this.tempCurrentFreehandDrawIndex = 0;
|
|
11199
11540
|
this.cancelObjColl = [];
|
|
11200
11541
|
this.cancelPointColl = [];
|
|
11542
|
+
this.freehandDrawSelectedId = null;
|
|
11543
|
+
this.transformCurrentObj = null;
|
|
11544
|
+
this.rotatedFlipCropSelection = false;
|
|
11545
|
+
this.panStartObj = null;
|
|
11546
|
+
this.currDestinationPoint = null;
|
|
11201
11547
|
this.updateCanvas();
|
|
11202
11548
|
this.refreshDropDownBtn(false);
|
|
11203
11549
|
this.enableDisableToolbarBtn();
|
|
@@ -11217,6 +11563,15 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11217
11563
|
isRotate = true;
|
|
11218
11564
|
const transitionArgs = { degree: degree };
|
|
11219
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');
|
|
11220
11575
|
let splitWords = [];
|
|
11221
11576
|
let activeObjShape;
|
|
11222
11577
|
if (!isNullOrUndefined(this.activeObj.activePoint) && !isNullOrUndefined(this.activeObj.shape)) {
|
|
@@ -11232,7 +11587,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11232
11587
|
}
|
|
11233
11588
|
this.redrawActObj();
|
|
11234
11589
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
11235
|
-
const zoomFactor = this.zoomFactor;
|
|
11236
11590
|
this.drawRotatedImage(degree);
|
|
11237
11591
|
this.clearOuterCanvas(this.lowerContext);
|
|
11238
11592
|
this.clearOuterCanvas(this.upperContext);
|
|
@@ -11245,8 +11599,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11245
11599
|
this.refreshToolbar('main', true, true);
|
|
11246
11600
|
}
|
|
11247
11601
|
}
|
|
11248
|
-
if (!this.isUndoRedo) {
|
|
11249
|
-
this.updateUndoRedoColl('rotate',
|
|
11602
|
+
if (!this.isUndoRedo && isNullOrUndefined(this.transformCurrentObj)) {
|
|
11603
|
+
this.updateUndoRedoColl('rotate', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
11250
11604
|
}
|
|
11251
11605
|
this.isUndoRedo = false;
|
|
11252
11606
|
if (isNullOrUndefined(this.activeObj.shape) && !this.isReverseRotate) {
|
|
@@ -11255,7 +11609,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11255
11609
|
else if (!this.isReverseRotate) {
|
|
11256
11610
|
this.refreshToolbar('main', true, true);
|
|
11257
11611
|
}
|
|
11258
|
-
this.alignRotateFlipColl();
|
|
11612
|
+
this.rotateFlipColl = this.alignRotateFlipColl(this.rotateFlipColl, true);
|
|
11259
11613
|
}
|
|
11260
11614
|
return isRotate;
|
|
11261
11615
|
}
|
|
@@ -11351,6 +11705,11 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11351
11705
|
else if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
11352
11706
|
isPrevent = true;
|
|
11353
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);
|
|
11354
11713
|
this.redrawActObj();
|
|
11355
11714
|
this.refreshActiveObj();
|
|
11356
11715
|
this.keyHistory = '';
|
|
@@ -11362,19 +11721,26 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11362
11721
|
if (this.defaultZoomFactor > 0) {
|
|
11363
11722
|
const zoomFactor = this.zoomFactor = this.defaultZoomFactor;
|
|
11364
11723
|
this.isCropTab = false;
|
|
11724
|
+
const isUndoRedo = this.isUndoRedo;
|
|
11365
11725
|
for (let i = 0; i < (zoomFactor * 10); i++) {
|
|
11726
|
+
this.isUndoRedo = true;
|
|
11366
11727
|
this.zoom(-0.1);
|
|
11367
11728
|
}
|
|
11729
|
+
this.isUndoRedo = isUndoRedo;
|
|
11368
11730
|
this.resetPanPoints();
|
|
11369
11731
|
}
|
|
11370
11732
|
this.cancelObjColl = extend([], this.objColl, [], true);
|
|
11371
11733
|
this.cancelPointColl = extend([], this.pointColl, [], true);
|
|
11734
|
+
this.updateObjAndFreeHandDrawColl();
|
|
11372
11735
|
this.isCropTab = true;
|
|
11373
11736
|
this.setCurrSelectionPoints(true);
|
|
11374
11737
|
this.zoomFactor = this.cropZoomFactor;
|
|
11375
11738
|
if (isNullOrUndefined(this.cropObj.activeObj.shape)) {
|
|
11376
11739
|
this.drawNewSelection(type, startX, startY, width, height);
|
|
11377
11740
|
}
|
|
11741
|
+
else {
|
|
11742
|
+
this.updateUndoRedoColl('crop-selection', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
11743
|
+
}
|
|
11378
11744
|
}
|
|
11379
11745
|
else {
|
|
11380
11746
|
if (type === 'custom') {
|
|
@@ -11449,23 +11815,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11449
11815
|
}
|
|
11450
11816
|
}
|
|
11451
11817
|
}
|
|
11452
|
-
setDestPointsForFlipState(isUpdate) {
|
|
11453
|
-
if (this.getCurrentPanRegion() !== '') {
|
|
11454
|
-
if (this.getCurrentPanRegion() === 'horizontal') {
|
|
11455
|
-
this.destLeft = this.lowerCanvas.clientWidth - (this.destWidth + this.destLeft);
|
|
11456
|
-
}
|
|
11457
|
-
else if (this.getCurrentPanRegion() === 'vertical') {
|
|
11458
|
-
this.destTop = this.lowerCanvas.clientHeight - (this.destHeight + this.destTop);
|
|
11459
|
-
}
|
|
11460
|
-
else {
|
|
11461
|
-
this.destLeft = this.lowerCanvas.clientWidth - (this.destWidth + this.destLeft);
|
|
11462
|
-
this.destTop = this.lowerCanvas.clientHeight - (this.destHeight + this.destTop);
|
|
11463
|
-
}
|
|
11464
|
-
if (!isNullOrUndefined(isUpdate)) {
|
|
11465
|
-
this.updateObjAndFreeHandDrawColl();
|
|
11466
|
-
}
|
|
11467
|
-
}
|
|
11468
|
-
}
|
|
11469
11818
|
/**
|
|
11470
11819
|
* Increase / Decrease the magnification of an image.
|
|
11471
11820
|
*
|
|
@@ -11474,7 +11823,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11474
11823
|
*/
|
|
11475
11824
|
zoom(value) {
|
|
11476
11825
|
if (!this.disabled && this.isImageLoaded) {
|
|
11477
|
-
if ((this.zoomFactor === 0 && value < 0) || (this.zoomFactor >
|
|
11826
|
+
if ((this.zoomFactor === 0 && value < 0) || (this.zoomFactor > 2 && value > 0 ||
|
|
11478
11827
|
(this.zoomFactor > 0 && value < 0 && this.disableZoomOutBtn()))) {
|
|
11479
11828
|
return;
|
|
11480
11829
|
}
|
|
@@ -11491,29 +11840,37 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11491
11840
|
else if (!isNullOrUndefined(this.activeObj.shape) && splitWords[0] !== 'crop') {
|
|
11492
11841
|
isShape = true;
|
|
11493
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);
|
|
11494
11861
|
this.redrawActObj();
|
|
11495
11862
|
this.refreshActiveObj();
|
|
11496
11863
|
this.upperContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
11497
11864
|
this.lowerContext.filter = this.canvasFilter;
|
|
11498
11865
|
this.upperCanvas.style.cursor = 'default';
|
|
11499
|
-
let zoomState;
|
|
11500
11866
|
let objColl = extend([], this.objColl, [], true);
|
|
11501
|
-
if (value === 3.75 || value === 1) {
|
|
11502
|
-
zoomState = 0.1;
|
|
11503
|
-
}
|
|
11504
|
-
else if (value === -3.75) {
|
|
11505
|
-
zoomState = -0.1;
|
|
11506
|
-
}
|
|
11507
|
-
else {
|
|
11508
|
-
zoomState = value;
|
|
11509
|
-
}
|
|
11510
11867
|
if (!this.isCropTab) {
|
|
11511
11868
|
if (this.degree !== 0) {
|
|
11512
11869
|
this.redrawActObj();
|
|
11513
11870
|
this.currentPannedPoint = { x: 0, y: 0 };
|
|
11514
|
-
this.rotatePan();
|
|
11871
|
+
this.rotatePan(true, true);
|
|
11515
11872
|
}
|
|
11516
|
-
this.
|
|
11873
|
+
this.updateObjAndFreeHandDrawColl();
|
|
11517
11874
|
}
|
|
11518
11875
|
if (this.degree === 0) {
|
|
11519
11876
|
this.drawZoomImgToCanvas(value, tempActiveObj);
|
|
@@ -11522,13 +11879,19 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11522
11879
|
this.tempFlipPanPoint.y += this.totalPannedPoint.y;
|
|
11523
11880
|
objColl = extend([], this.objColl, [], true);
|
|
11524
11881
|
this.objColl = [];
|
|
11882
|
+
const destLeft = this.destLeft;
|
|
11883
|
+
const destTop = this.destTop;
|
|
11884
|
+
this.setDestPointsForFlipState();
|
|
11525
11885
|
this.rotatedFlip();
|
|
11526
|
-
|
|
11527
|
-
|
|
11528
|
-
|
|
11529
|
-
|
|
11530
|
-
|
|
11531
|
-
|
|
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 };
|
|
11532
11895
|
}
|
|
11533
11896
|
}
|
|
11534
11897
|
else {
|
|
@@ -11551,19 +11914,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11551
11914
|
this.zoomFreehandDrawColl();
|
|
11552
11915
|
this.lowerContext.filter = temp;
|
|
11553
11916
|
}
|
|
11554
|
-
else if (this.degree === 0) {
|
|
11555
|
-
const temp = this.lowerContext.filter;
|
|
11556
|
-
this.lowerContext.filter = 'none';
|
|
11557
|
-
const destLeft = this.destLeft;
|
|
11558
|
-
const destTop = this.destTop;
|
|
11559
|
-
this.setDestPointsForFlipState();
|
|
11560
|
-
this.objColl = objColl;
|
|
11561
|
-
this.zoomObjColl();
|
|
11562
|
-
this.zoomFreehandDrawColl();
|
|
11563
|
-
this.destLeft = destLeft;
|
|
11564
|
-
this.destTop = destTop;
|
|
11565
|
-
this.lowerContext.filter = temp;
|
|
11566
|
-
}
|
|
11567
11917
|
if ((!isNullOrUndefined(this.currSelectionPoint) && this.currSelectionPoint.shape === 'crop-circle') || this.isCircleCrop) {
|
|
11568
11918
|
this.cropCircle(this.lowerContext);
|
|
11569
11919
|
}
|
|
@@ -11572,18 +11922,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11572
11922
|
if (!isNullOrUndefined(tempActiveObj)) {
|
|
11573
11923
|
this.activeObj = extend({}, tempActiveObj, {}, true);
|
|
11574
11924
|
this.drawObject('duplicate', this.activeObj);
|
|
11575
|
-
if (this.currentToolbar === 'crop') {
|
|
11576
|
-
this.refreshToolbar('main', true, true);
|
|
11577
|
-
}
|
|
11578
|
-
else {
|
|
11579
|
-
this.refreshToolbar(this.currentToolbar, true, true);
|
|
11580
|
-
}
|
|
11581
11925
|
if (this.zoomFactor === 0) {
|
|
11582
11926
|
this.currSelectionPoint = null;
|
|
11583
11927
|
}
|
|
11584
11928
|
}
|
|
11585
11929
|
if (!this.isUndoRedo) {
|
|
11586
|
-
this.updateUndoRedoColl('zoom',
|
|
11930
|
+
this.updateUndoRedoColl('zoom', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
11587
11931
|
}
|
|
11588
11932
|
this.isUndoRedo = false;
|
|
11589
11933
|
const zoomOut = document.querySelector('#' + this.element.id + '_zoomOut');
|
|
@@ -11595,9 +11939,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11595
11939
|
zoomOut.classList.remove('e-disabled');
|
|
11596
11940
|
zoomOut.parentElement.classList.remove('e-overlay');
|
|
11597
11941
|
}
|
|
11598
|
-
if (!this.togglePan) {
|
|
11599
|
-
this.callMainToolbar(false, true);
|
|
11600
|
-
}
|
|
11601
11942
|
this.autoEnablePan();
|
|
11602
11943
|
if (!isNullOrUndefined(tempActiveObj)) {
|
|
11603
11944
|
this.activeObj = extend({}, tempActiveObj, {}, true);
|
|
@@ -11605,24 +11946,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11605
11946
|
if (this.activeObj.shape === 'crop-custom') {
|
|
11606
11947
|
this.currObjType.isCustomCrop = true;
|
|
11607
11948
|
}
|
|
11608
|
-
if (isNullOrUndefined(this.activeObj.activePoint) || this.activeObj.activePoint.width === 0) {
|
|
11609
|
-
if (this.currentToolbar === 'crop' || !isNullOrUndefined(tempActiveObj)) {
|
|
11610
|
-
this.refreshToolbar('main', true, true);
|
|
11611
|
-
}
|
|
11612
|
-
else {
|
|
11613
|
-
this.refreshToolbar('main');
|
|
11614
|
-
this.currentToolbar = 'main';
|
|
11615
|
-
}
|
|
11616
|
-
}
|
|
11617
|
-
else {
|
|
11618
|
-
if (this.currentToolbar === 'crop' || !isNullOrUndefined(tempActiveObj)) {
|
|
11619
|
-
this.refreshToolbar('main', true, true);
|
|
11620
|
-
}
|
|
11621
|
-
else {
|
|
11622
|
-
this.refreshToolbar('main');
|
|
11623
|
-
this.currentToolbar = 'main';
|
|
11624
|
-
}
|
|
11625
|
-
}
|
|
11626
11949
|
const panBtn = this.element.querySelector('.e-img-pan .e-btn');
|
|
11627
11950
|
if (!isNullOrUndefined(panBtn) && this.togglePan) {
|
|
11628
11951
|
panBtn.classList.add('e-selected-btn');
|
|
@@ -11634,12 +11957,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
11634
11957
|
this.activeObj = extend({}, this.objColl[this.objColl.length - 1], {}, true);
|
|
11635
11958
|
this.objColl.pop();
|
|
11636
11959
|
this.drawObject('duplicate', this.activeObj);
|
|
11637
|
-
if (this.activeObj.shape === 'text') {
|
|
11638
|
-
this.refreshToolbar('text');
|
|
11639
|
-
}
|
|
11640
|
-
else {
|
|
11641
|
-
this.refreshToolbar('shapes');
|
|
11642
|
-
}
|
|
11643
11960
|
this.updateToolbarItems();
|
|
11644
11961
|
}
|
|
11645
11962
|
}
|
|
@@ -12043,14 +12360,13 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
12043
12360
|
else {
|
|
12044
12361
|
this.refreshToolbar('main');
|
|
12045
12362
|
}
|
|
12046
|
-
if (this.activeObj.activePoint.width !== 0) {
|
|
12363
|
+
if (!isNullOrUndefined(this.activeObj.activePoint) && this.activeObj.activePoint.width !== 0) {
|
|
12047
12364
|
this.tempActObj = this.activeObj;
|
|
12048
12365
|
}
|
|
12049
|
-
|
|
12366
|
+
this.refreshActiveObj();
|
|
12050
12367
|
this.undoRedoStep--;
|
|
12051
12368
|
this.enableDisableToolbarBtn();
|
|
12052
12369
|
this.isUndoRedo = true;
|
|
12053
|
-
this.lowerContext.filter = this.canvasFilter;
|
|
12054
12370
|
const obj = this.undoRedoColl[this.undoRedoStep];
|
|
12055
12371
|
if (this.undoRedoColl.length === this.undoRedoStep) {
|
|
12056
12372
|
this.currObjType.isUndoAction = false;
|
|
@@ -12058,82 +12374,47 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
12058
12374
|
else {
|
|
12059
12375
|
this.currObjType.isUndoAction = true;
|
|
12060
12376
|
}
|
|
12061
|
-
if (obj.operation !== '
|
|
12377
|
+
if (obj.operation !== 'textAreaCustomization' && this.textArea.style.display === 'block') {
|
|
12062
12378
|
this.textArea.style.display = 'none';
|
|
12063
12379
|
}
|
|
12064
12380
|
this.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
12065
|
-
|
|
12066
|
-
let
|
|
12067
|
-
|
|
12068
|
-
|
|
12069
|
-
|
|
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;
|
|
12070
12386
|
switch (obj.operation) {
|
|
12071
|
-
case '
|
|
12072
|
-
|
|
12073
|
-
|
|
12074
|
-
|
|
12075
|
-
else if (obj.value === -90) {
|
|
12076
|
-
value = 'rotateright';
|
|
12077
|
-
}
|
|
12078
|
-
this.performTransformation(value);
|
|
12079
|
-
break;
|
|
12080
|
-
case 'flip':
|
|
12081
|
-
if (obj.value.toLowerCase() === 'horizontal') {
|
|
12082
|
-
value = 'horizontalflip';
|
|
12083
|
-
}
|
|
12084
|
-
else if (obj.value.toLowerCase() === 'vertical') {
|
|
12085
|
-
value = 'verticalflip';
|
|
12086
|
-
}
|
|
12087
|
-
this.performTransformation(value);
|
|
12088
|
-
break;
|
|
12089
|
-
case 'zoom':
|
|
12090
|
-
if (this.zoomFactor === 0 && obj.zoomFactor !== 0) {
|
|
12091
|
-
this.zoomFactor = obj.zoomFactor;
|
|
12092
|
-
}
|
|
12093
|
-
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);
|
|
12094
12391
|
this.isUndoRedo = true;
|
|
12095
|
-
|
|
12096
|
-
|
|
12097
|
-
xDiff = this.destLeft;
|
|
12098
|
-
yDiff = this.destTop;
|
|
12099
|
-
this.destLeft = obj.previousObj.x;
|
|
12100
|
-
this.destTop = obj.previousObj.y;
|
|
12101
|
-
xDiff += this.destLeft;
|
|
12102
|
-
yDiff += this.destTop;
|
|
12103
|
-
this.drawPannedImage(xDiff, yDiff);
|
|
12104
|
-
break;
|
|
12105
|
-
case 'crop':
|
|
12106
|
-
if (!isNullOrUndefined(this.currSelectionPoint)) {
|
|
12107
|
-
tempUndoRedoColl = extend([], this.undoRedoColl, [], true);
|
|
12108
|
-
this.select('Custom');
|
|
12109
|
-
this.refreshToolbar('main', true, true);
|
|
12110
|
-
getComponent(this.element.querySelector('#' + this.element.id + '_cropBtn'), 'dropdown-btn').toggle();
|
|
12111
|
-
this.undoRedoColl = tempUndoRedoColl;
|
|
12112
|
-
this.enableDisableToolbarBtn();
|
|
12113
|
-
}
|
|
12392
|
+
this.redrawImgWithObj();
|
|
12393
|
+
this.refreshActiveObj();
|
|
12114
12394
|
break;
|
|
12115
12395
|
case 'freehanddraw':
|
|
12116
|
-
this.pointColl = obj.
|
|
12117
|
-
this.freehandCounter
|
|
12396
|
+
this.pointColl = obj.previousPointColl;
|
|
12397
|
+
this.freehandCounter = this.pointColl.length;
|
|
12118
12398
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12119
12399
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12120
12400
|
this.isUndoRedo = true;
|
|
12121
12401
|
this.redrawImgWithObj();
|
|
12122
12402
|
break;
|
|
12123
12403
|
case 'freehanddrawCustomized':
|
|
12124
|
-
this.pointColl = obj.
|
|
12404
|
+
this.pointColl = obj.previousPointColl;
|
|
12125
12405
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12126
12406
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12127
12407
|
this.isUndoRedo = true;
|
|
12128
12408
|
this.redrawImgWithObj();
|
|
12129
12409
|
break;
|
|
12130
|
-
case '
|
|
12131
|
-
|
|
12132
|
-
|
|
12133
|
-
this.
|
|
12410
|
+
case 'deleteFreehandDrawing':
|
|
12411
|
+
case 'deleteObj':
|
|
12412
|
+
if (obj.operation === 'deleteFreehandDrawing') {
|
|
12413
|
+
this.pointColl = obj.previousPointColl;
|
|
12414
|
+
this.freehandCounter = this.pointColl.length;
|
|
12134
12415
|
}
|
|
12135
|
-
else if (obj.
|
|
12136
|
-
this.objColl = obj.
|
|
12416
|
+
else if (obj.operation === 'deleteObj') {
|
|
12417
|
+
this.objColl = obj.previousObjColl;
|
|
12137
12418
|
}
|
|
12138
12419
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12139
12420
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
@@ -12141,7 +12422,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
12141
12422
|
this.redrawImgWithObj();
|
|
12142
12423
|
break;
|
|
12143
12424
|
case 'selectionTransform':
|
|
12144
|
-
this.activeObj = extend({}, obj.
|
|
12425
|
+
this.activeObj = extend({}, obj.previousObj.activeObj, {}, true);
|
|
12145
12426
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12146
12427
|
if (this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) {
|
|
12147
12428
|
this.drawObject('duplicate', this.activeObj);
|
|
@@ -12149,83 +12430,84 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
12149
12430
|
}
|
|
12150
12431
|
else {
|
|
12151
12432
|
this.refreshToolbar('main');
|
|
12433
|
+
this.performUndoDefaultAction(obj);
|
|
12152
12434
|
}
|
|
12153
12435
|
this.currObjType.isCustomCrop = false;
|
|
12154
12436
|
break;
|
|
12155
|
-
case '
|
|
12156
|
-
this.objColl = extend([], obj.
|
|
12157
|
-
|
|
12158
|
-
|
|
12159
|
-
|
|
12160
|
-
|
|
12161
|
-
|
|
12162
|
-
|
|
12163
|
-
|
|
12164
|
-
|
|
12165
|
-
|
|
12166
|
-
|
|
12167
|
-
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);
|
|
12168
12449
|
this.objColl.splice(i, 1);
|
|
12169
12450
|
break;
|
|
12170
12451
|
}
|
|
12171
12452
|
}
|
|
12172
|
-
if (!isNullOrUndefined(
|
|
12173
|
-
this.updateTextBox(
|
|
12453
|
+
if (!isNullOrUndefined(activeObj)) {
|
|
12454
|
+
this.updateTextBox(activeObj);
|
|
12174
12455
|
}
|
|
12175
12456
|
break;
|
|
12176
12457
|
case 'text':
|
|
12177
12458
|
if (!isNullOrUndefined(this.tempActObj)) {
|
|
12178
12459
|
this.activeObj = extend({}, this.tempActObj, {}, true);
|
|
12179
12460
|
}
|
|
12180
|
-
if (obj.
|
|
12461
|
+
if (obj.previousObjColl.length === 0 && this.objColl.length === 1) {
|
|
12181
12462
|
this.tempActObj = extend({}, this.objColl[0], {}, true);
|
|
12182
12463
|
}
|
|
12183
12464
|
else {
|
|
12184
12465
|
for (let i = 0; i < this.objColl.length; i++) {
|
|
12185
12466
|
if (!isNullOrUndefined(this.objColl[i]) &&
|
|
12186
|
-
isNullOrUndefined(obj.
|
|
12187
|
-
this.tempActObj = extend({},
|
|
12467
|
+
isNullOrUndefined(obj.previousObjColl[i])) {
|
|
12468
|
+
this.tempActObj = extend({}, this.objColl[i], {}, true);
|
|
12188
12469
|
break;
|
|
12189
12470
|
}
|
|
12190
|
-
if (obj.
|
|
12471
|
+
if (obj.previousObjColl[i].currIndex !== this.objColl[i].currIndex) {
|
|
12191
12472
|
this.tempActObj = extend({}, this.objColl[i], {}, true);
|
|
12192
12473
|
break;
|
|
12193
12474
|
}
|
|
12194
12475
|
}
|
|
12195
12476
|
}
|
|
12196
12477
|
this.activeObj = extend({}, this.tempActObj, {}, true);
|
|
12197
|
-
this.objColl = extend([], obj.
|
|
12478
|
+
this.objColl = extend([], obj.previousObjColl, [], true);
|
|
12198
12479
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12199
12480
|
this.isUndoRedo = true;
|
|
12200
12481
|
this.redrawImgWithObj();
|
|
12201
|
-
this.
|
|
12202
|
-
|
|
12203
|
-
|
|
12204
|
-
|
|
12205
|
-
|
|
12206
|
-
|
|
12207
|
-
|
|
12208
|
-
case 'opacity':
|
|
12209
|
-
case 'blur':
|
|
12210
|
-
case 'exposure':
|
|
12211
|
-
this.lowerContext.filter = this.canvasFilter = obj.previousObj;
|
|
12212
|
-
if (this.lowerContext.filter.split(' ').length > 1 &&
|
|
12213
|
-
this.lowerContext.filter.split(' ')[0].split('(')[1].split(')')[0] === '1') {
|
|
12214
|
-
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;
|
|
12215
12489
|
}
|
|
12216
|
-
this.setAdjustment(obj.operation);
|
|
12217
|
-
this.isUndoRedo = true;
|
|
12218
12490
|
break;
|
|
12219
|
-
|
|
12220
|
-
|
|
12221
|
-
|
|
12222
|
-
|
|
12223
|
-
case 'grayscale':
|
|
12224
|
-
case 'sepia':
|
|
12225
|
-
case 'invert':
|
|
12226
|
-
this.updateFilter(obj);
|
|
12491
|
+
default:
|
|
12492
|
+
this.performUndoDefaultAction(obj);
|
|
12493
|
+
this.setAdjustment(obj.operation);
|
|
12494
|
+
this.updateFilter(obj.operation, obj.filter);
|
|
12227
12495
|
break;
|
|
12228
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
|
+
}
|
|
12229
12511
|
}
|
|
12230
12512
|
}
|
|
12231
12513
|
}
|
|
@@ -12247,7 +12529,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
12247
12529
|
this.undoRedoStep++;
|
|
12248
12530
|
this.enableDisableToolbarBtn();
|
|
12249
12531
|
this.isUndoRedo = true;
|
|
12250
|
-
this.lowerContext.filter = this.canvasFilter;
|
|
12251
12532
|
const obj = this.undoRedoColl[this.undoRedoStep - 1];
|
|
12252
12533
|
if (this.undoRedoColl.length === this.undoRedoStep) {
|
|
12253
12534
|
this.currObjType.isUndoAction = false;
|
|
@@ -12255,74 +12536,49 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
12255
12536
|
else {
|
|
12256
12537
|
this.currObjType.isUndoAction = true;
|
|
12257
12538
|
}
|
|
12258
|
-
if (obj.operation !== '
|
|
12539
|
+
if (obj.operation !== 'textAreaCustomization' && this.textArea.style.display === 'block') {
|
|
12259
12540
|
this.textArea.style.display = 'none';
|
|
12260
12541
|
}
|
|
12261
12542
|
this.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
12262
|
-
|
|
12263
|
-
|
|
12264
|
-
|
|
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;
|
|
12265
12548
|
let tempUndoRedoColl;
|
|
12266
12549
|
let tempUndoRedoStep;
|
|
12267
|
-
let value = '';
|
|
12268
|
-
let currObj;
|
|
12269
12550
|
switch (obj.operation) {
|
|
12270
|
-
case '
|
|
12271
|
-
|
|
12272
|
-
|
|
12273
|
-
|
|
12274
|
-
|
|
12275
|
-
|
|
12276
|
-
|
|
12277
|
-
this.performTransformation(value);
|
|
12278
|
-
break;
|
|
12279
|
-
case 'flip':
|
|
12280
|
-
if (obj.value.toLowerCase() === 'horizontal') {
|
|
12281
|
-
value = 'horizontalflip';
|
|
12282
|
-
}
|
|
12283
|
-
else if (obj.value.toLowerCase() === 'vertical') {
|
|
12284
|
-
value = 'verticalflip';
|
|
12285
|
-
}
|
|
12286
|
-
this.performTransformation(value);
|
|
12287
|
-
break;
|
|
12288
|
-
case 'zoom':
|
|
12289
|
-
this.zoom(obj.value);
|
|
12290
|
-
break;
|
|
12291
|
-
case 'pan':
|
|
12292
|
-
xDiff = this.destLeft;
|
|
12293
|
-
yDiff = this.destTop;
|
|
12294
|
-
this.destLeft = obj.currentObj.x;
|
|
12295
|
-
this.destTop = obj.currentObj.y;
|
|
12296
|
-
xDiff += this.destLeft;
|
|
12297
|
-
yDiff += this.destTop;
|
|
12298
|
-
this.drawPannedImage(xDiff, yDiff);
|
|
12299
|
-
break;
|
|
12300
|
-
case 'crop':
|
|
12301
|
-
this.cropImg();
|
|
12302
|
-
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();
|
|
12303
12558
|
break;
|
|
12304
12559
|
case 'freehanddraw':
|
|
12305
|
-
this.pointColl = obj.
|
|
12306
|
-
this.freehandCounter
|
|
12560
|
+
this.pointColl = obj.currentPointColl;
|
|
12561
|
+
this.freehandCounter = this.pointColl.length;
|
|
12307
12562
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12308
12563
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12309
12564
|
this.isUndoRedo = true;
|
|
12310
12565
|
this.redrawImgWithObj();
|
|
12311
12566
|
break;
|
|
12312
12567
|
case 'freehanddrawCustomized':
|
|
12313
|
-
this.pointColl = obj.
|
|
12568
|
+
this.pointColl = obj.currentPointColl;
|
|
12314
12569
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12315
12570
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12316
12571
|
this.isUndoRedo = true;
|
|
12317
12572
|
this.redrawImgWithObj();
|
|
12318
12573
|
break;
|
|
12319
|
-
case '
|
|
12320
|
-
|
|
12321
|
-
|
|
12322
|
-
this.
|
|
12574
|
+
case 'deleteFreehandDrawing':
|
|
12575
|
+
case 'deleteObj':
|
|
12576
|
+
if (obj.operation === 'deleteFreehandDrawing') {
|
|
12577
|
+
this.pointColl = obj.currentPointColl;
|
|
12578
|
+
this.freehandCounter = this.pointColl.length;
|
|
12323
12579
|
}
|
|
12324
|
-
else if (obj.
|
|
12325
|
-
this.objColl = obj.
|
|
12580
|
+
else if (obj.operation === 'deleteObj') {
|
|
12581
|
+
this.objColl = obj.currentObjColl;
|
|
12326
12582
|
}
|
|
12327
12583
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12328
12584
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
@@ -12330,15 +12586,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
12330
12586
|
this.redrawImgWithObj();
|
|
12331
12587
|
break;
|
|
12332
12588
|
case 'selectionTransform':
|
|
12333
|
-
|
|
12334
|
-
if (this.zoomFactor > 0) {
|
|
12335
|
-
this.zoom(-this.zoomFactor);
|
|
12336
|
-
}
|
|
12337
|
-
else {
|
|
12338
|
-
this.zoom(Math.abs(this.zoomFactor));
|
|
12339
|
-
}
|
|
12340
|
-
}
|
|
12341
|
-
this.activeObj = extend({}, obj.currentSelectionObj, {}, true);
|
|
12589
|
+
this.activeObj = extend({}, obj.currentObj.activeObj, {}, true);
|
|
12342
12590
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12343
12591
|
if (this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) {
|
|
12344
12592
|
this.drawObject('duplicate', this.activeObj);
|
|
@@ -12347,38 +12595,57 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
12347
12595
|
else {
|
|
12348
12596
|
this.refreshToolbar('main');
|
|
12349
12597
|
}
|
|
12598
|
+
this.currObjType.isCustomCrop = false;
|
|
12350
12599
|
break;
|
|
12351
|
-
case '
|
|
12352
|
-
this.objColl = extend([], obj.
|
|
12353
|
-
|
|
12354
|
-
|
|
12355
|
-
|
|
12356
|
-
|
|
12357
|
-
|
|
12358
|
-
|
|
12359
|
-
|
|
12360
|
-
|
|
12361
|
-
|
|
12362
|
-
|
|
12363
|
-
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);
|
|
12364
12612
|
this.objColl.splice(i, 1);
|
|
12365
12613
|
break;
|
|
12366
12614
|
}
|
|
12367
12615
|
}
|
|
12368
|
-
if (!isNullOrUndefined(
|
|
12369
|
-
this.updateTextBox(
|
|
12616
|
+
if (!isNullOrUndefined(activeObj)) {
|
|
12617
|
+
this.updateTextBox(activeObj);
|
|
12370
12618
|
}
|
|
12371
12619
|
break;
|
|
12372
12620
|
case 'text':
|
|
12373
12621
|
if (!isNullOrUndefined(this.tempActObj)) {
|
|
12374
12622
|
this.activeObj = extend({}, this.tempActObj, {}, true);
|
|
12375
12623
|
}
|
|
12376
|
-
|
|
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);
|
|
12377
12641
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12378
12642
|
this.isUndoRedo = true;
|
|
12379
12643
|
this.redrawImgWithObj();
|
|
12644
|
+
if (!isNullOrUndefined(this.tempActObj)) {
|
|
12645
|
+
this.activeObj = extend({}, this.tempActObj, {}, true);
|
|
12646
|
+
}
|
|
12380
12647
|
this.textArea.style.display = 'block';
|
|
12381
|
-
this.textArea.value = obj.
|
|
12648
|
+
this.textArea.value = obj.currentText;
|
|
12382
12649
|
tempUndoRedoColl = extend([], this.undoRedoColl, [], true);
|
|
12383
12650
|
tempUndoRedoStep = this.undoRedoStep;
|
|
12384
12651
|
this.redrawActObj();
|
|
@@ -12386,39 +12653,49 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
12386
12653
|
this.undoRedoStep = tempUndoRedoStep;
|
|
12387
12654
|
this.textArea.style.display = 'none';
|
|
12388
12655
|
this.textArea.value = '';
|
|
12656
|
+
this.redrawActObj();
|
|
12389
12657
|
break;
|
|
12390
|
-
|
|
12391
|
-
|
|
12392
|
-
|
|
12393
|
-
|
|
12394
|
-
|
|
12395
|
-
|
|
12396
|
-
|
|
12397
|
-
|
|
12398
|
-
this.
|
|
12399
|
-
|
|
12400
|
-
|
|
12401
|
-
|
|
12402
|
-
|
|
12403
|
-
|
|
12404
|
-
|
|
12405
|
-
|
|
12406
|
-
|
|
12407
|
-
if (
|
|
12408
|
-
|
|
12409
|
-
}
|
|
12410
|
-
if (document.getElementById(this.element.id + '_' + obj.operation + 'Canvas')) {
|
|
12411
|
-
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');
|
|
12412
12677
|
}
|
|
12413
|
-
this.
|
|
12414
|
-
this.
|
|
12415
|
-
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12416
|
-
this.redrawImgWithObj();
|
|
12678
|
+
this.setAdjustment(obj.operation);
|
|
12679
|
+
this.updateFilter(obj.operation);
|
|
12417
12680
|
break;
|
|
12418
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;
|
|
12419
12690
|
if (this.undoRedoStep === this.undoRedoColl.length) {
|
|
12420
12691
|
this.isUndoRedo = false;
|
|
12421
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
|
+
}
|
|
12422
12699
|
}
|
|
12423
12700
|
}
|
|
12424
12701
|
}
|