@syncfusion/ej2-image-editor 20.4.48 → 20.4.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -2
- package/GitLeaksReport.json +1 -0
- package/dist/ej2-image-editor.umd.min.js +2 -2
- package/dist/ej2-image-editor.umd.min.js.map +1 -1
- package/dist/es6/ej2-image-editor.es2015.js +1156 -878
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +1152 -874
- package/dist/es6/ej2-image-editor.es5.js.map +1 -1
- package/dist/global/ej2-image-editor.min.js +2 -2
- package/dist/global/ej2-image-editor.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/gitleaks-ci/gitleaks +0 -0
- package/gitleaks-ci.tar.gz +0 -0
- package/package.json +11 -11
- package/src/image-editor/image-editor.d.ts +15 -4
- package/src/image-editor/image-editor.js +1152 -864
|
@@ -178,9 +178,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
178
178
|
_this.isAllowCropPan = false;
|
|
179
179
|
_this.tempPannedPoint = { x: 0, y: 0 };
|
|
180
180
|
_this.cropObj = { cropZoom: 0, defaultZoom: 0, totalPannedPoint: { x: 0, y: 0 }, totalPannedClientPoint: { x: 0, y: 0 },
|
|
181
|
-
totalPannedInternalPoint: { x: 0, y: 0 }, activeObj: {}, rotateFlipColl: [],
|
|
182
|
-
currFlipState: '', destPoints: { startX: 0, startY: 0, width: 0, height: 0 },
|
|
183
|
-
srcPoints: { startX: 0, startY: 0, width: 0, height: 0 } };
|
|
181
|
+
totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {}, rotateFlipColl: [],
|
|
182
|
+
degree: 0, currFlipState: '', destPoints: { startX: 0, startY: 0, width: 0, height: 0 },
|
|
183
|
+
srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '' };
|
|
184
184
|
_this.afterCropActions = [];
|
|
185
185
|
_this.isCancelAction = false;
|
|
186
186
|
_this.isFreehandPointMoved = false;
|
|
@@ -399,7 +399,6 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
399
399
|
this.unwireEvent();
|
|
400
400
|
_super.prototype.destroy.call(this);
|
|
401
401
|
this.element.innerHTML = '';
|
|
402
|
-
this.trigger('destroyed');
|
|
403
402
|
};
|
|
404
403
|
ImageEditor.prototype.initialize = function () {
|
|
405
404
|
this.updateFinetunes();
|
|
@@ -967,7 +966,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
967
966
|
redo.parentElement.classList.remove('e-overlay');
|
|
968
967
|
}
|
|
969
968
|
var zoomIn = document.querySelector('#' + this.element.id + '_zoomIn');
|
|
970
|
-
if (!isNullOrUndefined(zoomIn) && this.zoomFactor >=
|
|
969
|
+
if (!isNullOrUndefined(zoomIn) && this.zoomFactor >= 2) {
|
|
971
970
|
zoomIn.classList.add('e-disabled');
|
|
972
971
|
zoomIn.parentElement.classList.add('e-overlay');
|
|
973
972
|
}
|
|
@@ -1180,32 +1179,34 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
1180
1179
|
ImageEditor.prototype.cropSelect = function (args) {
|
|
1181
1180
|
this.isCropTab = true;
|
|
1182
1181
|
this.zoomFactor = this.cropZoomFactor;
|
|
1183
|
-
var
|
|
1182
|
+
var prevCropObj = extend({}, this.cropObj, {}, true);
|
|
1183
|
+
var previousObj = this.getCurrentObj();
|
|
1184
|
+
previousObj.objColl = extend([], this.objColl, [], true);
|
|
1185
|
+
previousObj.pointColl = extend([], this.pointColl, [], true);
|
|
1186
|
+
previousObj.afterCropActions = this.afterCropActions;
|
|
1184
1187
|
var text = args.item.id;
|
|
1185
1188
|
this.currentToolbar = 'crop';
|
|
1186
1189
|
this.currSelectionPoint = null;
|
|
1187
1190
|
this.select(text);
|
|
1188
1191
|
this.refreshToolbar('main', true, true);
|
|
1189
1192
|
this.refreshDropDownBtn(true);
|
|
1190
|
-
this.
|
|
1191
|
-
currentObj: extend([], this.objColl, [], true),
|
|
1192
|
-
previousObj: extend([], this.objColl, [], true),
|
|
1193
|
-
previousSelectionObj: extend({}, activeObj, {}, true),
|
|
1194
|
-
currentSelectionObj: extend({}, this.activeObj, {}, true),
|
|
1195
|
-
zoomFactor: this.zoomFactor, sharpen: this.adjustmentLevel.sharpen, bw: this.adjustmentLevel.bw });
|
|
1196
|
-
this.undoRedoStep++;
|
|
1193
|
+
this.updateUndoRedoColl('selectionTransform', previousObj, previousObj.objColl, previousObj.pointColl, prevCropObj);
|
|
1197
1194
|
this.enableDisableToolbarBtn();
|
|
1198
1195
|
};
|
|
1199
1196
|
ImageEditor.prototype.transformSelect = function (args) {
|
|
1200
1197
|
this.cropSelectedState();
|
|
1201
1198
|
this.currentSelectionPoint = null;
|
|
1202
1199
|
this.performTransformation(args.item.id);
|
|
1203
|
-
this.afterCropActions.push(args.item.id);
|
|
1204
1200
|
};
|
|
1205
1201
|
ImageEditor.prototype.performTransformation = function (text) {
|
|
1206
1202
|
var tempZoomFactor = this.defaultZoomFactor;
|
|
1207
1203
|
var isUndoRedo = this.isUndoRedo;
|
|
1204
|
+
var prevCropObj = extend({}, this.cropObj, {}, true);
|
|
1208
1205
|
if (this.defaultZoomFactor !== 0) {
|
|
1206
|
+
this.transformCurrentObj = this.getCurrentObj();
|
|
1207
|
+
this.transformCurrentObj.objColl = extend([], this.objColl, null, true);
|
|
1208
|
+
this.transformCurrentObj.pointColl = extend({}, this.pointColl, null, true);
|
|
1209
|
+
this.transformCurrentObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
1209
1210
|
this.isUndoRedo = true;
|
|
1210
1211
|
if (this.defaultZoomFactor > 0) {
|
|
1211
1212
|
this.zoom(-this.defaultZoomFactor);
|
|
@@ -1220,10 +1221,19 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
1220
1221
|
this.isUndoRedo = true;
|
|
1221
1222
|
this.zoom(tempZoomFactor);
|
|
1222
1223
|
this.isUndoRedo = isUndoRedo;
|
|
1224
|
+
var state = '';
|
|
1225
|
+
if (text === 'rotateleft' || text === 'rotateright') {
|
|
1226
|
+
state = 'rotate';
|
|
1227
|
+
}
|
|
1228
|
+
else if (text === 'horizontalflip' || text === 'verticalflip') {
|
|
1229
|
+
state = 'flip';
|
|
1230
|
+
}
|
|
1231
|
+
this.updateUndoRedoColl(state, this.transformCurrentObj, this.transformCurrentObj.objColl, this.transformCurrentObj.pointColl, prevCropObj);
|
|
1232
|
+
this.transformCurrentObj = null;
|
|
1223
1233
|
}
|
|
1224
1234
|
};
|
|
1225
1235
|
ImageEditor.prototype.updateTransform = function (text) {
|
|
1226
|
-
switch (text) {
|
|
1236
|
+
switch (text.toLowerCase()) {
|
|
1227
1237
|
case 'rotateleft':
|
|
1228
1238
|
this.rotate(-90);
|
|
1229
1239
|
break;
|
|
@@ -1325,15 +1335,16 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
1325
1335
|
showButtons: false, mode: 'Palette', cssClass: 'e-shape-fill-color',
|
|
1326
1336
|
change: function (args) {
|
|
1327
1337
|
_this.pushActItemIntoObj();
|
|
1328
|
-
var
|
|
1338
|
+
var prevCropObj = extend({}, _this.cropObj, {}, true);
|
|
1339
|
+
var prevObj = _this.getCurrentObj();
|
|
1340
|
+
prevObj.objColl = extend([], _this.objColl, [], true);
|
|
1341
|
+
prevObj.pointColl = extend([], _this.pointColl, [], true);
|
|
1342
|
+
prevObj.afterCropActions = extend([], _this.afterCropActions, [], true);
|
|
1329
1343
|
_this.objColl.pop();
|
|
1330
1344
|
proxy.activeObj.strokeSettings.fillColor = args.currentValue.hex;
|
|
1331
1345
|
proxy.strokeSettings.fillColor = proxy.activeObj.strokeSettings.fillColor;
|
|
1332
1346
|
_this.objColl.push(_this.activeObj);
|
|
1333
|
-
|
|
1334
|
-
previousObj: objColl, zoomFactor: proxy.zoomFactor, sharpen: proxy.adjustmentLevel.sharpen,
|
|
1335
|
-
bw: proxy.adjustmentLevel.bw });
|
|
1336
|
-
proxy.undoRedoStep++;
|
|
1347
|
+
_this.updateUndoRedoColl('shapeTransform', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
1337
1348
|
proxy.redrawShape(proxy.objColl[proxy.objColl.length - 1]);
|
|
1338
1349
|
if (args.currentValue.rgba === '') {
|
|
1339
1350
|
fillDDB_1.element.children[0].classList.add('e-nocolor-item');
|
|
@@ -1368,17 +1379,17 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
1368
1379
|
showButtons: false, mode: 'Palette', cssClass: 'e-shape-stroke-color',
|
|
1369
1380
|
change: function (args) {
|
|
1370
1381
|
_this.pushActItemIntoObj();
|
|
1371
|
-
var
|
|
1382
|
+
var prevCropObj = extend({}, _this.cropObj, {}, true);
|
|
1383
|
+
var prevObj = _this.getCurrentObj();
|
|
1384
|
+
prevObj.objColl = extend([], _this.objColl, [], true);
|
|
1385
|
+
prevObj.pointColl = extend([], _this.pointColl, [], true);
|
|
1386
|
+
prevObj.afterCropActions = extend([], _this.afterCropActions, [], true);
|
|
1372
1387
|
_this.objColl.pop();
|
|
1373
1388
|
proxy.activeObj.strokeSettings.strokeColor = args.currentValue.hex;
|
|
1374
1389
|
proxy.strokeSettings.strokeColor = proxy.activeObj.strokeSettings.strokeColor;
|
|
1375
1390
|
if (!proxy.togglePen) {
|
|
1376
1391
|
_this.objColl.push(_this.activeObj);
|
|
1377
|
-
proxy.
|
|
1378
|
-
currentObj: extend([], proxy.objColl, [], true),
|
|
1379
|
-
previousObj: objColl, zoomFactor: proxy.zoomFactor,
|
|
1380
|
-
sharpen: proxy.adjustmentLevel.sharpen, bw: proxy.adjustmentLevel.bw });
|
|
1381
|
-
proxy.undoRedoStep++;
|
|
1392
|
+
proxy.updateUndoRedoColl('shapeTransform', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
1382
1393
|
proxy.redrawShape(proxy.objColl[proxy.objColl.length - 1]);
|
|
1383
1394
|
}
|
|
1384
1395
|
strokeDDB_1.element.children[0].style.backgroundColor = args.currentValue.rgba;
|
|
@@ -1429,18 +1440,18 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
1429
1440
|
},
|
|
1430
1441
|
select: function (args) {
|
|
1431
1442
|
_this.pushActItemIntoObj();
|
|
1432
|
-
var
|
|
1443
|
+
var prevCropObj = extend({}, _this.cropObj, {}, true);
|
|
1444
|
+
var prevObj = _this.getCurrentObj();
|
|
1445
|
+
prevObj.objColl = extend([], _this.objColl, [], true);
|
|
1446
|
+
prevObj.pointColl = extend([], _this.pointColl, [], true);
|
|
1447
|
+
prevObj.afterCropActions = extend([], _this.afterCropActions, [], true);
|
|
1433
1448
|
_this.objColl.pop();
|
|
1434
1449
|
spanElem_1.textContent = args.item.text;
|
|
1435
1450
|
_this.activeObj.strokeSettings.strokeWidth = parseInt(args.item.id, 10);
|
|
1436
1451
|
_this.activeObj.strokeSettings.strokeWidth *= 2;
|
|
1437
1452
|
_this.strokeSettings.strokeWidth = _this.activeObj.strokeSettings.strokeWidth;
|
|
1438
1453
|
_this.objColl.push(_this.activeObj);
|
|
1439
|
-
_this.
|
|
1440
|
-
currentObj: extend([], _this.objColl, [], true),
|
|
1441
|
-
previousObj: objColl, zoomFactor: _this.zoomFactor,
|
|
1442
|
-
sharpen: _this.adjustmentLevel.sharpen, bw: _this.adjustmentLevel.bw });
|
|
1443
|
-
_this.undoRedoStep++;
|
|
1454
|
+
_this.updateUndoRedoColl('shapeTransform', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
1444
1455
|
_this.redrawShape(_this.objColl[_this.objColl.length - 1]);
|
|
1445
1456
|
if (Browser.isDevice) {
|
|
1446
1457
|
if (!isNullOrUndefined(document.getElementById(_this.element.id + '_bottomToolbar'))) {
|
|
@@ -1571,17 +1582,17 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
1571
1582
|
showButtons: false, mode: 'Palette', cssClass: 'e-text-fontt-color',
|
|
1572
1583
|
change: function (args) {
|
|
1573
1584
|
_this.pushActItemIntoObj();
|
|
1574
|
-
var
|
|
1585
|
+
var prevCropObj = extend({}, _this.cropObj, {}, true);
|
|
1586
|
+
var prevObj = _this.getCurrentObj();
|
|
1587
|
+
prevObj.objColl = extend([], _this.objColl, [], true);
|
|
1588
|
+
prevObj.pointColl = extend([], _this.pointColl, [], true);
|
|
1589
|
+
prevObj.afterCropActions = extend([], _this.afterCropActions, [], true);
|
|
1575
1590
|
_this.objColl.pop();
|
|
1576
1591
|
if (proxy.textArea.style.display === 'none') {
|
|
1577
1592
|
proxy.strokeSettings.strokeColor = proxy.activeObj.strokeSettings.strokeColor = args.currentValue.hex;
|
|
1578
1593
|
if (!proxy.togglePen) {
|
|
1579
1594
|
_this.objColl.push(_this.activeObj);
|
|
1580
|
-
proxy.
|
|
1581
|
-
value: null, currentObj: extend([], proxy.objColl, [], true),
|
|
1582
|
-
previousObj: objColl, zoomFactor: proxy.zoomFactor,
|
|
1583
|
-
sharpen: proxy.adjustmentLevel.sharpen, bw: proxy.adjustmentLevel.bw });
|
|
1584
|
-
proxy.undoRedoStep++;
|
|
1595
|
+
proxy.updateUndoRedoColl('shapeTransform', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
1585
1596
|
proxy.redrawShape(proxy.objColl[proxy.objColl.length - 1]);
|
|
1586
1597
|
}
|
|
1587
1598
|
}
|
|
@@ -1590,21 +1601,13 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
1590
1601
|
var temp = proxy.activeObj.strokeSettings.strokeColor;
|
|
1591
1602
|
proxy.activeObj.strokeSettings.strokeColor = args.currentValue.hex;
|
|
1592
1603
|
_this.objColl.push(_this.activeObj);
|
|
1593
|
-
_this.
|
|
1594
|
-
currentObj: extend([], _this.objColl, [], true),
|
|
1595
|
-
previousObj: objColl, zoomFactor: proxy.zoomFactor,
|
|
1596
|
-
sharpen: proxy.adjustmentLevel.sharpen, bw: proxy.adjustmentLevel.bw });
|
|
1597
|
-
_this.undoRedoStep++;
|
|
1604
|
+
_this.updateUndoRedoColl('textAreaCustomization', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
1598
1605
|
_this.objColl.pop();
|
|
1599
1606
|
proxy.activeObj.strokeSettings.strokeColor = temp;
|
|
1600
1607
|
}
|
|
1601
1608
|
else if (!proxy.togglePen) {
|
|
1602
1609
|
_this.objColl.push(_this.activeObj);
|
|
1603
|
-
|
|
1604
|
-
currentObj: extend([], proxy.objColl, [], true),
|
|
1605
|
-
previousObj: objColl, zoomFactor: proxy.zoomFactor,
|
|
1606
|
-
sharpen: proxy.adjustmentLevel.sharpen, bw: proxy.adjustmentLevel.bw });
|
|
1607
|
-
proxy.undoRedoStep++;
|
|
1610
|
+
_this.updateUndoRedoColl('shapeTransform', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
1608
1611
|
proxy.redrawShape(proxy.objColl[proxy.objColl.length - 1]);
|
|
1609
1612
|
}
|
|
1610
1613
|
strokeDDB_2.element.children[0].style.backgroundColor = args.currentValue.rgba;
|
|
@@ -1676,6 +1679,11 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
1676
1679
|
select: function (args) {
|
|
1677
1680
|
_this.pushActItemIntoObj();
|
|
1678
1681
|
var objColl = extend([], _this.objColl, [], true);
|
|
1682
|
+
var prevCropObj = extend({}, _this.cropObj, {}, true);
|
|
1683
|
+
var prevObj = _this.getCurrentObj();
|
|
1684
|
+
prevObj.objColl = extend([], _this.objColl, [], true);
|
|
1685
|
+
prevObj.pointColl = extend([], _this.pointColl, [], true);
|
|
1686
|
+
prevObj.afterCropActions = extend([], _this.afterCropActions, [], true);
|
|
1679
1687
|
_this.objColl.pop();
|
|
1680
1688
|
spanElem_2.textContent = args.item.text;
|
|
1681
1689
|
if (Browser.isDevice) {
|
|
@@ -1687,11 +1695,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
1687
1695
|
_this.activeObj.textSettings.fontFamily = _this.toPascalCase(args.item.id);
|
|
1688
1696
|
_this.redrawText();
|
|
1689
1697
|
_this.objColl.push(_this.activeObj);
|
|
1690
|
-
_this.
|
|
1691
|
-
currentObj: extend([], _this.objColl, [], true),
|
|
1692
|
-
previousObj: objColl, zoomFactor: _this.zoomFactor,
|
|
1693
|
-
sharpen: _this.adjustmentLevel.sharpen, bw: _this.adjustmentLevel.bw });
|
|
1694
|
-
_this.undoRedoStep++;
|
|
1698
|
+
_this.updateUndoRedoColl('textAreaCustomization', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
1695
1699
|
_this.objColl.pop();
|
|
1696
1700
|
_this.upperContext.clearRect(0, 0, _this.upperCanvas.width, _this.upperCanvas.height);
|
|
1697
1701
|
var width = _this.activeObj.activePoint.width +
|
|
@@ -1706,11 +1710,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
1706
1710
|
_this.textSettings.fontFamily = _this.activeObj.textSettings.fontFamily = _this.toPascalCase(args.item.id);
|
|
1707
1711
|
_this.redrawText();
|
|
1708
1712
|
_this.objColl.push(_this.activeObj);
|
|
1709
|
-
_this.
|
|
1710
|
-
currentObj: extend([], _this.objColl, [], true),
|
|
1711
|
-
previousObj: objColl, zoomFactor: _this.zoomFactor,
|
|
1712
|
-
sharpen: _this.adjustmentLevel.sharpen, bw: _this.adjustmentLevel.bw });
|
|
1713
|
-
_this.undoRedoStep++;
|
|
1713
|
+
_this.updateUndoRedoColl('shapeTransform', prevObj, objColl, extend([], _this.pointColl, [], true), prevCropObj);
|
|
1714
1714
|
_this.redrawShape(_this.objColl[_this.objColl.length - 1]);
|
|
1715
1715
|
}
|
|
1716
1716
|
}
|
|
@@ -1811,7 +1811,11 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
1811
1811
|
},
|
|
1812
1812
|
select: function (args) {
|
|
1813
1813
|
_this.pushActItemIntoObj();
|
|
1814
|
-
var
|
|
1814
|
+
var prevCropObj = extend({}, _this.cropObj, {}, true);
|
|
1815
|
+
var prevObj = _this.getCurrentObj();
|
|
1816
|
+
prevObj.objColl = extend([], _this.objColl, [], true);
|
|
1817
|
+
prevObj.pointColl = extend([], _this.pointColl, [], true);
|
|
1818
|
+
prevObj.afterCropActions = extend([], _this.afterCropActions, [], true);
|
|
1815
1819
|
_this.objColl.pop();
|
|
1816
1820
|
fontSizeSpanElem_1.textContent = args.item.text;
|
|
1817
1821
|
if (_this.textArea.style.display === 'block') {
|
|
@@ -1819,11 +1823,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
1819
1823
|
var temp = _this.activeObj.textSettings.fontSize;
|
|
1820
1824
|
_this.activeObj.textSettings.fontSize = parseInt(_this.fontSizeColl[(parseInt(args.item.text, 10) - 1)].text, 10);
|
|
1821
1825
|
_this.objColl.push(_this.activeObj);
|
|
1822
|
-
_this.
|
|
1823
|
-
currentObj: extend([], _this.objColl, [], true),
|
|
1824
|
-
previousObj: objColl, zoomFactor: _this.zoomFactor,
|
|
1825
|
-
sharpen: _this.adjustmentLevel.sharpen, bw: _this.adjustmentLevel.bw });
|
|
1826
|
-
_this.undoRedoStep++;
|
|
1826
|
+
_this.updateUndoRedoColl('textAreaCustomization', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
1827
1827
|
_this.objColl.pop();
|
|
1828
1828
|
var textStyle = '';
|
|
1829
1829
|
if (_this.textArea.style.fontWeight === 'bold') {
|
|
@@ -1863,11 +1863,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
1863
1863
|
_this.updateActiveObject(_this.activeObj.activePoint, _this.activeObj);
|
|
1864
1864
|
_this.redrawText();
|
|
1865
1865
|
_this.objColl.push(_this.activeObj);
|
|
1866
|
-
_this.
|
|
1867
|
-
currentObj: extend([], _this.objColl, [], true),
|
|
1868
|
-
previousObj: objColl, zoomFactor: _this.zoomFactor,
|
|
1869
|
-
sharpen: _this.adjustmentLevel.sharpen, bw: _this.adjustmentLevel.bw });
|
|
1870
|
-
_this.undoRedoStep++;
|
|
1866
|
+
_this.updateUndoRedoColl('shapeTransform', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
1871
1867
|
_this.redrawShape(_this.objColl[_this.objColl.length - 1]);
|
|
1872
1868
|
}
|
|
1873
1869
|
}
|
|
@@ -1927,14 +1923,27 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
1927
1923
|
return width;
|
|
1928
1924
|
};
|
|
1929
1925
|
ImageEditor.prototype.updateUndoRedoObj = function (objColl) {
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1926
|
+
if (this.allowUndoRedo) {
|
|
1927
|
+
this.objColl.push(this.activeObj);
|
|
1928
|
+
var cropObj = extend({}, this.cropObj, {}, true);
|
|
1929
|
+
var obj = this.getCurrentObj();
|
|
1930
|
+
obj.objColl = extend([], this.objColl, [], true);
|
|
1931
|
+
obj.pointColl = extend([], this.pointColl, [], true);
|
|
1932
|
+
obj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
1933
|
+
this.undoRedoColl.push({ operation: 'shapeTransform', previousObj: obj, currentObj: obj,
|
|
1934
|
+
previousObjColl: objColl, currentObjColl: obj.objColl,
|
|
1935
|
+
previousPointColl: obj.pointColl, currentPointColl: obj.pointColl,
|
|
1936
|
+
previousCropObj: cropObj, currentCropObj: cropObj });
|
|
1937
|
+
this.undoRedoStep++;
|
|
1938
|
+
this.redrawShape(this.objColl[this.objColl.length - 1]);
|
|
1939
|
+
}
|
|
1936
1940
|
};
|
|
1937
1941
|
ImageEditor.prototype.updateObjColl = function (item, objColl) {
|
|
1942
|
+
var prevCropObj = extend({}, this.cropObj, {}, true);
|
|
1943
|
+
var prevObj = this.getCurrentObj();
|
|
1944
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
1945
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
1946
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
1938
1947
|
var tempBold = this.activeObj.textSettings.bold;
|
|
1939
1948
|
var tempItalic = this.activeObj.textSettings.italic;
|
|
1940
1949
|
switch (item) {
|
|
@@ -1956,10 +1965,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
1956
1965
|
break;
|
|
1957
1966
|
}
|
|
1958
1967
|
this.objColl.push(this.activeObj);
|
|
1959
|
-
this.
|
|
1960
|
-
currentObj: extend([], this.objColl, [], true), previousObj: objColl, zoomFactor: this.zoomFactor,
|
|
1961
|
-
sharpen: this.adjustmentLevel.sharpen, bw: this.adjustmentLevel.bw });
|
|
1962
|
-
this.undoRedoStep++;
|
|
1968
|
+
this.updateUndoRedoColl('textAreaCustomization', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
1963
1969
|
this.objColl.pop();
|
|
1964
1970
|
this.activeObj.textSettings.bold = tempBold;
|
|
1965
1971
|
this.activeObj.textSettings.italic = tempItalic;
|
|
@@ -2188,7 +2194,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
2188
2194
|
this.disablePan = false;
|
|
2189
2195
|
}
|
|
2190
2196
|
zoomIn = document.querySelector('#' + this.element.id + '_zoomIn');
|
|
2191
|
-
if (!isNullOrUndefined(zoomIn) && this.zoomFactor >=
|
|
2197
|
+
if (!isNullOrUndefined(zoomIn) && this.zoomFactor >= 2) {
|
|
2192
2198
|
zoomIn.classList.add('e-disabled');
|
|
2193
2199
|
zoomIn.parentElement.classList.add('e-overlay');
|
|
2194
2200
|
}
|
|
@@ -2208,7 +2214,12 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
2208
2214
|
break;
|
|
2209
2215
|
case 'crop':
|
|
2210
2216
|
if (!isNullOrUndefined(this.currSelectionPoint)) {
|
|
2211
|
-
this.
|
|
2217
|
+
if (this.currObjType.isUndoAction) {
|
|
2218
|
+
this.refreshUndoRedoColl();
|
|
2219
|
+
}
|
|
2220
|
+
if (!isNullOrUndefined(this.cropObj.activeObj.shape)) {
|
|
2221
|
+
this.select(this.cropObj.activeObj.shape);
|
|
2222
|
+
}
|
|
2212
2223
|
this.refreshToolbar('main', true, true);
|
|
2213
2224
|
getComponent(this.element.querySelector('#' + this.element.id + '_cropBtn'), 'dropdown-btn').toggle();
|
|
2214
2225
|
if (!isNullOrUndefined(this.activeObj.shape)) {
|
|
@@ -2220,12 +2231,12 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
2220
2231
|
imageEditorObj.reset();
|
|
2221
2232
|
this.currentToolbar = 'main';
|
|
2222
2233
|
break;
|
|
2223
|
-
case 'undo':
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
case 'redo':
|
|
2227
|
-
|
|
2228
|
-
|
|
2234
|
+
// case 'undo':
|
|
2235
|
+
// this.callUndo();
|
|
2236
|
+
// break;
|
|
2237
|
+
// case 'redo':
|
|
2238
|
+
// this.callRedo();
|
|
2239
|
+
// break;
|
|
2229
2240
|
case 'adjustment':
|
|
2230
2241
|
if (!isDisabledAdjustment) {
|
|
2231
2242
|
this.refreshToolbar('adjustment');
|
|
@@ -2257,6 +2268,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
2257
2268
|
case 'sepia':
|
|
2258
2269
|
case 'invert':
|
|
2259
2270
|
case 'sharpen':
|
|
2271
|
+
if (this.currObjType.isUndoAction) {
|
|
2272
|
+
this.refreshUndoRedoColl();
|
|
2273
|
+
}
|
|
2260
2274
|
this.currObjType.isFiltered = true;
|
|
2261
2275
|
this.setFilter(type);
|
|
2262
2276
|
break;
|
|
@@ -2289,7 +2303,6 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
2289
2303
|
this.currObjType.isFiltered = false;
|
|
2290
2304
|
this.adjustmentLevel = extend({}, this.tempAdjustmentLevel, {}, true);
|
|
2291
2305
|
this.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
2292
|
-
this.undoRedoColl = extend([], this.tempUndoRedoColl, [], true);
|
|
2293
2306
|
this.undoRedoStep = this.tempUndoRedoStep;
|
|
2294
2307
|
this.upperCanvas.style.cursor = 'default';
|
|
2295
2308
|
this.currObjType.isCustomCrop = false;
|
|
@@ -2328,7 +2341,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
2328
2341
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
2329
2342
|
this.renderImage();
|
|
2330
2343
|
this.refreshToolbar('main');
|
|
2331
|
-
this.pointColl[this.freehandDrawSelectedIndex]
|
|
2344
|
+
if (!isNullOrUndefined(this.pointColl[this.freehandDrawSelectedIndex])) {
|
|
2345
|
+
this.pointColl[this.freehandDrawSelectedIndex].isSelected = false;
|
|
2346
|
+
}
|
|
2332
2347
|
this.isFreehandDrawEditing = this.isFreehandDrawingPoint = false;
|
|
2333
2348
|
this.freehandDrawHoveredIndex = this.freehandDrawSelectedIndex = null;
|
|
2334
2349
|
};
|
|
@@ -2340,8 +2355,10 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
2340
2355
|
this.pointColl[n].strokeWidth = this.tempFreeHandDrawEditingStyles.strokeWidth;
|
|
2341
2356
|
}
|
|
2342
2357
|
this.pointCounter = 0;
|
|
2343
|
-
this.pointColl[this.freehandDrawSelectedIndex]
|
|
2344
|
-
|
|
2358
|
+
if (!isNullOrUndefined(this.pointColl[this.freehandDrawSelectedIndex])) {
|
|
2359
|
+
this.pointColl[this.freehandDrawSelectedIndex].isSelected = false;
|
|
2360
|
+
}
|
|
2361
|
+
this.freehandDrawHoveredIndex = this.freehandDrawSelectedIndex = this.freehandDrawSelectedId = null;
|
|
2345
2362
|
this.isFreehandDrawEditing = this.isFreehandDrawingPoint = false;
|
|
2346
2363
|
this.tempFreeHandDrawEditingStyles = { strokeColor: null, strokeWidth: null, fillColor: null };
|
|
2347
2364
|
this.refreshToolbar('main');
|
|
@@ -2877,6 +2894,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
2877
2894
|
width: Browser.isDevice ? '200px' : '300px',
|
|
2878
2895
|
cssClass: 'e-slider',
|
|
2879
2896
|
change: function (args) {
|
|
2897
|
+
if (_this.currObjType.isUndoAction) {
|
|
2898
|
+
_this.refreshUndoRedoColl();
|
|
2899
|
+
}
|
|
2880
2900
|
_this.setCurrAdjustmentValue(type, args.value);
|
|
2881
2901
|
_this.enableDisableToolbarBtn();
|
|
2882
2902
|
}
|
|
@@ -2981,11 +3001,80 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
2981
3001
|
this.iterateObjColl();
|
|
2982
3002
|
this.freehandRedraw(this.lowerContext);
|
|
2983
3003
|
this.lowerContext.filter = temp;
|
|
3004
|
+
this.currSelectionPoint = null;
|
|
3005
|
+
}
|
|
3006
|
+
else {
|
|
3007
|
+
if (this.cropObj.cropZoom > 0) {
|
|
3008
|
+
var cropObjColl_1 = extend([], this.objColl, null, true);
|
|
3009
|
+
var cropPointColl_1 = extend([], this.pointColl, null, true);
|
|
3010
|
+
this.objColl = [];
|
|
3011
|
+
this.pointColl = [];
|
|
3012
|
+
this.freehandCounter = 0;
|
|
3013
|
+
this.zoom(this.cropObj.cropZoom);
|
|
3014
|
+
this.objColl = cropObjColl_1;
|
|
3015
|
+
this.pointColl = cropPointColl_1;
|
|
3016
|
+
this.freehandCounter = this.pointColl.length;
|
|
3017
|
+
this.currSelectionPoint = extend({}, this.cropObj.activeObj, null, true);
|
|
3018
|
+
if (this.cropObj.currFlipState !== '') {
|
|
3019
|
+
this.cropObj.totalPannedPoint.x += this.cropObj.tempFlipPanPoint.x;
|
|
3020
|
+
this.cropObj.totalPannedPoint.y += this.cropObj.tempFlipPanPoint.y;
|
|
3021
|
+
}
|
|
3022
|
+
}
|
|
3023
|
+
var destPoints = { startX: this.destLeft, startY: this.destTop, width: this.destWidth, height: this.destHeight };
|
|
3024
|
+
this.destLeft = this.currSelectionPoint.activePoint.startX;
|
|
3025
|
+
this.destTop = this.currSelectionPoint.activePoint.startY;
|
|
3026
|
+
this.destWidth = this.currSelectionPoint.activePoint.width;
|
|
3027
|
+
this.destHeight = this.currSelectionPoint.activePoint.height;
|
|
3028
|
+
this.zoomObjColl();
|
|
3029
|
+
this.zoomFreehandDrawColl();
|
|
3030
|
+
this.destLeft = destPoints.startX;
|
|
3031
|
+
this.destTop = destPoints.startY;
|
|
3032
|
+
this.destWidth = destPoints.width;
|
|
3033
|
+
this.destHeight = destPoints.height;
|
|
3034
|
+
this.updatePannedRegion();
|
|
3035
|
+
this.updateObjAndFreeHandDrawColl();
|
|
3036
|
+
var cropObjColl = extend([], this.objColl, null, true);
|
|
3037
|
+
var cropPointColl = extend([], this.pointColl, null, true);
|
|
3038
|
+
this.objColl = [];
|
|
3039
|
+
this.pointColl = [];
|
|
3040
|
+
this.freehandCounter = 0;
|
|
3041
|
+
this.setCurrentObj();
|
|
3042
|
+
var activeObj = extend({}, this.activeObj, null, true);
|
|
3043
|
+
this.refreshActiveObj();
|
|
3044
|
+
this.objColl = cropObjColl;
|
|
3045
|
+
this.pointColl = cropPointColl;
|
|
3046
|
+
this.freehandCounter = this.pointColl.length;
|
|
3047
|
+
this.zoomObjColl();
|
|
3048
|
+
this.zoomFreehandDrawColl();
|
|
3049
|
+
this.currSelectionPoint = null;
|
|
3050
|
+
if (this.degree === 0) {
|
|
3051
|
+
this.drawPannImage({ x: 0, y: 0 });
|
|
3052
|
+
}
|
|
3053
|
+
this.activeObj = activeObj;
|
|
3054
|
+
this.drawObject('duplicate');
|
|
3055
|
+
}
|
|
3056
|
+
};
|
|
3057
|
+
ImageEditor.prototype.updatePannedRegion = function () {
|
|
3058
|
+
var pannedPoint = this.degree === 0 ? this.cropObj.totalPannedPoint : this.cropObj.totalPannedClientPoint;
|
|
3059
|
+
if (this.currFlipState === this.cropObj.currFlipState) {
|
|
3060
|
+
this.panObjColl(-pannedPoint.x, -pannedPoint.y, '');
|
|
3061
|
+
this.panFreehandDrawColl(-pannedPoint.x, -pannedPoint.y, '');
|
|
2984
3062
|
}
|
|
2985
3063
|
else {
|
|
2986
|
-
this.
|
|
3064
|
+
if (this.currFlipState === 'horizontal' && this.cropObj.currFlipState === '' ||
|
|
3065
|
+
this.currFlipState === 'vertical' && this.cropObj.currFlipState === '') {
|
|
3066
|
+
this.panObjColl(-pannedPoint.x, -pannedPoint.y, '');
|
|
3067
|
+
this.panFreehandDrawColl(-pannedPoint.x, -pannedPoint.y, '');
|
|
3068
|
+
}
|
|
3069
|
+
else if (this.currFlipState === '' && this.cropObj.currFlipState === 'horizontal') {
|
|
3070
|
+
this.panObjColl(pannedPoint.x, -pannedPoint.y, '');
|
|
3071
|
+
this.panFreehandDrawColl(pannedPoint.x, -pannedPoint.y, '');
|
|
3072
|
+
}
|
|
3073
|
+
else if (this.currFlipState === '' && this.cropObj.currFlipState === 'vertical') {
|
|
3074
|
+
this.panObjColl(-pannedPoint.x, pannedPoint.y, '');
|
|
3075
|
+
this.panFreehandDrawColl(-pannedPoint.x, pannedPoint.y, '');
|
|
3076
|
+
}
|
|
2987
3077
|
}
|
|
2988
|
-
this.currSelectionPoint = null;
|
|
2989
3078
|
};
|
|
2990
3079
|
ImageEditor.prototype.updateObjAndFreeHandDrawColl = function () {
|
|
2991
3080
|
for (var i = 0; i < this.objColl.length; i++) {
|
|
@@ -3105,7 +3194,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
3105
3194
|
var activeObj = extend({}, this.activeObj, {});
|
|
3106
3195
|
this.destLeft += (-this.totalPannedPoint.x);
|
|
3107
3196
|
this.destTop += (-this.totalPannedPoint.y);
|
|
3108
|
-
this.drawPannImage({ x: -this.totalPannedPoint.x, y: -this.totalPannedPoint.y }
|
|
3197
|
+
this.drawPannImage({ x: -this.totalPannedPoint.x, y: -this.totalPannedPoint.y });
|
|
3109
3198
|
this.updateFlipPan(activeObj);
|
|
3110
3199
|
this.totalPannedPoint = { x: 0, y: 0 };
|
|
3111
3200
|
}
|
|
@@ -3125,6 +3214,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
3125
3214
|
else {
|
|
3126
3215
|
this.zoom(Math.abs(length_1));
|
|
3127
3216
|
}
|
|
3217
|
+
this.cropZoomFactor = this.tempZoomFactor;
|
|
3128
3218
|
}
|
|
3129
3219
|
else {
|
|
3130
3220
|
this.isCancelAction = true;
|
|
@@ -3134,7 +3224,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
3134
3224
|
this.freehandCounter = 0;
|
|
3135
3225
|
var cropObj = extend({}, this.cropObj, {});
|
|
3136
3226
|
var afterCropActions = extend([], this.afterCropActions, {}, true);
|
|
3137
|
-
this.
|
|
3227
|
+
this.setCurrentObj();
|
|
3138
3228
|
this.cropImg();
|
|
3139
3229
|
this.cropObj = cropObj;
|
|
3140
3230
|
this.afterCropActions = afterCropActions;
|
|
@@ -3187,6 +3277,11 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
3187
3277
|
}
|
|
3188
3278
|
}
|
|
3189
3279
|
context.closePath();
|
|
3280
|
+
var prevCropObj = extend({}, this.cropObj, {}, true);
|
|
3281
|
+
var prevObj = this.getCurrentObj();
|
|
3282
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
3283
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
3284
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
3190
3285
|
this.pointColl[this.freehandCounter] = {};
|
|
3191
3286
|
this.pointColl[this.freehandCounter].points = extend([], this.points);
|
|
3192
3287
|
this.pointColl[this.freehandCounter].strokeColor = this.activeObj.strokeSettings.strokeColor;
|
|
@@ -3198,16 +3293,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
3198
3293
|
this.freehandCounter++;
|
|
3199
3294
|
this.currentFreehandDrawIndex++;
|
|
3200
3295
|
this.isFreehandDrawing = false;
|
|
3201
|
-
|
|
3202
|
-
var currentObj = extend([], this.pointColl, [], true);
|
|
3203
|
-
this.pointColl = {};
|
|
3204
|
-
for (var i = 0; i < this.freehandCounter - 1; i++) {
|
|
3205
|
-
this.pointColl[i] = currentObj[i];
|
|
3206
|
-
}
|
|
3207
|
-
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3208
|
-
var previousObj = extend([], this.pointColl, [], true);
|
|
3209
|
-
this.updateUndoRedoColl('freehanddraw', null, previousObj, currentObj, this.zoomFactor);
|
|
3210
|
-
this.pointColl = currentObj;
|
|
3296
|
+
this.updateUndoRedoColl('freehanddraw', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
3211
3297
|
};
|
|
3212
3298
|
ImageEditor.prototype.freehandMoveHandler = function (e) {
|
|
3213
3299
|
this.isFreehandPointMoved = true;
|
|
@@ -3691,8 +3777,11 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
3691
3777
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3692
3778
|
var temp = extend([], _this.pointColl, [], true);
|
|
3693
3779
|
_this.updateFreehandDrawColorChange();
|
|
3694
|
-
|
|
3695
|
-
var
|
|
3780
|
+
var prevCropObj = extend({}, _this.cropObj, {}, true);
|
|
3781
|
+
var prevObj = _this.getCurrentObj();
|
|
3782
|
+
prevObj.objColl = extend([], _this.objColl, [], true);
|
|
3783
|
+
prevObj.pointColl = extend([], _this.pointColl, [], true);
|
|
3784
|
+
prevObj.afterCropActions = extend([], _this.afterCropActions, [], true);
|
|
3696
3785
|
_this.pointColl = temp;
|
|
3697
3786
|
proxy.isFreehandDrawCustomized = true;
|
|
3698
3787
|
proxy.activeObj.strokeSettings.strokeColor = proxy.selectedFreehandColor = args.currentValue.hex;
|
|
@@ -3700,7 +3789,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
3700
3789
|
_this.upperContext.clearRect(0, 0, _this.upperCanvas.width, _this.upperCanvas.height);
|
|
3701
3790
|
_this.pointColl[_this.freehandDrawSelectedIndex].strokeColor = args.currentValue.hex;
|
|
3702
3791
|
_this.hoverFreehandraw(args.currentValue.hex);
|
|
3703
|
-
_this.updateUndoRedoColl('freehanddrawCustomized',
|
|
3792
|
+
_this.updateUndoRedoColl('freehanddrawCustomized', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
3704
3793
|
}
|
|
3705
3794
|
else if (!proxy.togglePen) {
|
|
3706
3795
|
proxy.redrawShape(_this.activeObj);
|
|
@@ -3765,8 +3854,11 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
3765
3854
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3766
3855
|
var temp = extend([], _this.pointColl, [], true);
|
|
3767
3856
|
_this.updateFreehandDrawColorChange();
|
|
3768
|
-
|
|
3769
|
-
var
|
|
3857
|
+
var prevCropObj = extend({}, _this.cropObj, {}, true);
|
|
3858
|
+
var prevObj = _this.getCurrentObj();
|
|
3859
|
+
prevObj.objColl = extend([], _this.objColl, [], true);
|
|
3860
|
+
prevObj.pointColl = extend([], _this.pointColl, [], true);
|
|
3861
|
+
prevObj.afterCropActions = extend([], _this.afterCropActions, [], true);
|
|
3770
3862
|
_this.pointColl = temp;
|
|
3771
3863
|
_this.isFreehandDrawCustomized = true;
|
|
3772
3864
|
spanElem_3.textContent = args.item.text;
|
|
@@ -3775,7 +3867,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
3775
3867
|
_this.upperContext.clearRect(0, 0, _this.upperCanvas.width, _this.upperCanvas.height);
|
|
3776
3868
|
_this.hoverFreehandraw(null, _this.penStrokeWidth);
|
|
3777
3869
|
_this.pointColl[_this.freehandDrawSelectedIndex].strokeWidth = _this.penStrokeWidth;
|
|
3778
|
-
_this.updateUndoRedoColl('freehanddrawCustomized',
|
|
3870
|
+
_this.updateUndoRedoColl('freehanddrawCustomized', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
3779
3871
|
}
|
|
3780
3872
|
if (Browser.isDevice) {
|
|
3781
3873
|
if (!isNullOrUndefined(document.getElementById(_this.element.id + '_bottomToolbar'))) {
|
|
@@ -3984,6 +4076,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
3984
4076
|
this.destLeft += this.totalPannedInternalPoint.x;
|
|
3985
4077
|
this.destTop += this.totalPannedInternalPoint.y;
|
|
3986
4078
|
var temp = this.lowerContext.filter;
|
|
4079
|
+
if (this.degree === 0) {
|
|
4080
|
+
this.setDestPointsForFlipState();
|
|
4081
|
+
}
|
|
3987
4082
|
this.updateBrightnessFilter();
|
|
3988
4083
|
this.lowerContext.drawImage(this.baseImg, this.srcLeft, this.srcTop, this.srcWidth, this.srcHeight, this.destLeft, this.destTop, this.destWidth, this.destHeight);
|
|
3989
4084
|
this.updateCurrentTransformedState('reverse');
|
|
@@ -4227,6 +4322,10 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
4227
4322
|
context.strokeStyle = '#fff';
|
|
4228
4323
|
minStrokeWidth = maxStrokeWidth = this.penStrokeWidth = strokeWidth ?
|
|
4229
4324
|
strokeWidth : this.pointColl[idx].strokeWidth;
|
|
4325
|
+
if (len === 1) {
|
|
4326
|
+
controlPoint1 = controlPoint2 = startPoint = endPoint = this.points[0];
|
|
4327
|
+
this.startDraw(context, controlPoint1, controlPoint2, startPoint, endPoint, minStrokeWidth, maxStrokeWidth);
|
|
4328
|
+
}
|
|
4230
4329
|
for (var l = 0; l < len - 3; l++) {
|
|
4231
4330
|
if (this.points[l + 1] && this.points[l + 2] && this.points[l + 2]) {
|
|
4232
4331
|
controlPoint1 = (this.calcCurveControlPoints(this.points[l + 0], this.points[l + 1], this.points[l + 2])).controlPoint2;
|
|
@@ -4235,55 +4334,64 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
4235
4334
|
endPoint = this.points[l + 2];
|
|
4236
4335
|
this.startDraw(context, controlPoint1, controlPoint2, startPoint, endPoint, minStrokeWidth, maxStrokeWidth);
|
|
4237
4336
|
}
|
|
4238
|
-
if (len === 1) {
|
|
4239
|
-
controlPoint1 = controlPoint2 = startPoint = endPoint = this.points[0];
|
|
4240
|
-
this.startDraw(context, controlPoint1, controlPoint2, startPoint, endPoint, minStrokeWidth, maxStrokeWidth);
|
|
4241
|
-
}
|
|
4242
4337
|
}
|
|
4243
4338
|
context.closePath();
|
|
4244
4339
|
};
|
|
4245
|
-
ImageEditor.prototype.
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
this.points[l].x = (this.destLeft + this.destWidth) - (this.points[l].x - this.destLeft);
|
|
4255
|
-
}
|
|
4256
|
-
else if (this.points[l].x >= this.destLeft + (this.destWidth / 2)) {
|
|
4257
|
-
this.points[l].x = this.destLeft + (this.destLeft + this.destWidth - this.points[l].x);
|
|
4258
|
-
}
|
|
4259
|
-
this.points[l].ratioX = (this.points[l].x - this.destLeft) / this.destWidth;
|
|
4260
|
-
this.points[l].ratioY = (this.points[l].y - this.destTop) / this.destHeight;
|
|
4340
|
+
ImageEditor.prototype.pointsHorizontalFlip = function () {
|
|
4341
|
+
for (var n = 0; n < this.freehandCounter; n++) {
|
|
4342
|
+
if (this.pointColl[n].shapeFlip !== this.currFlipState) {
|
|
4343
|
+
this.points = extend([], this.pointColl[n].points, []);
|
|
4344
|
+
this.pointCounter = 0;
|
|
4345
|
+
var len = this.points.length;
|
|
4346
|
+
for (var l = 0; l < len; l++) {
|
|
4347
|
+
if (this.points[l].x <= this.destLeft + (this.destWidth / 2)) {
|
|
4348
|
+
this.points[l].x = (this.destLeft + this.destWidth) - (this.points[l].x - this.destLeft);
|
|
4261
4349
|
}
|
|
4262
|
-
this.
|
|
4350
|
+
else if (this.points[l].x >= this.destLeft + (this.destWidth / 2)) {
|
|
4351
|
+
this.points[l].x = this.destLeft + (this.destLeft + this.destWidth - this.points[l].x);
|
|
4352
|
+
}
|
|
4353
|
+
this.points[l].ratioX = (this.points[l].x - this.destLeft) / this.destWidth;
|
|
4354
|
+
this.points[l].ratioY = (this.points[l].y - this.destTop) / this.destHeight;
|
|
4263
4355
|
}
|
|
4356
|
+
this.pointColl[n].shapeFlip = this.currFlipState;
|
|
4264
4357
|
}
|
|
4265
4358
|
}
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
this.points[l].ratioX = (this.points[l].x - this.destLeft) / this.destWidth;
|
|
4280
|
-
this.points[l].ratioY = (this.points[l].y - this.destTop) / this.destHeight;
|
|
4359
|
+
};
|
|
4360
|
+
ImageEditor.prototype.pointsVerticalFlip = function () {
|
|
4361
|
+
for (var n = 0; n < this.freehandCounter; n++) {
|
|
4362
|
+
if (this.pointColl[n].shapeFlip !== this.currFlipState) {
|
|
4363
|
+
this.points = extend([], this.pointColl[n].points, []);
|
|
4364
|
+
this.pointCounter = 0;
|
|
4365
|
+
var len = this.points.length;
|
|
4366
|
+
for (var l = 0; l < len; l++) {
|
|
4367
|
+
if (this.points[l].y <= this.destTop + (this.destHeight / 2)) {
|
|
4368
|
+
this.points[l].y = (this.destTop + this.destHeight) - (this.points[l].y - this.destTop);
|
|
4369
|
+
}
|
|
4370
|
+
else if (this.points[l].y >= this.destTop + (this.destHeight / 2)) {
|
|
4371
|
+
this.points[l].y = this.destTop + (this.destTop + this.destHeight - this.points[l].y);
|
|
4281
4372
|
}
|
|
4282
|
-
this.
|
|
4373
|
+
this.points[l].ratioX = (this.points[l].x - this.destLeft) / this.destWidth;
|
|
4374
|
+
this.points[l].ratioY = (this.points[l].y - this.destTop) / this.destHeight;
|
|
4283
4375
|
}
|
|
4376
|
+
this.pointColl[n].shapeFlip = this.currFlipState;
|
|
4284
4377
|
}
|
|
4285
4378
|
}
|
|
4286
4379
|
};
|
|
4380
|
+
ImageEditor.prototype.flipFreehandrawColl = function (value) {
|
|
4381
|
+
if (value.toLowerCase() === 'horizontal') {
|
|
4382
|
+
this.pointsHorizontalFlip();
|
|
4383
|
+
}
|
|
4384
|
+
else if (value.toLowerCase() === 'vertical') {
|
|
4385
|
+
this.pointsVerticalFlip();
|
|
4386
|
+
}
|
|
4387
|
+
else {
|
|
4388
|
+
this.pointsHorizontalFlip();
|
|
4389
|
+
for (var i = 0; i < this.freehandCounter; i++) {
|
|
4390
|
+
this.pointColl[i].shapeFlip = '';
|
|
4391
|
+
}
|
|
4392
|
+
this.pointsVerticalFlip();
|
|
4393
|
+
}
|
|
4394
|
+
};
|
|
4287
4395
|
ImageEditor.prototype.rotateFreehandDrawColl = function () {
|
|
4288
4396
|
for (var n = 0; n < this.freehandCounter; n++) {
|
|
4289
4397
|
this.points = extend([], this.pointColl[n].points, []);
|
|
@@ -4305,7 +4413,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
4305
4413
|
}
|
|
4306
4414
|
}
|
|
4307
4415
|
};
|
|
4308
|
-
ImageEditor.prototype.zoomFreehandDrawColl = function () {
|
|
4416
|
+
ImageEditor.prototype.zoomFreehandDrawColl = function (isPreventApply) {
|
|
4309
4417
|
for (var n = 0; n < this.freehandCounter; n++) {
|
|
4310
4418
|
this.points = extend([], this.pointColl[n].points, []);
|
|
4311
4419
|
this.pointCounter = 0;
|
|
@@ -4315,7 +4423,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
4315
4423
|
this.points[l].y = this.zoomY(this.points[l].ratioY);
|
|
4316
4424
|
}
|
|
4317
4425
|
}
|
|
4318
|
-
|
|
4426
|
+
if (isNullOrUndefined(isPreventApply)) {
|
|
4427
|
+
this.freehandRedraw(this.lowerContext);
|
|
4428
|
+
}
|
|
4319
4429
|
};
|
|
4320
4430
|
ImageEditor.prototype.zoomX = function (x) {
|
|
4321
4431
|
return (x * this.destWidth) + this.destLeft;
|
|
@@ -4484,170 +4594,154 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
4484
4594
|
};
|
|
4485
4595
|
ImageEditor.prototype.updateCropObj = function () {
|
|
4486
4596
|
this.afterCropActions = [];
|
|
4487
|
-
|
|
4488
|
-
this.cropObj
|
|
4489
|
-
this.cropObj.totalPannedPoint = extend({}, this.totalPannedPoint, {}, true);
|
|
4490
|
-
this.cropObj.totalPannedClientPoint = extend({}, this.totalPannedClientPoint, {}, true);
|
|
4491
|
-
this.cropObj.totalPannedInternalPoint = extend({}, this.totalPannedInternalPoint, {}, true);
|
|
4492
|
-
this.cropObj.activeObj = extend({}, this.activeObj, {}, true);
|
|
4493
|
-
this.cropObj.rotateFlipColl = extend([], this.rotateFlipColl, [], true);
|
|
4494
|
-
this.cropObj.degree = this.degree;
|
|
4495
|
-
this.cropObj.currFlipState = this.currFlipState;
|
|
4496
|
-
this.cropObj.destPoints = { startX: this.destLeft, startY: this.destTop, endX: 0, endY: 0,
|
|
4497
|
-
width: this.destWidth, height: this.destHeight };
|
|
4498
|
-
this.cropObj.srcPoints = { startX: this.srcLeft, startY: this.srcTop, endX: 0, endY: 0,
|
|
4499
|
-
width: this.srcWidth, height: this.srcHeight };
|
|
4597
|
+
var obj = this.getCurrentObj();
|
|
4598
|
+
this.cropObj = extend({}, obj, {}, true);
|
|
4500
4599
|
};
|
|
4501
|
-
ImageEditor.prototype.
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
this.
|
|
4505
|
-
this.
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
this.
|
|
4518
|
-
this.
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4600
|
+
ImageEditor.prototype.setCurrentObj = function (obj) {
|
|
4601
|
+
var isObj = obj ? true : false;
|
|
4602
|
+
obj = obj ? obj : this.cropObj;
|
|
4603
|
+
this.cropZoomFactor = obj.cropZoom;
|
|
4604
|
+
this.defaultZoomFactor = obj.defaultZoom;
|
|
4605
|
+
if (!isObj) {
|
|
4606
|
+
this.zoomFactor = obj.cropZoom;
|
|
4607
|
+
}
|
|
4608
|
+
else {
|
|
4609
|
+
if (!isNullOrUndefined(obj.activeObj.shape) && obj.activeObj.shape.split('-')[0] === 'crop') {
|
|
4610
|
+
this.zoomFactor = obj.cropZoom;
|
|
4611
|
+
}
|
|
4612
|
+
else {
|
|
4613
|
+
this.zoomFactor = obj.defaultZoom;
|
|
4614
|
+
}
|
|
4615
|
+
}
|
|
4616
|
+
this.totalPannedPoint = extend({}, obj.totalPannedPoint, {}, true);
|
|
4617
|
+
this.totalPannedClientPoint = extend({}, obj.totalPannedClientPoint, {}, true);
|
|
4618
|
+
this.totalPannedInternalPoint = extend({}, obj.totalPannedInternalPoint, {}, true);
|
|
4619
|
+
this.tempFlipPanPoint = extend({}, obj.tempFlipPanPoint, {}, true);
|
|
4620
|
+
this.rotateFlipColl = extend([], obj.rotateFlipColl, [], true);
|
|
4621
|
+
this.degree = obj.degree;
|
|
4622
|
+
this.currFlipState = obj.currFlipState;
|
|
4623
|
+
this.destLeft = obj.destPoints.startX;
|
|
4624
|
+
this.destTop = obj.destPoints.startY;
|
|
4625
|
+
this.destWidth = obj.destPoints.width;
|
|
4626
|
+
this.destHeight = obj.destPoints.height;
|
|
4627
|
+
this.srcLeft = obj.srcPoints.startX;
|
|
4628
|
+
this.srcTop = obj.srcPoints.startY;
|
|
4629
|
+
this.srcWidth = obj.srcPoints.width;
|
|
4630
|
+
this.srcHeight = obj.srcPoints.height;
|
|
4631
|
+
this.lowerContext.filter = obj.filter;
|
|
4632
|
+
if (this.lowerContext.filter.split(' ').length > 1) {
|
|
4633
|
+
if (this.lowerContext.filter.split(' ')[0].split('(')[1].split(')')[0] === '1') {
|
|
4634
|
+
this.isBrightnessAdjusted = false;
|
|
4635
|
+
}
|
|
4636
|
+
else {
|
|
4637
|
+
this.isBrightnessAdjusted = true;
|
|
4523
4638
|
}
|
|
4639
|
+
}
|
|
4640
|
+
var isCircleCrop = this.isCircleCrop;
|
|
4641
|
+
var currSelectionPoint = extend({}, this.currSelectionPoint, {}, true);
|
|
4642
|
+
this.currSelectionPoint = null;
|
|
4643
|
+
this.isCircleCrop = false;
|
|
4644
|
+
this.drawCropSelectionImage(obj, false);
|
|
4645
|
+
if (this.degree !== 0) {
|
|
4524
4646
|
this.currentPannedPoint = { x: 0, y: 0 };
|
|
4525
4647
|
this.rotatePan();
|
|
4526
4648
|
}
|
|
4527
|
-
this.activeObj = extend({},
|
|
4649
|
+
this.activeObj = extend({}, obj.activeObj, {}, true);
|
|
4528
4650
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
4529
|
-
this.
|
|
4530
|
-
|
|
4651
|
+
if (this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) {
|
|
4652
|
+
this.drawObject('duplicate');
|
|
4653
|
+
}
|
|
4654
|
+
var activeObj = extend({}, obj.activeObj, {}, true);
|
|
4531
4655
|
var isAfterCropAction = false;
|
|
4532
|
-
|
|
4656
|
+
this.afterCropActions = this.alignRotateFlipColl(this.afterCropActions);
|
|
4657
|
+
var afterCropActions = extend([], this.afterCropActions, [], true);
|
|
4658
|
+
if (!isObj && afterCropActions.length > 0) {
|
|
4533
4659
|
isAfterCropAction = true;
|
|
4534
|
-
var
|
|
4535
|
-
var pointColl = extend([], this.pointColl, {}, true);
|
|
4536
|
-
var freehandCounter = this.freehandCounter;
|
|
4537
|
-
this.objColl = [];
|
|
4538
|
-
this.pointColl = [];
|
|
4539
|
-
this.freehandCounter = 0;
|
|
4540
|
-
var isCircleCrop = this.isCircleCrop;
|
|
4541
|
-
var currSelectionPoint = extend({}, this.currSelectionPoint, {}, true);
|
|
4542
|
-
this.currSelectionPoint = null;
|
|
4543
|
-
this.isCircleCrop = false;
|
|
4544
|
-
var isFlip = false;
|
|
4545
|
-
for (var i = 0; i < this.afterCropActions.length; i++) {
|
|
4660
|
+
for (var i = 0; i < afterCropActions.length; i++) {
|
|
4546
4661
|
if (this.degree % 90 === 0 && this.degree % 180 !== 0 &&
|
|
4547
|
-
(
|
|
4662
|
+
(afterCropActions[i] === 'horizontalflip' || afterCropActions[i] === 'verticalflip')) {
|
|
4548
4663
|
this.rotatedFlipCropSelection = true;
|
|
4549
4664
|
}
|
|
4550
|
-
this.updateTransform(
|
|
4551
|
-
if (
|
|
4552
|
-
if (
|
|
4553
|
-
this.
|
|
4554
|
-
this.
|
|
4665
|
+
this.updateTransform(afterCropActions[i]);
|
|
4666
|
+
if (afterCropActions[i] === 'horizontalflip' || afterCropActions[i] === 'verticalflip') {
|
|
4667
|
+
if (afterCropActions.length === 1) {
|
|
4668
|
+
this.activeObj = extend({}, this.cropObj.activeObj, {}, true);
|
|
4669
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
4670
|
+
this.drawObject('duplicate');
|
|
4555
4671
|
}
|
|
4556
|
-
isFlip = true;
|
|
4557
4672
|
}
|
|
4558
4673
|
}
|
|
4559
|
-
this.isCircleCrop = isCircleCrop;
|
|
4560
|
-
this.currSelectionPoint = currSelectionPoint;
|
|
4561
|
-
var destPoints = { startX: this.destLeft, startY: this.destTop, width: this.destWidth, height: this.destHeight };
|
|
4562
4674
|
activeObj = extend({}, this.activeObj, {}, true);
|
|
4563
|
-
this.refreshActiveObj();
|
|
4564
|
-
this.objColl = objColl;
|
|
4565
|
-
this.pointColl = pointColl;
|
|
4566
|
-
this.freehandCounter = freehandCounter;
|
|
4567
|
-
if (this.rotateFlipColl.length > 1 && typeof (this.rotateFlipColl[this.rotateFlipColl.length - 1]) === 'string') {
|
|
4568
|
-
this.iterateObjColl();
|
|
4569
|
-
this.freehandRedraw(this.lowerContext);
|
|
4570
|
-
}
|
|
4571
|
-
else if (this.rotateFlipColl.length > 1 && typeof (this.rotateFlipColl[this.rotateFlipColl.length - 1]) === 'number' ||
|
|
4572
|
-
this.rotateFlipColl.length >= 0) {
|
|
4573
|
-
this.destLeft = activeObj.activePoint.startX;
|
|
4574
|
-
this.destTop = activeObj.activePoint.startY;
|
|
4575
|
-
this.destWidth = activeObj.activePoint.width;
|
|
4576
|
-
this.destHeight = activeObj.activePoint.height;
|
|
4577
|
-
this.zoomObjColl();
|
|
4578
|
-
this.zoomFreehandDrawColl();
|
|
4579
|
-
}
|
|
4580
|
-
this.destLeft = destPoints.startX;
|
|
4581
|
-
this.destTop = destPoints.startY;
|
|
4582
|
-
this.destWidth = destPoints.width;
|
|
4583
|
-
this.destHeight = destPoints.height;
|
|
4584
4675
|
this.totalPannedPoint = { x: 0, y: 0 };
|
|
4585
4676
|
this.totalPannedClientPoint = { x: 0, y: 0 };
|
|
4586
4677
|
this.totalPannedInternalPoint = { x: 0, y: 0 };
|
|
4587
4678
|
this.activeObj = activeObj;
|
|
4588
4679
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
4589
|
-
this.
|
|
4590
|
-
|
|
4680
|
+
if (this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) {
|
|
4681
|
+
this.drawObject('duplicate');
|
|
4682
|
+
}
|
|
4683
|
+
if (obj.degree !== this.degree) {
|
|
4591
4684
|
this.cropZoomFactor = this.zoomFactor = 0;
|
|
4592
4685
|
}
|
|
4593
4686
|
this.updateObjAndFreeHandDrawColl();
|
|
4594
|
-
if (isFlip) {
|
|
4595
|
-
if (this.degree === 0) {
|
|
4596
|
-
var currSelectionPoint_1 = extend({}, this.currSelectionPoint, {}, true);
|
|
4597
|
-
this.currSelectionPoint = null;
|
|
4598
|
-
this.isCircleCrop = false;
|
|
4599
|
-
this.drawPannImage({ x: 0, y: 0 }, this.getCurrentPanRegion());
|
|
4600
|
-
this.updateFlipPan(activeObj);
|
|
4601
|
-
this.isCircleCrop = isCircleCrop;
|
|
4602
|
-
this.currSelectionPoint = currSelectionPoint_1;
|
|
4603
|
-
}
|
|
4604
|
-
this.activeObj = activeObj;
|
|
4605
|
-
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
4606
|
-
this.drawObject('duplicate');
|
|
4607
|
-
}
|
|
4608
4687
|
if (this.rotatedFlipCropSelection) {
|
|
4609
4688
|
// this.totalPannedInternalPoint = extend({}, this.cropObj.totalPannedInternalPoint, {}, true) as Point;
|
|
4610
4689
|
this.rotatedFlipCropSelection = false;
|
|
4611
4690
|
}
|
|
4612
4691
|
}
|
|
4692
|
+
this.afterCropActions = afterCropActions;
|
|
4613
4693
|
if (!this.isCancelAction && !isAfterCropAction) {
|
|
4614
|
-
this.setDestPointsForFlipState();
|
|
4615
4694
|
this.updateObjAndFreeHandDrawColl();
|
|
4616
4695
|
this.zoomFreehandDrawColl();
|
|
4617
|
-
this.destLeft =
|
|
4618
|
-
this.destTop =
|
|
4696
|
+
this.destLeft = obj.destPoints.startX;
|
|
4697
|
+
this.destTop = obj.destPoints.startY;
|
|
4619
4698
|
}
|
|
4620
4699
|
this.activeObj = activeObj;
|
|
4700
|
+
this.isCircleCrop = isCircleCrop;
|
|
4701
|
+
this.currSelectionPoint = currSelectionPoint;
|
|
4621
4702
|
};
|
|
4622
|
-
ImageEditor.prototype.drawCropSelectionImage = function () {
|
|
4703
|
+
ImageEditor.prototype.drawCropSelectionImage = function (obj, isObj) {
|
|
4623
4704
|
var temp = this.lowerContext.filter;
|
|
4624
4705
|
this.upperContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
4625
4706
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
4626
4707
|
this.reverseTransformedState();
|
|
4627
|
-
|
|
4708
|
+
if (isObj) {
|
|
4709
|
+
this.updateCurrentTransformedState('initial');
|
|
4710
|
+
}
|
|
4711
|
+
else {
|
|
4712
|
+
this.iterateRotateFlipColl(this.lowerContext, 'initial');
|
|
4713
|
+
}
|
|
4714
|
+
this.setDestPointsForFlipState();
|
|
4628
4715
|
this.updateBrightnessFilter();
|
|
4629
4716
|
this.lowerContext.drawImage(this.baseImg, this.srcLeft, this.srcTop, this.srcWidth, this.srcHeight, this.destLeft, this.destTop, this.destWidth, this.destHeight);
|
|
4630
|
-
|
|
4631
|
-
|
|
4717
|
+
if (isObj) {
|
|
4718
|
+
this.updateCurrentTransformedState('reverse');
|
|
4719
|
+
}
|
|
4720
|
+
else {
|
|
4721
|
+
this.iterateRotateFlipColl(this.lowerContext, 'reverse');
|
|
4722
|
+
}
|
|
4723
|
+
this.destLeft = this.cropObj.destPoints.startX;
|
|
4724
|
+
this.destTop = this.cropObj.destPoints.startY;
|
|
4725
|
+
var activeObj = extend({}, obj.activeObj, {}, true);
|
|
4632
4726
|
this.lowerContext.filter = 'none';
|
|
4633
4727
|
if (this.isCancelAction) {
|
|
4634
4728
|
this.zoomObjColl();
|
|
4635
4729
|
this.zoomFreehandDrawColl();
|
|
4636
4730
|
}
|
|
4637
4731
|
else {
|
|
4638
|
-
this.destLeft =
|
|
4639
|
-
this.destTop =
|
|
4640
|
-
this.destWidth =
|
|
4641
|
-
this.destHeight =
|
|
4642
|
-
this.srcLeft =
|
|
4643
|
-
this.srcTop =
|
|
4644
|
-
this.srcWidth =
|
|
4645
|
-
this.srcHeight =
|
|
4732
|
+
this.destLeft = obj.destPoints.startX;
|
|
4733
|
+
this.destTop = obj.destPoints.startY;
|
|
4734
|
+
this.destWidth = obj.destPoints.width;
|
|
4735
|
+
this.destHeight = obj.destPoints.height;
|
|
4736
|
+
this.srcLeft = obj.srcPoints.startX;
|
|
4737
|
+
this.srcTop = obj.srcPoints.startY;
|
|
4738
|
+
this.srcWidth = obj.srcPoints.width;
|
|
4739
|
+
this.srcHeight = obj.srcPoints.height;
|
|
4646
4740
|
var destPoints = { startX: this.destLeft, startY: this.destTop, width: this.destWidth, height: this.destHeight };
|
|
4647
|
-
this.destLeft =
|
|
4648
|
-
this.destTop =
|
|
4649
|
-
this.destWidth =
|
|
4650
|
-
this.destHeight =
|
|
4741
|
+
this.destLeft = obj.activeObj.activePoint.startX;
|
|
4742
|
+
this.destTop = obj.activeObj.activePoint.startY;
|
|
4743
|
+
this.destWidth = obj.activeObj.activePoint.width;
|
|
4744
|
+
this.destHeight = obj.activeObj.activePoint.height;
|
|
4651
4745
|
this.zoomObjColl();
|
|
4652
4746
|
this.zoomFreehandDrawColl();
|
|
4653
4747
|
this.destLeft = destPoints.startX;
|
|
@@ -4664,10 +4758,12 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
4664
4758
|
}
|
|
4665
4759
|
if (isNullOrUndefined(isRotateCrop) && this.degree !== 0) {
|
|
4666
4760
|
this.updateCropObj();
|
|
4761
|
+
this.currDestinationPoint = { startX: this.destLeft, startY: this.destTop, width: this.destWidth, height: this.destHeight };
|
|
4667
4762
|
this.rotateCrop();
|
|
4668
4763
|
}
|
|
4669
4764
|
else if (isNullOrUndefined(isRotateCrop) && this.currFlipState !== '') {
|
|
4670
4765
|
this.updateCropObj();
|
|
4766
|
+
this.currDestinationPoint = { startX: this.destLeft, startY: this.destTop, width: this.destWidth, height: this.destHeight };
|
|
4671
4767
|
this.flipCrop();
|
|
4672
4768
|
}
|
|
4673
4769
|
else {
|
|
@@ -4677,6 +4773,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
4677
4773
|
this.updateCropObj();
|
|
4678
4774
|
this.resetPanPoints();
|
|
4679
4775
|
this.updateImageRatioForActObj();
|
|
4776
|
+
this.currDestinationPoint = { startX: this.destLeft, startY: this.destTop, width: this.destWidth, height: this.destHeight };
|
|
4680
4777
|
this.currSelectionPoint = extend({}, this.activeObj, {}, true);
|
|
4681
4778
|
this.cropDestPoints = { startX: this.destLeft, startY: this.destTop, width: this.destWidth, height: this.destHeight };
|
|
4682
4779
|
}
|
|
@@ -4866,21 +4963,35 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
4866
4963
|
}
|
|
4867
4964
|
return panRegion;
|
|
4868
4965
|
};
|
|
4869
|
-
ImageEditor.prototype.drawPannImage = function (point
|
|
4966
|
+
ImageEditor.prototype.drawPannImage = function (point) {
|
|
4967
|
+
var destPoints = { startX: this.destLeft, startY: this.destTop, width: this.destWidth, height: this.destHeight };
|
|
4870
4968
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
4969
|
+
this.updateCurrentTransformedState('initial');
|
|
4970
|
+
this.destLeft = destPoints.startX;
|
|
4971
|
+
this.destTop = destPoints.startY;
|
|
4972
|
+
this.destWidth = destPoints.width;
|
|
4973
|
+
this.destHeight = destPoints.height;
|
|
4974
|
+
this.setDestPointsForFlipState();
|
|
4871
4975
|
this.updateBrightnessFilter();
|
|
4872
4976
|
this.lowerContext.drawImage(this.baseImg, this.srcLeft, this.srcTop, this.srcWidth, this.srcHeight, this.destLeft, this.destTop, this.destWidth, this.destHeight);
|
|
4873
4977
|
if ((!isNullOrUndefined(this.currSelectionPoint) && this.currSelectionPoint.shape === 'crop-circle') || this.isCircleCrop) {
|
|
4874
4978
|
this.cropCircle(this.lowerContext, null, true);
|
|
4875
4979
|
}
|
|
4980
|
+
this.updateCurrentTransformedState('reverse');
|
|
4981
|
+
this.destLeft = destPoints.startX;
|
|
4982
|
+
this.destTop = destPoints.startY;
|
|
4983
|
+
this.destWidth = destPoints.width;
|
|
4984
|
+
this.destHeight = destPoints.height;
|
|
4876
4985
|
this.lowerContext.filter = 'none';
|
|
4877
|
-
this.panObjColl(point.x, point.y,
|
|
4878
|
-
this.panFreehandDrawColl(point.x, point.y,
|
|
4986
|
+
this.panObjColl(point.x, point.y, '');
|
|
4987
|
+
this.panFreehandDrawColl(point.x, point.y, '');
|
|
4879
4988
|
if (this.isCircleCrop) {
|
|
4880
4989
|
this.cropCircle(this.lowerContext, null, true);
|
|
4881
4990
|
}
|
|
4882
4991
|
};
|
|
4883
4992
|
ImageEditor.prototype.drawPannedImage = function (xDiff, yDiff) {
|
|
4993
|
+
var panEventArgs = { startPoint: this.panDown, endPoint: this.panMove };
|
|
4994
|
+
this.trigger('panning', panEventArgs);
|
|
4884
4995
|
var isObjCreated = false;
|
|
4885
4996
|
if (isNullOrUndefined(this.activeObj.shape)) {
|
|
4886
4997
|
isObjCreated = true;
|
|
@@ -4905,11 +5016,10 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
4905
5016
|
this.updateActiveObject(this.activeObj.activePoint, this.activeObj);
|
|
4906
5017
|
this.isCropTab = true;
|
|
4907
5018
|
}
|
|
4908
|
-
var panRegion = this.getCurrentPanRegion();
|
|
4909
5019
|
if (this.degree === 0) {
|
|
4910
5020
|
var point = void 0;
|
|
4911
5021
|
if (isNullOrUndefined(xDiff) && isNullOrUndefined(yDiff)) {
|
|
4912
|
-
point = this.updatePanPoints(
|
|
5022
|
+
point = this.updatePanPoints('');
|
|
4913
5023
|
}
|
|
4914
5024
|
else {
|
|
4915
5025
|
point = { x: xDiff, y: yDiff };
|
|
@@ -4918,7 +5028,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
4918
5028
|
this.totalPannedPoint.y += point.y;
|
|
4919
5029
|
var tempSelectionObj = extend({}, this.activeObj, {}, true);
|
|
4920
5030
|
var temp = this.lowerContext.filter;
|
|
4921
|
-
this.drawPannImage(point
|
|
5031
|
+
this.drawPannImage(point);
|
|
4922
5032
|
this.lowerContext.filter = temp;
|
|
4923
5033
|
this.tempPanMove = extend({}, this.panMove, {}, true);
|
|
4924
5034
|
this.activeObj = extend({}, tempSelectionObj, {}, true);
|
|
@@ -4926,13 +5036,12 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
4926
5036
|
if (!isNullOrUndefined(this.activeObj.shape)) {
|
|
4927
5037
|
this.drawObject('duplicate', this.activeObj);
|
|
4928
5038
|
}
|
|
4929
|
-
this.updateFlipPan(tempSelectionObj);
|
|
4930
5039
|
}
|
|
4931
5040
|
else {
|
|
4932
5041
|
var tempFlipState = this.currFlipState;
|
|
4933
5042
|
this.isCropTab = true;
|
|
4934
5043
|
if (isNullOrUndefined(xDiff) && isNullOrUndefined(yDiff)) {
|
|
4935
|
-
this.currentPannedPoint = this.updatePanPoints(
|
|
5044
|
+
this.currentPannedPoint = this.updatePanPoints('');
|
|
4936
5045
|
}
|
|
4937
5046
|
else {
|
|
4938
5047
|
this.currentPannedPoint = { x: xDiff, y: yDiff };
|
|
@@ -5016,45 +5125,23 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
5016
5125
|
var tempFlipColl = this.flipColl;
|
|
5017
5126
|
this.flipColl = [];
|
|
5018
5127
|
this.updateImageRatioForActObj();
|
|
5019
|
-
this.
|
|
5128
|
+
this.objColl.push(this.activeObj);
|
|
5129
|
+
if (this.zoomFactor > 0) {
|
|
5130
|
+
var zoomFactor = this.zoomFactor;
|
|
5131
|
+
var isUndoRedo = this.isUndoRedo;
|
|
5132
|
+
for (var i = 0; i < (zoomFactor * 10); i++) {
|
|
5133
|
+
this.isUndoRedo = true;
|
|
5134
|
+
this.zoom(-0.1);
|
|
5135
|
+
}
|
|
5136
|
+
this.isUndoRedo = isUndoRedo;
|
|
5137
|
+
this.resetPanPoints();
|
|
5138
|
+
}
|
|
5139
|
+
this.currSelectionPoint = extend({}, this.objColl[this.objColl.length - 1], {}, true);
|
|
5020
5140
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
5021
5141
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
5022
5142
|
var temp = this.lowerContext.filter;
|
|
5023
5143
|
this.updateBrightnessFilter();
|
|
5024
|
-
if (!isNullOrUndefined(this.tempPannedPoint) && this.totalPannedPoint.x === 0 && this.totalPannedPoint.y === 0) {
|
|
5025
|
-
this.totalPannedPoint = extend({}, this.tempPannedPoint, {}, true);
|
|
5026
|
-
this.tempPannedPoint = { x: 0, y: 0 };
|
|
5027
|
-
}
|
|
5028
|
-
var isPrevent = true;
|
|
5029
|
-
if (!isNullOrUndefined(this.activeObj.shape) && this.activeObj.shape.split('-')[0] === 'crop' &&
|
|
5030
|
-
this.zoomFactor === 0 && this.cropObj.cropZoom !== 0) {
|
|
5031
|
-
isPrevent = false;
|
|
5032
|
-
}
|
|
5033
|
-
if (this.zoomFactor === 0 && isPrevent) {
|
|
5034
|
-
if (this.totalPannedPoint.x > 0) {
|
|
5035
|
-
this.destLeft -= Math.abs(this.totalPannedPoint.x);
|
|
5036
|
-
}
|
|
5037
|
-
else {
|
|
5038
|
-
this.destLeft += Math.abs(this.totalPannedPoint.x);
|
|
5039
|
-
}
|
|
5040
|
-
if (this.totalPannedPoint.y > 0) {
|
|
5041
|
-
this.destTop -= Math.abs(this.totalPannedPoint.y);
|
|
5042
|
-
}
|
|
5043
|
-
else {
|
|
5044
|
-
this.destTop += Math.abs(this.totalPannedPoint.y);
|
|
5045
|
-
}
|
|
5046
|
-
}
|
|
5047
5144
|
this.lowerContext.drawImage(this.baseImg, this.srcLeft, this.srcTop, this.srcWidth, this.srcHeight, this.destLeft, this.destTop, this.destWidth, this.destHeight);
|
|
5048
|
-
var destLeft = this.destLeft;
|
|
5049
|
-
var destTop = this.destTop;
|
|
5050
|
-
if (this.currFlipState === 'horizontal' && this.zoomFactor > 0 && this.totalPannedPoint.x !== 0) {
|
|
5051
|
-
this.destLeft = destLeft - this.totalPannedPoint.x;
|
|
5052
|
-
}
|
|
5053
|
-
else if (this.currFlipState === 'vertical' && this.zoomFactor > 0 && this.totalPannedPoint.y !== 0) {
|
|
5054
|
-
this.destTop = destTop - this.totalPannedPoint.y;
|
|
5055
|
-
}
|
|
5056
|
-
this.updateImageRatioForActObj();
|
|
5057
|
-
this.objColl.push(this.activeObj);
|
|
5058
5145
|
for (var i = 0; i < this.objColl.length; i++) {
|
|
5059
5146
|
this.objColl[i].shapeFlip = '';
|
|
5060
5147
|
}
|
|
@@ -5062,37 +5149,21 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
5062
5149
|
this.pointColl[i].shapeFlip = '';
|
|
5063
5150
|
}
|
|
5064
5151
|
this.redrawObj(this.getCurrentPanRegion());
|
|
5065
|
-
this.flipFreehandrawColl(this.
|
|
5066
|
-
if (this.zoomFactor === 0 && isPrevent) {
|
|
5067
|
-
if (this.getCurrentPanRegion() === 'horizontal') {
|
|
5068
|
-
this.panObjColl(this.totalPannedPoint.x, -this.totalPannedPoint.y, this.getCurrentPanRegion());
|
|
5069
|
-
this.panFreehandDrawColl(this.totalPannedPoint.x, -this.totalPannedPoint.y, this.getCurrentPanRegion());
|
|
5070
|
-
}
|
|
5071
|
-
else if (this.getCurrentPanRegion() === 'vertical') {
|
|
5072
|
-
this.panObjColl(-this.totalPannedPoint.x, this.totalPannedPoint.y, this.getCurrentPanRegion());
|
|
5073
|
-
this.panFreehandDrawColl(-this.totalPannedPoint.x, this.totalPannedPoint.y, this.getCurrentPanRegion());
|
|
5074
|
-
}
|
|
5075
|
-
else {
|
|
5076
|
-
this.panObjColl(-this.totalPannedPoint.x, -this.totalPannedPoint.y, this.getCurrentPanRegion());
|
|
5077
|
-
this.panFreehandDrawColl(-this.totalPannedPoint.x, -this.totalPannedPoint.y, this.getCurrentPanRegion());
|
|
5078
|
-
}
|
|
5079
|
-
}
|
|
5152
|
+
this.flipFreehandrawColl(this.getCurrentPanRegion());
|
|
5080
5153
|
this.activeObj = extend({}, this.objColl[this.objColl.length - 1], {}, true);
|
|
5081
5154
|
this.objColl.pop();
|
|
5155
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
5082
5156
|
this.drawObject('duplicate');
|
|
5083
|
-
this.destLeft = destLeft;
|
|
5084
|
-
this.destTop = destTop;
|
|
5085
5157
|
this.cropImg(true);
|
|
5086
|
-
this.
|
|
5158
|
+
this.isReverseRotate = true;
|
|
5159
|
+
this.reverseTransformedState();
|
|
5087
5160
|
this.setDestinationPoints();
|
|
5161
|
+
this.currentTransformedState('initial');
|
|
5088
5162
|
this.updateBrightnessFilter();
|
|
5089
5163
|
this.lowerContext.drawImage(this.baseImg, this.srcLeft, this.srcTop, this.srcWidth, this.srcHeight, this.destLeft, this.destTop, this.destWidth, this.destHeight);
|
|
5090
5164
|
this.lowerContext.filter = temp;
|
|
5091
5165
|
this.isRotateZoom = false;
|
|
5092
5166
|
this.updateCurrentTransformedState('reverse');
|
|
5093
|
-
if (tempCurrFlipState === '' && this.currFlipState !== '') {
|
|
5094
|
-
tempCurrFlipState = this.currFlipState;
|
|
5095
|
-
}
|
|
5096
5167
|
this.currFlipState = tempCurrFlipState;
|
|
5097
5168
|
this.flipColl = tempFlipColl;
|
|
5098
5169
|
this.lowerContext.filter = 'none';
|
|
@@ -5103,9 +5174,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
5103
5174
|
this.pointColl[i].shapeFlip = '';
|
|
5104
5175
|
}
|
|
5105
5176
|
this.redrawObj(this.getCurrentPanRegion());
|
|
5106
|
-
this.flipFreehandrawColl(this.
|
|
5107
|
-
this.
|
|
5108
|
-
this.
|
|
5177
|
+
this.flipFreehandrawColl(this.getCurrentPanRegion());
|
|
5178
|
+
this.zoomObjColl();
|
|
5179
|
+
this.zoomFreehandDrawColl();
|
|
5109
5180
|
this.lowerContext.filter = temp;
|
|
5110
5181
|
if ((!isNullOrUndefined(this.currSelectionPoint) && this.currSelectionPoint.shape === 'crop-circle') || this.isCircleCrop) {
|
|
5111
5182
|
this.cropCircle(this.lowerContext);
|
|
@@ -5116,6 +5187,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
5116
5187
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
5117
5188
|
this.isReverseFlip = false;
|
|
5118
5189
|
this.resetPanPoints();
|
|
5190
|
+
this.tempFlipPanPoint = { x: 0, y: 0 };
|
|
5119
5191
|
};
|
|
5120
5192
|
ImageEditor.prototype.rotateCrop = function () {
|
|
5121
5193
|
var shape = '';
|
|
@@ -5158,31 +5230,19 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
5158
5230
|
}
|
|
5159
5231
|
var activeObj = extend({}, this.objColl[this.objColl.length - 1], {}, true);
|
|
5160
5232
|
if (this.currFlipState !== '') {
|
|
5161
|
-
var flipState = '';
|
|
5162
5233
|
for (var i = 0; i < this.objColl.length; i++) {
|
|
5163
5234
|
this.objColl[i].shapeFlip = '';
|
|
5164
5235
|
}
|
|
5165
|
-
if (this.currFlipState === 'horizontal') {
|
|
5166
|
-
flipState = this.degree % 90 === 0 && this.degree % 180 !== 0 ? 'vertical' : 'horizontal';
|
|
5167
|
-
this.redrawObj(flipState);
|
|
5168
|
-
}
|
|
5169
|
-
else if (this.currFlipState === 'vertical') {
|
|
5170
|
-
flipState = this.degree % 90 === 0 && this.degree % 180 !== 0 ? 'horizontal' : 'vertical';
|
|
5171
|
-
this.redrawObj(flipState);
|
|
5172
|
-
}
|
|
5173
5236
|
for (var i = 0; i < this.freehandCounter; i++) {
|
|
5174
5237
|
this.pointColl[i].shapeFlip = '';
|
|
5175
5238
|
}
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
}
|
|
5180
|
-
else if (this.currFlipState === 'vertical') {
|
|
5181
|
-
flipState = this.degree % 90 === 0 && this.degree % 180 !== 0 ? 'horizontal' : 'vertical';
|
|
5182
|
-
this.flipFreehandrawColl(flipState);
|
|
5183
|
-
}
|
|
5239
|
+
var flipState = this.getCurrentCropState('initial');
|
|
5240
|
+
this.redrawObj(flipState);
|
|
5241
|
+
this.flipFreehandrawColl(flipState);
|
|
5184
5242
|
}
|
|
5243
|
+
this.zoomObjColl();
|
|
5185
5244
|
this.zoomFreehandDrawColl();
|
|
5245
|
+
activeObj = extend({}, this.objColl[this.objColl.length - 1], {}, true);
|
|
5186
5246
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
5187
5247
|
this.drawObject('duplicate', activeObj);
|
|
5188
5248
|
this.objColl.pop();
|
|
@@ -5211,25 +5271,16 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
5211
5271
|
this.rotateObjColl();
|
|
5212
5272
|
this.rotateFreehandDrawColl();
|
|
5213
5273
|
}
|
|
5214
|
-
if (this.
|
|
5274
|
+
if (this.getCurrentPanRegion() !== '') {
|
|
5215
5275
|
for (var i = 0; i < this.objColl.length; i++) {
|
|
5216
5276
|
this.objColl[i].shapeFlip = '';
|
|
5217
5277
|
}
|
|
5218
|
-
if (this.currFlipState === 'horizontal') {
|
|
5219
|
-
this.redrawObj('horizontal');
|
|
5220
|
-
}
|
|
5221
|
-
else if (this.currFlipState === 'vertical') {
|
|
5222
|
-
this.redrawObj('vertical');
|
|
5223
|
-
}
|
|
5224
5278
|
for (var i = 0; i < this.freehandCounter; i++) {
|
|
5225
5279
|
this.pointColl[i].shapeFlip = '';
|
|
5226
5280
|
}
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
else if (this.currFlipState === 'vertical') {
|
|
5231
|
-
this.flipFreehandrawColl('vertical');
|
|
5232
|
-
}
|
|
5281
|
+
var flipState = this.getCurrentCropState('reverse');
|
|
5282
|
+
this.redrawObj(flipState);
|
|
5283
|
+
this.flipFreehandrawColl(flipState);
|
|
5233
5284
|
}
|
|
5234
5285
|
this.isReverseRotate = false;
|
|
5235
5286
|
if (shape === 'crop-circle') {
|
|
@@ -5252,37 +5303,141 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
5252
5303
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
5253
5304
|
this.resetPanPoints();
|
|
5254
5305
|
};
|
|
5255
|
-
ImageEditor.prototype.
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5306
|
+
ImageEditor.prototype.getCurrentCropState = function (type, isAllowInvert) {
|
|
5307
|
+
var flipState = '';
|
|
5308
|
+
var state = [];
|
|
5309
|
+
if (type === 'initial') {
|
|
5310
|
+
if (this.degree === 180 || this.degree === -180) {
|
|
5311
|
+
flipState = this.flipColl.length > 1 ? this.getCurrentPanRegion() : this.currFlipState;
|
|
5260
5312
|
}
|
|
5261
|
-
else
|
|
5262
|
-
|
|
5263
|
-
|
|
5313
|
+
else {
|
|
5314
|
+
for (var i = 0; i < this.rotateFlipColl.length; i++) {
|
|
5315
|
+
if (typeof (this.rotateFlipColl[i]) === 'number') {
|
|
5316
|
+
state.push('number');
|
|
5317
|
+
}
|
|
5318
|
+
else if (typeof (this.rotateFlipColl[i]) === 'string') {
|
|
5319
|
+
state.push('string');
|
|
5320
|
+
}
|
|
5321
|
+
}
|
|
5322
|
+
if (state.length > 1 && state[state.length - 1] === 'string' && state[state.length - 2] === 'number') {
|
|
5323
|
+
if (this.currFlipState === 'horizontal') {
|
|
5324
|
+
flipState = 'vertical';
|
|
5325
|
+
}
|
|
5326
|
+
else if (this.currFlipState === 'vertical') {
|
|
5327
|
+
flipState = 'horizontal';
|
|
5328
|
+
}
|
|
5329
|
+
}
|
|
5330
|
+
else if (state.length > 1 && state[state.length - 1] === 'number' && state[state.length - 2] === 'string') {
|
|
5331
|
+
flipState = this.flipColl.length > 1 ? this.getCurrentPanRegion() : this.currFlipState;
|
|
5332
|
+
}
|
|
5264
5333
|
}
|
|
5265
5334
|
}
|
|
5266
5335
|
else {
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
this.
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5336
|
+
flipState = this.getCurrentPanRegion();
|
|
5337
|
+
if (isAllowInvert || !this.isInitialRotate()) {
|
|
5338
|
+
if (this.degree === -90 || this.degree === -270) {
|
|
5339
|
+
if (flipState === 'horizontal') {
|
|
5340
|
+
flipState = 'vertical';
|
|
5341
|
+
}
|
|
5342
|
+
else if (flipState === 'vertical') {
|
|
5343
|
+
flipState = 'horizontal';
|
|
5344
|
+
}
|
|
5345
|
+
}
|
|
5274
5346
|
}
|
|
5275
5347
|
}
|
|
5348
|
+
if (flipState === '') {
|
|
5349
|
+
flipState = this.flipColl.length > 1 ? this.getCurrentPanRegion() : this.currFlipState;
|
|
5350
|
+
}
|
|
5351
|
+
return flipState;
|
|
5276
5352
|
};
|
|
5277
|
-
ImageEditor.prototype.
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
if (!isNullOrUndefined(this.activeObj.activePoint) && !isNullOrUndefined(this.activeObj.shape)) {
|
|
5282
|
-
rotatePanActiveObj = extend({}, this.activeObj, {}, true);
|
|
5353
|
+
ImageEditor.prototype.isInitialRotate = function () {
|
|
5354
|
+
var isRotate = false;
|
|
5355
|
+
if (this.rotateFlipColl.length > 0 && typeof (this.rotateFlipColl[0]) === 'number') {
|
|
5356
|
+
isRotate = true;
|
|
5283
5357
|
}
|
|
5284
|
-
|
|
5358
|
+
return isRotate;
|
|
5359
|
+
};
|
|
5360
|
+
ImageEditor.prototype.updateRotatePanPoints = function () {
|
|
5361
|
+
var panRegion = '';
|
|
5362
|
+
if (this.isInitialRotate() && this.degree < 0) {
|
|
5363
|
+
panRegion = this.getCurrentCropState('reverse', true);
|
|
5364
|
+
}
|
|
5365
|
+
else {
|
|
5366
|
+
panRegion = this.getCurrentPanRegion();
|
|
5367
|
+
}
|
|
5368
|
+
if (this.degree % 90 === 0 && this.degree % 180 !== 0) {
|
|
5369
|
+
if (this.degree === 90 || (this.degree === -90 && (panRegion === 'horizontal' || panRegion === 'vertical'))
|
|
5370
|
+
|| (this.degree === -270 && (panRegion === '' || panRegion === 'verticalHorizontal' || panRegion === 'horizontalVertical'))) {
|
|
5371
|
+
if (panRegion === '') {
|
|
5372
|
+
this.destLeft += this.currentPannedPoint.y;
|
|
5373
|
+
this.destTop -= this.currentPannedPoint.x;
|
|
5374
|
+
}
|
|
5375
|
+
else if (panRegion === 'horizontal') {
|
|
5376
|
+
this.destLeft += this.currentPannedPoint.y;
|
|
5377
|
+
this.destTop += this.currentPannedPoint.x;
|
|
5378
|
+
}
|
|
5379
|
+
else if (panRegion === 'vertical') {
|
|
5380
|
+
this.destLeft -= this.currentPannedPoint.y;
|
|
5381
|
+
this.destTop -= this.currentPannedPoint.x;
|
|
5382
|
+
}
|
|
5383
|
+
else {
|
|
5384
|
+
this.destLeft -= this.currentPannedPoint.y;
|
|
5385
|
+
this.destTop += this.currentPannedPoint.x;
|
|
5386
|
+
}
|
|
5387
|
+
}
|
|
5388
|
+
else if (this.degree === 270 || (this.degree === -270 && (panRegion === 'horizontal' || panRegion === 'vertical'))
|
|
5389
|
+
|| (this.degree === -90 && (panRegion === '' || panRegion === 'verticalHorizontal' || panRegion === 'horizontalVertical'))) {
|
|
5390
|
+
if (panRegion === '') {
|
|
5391
|
+
this.destLeft -= this.currentPannedPoint.y;
|
|
5392
|
+
this.destTop += this.currentPannedPoint.x;
|
|
5393
|
+
}
|
|
5394
|
+
else if (panRegion === 'horizontal') {
|
|
5395
|
+
this.destLeft -= this.currentPannedPoint.y;
|
|
5396
|
+
this.destTop -= this.currentPannedPoint.x;
|
|
5397
|
+
}
|
|
5398
|
+
else if (panRegion === 'vertical') {
|
|
5399
|
+
this.destLeft += this.currentPannedPoint.y;
|
|
5400
|
+
this.destTop += this.currentPannedPoint.x;
|
|
5401
|
+
}
|
|
5402
|
+
else {
|
|
5403
|
+
this.destLeft += this.currentPannedPoint.y;
|
|
5404
|
+
this.destTop -= this.currentPannedPoint.x;
|
|
5405
|
+
}
|
|
5406
|
+
}
|
|
5407
|
+
}
|
|
5408
|
+
else {
|
|
5409
|
+
if (this.degree === 180 || this.degree === -180) {
|
|
5410
|
+
if (panRegion === '') {
|
|
5411
|
+
this.destLeft -= this.currentPannedPoint.x;
|
|
5412
|
+
this.destTop -= this.currentPannedPoint.y;
|
|
5413
|
+
}
|
|
5414
|
+
else if (panRegion === 'horizontal') {
|
|
5415
|
+
this.destLeft += this.currentPannedPoint.x;
|
|
5416
|
+
this.destTop -= this.currentPannedPoint.y;
|
|
5417
|
+
}
|
|
5418
|
+
else if (panRegion === 'vertical') {
|
|
5419
|
+
this.destLeft -= this.currentPannedPoint.x;
|
|
5420
|
+
this.destTop += this.currentPannedPoint.y;
|
|
5421
|
+
}
|
|
5422
|
+
else {
|
|
5423
|
+
this.destLeft += this.currentPannedPoint.x;
|
|
5424
|
+
this.destTop += this.currentPannedPoint.y;
|
|
5425
|
+
}
|
|
5426
|
+
}
|
|
5427
|
+
}
|
|
5428
|
+
};
|
|
5429
|
+
ImageEditor.prototype.rotatePan = function (isCropSelection, isDefaultZoom) {
|
|
5430
|
+
this.isReverseRotate = true;
|
|
5431
|
+
var tempDegree = this.degree;
|
|
5432
|
+
var rotatePanActiveObj;
|
|
5433
|
+
if (!isNullOrUndefined(this.activeObj.activePoint) && !isNullOrUndefined(this.activeObj.shape)) {
|
|
5434
|
+
rotatePanActiveObj = extend({}, this.activeObj, {}, true);
|
|
5435
|
+
}
|
|
5436
|
+
var tempObjColl = extend([], this.objColl, [], true);
|
|
5437
|
+
var tempPointColl = extend([], this.pointColl, [], true);
|
|
5285
5438
|
this.objColl = [];
|
|
5439
|
+
this.pointColl = [];
|
|
5440
|
+
this.freehandCounter = 0;
|
|
5286
5441
|
this.refreshActiveObj();
|
|
5287
5442
|
this.isRotateZoom = true;
|
|
5288
5443
|
this.updateCurrentTransformedState('initial');
|
|
@@ -5311,15 +5466,25 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
5311
5466
|
this.totalPannedClientPoint.x = this.destLeft - destLeft;
|
|
5312
5467
|
this.totalPannedClientPoint.y = this.destTop - destTop;
|
|
5313
5468
|
this.objColl = tempObjColl;
|
|
5469
|
+
this.pointColl = tempPointColl;
|
|
5470
|
+
this.freehandCounter = this.pointColl.length;
|
|
5314
5471
|
this.degree = tempDegree;
|
|
5315
|
-
this.objColl = extend([], tempObjColl, [], true);
|
|
5316
5472
|
this.lowerContext.filter = 'none';
|
|
5317
|
-
var panRegion = this.getCurrentPanRegion();
|
|
5318
5473
|
if (isCropSelection) {
|
|
5319
|
-
|
|
5474
|
+
if (isDefaultZoom) {
|
|
5475
|
+
this.totalPannedClientPoint.x = -this.totalPannedClientPoint.x;
|
|
5476
|
+
this.totalPannedClientPoint.y = -this.totalPannedClientPoint.y;
|
|
5477
|
+
this.currentPannedPoint = extend({}, this.totalPannedClientPoint, {}, true);
|
|
5478
|
+
this.totalPannedClientPoint = { x: 0, y: 0 };
|
|
5479
|
+
this.destLeft += this.currentPannedPoint.x;
|
|
5480
|
+
this.destTop += this.currentPannedPoint.y;
|
|
5481
|
+
}
|
|
5482
|
+
else {
|
|
5483
|
+
this.currentPannedPoint = extend({}, this.totalPannedClientPoint, {}, true);
|
|
5484
|
+
}
|
|
5320
5485
|
}
|
|
5321
|
-
this.panObjColl(this.currentPannedPoint.x, this.currentPannedPoint.y,
|
|
5322
|
-
this.panFreehandDrawColl(this.currentPannedPoint.x, this.currentPannedPoint.y,
|
|
5486
|
+
this.panObjColl(this.currentPannedPoint.x, this.currentPannedPoint.y, '');
|
|
5487
|
+
this.panFreehandDrawColl(this.currentPannedPoint.x, this.currentPannedPoint.y, '');
|
|
5323
5488
|
this.lowerContext.filter = temp;
|
|
5324
5489
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
5325
5490
|
this.activeObj = extend({}, rotatePanActiveObj, {}, true);
|
|
@@ -5367,7 +5532,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
5367
5532
|
this.zoomFactor += value;
|
|
5368
5533
|
}
|
|
5369
5534
|
if (this.isCropTab) {
|
|
5370
|
-
this.cropZoomFactor
|
|
5535
|
+
this.cropZoomFactor = this.zoomFactor;
|
|
5371
5536
|
}
|
|
5372
5537
|
else {
|
|
5373
5538
|
this.defaultZoomFactor = this.zoomFactor;
|
|
@@ -5409,18 +5574,32 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
5409
5574
|
}
|
|
5410
5575
|
this.destLeft = destLeft - ((maxDimension.width - this.destWidth) / 2);
|
|
5411
5576
|
this.destTop = destTop - ((maxDimension.height - this.destHeight) / 2);
|
|
5577
|
+
destLeft = this.destLeft;
|
|
5578
|
+
destTop = this.destTop;
|
|
5412
5579
|
if (!isNullOrUndefined(selectionObj)) {
|
|
5413
5580
|
if (this.destLeft > selectionObj.activePoint.startX) {
|
|
5414
5581
|
this.destLeft = selectionObj.activePoint.startX;
|
|
5582
|
+
if (this.degree === 0) {
|
|
5583
|
+
this.totalPannedPoint.x -= (destLeft - this.destLeft);
|
|
5584
|
+
}
|
|
5415
5585
|
}
|
|
5416
5586
|
if (this.destTop > selectionObj.activePoint.startY) {
|
|
5417
5587
|
this.destTop = selectionObj.activePoint.startY;
|
|
5588
|
+
if (this.degree === 0) {
|
|
5589
|
+
this.totalPannedPoint.y -= (destTop - this.destTop);
|
|
5590
|
+
}
|
|
5418
5591
|
}
|
|
5419
5592
|
if (this.destLeft + maxDimension.width < selectionObj.activePoint.endX) {
|
|
5420
5593
|
this.destLeft = selectionObj.activePoint.endX - maxDimension.width;
|
|
5594
|
+
if (this.degree === 0) {
|
|
5595
|
+
this.totalPannedPoint.x -= (destLeft - this.destLeft);
|
|
5596
|
+
}
|
|
5421
5597
|
}
|
|
5422
5598
|
if (this.destTop + maxDimension.height < selectionObj.activePoint.endY) {
|
|
5423
5599
|
this.destTop = selectionObj.activePoint.endY - maxDimension.height;
|
|
5600
|
+
if (this.degree === 0) {
|
|
5601
|
+
this.totalPannedPoint.y -= (destTop - this.destTop);
|
|
5602
|
+
}
|
|
5424
5603
|
}
|
|
5425
5604
|
}
|
|
5426
5605
|
return maxDimension;
|
|
@@ -5642,11 +5821,44 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
5642
5821
|
this.degree = 0;
|
|
5643
5822
|
}
|
|
5644
5823
|
};
|
|
5645
|
-
ImageEditor.prototype.
|
|
5646
|
-
|
|
5824
|
+
ImageEditor.prototype.getCurrentObj = function () {
|
|
5825
|
+
var obj = { cropZoom: 0, defaultZoom: 0, totalPannedPoint: { x: 0, y: 0 }, totalPannedClientPoint: { x: 0, y: 0 },
|
|
5826
|
+
totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {},
|
|
5827
|
+
rotateFlipColl: [], degree: 0, currFlipState: '',
|
|
5828
|
+
destPoints: { startX: 0, startY: 0, width: 0, height: 0 },
|
|
5829
|
+
srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '' };
|
|
5830
|
+
obj.cropZoom = this.cropZoomFactor;
|
|
5831
|
+
obj.defaultZoom = this.defaultZoomFactor;
|
|
5832
|
+
obj.totalPannedPoint = extend({}, this.totalPannedPoint, {}, true);
|
|
5833
|
+
obj.totalPannedClientPoint = extend({}, this.totalPannedClientPoint, {}, true);
|
|
5834
|
+
obj.totalPannedInternalPoint = extend({}, this.totalPannedInternalPoint, {}, true);
|
|
5835
|
+
obj.tempFlipPanPoint = extend({}, this.tempFlipPanPoint, {}, true);
|
|
5836
|
+
obj.activeObj = extend({}, this.activeObj, {}, true);
|
|
5837
|
+
obj.rotateFlipColl = extend([], this.rotateFlipColl, [], true);
|
|
5838
|
+
obj.degree = this.degree;
|
|
5839
|
+
obj.currFlipState = this.currFlipState;
|
|
5840
|
+
obj.destPoints = { startX: this.destLeft, startY: this.destTop, endX: 0, endY: 0,
|
|
5841
|
+
width: this.destWidth, height: this.destHeight };
|
|
5842
|
+
obj.srcPoints = { startX: this.srcLeft, startY: this.srcTop, endX: 0, endY: 0,
|
|
5843
|
+
width: this.srcWidth, height: this.srcHeight };
|
|
5844
|
+
obj.filter = this.lowerContext.filter;
|
|
5845
|
+
return obj;
|
|
5846
|
+
};
|
|
5847
|
+
ImageEditor.prototype.updateUndoRedoColl = function (operation, previousObj, previousObjColl, previousPointColl, previousCropObj, previousText, currentText, previousFilter) {
|
|
5848
|
+
if (!this.isInitialLoading && this.allowUndoRedo) {
|
|
5849
|
+
if (this.currObjType.isUndoAction) {
|
|
5850
|
+
this.refreshUndoRedoColl();
|
|
5851
|
+
}
|
|
5647
5852
|
this.undoRedoStep++;
|
|
5648
|
-
this.
|
|
5649
|
-
|
|
5853
|
+
var currentObj = this.getCurrentObj();
|
|
5854
|
+
currentObj.objColl = extend([], this.objColl, [], true);
|
|
5855
|
+
currentObj.pointColl = extend([], this.pointColl, [], true);
|
|
5856
|
+
currentObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
5857
|
+
this.undoRedoColl.push({ operation: operation, previousObj: previousObj, currentObj: currentObj,
|
|
5858
|
+
previousObjColl: previousObjColl, currentObjColl: currentObj.objColl,
|
|
5859
|
+
previousPointColl: previousPointColl, currentPointColl: currentObj.pointColl,
|
|
5860
|
+
previousCropObj: previousCropObj, currentCropObj: extend({}, this.cropObj, {}, true),
|
|
5861
|
+
previousText: previousText, currentText: currentText, filter: previousFilter });
|
|
5650
5862
|
if (this.undoRedoColl.length > 16) {
|
|
5651
5863
|
this.undoRedoColl.splice(0, 1);
|
|
5652
5864
|
this.undoRedoStep--;
|
|
@@ -5921,6 +6133,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
5921
6133
|
}
|
|
5922
6134
|
this.freehandDrawSelectedIndex = this.freehandDrawHoveredIndex;
|
|
5923
6135
|
this.pointColl[this.freehandDrawSelectedIndex].isSelected = true;
|
|
6136
|
+
this.freehandDrawSelectedId = this.pointColl[this.freehandDrawSelectedIndex].id;
|
|
5924
6137
|
if (this.pointColl[this.freehandDrawHoveredIndex].strokeColor !== '#42a5f5') {
|
|
5925
6138
|
this.tempFreeHandDrawEditingStyles.strokeColor = this.pointColl[this.freehandDrawHoveredIndex].strokeColor;
|
|
5926
6139
|
}
|
|
@@ -6213,15 +6426,16 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
6213
6426
|
}
|
|
6214
6427
|
if (e.currentTarget === this.upperCanvas) {
|
|
6215
6428
|
this.currObjType.shape = this.currObjType.shape.toLowerCase();
|
|
6216
|
-
|
|
6429
|
+
var prevCropObj = extend({}, this.cropObj, {}, true);
|
|
6430
|
+
var prevObj = this.getCurrentObj();
|
|
6431
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
6432
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
6433
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
6434
|
+
if (!this.togglePen && !isCropSelection) {
|
|
6217
6435
|
if (!isNullOrUndefined(this.tempObjColl) && this.activeObj.activePoint.width !== 0) {
|
|
6218
6436
|
this.objColl.push(this.activeObj);
|
|
6219
6437
|
if (JSON.stringify(this.activeObj.activePoint) !== JSON.stringify(this.tempActiveObj.activePoint)) {
|
|
6220
|
-
this.
|
|
6221
|
-
currentObj: extend([], this.objColl, [], true),
|
|
6222
|
-
previousObj: this.tempObjColl, zoomFactor: this.zoomFactor,
|
|
6223
|
-
sharpen: this.adjustmentLevel.sharpen, bw: this.adjustmentLevel.bw });
|
|
6224
|
-
this.undoRedoStep++;
|
|
6438
|
+
this.updateUndoRedoColl('shapeTransform', prevObj, this.tempObjColl, prevObj.pointColl, prevCropObj);
|
|
6225
6439
|
}
|
|
6226
6440
|
this.redrawShape(this.objColl[this.objColl.length - 1]);
|
|
6227
6441
|
this.tempObjColl = undefined;
|
|
@@ -6232,13 +6446,8 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
6232
6446
|
}
|
|
6233
6447
|
else if (isCropSelection && !this.togglePen) {
|
|
6234
6448
|
if (JSON.stringify(this.activeObj.activePoint) !== JSON.stringify(this.tempActiveObj.activePoint)) {
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
previousObj: this.objColl, zoomFactor: this.zoomFactor,
|
|
6238
|
-
currentSelectionObj: extend([], this.activeObj, {}, true),
|
|
6239
|
-
previousSelectionObj: extend([], this.tempActiveObj, {}, true),
|
|
6240
|
-
sharpen: this.adjustmentLevel.sharpen, bw: this.adjustmentLevel.bw });
|
|
6241
|
-
this.undoRedoStep++;
|
|
6449
|
+
prevObj.activeObj = extend([], this.tempActiveObj, {}, true);
|
|
6450
|
+
this.updateUndoRedoColl('selectionTransform', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
6242
6451
|
}
|
|
6243
6452
|
}
|
|
6244
6453
|
}
|
|
@@ -6269,27 +6478,34 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
6269
6478
|
e.preventDefault();
|
|
6270
6479
|
e.stopImmediatePropagation();
|
|
6271
6480
|
break;
|
|
6272
|
-
case (e.ctrlKey && 'z'):
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
case (e.ctrlKey && 'y'):
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6481
|
+
// case (e.ctrlKey && 'z'):
|
|
6482
|
+
// if (this.allowUndoRedo) {
|
|
6483
|
+
// this.callUndo();
|
|
6484
|
+
// }
|
|
6485
|
+
// break;
|
|
6486
|
+
// case (e.ctrlKey && 'y'):
|
|
6487
|
+
// if (this.allowUndoRedo) {
|
|
6488
|
+
// this.callRedo();
|
|
6489
|
+
// }
|
|
6490
|
+
// break;
|
|
6282
6491
|
case 'Delete':
|
|
6283
6492
|
if (this.isFreehandDrawEditing) {
|
|
6284
6493
|
this.updateFreehandDrawColorChange();
|
|
6285
|
-
|
|
6286
|
-
var
|
|
6287
|
-
|
|
6288
|
-
|
|
6494
|
+
var prevCropObj = extend({}, this.cropObj, {}, true);
|
|
6495
|
+
var prevObj = this.getCurrentObj();
|
|
6496
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
6497
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
6498
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
6499
|
+
this.deleteFreehandDraw(parseInt(this.freehandDrawSelectedId.split('_')[1], 10) - 1, true);
|
|
6500
|
+
this.updateUndoRedoColl('deleteFreehandDrawing', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
6289
6501
|
}
|
|
6290
6502
|
else if (this.textArea.style.display === 'none') {
|
|
6291
6503
|
this.objColl.push(this.activeObj);
|
|
6292
|
-
var
|
|
6504
|
+
var prevCropObj = extend({}, this.cropObj, {}, true);
|
|
6505
|
+
var prevObj = this.getCurrentObj();
|
|
6506
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
6507
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
6508
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
6293
6509
|
this.objColl.pop();
|
|
6294
6510
|
previousShapeSettings = this.updatePreviousShapeSettings();
|
|
6295
6511
|
shapeChangingArgs = { action: 'delete', previousShapeSettings: previousShapeSettings, currentShapeSettings: null };
|
|
@@ -6297,7 +6513,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
6297
6513
|
this.clearSelection();
|
|
6298
6514
|
this.trigger('shapeChanging', shapeChangingArgs);
|
|
6299
6515
|
this.refreshToolbar('main');
|
|
6300
|
-
this.updateUndoRedoColl('
|
|
6516
|
+
this.updateUndoRedoColl('deleteObj', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
6301
6517
|
}
|
|
6302
6518
|
break;
|
|
6303
6519
|
case 'Escape':
|
|
@@ -6352,6 +6568,10 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
6352
6568
|
this.lastPan = { x: this.destLeft, y: this.destTop };
|
|
6353
6569
|
if (isNullOrUndefined(this.tempPanMove)) {
|
|
6354
6570
|
this.tempPanMove = { x: x, y: y };
|
|
6571
|
+
this.panStartObj = this.getCurrentObj();
|
|
6572
|
+
this.panStartObj.objColl = extend([], this.objColl, [], true);
|
|
6573
|
+
this.panStartObj.pointColl = extend([], this.pointColl, [], true);
|
|
6574
|
+
this.panStartObj.afterCropActions = this.afterCropActions;
|
|
6355
6575
|
}
|
|
6356
6576
|
};
|
|
6357
6577
|
ImageEditor.prototype.canvasMouseMoveHandler = function (e) {
|
|
@@ -6384,10 +6604,12 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
6384
6604
|
e.preventDefault();
|
|
6385
6605
|
if (this.togglePan) {
|
|
6386
6606
|
if (this.panDown && this.panMove && this.togglePan && this.dragCanvas) {
|
|
6607
|
+
var prevCropObj = extend({}, this.cropObj, {}, true);
|
|
6608
|
+
this.updateUndoRedoColl('pan', this.panStartObj, this.panStartObj.objColl, this.panStartObj.pointColl, prevCropObj);
|
|
6387
6609
|
this.panDown = null;
|
|
6388
6610
|
this.panMove = null;
|
|
6389
6611
|
this.tempPanMove = null;
|
|
6390
|
-
this.
|
|
6612
|
+
this.panStartObj = null;
|
|
6391
6613
|
}
|
|
6392
6614
|
}
|
|
6393
6615
|
this.currObjType.isDragging = false;
|
|
@@ -6429,7 +6651,8 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
6429
6651
|
ImageEditor.prototype.adjustToScreen = function () {
|
|
6430
6652
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
6431
6653
|
var proxy = this;
|
|
6432
|
-
if (!this.element.querySelector('#' + this.element.id + '_contextualToolbar')
|
|
6654
|
+
if ((!isNullOrUndefined(this.element.querySelector('#' + this.element.id + '_contextualToolbar')) &&
|
|
6655
|
+
!this.element.querySelector('#' + this.element.id + '_contextualToolbar').parentElement.classList.contains('e-hide')) ||
|
|
6433
6656
|
(!isNullOrUndefined(this.element.querySelector('#' + this.element.id + '_headWrapper'))
|
|
6434
6657
|
&& !this.element.querySelector('#' + this.element.id + '_headWrapper').parentElement.classList.contains('e-hide'))) {
|
|
6435
6658
|
this.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
@@ -6699,7 +6922,12 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
6699
6922
|
};
|
|
6700
6923
|
ImageEditor.prototype.updateTextFromTextArea = function () {
|
|
6701
6924
|
if (this.activeObj.keyHistory !== this.textArea.value) {
|
|
6702
|
-
|
|
6925
|
+
var prevCropObj = extend({}, this.cropObj, {}, true);
|
|
6926
|
+
var prevObj = this.getCurrentObj();
|
|
6927
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
6928
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
6929
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
6930
|
+
this.updateUndoRedoColl('text', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj, this.activeObj.keyHistory, this.textArea.value);
|
|
6703
6931
|
}
|
|
6704
6932
|
this.activeObj.keyHistory = this.textArea.value;
|
|
6705
6933
|
this.textArea.style.display = 'none';
|
|
@@ -6980,7 +7208,6 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
6980
7208
|
this.refreshActiveObj();
|
|
6981
7209
|
this.lowerContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
6982
7210
|
this.redrawImgWithObj();
|
|
6983
|
-
//this.zoomFreehandDrawColl();
|
|
6984
7211
|
if ((!isNullOrUndefined(this.currSelectionPoint) && this.currSelectionPoint.shape === 'crop-circle') || this.isCircleCrop) {
|
|
6985
7212
|
this.cropCircle(this.lowerContext);
|
|
6986
7213
|
}
|
|
@@ -8184,6 +8411,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
8184
8411
|
this.activeObj = extend({}, tempObj, {}, true);
|
|
8185
8412
|
};
|
|
8186
8413
|
ImageEditor.prototype.drawObject = function (canvas, obj, isCropRatio, points, isPreventDrag, saveContext) {
|
|
8414
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
8187
8415
|
var canvasDraw;
|
|
8188
8416
|
if (canvas.toLowerCase() === 'original') {
|
|
8189
8417
|
canvasDraw = this.lowerContext;
|
|
@@ -9934,28 +10162,6 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
9934
10162
|
height: this.destHeight / this.objColl[i].activePoint.height };
|
|
9935
10163
|
}
|
|
9936
10164
|
};
|
|
9937
|
-
ImageEditor.prototype.setTextFontSize = function (obj) {
|
|
9938
|
-
if (obj.shape === 'text') {
|
|
9939
|
-
var maxText = this.getMaxText(null, obj.keyHistory);
|
|
9940
|
-
var degree = void 0;
|
|
9941
|
-
if (obj.shapeDegree === 0) {
|
|
9942
|
-
degree = this.degree;
|
|
9943
|
-
}
|
|
9944
|
-
else {
|
|
9945
|
-
degree = this.degree - obj.shapeDegree;
|
|
9946
|
-
}
|
|
9947
|
-
var multiplier = 2;
|
|
9948
|
-
if (maxText.length === 1) {
|
|
9949
|
-
multiplier = 1;
|
|
9950
|
-
}
|
|
9951
|
-
if (degree === 0 || degree === 180 || degree === -180) {
|
|
9952
|
-
obj.textSettings.fontSize = (obj.activePoint.width / maxText.length) * multiplier;
|
|
9953
|
-
}
|
|
9954
|
-
else {
|
|
9955
|
-
obj.textSettings.fontSize = (obj.activePoint.height / maxText.length) * multiplier;
|
|
9956
|
-
}
|
|
9957
|
-
}
|
|
9958
|
-
};
|
|
9959
10165
|
ImageEditor.prototype.redrawShape = function (obj) {
|
|
9960
10166
|
for (var i = 0; i < this.objColl.length; i++) {
|
|
9961
10167
|
if (JSON.stringify(obj) === JSON.stringify(this.objColl[i])) {
|
|
@@ -10156,7 +10362,10 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
10156
10362
|
}
|
|
10157
10363
|
this.togglePen = false;
|
|
10158
10364
|
this.redrawActObj();
|
|
10159
|
-
var
|
|
10365
|
+
var prevObj = this.getCurrentObj();
|
|
10366
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
10367
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
10368
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
10160
10369
|
this.keyHistory = '';
|
|
10161
10370
|
this.refreshActiveObj();
|
|
10162
10371
|
this.activeObj.shape = 'text';
|
|
@@ -10220,10 +10429,8 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
10220
10429
|
this.activeObj.textFlip = this.currFlipState;
|
|
10221
10430
|
this.updateFontRatio(this.activeObj);
|
|
10222
10431
|
this.objColl.push(this.activeObj);
|
|
10223
|
-
|
|
10224
|
-
|
|
10225
|
-
sharpen: this.adjustmentLevel.sharpen, bw: this.adjustmentLevel.bw });
|
|
10226
|
-
this.undoRedoStep++;
|
|
10432
|
+
var prevCropObj = extend({}, this.cropObj, {}, true);
|
|
10433
|
+
this.updateUndoRedoColl('shapeTransform', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10227
10434
|
this.redrawShape(this.objColl[this.objColl.length - 1]);
|
|
10228
10435
|
this.isShapeInserted = true;
|
|
10229
10436
|
this.refreshToolbar('text');
|
|
@@ -10368,6 +10575,43 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
10368
10575
|
}
|
|
10369
10576
|
}
|
|
10370
10577
|
this.freehandRedraw(this.lowerContext);
|
|
10578
|
+
this.updateCurrSelectionPoint(degree);
|
|
10579
|
+
};
|
|
10580
|
+
ImageEditor.prototype.updateCurrSelectionPoint = function (degree) {
|
|
10581
|
+
if (!isNullOrUndefined(this.currSelectionPoint) && !isNullOrUndefined(this.currDestinationPoint)) {
|
|
10582
|
+
var activeObj = extend({}, this.activeObj, {}, true);
|
|
10583
|
+
var objColl = extend([], this.objColl, [], true);
|
|
10584
|
+
var srcPoints = { startX: this.srcLeft, startY: this.srcTop, width: this.srcWidth, height: this.srcHeight };
|
|
10585
|
+
var destPoints = { startX: this.destLeft, startY: this.destTop, width: this.destWidth, height: this.destHeight };
|
|
10586
|
+
this.objColl = [];
|
|
10587
|
+
this.objColl.push(extend({}, this.currSelectionPoint, {}, true));
|
|
10588
|
+
this.srcLeft = 0;
|
|
10589
|
+
this.srcTop = 0;
|
|
10590
|
+
this.srcWidth = this.baseImg.width;
|
|
10591
|
+
this.srcHeight = this.baseImg.height;
|
|
10592
|
+
this.destLeft = this.currDestinationPoint.startX;
|
|
10593
|
+
this.destTop = this.currDestinationPoint.startY;
|
|
10594
|
+
this.destWidth = this.currDestinationPoint.width;
|
|
10595
|
+
this.destHeight = this.currDestinationPoint.height;
|
|
10596
|
+
if (typeof (degree) === 'number') {
|
|
10597
|
+
this.setDestinationPoints();
|
|
10598
|
+
this.setClientTransformedDimension();
|
|
10599
|
+
}
|
|
10600
|
+
this.objColl[0].shapeFlip = '';
|
|
10601
|
+
this.redrawObj(degree);
|
|
10602
|
+
this.currSelectionPoint = extend({}, this.objColl[0], {}, true);
|
|
10603
|
+
this.currDestinationPoint = { startX: this.destLeft, startY: this.destTop, width: this.destWidth, height: this.destHeight };
|
|
10604
|
+
this.objColl = objColl;
|
|
10605
|
+
this.activeObj = activeObj;
|
|
10606
|
+
this.srcLeft = srcPoints.startX;
|
|
10607
|
+
this.srcTop = srcPoints.startY;
|
|
10608
|
+
this.srcWidth = srcPoints.width;
|
|
10609
|
+
this.srcHeight = srcPoints.height;
|
|
10610
|
+
this.destLeft = destPoints.startX;
|
|
10611
|
+
this.destTop = destPoints.startY;
|
|
10612
|
+
this.destWidth = destPoints.width;
|
|
10613
|
+
this.destHeight = destPoints.height;
|
|
10614
|
+
}
|
|
10371
10615
|
};
|
|
10372
10616
|
ImageEditor.prototype.setClientTransformedDimension = function (isPreventDimension) {
|
|
10373
10617
|
if (this.degree % 90 === 0 && this.degree % 180 !== 0) {
|
|
@@ -10384,100 +10628,110 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
10384
10628
|
}
|
|
10385
10629
|
}
|
|
10386
10630
|
};
|
|
10387
|
-
ImageEditor.prototype.popForDefaultTransformedState = function () {
|
|
10631
|
+
ImageEditor.prototype.popForDefaultTransformedState = function (collection) {
|
|
10388
10632
|
var rotateRight = 0;
|
|
10389
10633
|
var rotateleft = 0;
|
|
10390
10634
|
var horizontal = 0;
|
|
10391
10635
|
var vertical = 0;
|
|
10392
|
-
for (var i = 0; i <
|
|
10393
|
-
if (
|
|
10636
|
+
for (var i = 0; i < collection.length; i++) {
|
|
10637
|
+
if (collection[i] === 90 || collection[i] === 'rotateRight') {
|
|
10394
10638
|
rotateRight++;
|
|
10395
10639
|
rotateleft = 0;
|
|
10396
10640
|
horizontal = 0;
|
|
10397
10641
|
vertical = 0;
|
|
10398
10642
|
if (rotateRight === 4) {
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10643
|
+
collection.pop();
|
|
10644
|
+
collection.pop();
|
|
10645
|
+
collection.pop();
|
|
10646
|
+
collection.pop();
|
|
10403
10647
|
}
|
|
10404
10648
|
}
|
|
10405
|
-
else if (
|
|
10649
|
+
else if (collection[i] === -90 || collection[i] === 'rotateLeft') {
|
|
10406
10650
|
rotateleft++;
|
|
10407
10651
|
rotateRight = 0;
|
|
10408
10652
|
horizontal = 0;
|
|
10409
10653
|
vertical = 0;
|
|
10410
10654
|
if (rotateleft === 4) {
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
|
|
10655
|
+
collection.pop();
|
|
10656
|
+
collection.pop();
|
|
10657
|
+
collection.pop();
|
|
10658
|
+
collection.pop();
|
|
10415
10659
|
}
|
|
10416
10660
|
}
|
|
10417
|
-
else if (
|
|
10661
|
+
else if (collection[i] === 'horizontal' || collection[i] === 'horizontalflip') {
|
|
10418
10662
|
horizontal++;
|
|
10419
10663
|
rotateleft = 0;
|
|
10420
10664
|
rotateRight = 0;
|
|
10421
10665
|
vertical = 0;
|
|
10422
10666
|
if (horizontal === 2) {
|
|
10423
|
-
|
|
10424
|
-
|
|
10667
|
+
collection.pop();
|
|
10668
|
+
collection.pop();
|
|
10425
10669
|
}
|
|
10426
10670
|
}
|
|
10427
|
-
else if (
|
|
10671
|
+
else if (collection[i] === 'vertical' || collection[i] === 'verticalflip') {
|
|
10428
10672
|
vertical++;
|
|
10429
10673
|
horizontal = 0;
|
|
10430
10674
|
rotateleft = 0;
|
|
10431
10675
|
rotateRight = 0;
|
|
10432
10676
|
if (vertical === 2) {
|
|
10433
|
-
|
|
10434
|
-
|
|
10677
|
+
collection.pop();
|
|
10678
|
+
collection.pop();
|
|
10435
10679
|
}
|
|
10436
10680
|
}
|
|
10437
10681
|
}
|
|
10682
|
+
return collection;
|
|
10438
10683
|
};
|
|
10439
|
-
ImageEditor.prototype.popForDefaultFlipState = function () {
|
|
10440
|
-
for (var i = 0; i <
|
|
10441
|
-
if (!isNullOrUndefined(
|
|
10442
|
-
if (
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
|
|
10684
|
+
ImageEditor.prototype.popForDefaultFlipState = function (collection) {
|
|
10685
|
+
for (var i = 0; i < collection.length; i++) {
|
|
10686
|
+
if (!isNullOrUndefined(collection[i + 3])) {
|
|
10687
|
+
if ((collection[i] === 'horizontal' || collection[i] === 'horizontalFlip')
|
|
10688
|
+
&& (collection[i + 1] === 'vertical' || collection[i] === 'verticalFlip') &&
|
|
10689
|
+
(collection[i + 2] === 'horizontal' || collection[i] === 'horizontalFlip') &&
|
|
10690
|
+
(collection[i + 3] === 'vertical' || collection[i] === 'verticalFlip')) {
|
|
10691
|
+
collection.pop();
|
|
10692
|
+
collection.pop();
|
|
10693
|
+
collection.pop();
|
|
10694
|
+
collection.pop();
|
|
10448
10695
|
}
|
|
10449
|
-
else if (
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
|
|
10696
|
+
else if ((collection[i] === 'vertical' || collection[i] === 'verticalFlip')
|
|
10697
|
+
&& (collection[i + 1] === 'horizontal' || collection[i + 1] === 'horizontalFlip') &&
|
|
10698
|
+
(collection[i + 2] === 'vertical' || collection[i] === 'verticalFlip') &&
|
|
10699
|
+
(collection[i + 3] === 'horizontal' || collection[i] === 'horizontalFlip')) {
|
|
10700
|
+
collection.pop();
|
|
10701
|
+
collection.pop();
|
|
10702
|
+
collection.pop();
|
|
10703
|
+
collection.pop();
|
|
10455
10704
|
}
|
|
10456
10705
|
}
|
|
10457
10706
|
}
|
|
10707
|
+
return collection;
|
|
10458
10708
|
};
|
|
10459
|
-
ImageEditor.prototype.popForDefaultRotateState = function () {
|
|
10460
|
-
for (var i = 0; i <
|
|
10461
|
-
if (!isNullOrUndefined(
|
|
10462
|
-
if (
|
|
10463
|
-
|
|
10464
|
-
|
|
10709
|
+
ImageEditor.prototype.popForDefaultRotateState = function (collection) {
|
|
10710
|
+
for (var i = 0; i < collection.length; i++) {
|
|
10711
|
+
if (!isNullOrUndefined(collection[i + 1])) {
|
|
10712
|
+
if ((collection[i] === 90 || collection[i] === 'rotateRight') &&
|
|
10713
|
+
(collection[i + 1] === -90 || collection[i] === 'rotateLeft')) {
|
|
10714
|
+
collection.pop();
|
|
10715
|
+
collection.pop();
|
|
10465
10716
|
}
|
|
10466
|
-
else if (
|
|
10467
|
-
|
|
10468
|
-
|
|
10717
|
+
else if ((collection[i] === -90 || collection[i] === 'rotateLeft') &&
|
|
10718
|
+
(collection[i + 1] === 90 || collection[i] === 'rotateRight')) {
|
|
10719
|
+
collection.pop();
|
|
10720
|
+
collection.pop();
|
|
10469
10721
|
}
|
|
10470
10722
|
}
|
|
10471
10723
|
}
|
|
10724
|
+
return collection;
|
|
10472
10725
|
};
|
|
10473
|
-
ImageEditor.prototype.alignRotateFlipColl = function () {
|
|
10474
|
-
this.popForDefaultTransformedState();
|
|
10475
|
-
this.popForDefaultFlipState();
|
|
10476
|
-
this.popForDefaultRotateState();
|
|
10477
|
-
if (
|
|
10726
|
+
ImageEditor.prototype.alignRotateFlipColl = function (collection, isRotateFlipCollection) {
|
|
10727
|
+
collection = this.popForDefaultTransformedState(collection);
|
|
10728
|
+
collection = this.popForDefaultFlipState(collection);
|
|
10729
|
+
collection = this.popForDefaultRotateState(collection);
|
|
10730
|
+
if (collection.length === 0 && isRotateFlipCollection) {
|
|
10478
10731
|
this.degree = 0;
|
|
10479
10732
|
this.currFlipState = '';
|
|
10480
10733
|
}
|
|
10734
|
+
return collection;
|
|
10481
10735
|
};
|
|
10482
10736
|
ImageEditor.prototype.updateFlipColl = function (direction) {
|
|
10483
10737
|
if (this.flipColl.length === 0) {
|
|
@@ -10648,35 +10902,51 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
10648
10902
|
this.applyPenDraw();
|
|
10649
10903
|
this.adjustmentLevel.brightness = value;
|
|
10650
10904
|
value = this.getFilterValue(value);
|
|
10651
|
-
var
|
|
10905
|
+
var prevCropObj = extend({}, this.cropObj, {}, true);
|
|
10906
|
+
var prevObj = this.getCurrentObj();
|
|
10907
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
10908
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
10909
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
10652
10910
|
this.updateAdjustment('brightness', value);
|
|
10653
|
-
this.updateUndoRedoColl('brightness',
|
|
10911
|
+
this.updateUndoRedoColl('brightness', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10654
10912
|
};
|
|
10655
10913
|
ImageEditor.prototype.setContrast = function (value) {
|
|
10656
10914
|
this.applyPenDraw();
|
|
10657
10915
|
this.adjustmentLevel.contrast = value;
|
|
10658
|
-
var temp = this.lowerContext.filter;
|
|
10659
10916
|
value = this.getFilterValue(value);
|
|
10660
10917
|
value *= 100;
|
|
10918
|
+
var prevCropObj = extend({}, this.cropObj, {}, true);
|
|
10919
|
+
var prevObj = this.getCurrentObj();
|
|
10920
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
10921
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
10922
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
10661
10923
|
this.updateAdjustment('contrast', value);
|
|
10662
|
-
this.updateUndoRedoColl('contrast',
|
|
10924
|
+
this.updateUndoRedoColl('contrast', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10663
10925
|
};
|
|
10664
10926
|
ImageEditor.prototype.setHue = function (value) {
|
|
10665
10927
|
this.applyPenDraw();
|
|
10666
10928
|
this.adjustmentLevel.hue = value;
|
|
10667
10929
|
value *= 3;
|
|
10668
|
-
var
|
|
10930
|
+
var prevCropObj = extend({}, this.cropObj, {}, true);
|
|
10931
|
+
var prevObj = this.getCurrentObj();
|
|
10932
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
10933
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
10934
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
10669
10935
|
this.updateAdjustment('hue', value);
|
|
10670
|
-
this.updateUndoRedoColl('hue',
|
|
10936
|
+
this.updateUndoRedoColl('hue', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10671
10937
|
};
|
|
10672
10938
|
ImageEditor.prototype.setSaturation = function (value) {
|
|
10673
10939
|
this.applyPenDraw();
|
|
10674
10940
|
this.adjustmentLevel.saturation = value;
|
|
10675
10941
|
value = this.getSaturationFilterValue(value);
|
|
10676
10942
|
value *= 100;
|
|
10677
|
-
var
|
|
10943
|
+
var prevCropObj = extend({}, this.cropObj, {}, true);
|
|
10944
|
+
var prevObj = this.getCurrentObj();
|
|
10945
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
10946
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
10947
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
10678
10948
|
this.updateAdjustment('saturation', value);
|
|
10679
|
-
this.updateUndoRedoColl('saturation',
|
|
10949
|
+
this.updateUndoRedoColl('saturation', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10680
10950
|
};
|
|
10681
10951
|
ImageEditor.prototype.setOpacity = function (value) {
|
|
10682
10952
|
this.applyPenDraw();
|
|
@@ -10699,9 +10969,13 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
10699
10969
|
else if (value === 0) {
|
|
10700
10970
|
value = 0.25;
|
|
10701
10971
|
}
|
|
10702
|
-
var
|
|
10972
|
+
var prevCropObj = extend({}, this.cropObj, {}, true);
|
|
10973
|
+
var prevObj = this.getCurrentObj();
|
|
10974
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
10975
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
10976
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
10703
10977
|
this.updateAdjustment('opacity', value);
|
|
10704
|
-
this.updateUndoRedoColl('opacity',
|
|
10978
|
+
this.updateUndoRedoColl('opacity', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10705
10979
|
};
|
|
10706
10980
|
ImageEditor.prototype.setBlur = function (value) {
|
|
10707
10981
|
this.applyPenDraw();
|
|
@@ -10709,25 +10983,37 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
10709
10983
|
value /= 20;
|
|
10710
10984
|
// Since 0.5 is not working in blur we consider from 1
|
|
10711
10985
|
value += 0.5;
|
|
10712
|
-
var
|
|
10986
|
+
var prevCropObj = extend({}, this.cropObj, {}, true);
|
|
10987
|
+
var prevObj = this.getCurrentObj();
|
|
10988
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
10989
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
10990
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
10713
10991
|
this.updateAdjustment('blur', value);
|
|
10714
|
-
this.updateUndoRedoColl('blur',
|
|
10992
|
+
this.updateUndoRedoColl('blur', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10715
10993
|
};
|
|
10716
10994
|
ImageEditor.prototype.setExposure = function (value) {
|
|
10717
10995
|
this.applyPenDraw();
|
|
10718
10996
|
this.adjustmentLevel.exposure = value;
|
|
10719
10997
|
value = this.getFilterValue(value);
|
|
10720
|
-
var
|
|
10998
|
+
var prevCropObj = extend({}, this.cropObj, {}, true);
|
|
10999
|
+
var prevObj = this.getCurrentObj();
|
|
11000
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
11001
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
11002
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
10721
11003
|
this.updateAdjustment('exposure', value);
|
|
10722
|
-
this.updateUndoRedoColl('exposure',
|
|
11004
|
+
this.updateUndoRedoColl('exposure', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10723
11005
|
};
|
|
10724
11006
|
ImageEditor.prototype.setFilter = function (type) {
|
|
10725
11007
|
type = type.toLowerCase();
|
|
10726
11008
|
this.applyPenDraw();
|
|
10727
|
-
var tempFilter = this.lowerContext.filter;
|
|
10728
11009
|
var prevFilter = this.currentFilter;
|
|
11010
|
+
var prevCropObj = extend({}, this.cropObj, {}, true);
|
|
11011
|
+
var prevObj = this.getCurrentObj();
|
|
11012
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
11013
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
11014
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
10729
11015
|
this.updateAdjustment(type, null);
|
|
10730
|
-
this.updateUndoRedoColl(type,
|
|
11016
|
+
this.updateUndoRedoColl(type, prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj, null, null, prevFilter);
|
|
10731
11017
|
};
|
|
10732
11018
|
ImageEditor.prototype.renderImage = function () {
|
|
10733
11019
|
var temp = this.lowerContext.filter;
|
|
@@ -10762,8 +11048,81 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
10762
11048
|
this.updateFontStyles();
|
|
10763
11049
|
this.textArea.style.width = this.activeObj.activePoint.width + 'px';
|
|
10764
11050
|
};
|
|
11051
|
+
ImageEditor.prototype.drawNewSelection = function (type, startX, startY, width, height) {
|
|
11052
|
+
var points;
|
|
11053
|
+
var cropShape = 'crop-' + type;
|
|
11054
|
+
if (cropShape.toLowerCase() === 'crop-custom') {
|
|
11055
|
+
if (this.currObjType.shape === '') {
|
|
11056
|
+
this.drawCustomSelection('crop-custom');
|
|
11057
|
+
}
|
|
11058
|
+
if (startX && startY) {
|
|
11059
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
11060
|
+
this.currObjType.shape = this.activeObj.shape = cropShape.toLowerCase();
|
|
11061
|
+
this.activeObj.activePoint.startX = startX;
|
|
11062
|
+
this.activeObj.activePoint.startY = startY;
|
|
11063
|
+
this.activeObj.activePoint.endX = this.lowerCanvas.width;
|
|
11064
|
+
this.activeObj.activePoint.endY = this.lowerCanvas.height;
|
|
11065
|
+
this.activeObj.activePoint.width = this.activeObj.activePoint.endX - this.activeObj.activePoint.startX;
|
|
11066
|
+
this.activeObj.activePoint.height = this.activeObj.activePoint.endY - this.activeObj.activePoint.startY;
|
|
11067
|
+
this.drawObject('duplicate');
|
|
11068
|
+
}
|
|
11069
|
+
}
|
|
11070
|
+
else if (cropShape.toLowerCase() === 'crop-canvas') {
|
|
11071
|
+
this.upperCanvas.style.display = 'none';
|
|
11072
|
+
this.dragCanvas = true;
|
|
11073
|
+
}
|
|
11074
|
+
else {
|
|
11075
|
+
this.currObjType.isCustomCrop = false;
|
|
11076
|
+
this.currObjType.shape = cropShape.toLowerCase();
|
|
11077
|
+
if (width && height) {
|
|
11078
|
+
points = { startX: startX, startY: startY, endX: startX + width, endY: startY + height,
|
|
11079
|
+
width: width, height: height };
|
|
11080
|
+
}
|
|
11081
|
+
else if (width && cropShape === 'crop-circle') {
|
|
11082
|
+
points = { startX: startX, startY: startY, endX: startX + width, endY: startY + width,
|
|
11083
|
+
width: width, height: width };
|
|
11084
|
+
}
|
|
11085
|
+
this.activeObj.shape = cropShape.toLowerCase();
|
|
11086
|
+
this.drawObject('duplicate', null, true, points);
|
|
11087
|
+
}
|
|
11088
|
+
};
|
|
11089
|
+
ImageEditor.prototype.setDestPointsForFlipState = function (isUpdate) {
|
|
11090
|
+
if (this.getCurrentPanRegion() !== '') {
|
|
11091
|
+
if (this.getCurrentPanRegion() === 'horizontal') {
|
|
11092
|
+
this.destLeft = this.lowerCanvas.clientWidth - (this.destWidth + this.destLeft);
|
|
11093
|
+
}
|
|
11094
|
+
else if (this.getCurrentPanRegion() === 'vertical') {
|
|
11095
|
+
this.destTop = this.lowerCanvas.clientHeight - (this.destHeight + this.destTop);
|
|
11096
|
+
}
|
|
11097
|
+
else {
|
|
11098
|
+
this.destLeft = this.lowerCanvas.clientWidth - (this.destWidth + this.destLeft);
|
|
11099
|
+
this.destTop = this.lowerCanvas.clientHeight - (this.destHeight + this.destTop);
|
|
11100
|
+
}
|
|
11101
|
+
}
|
|
11102
|
+
};
|
|
11103
|
+
ImageEditor.prototype.performUndoDefaultAction = function (obj) {
|
|
11104
|
+
this.lowerContext.filter = obj.previousObj.filter;
|
|
11105
|
+
this.objColl = [];
|
|
11106
|
+
this.pointColl = [];
|
|
11107
|
+
this.freehandCounter = 0;
|
|
11108
|
+
this.setCurrentObj(obj.previousObj);
|
|
11109
|
+
this.destLeft = obj.previousObj.destPoints.startX;
|
|
11110
|
+
this.destTop = obj.previousObj.destPoints.startY;
|
|
11111
|
+
var activeObj = extend({}, this.activeObj, {}, true);
|
|
11112
|
+
this.objColl = extend([], obj.previousObjColl, [], true);
|
|
11113
|
+
this.pointColl = extend([], obj.previousPointColl, [], true);
|
|
11114
|
+
this.freehandCounter = this.pointColl.length;
|
|
11115
|
+
this.lowerContext.filter = 'none';
|
|
11116
|
+
this.iterateObjColl();
|
|
11117
|
+
this.freehandRedraw(this.lowerContext);
|
|
11118
|
+
this.lowerContext.filter = obj.previousObj.filter;
|
|
11119
|
+
this.activeObj = activeObj;
|
|
11120
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
11121
|
+
if (this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) {
|
|
11122
|
+
this.drawObject('duplicate');
|
|
11123
|
+
}
|
|
11124
|
+
};
|
|
10765
11125
|
ImageEditor.prototype.setAdjustment = function (type) {
|
|
10766
|
-
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
10767
11126
|
var splitWords = this.lowerContext.filter.split(' ');
|
|
10768
11127
|
var value;
|
|
10769
11128
|
var valueArr;
|
|
@@ -10826,59 +11185,25 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
10826
11185
|
this.adjustmentLevel.exposure = this.setFilterValue(value);
|
|
10827
11186
|
break;
|
|
10828
11187
|
}
|
|
10829
|
-
this.callUpdateCurrentTransformedState();
|
|
10830
11188
|
};
|
|
10831
|
-
ImageEditor.prototype.updateFilter = function (
|
|
10832
|
-
|
|
10833
|
-
|
|
10834
|
-
|
|
10835
|
-
|
|
10836
|
-
|
|
10837
|
-
|
|
10838
|
-
filterCanvas.parentElement.classList.add('e-selected');
|
|
10839
|
-
}
|
|
10840
|
-
this.currentFilter = obj.value;
|
|
10841
|
-
this.lowerContext.filter = this.canvasFilter = obj.previousObj;
|
|
10842
|
-
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
10843
|
-
this.isUndoRedo = true;
|
|
10844
|
-
this.redrawImgWithObj();
|
|
10845
|
-
};
|
|
10846
|
-
ImageEditor.prototype.drawNewSelection = function (type, startX, startY, width, height) {
|
|
10847
|
-
var points;
|
|
10848
|
-
var cropShape = 'crop-' + type;
|
|
10849
|
-
if (cropShape.toLowerCase() === 'crop-custom') {
|
|
10850
|
-
if (this.currObjType.shape === '') {
|
|
10851
|
-
this.drawCustomSelection('crop-custom');
|
|
11189
|
+
ImageEditor.prototype.updateFilter = function (type, previousFilter) {
|
|
11190
|
+
if (type === 'default' || type === 'chrome' || type === 'cold' ||
|
|
11191
|
+
type === 'warm' || type === 'grayscale' || type === 'blackandwhite' ||
|
|
11192
|
+
type === 'sepia' || type === 'invert' || type === 'sharpen') {
|
|
11193
|
+
var selEle = this.element.querySelector('.e-contextual-toolbar-wrapper .e-toolbar-item.e-selected');
|
|
11194
|
+
if (selEle) {
|
|
11195
|
+
selEle.classList.remove('e-selected');
|
|
10852
11196
|
}
|
|
10853
|
-
|
|
10854
|
-
|
|
10855
|
-
|
|
10856
|
-
this.activeObj.activePoint.startX = startX;
|
|
10857
|
-
this.activeObj.activePoint.startY = startY;
|
|
10858
|
-
this.activeObj.activePoint.endX = this.lowerCanvas.width;
|
|
10859
|
-
this.activeObj.activePoint.endY = this.lowerCanvas.height;
|
|
10860
|
-
this.activeObj.activePoint.width = this.activeObj.activePoint.endX - this.activeObj.activePoint.startX;
|
|
10861
|
-
this.activeObj.activePoint.height = this.activeObj.activePoint.endY - this.activeObj.activePoint.startY;
|
|
10862
|
-
this.drawObject('duplicate');
|
|
11197
|
+
var filterCanvas = document.getElementById(this.element.id + '_' + type + 'Canvas');
|
|
11198
|
+
if (filterCanvas) {
|
|
11199
|
+
filterCanvas.parentElement.classList.add('e-selected');
|
|
10863
11200
|
}
|
|
10864
|
-
|
|
10865
|
-
|
|
10866
|
-
this.upperCanvas.style.display = 'none';
|
|
10867
|
-
this.dragCanvas = true;
|
|
10868
|
-
}
|
|
10869
|
-
else {
|
|
10870
|
-
this.currObjType.isCustomCrop = false;
|
|
10871
|
-
this.currObjType.shape = cropShape.toLowerCase();
|
|
10872
|
-
if (width && height) {
|
|
10873
|
-
points = { startX: startX, startY: startY, endX: startX + width, endY: startY + height,
|
|
10874
|
-
width: width, height: height };
|
|
11201
|
+
if (!isNullOrUndefined(previousFilter)) {
|
|
11202
|
+
this.currentFilter = previousFilter;
|
|
10875
11203
|
}
|
|
10876
|
-
else
|
|
10877
|
-
|
|
10878
|
-
width: width, height: width };
|
|
11204
|
+
else {
|
|
11205
|
+
this.currentFilter = this.element.id + '_' + type;
|
|
10879
11206
|
}
|
|
10880
|
-
this.activeObj.shape = cropShape.toLowerCase();
|
|
10881
|
-
this.drawObject('duplicate', null, true, points);
|
|
10882
11207
|
}
|
|
10883
11208
|
};
|
|
10884
11209
|
/**
|
|
@@ -10919,11 +11244,15 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
10919
11244
|
}
|
|
10920
11245
|
if (!this.disabled && this.activeObj.horTopLine !== undefined && (this.currObjType.isCustomCrop || splitWords[0] === 'crop')) {
|
|
10921
11246
|
isCrop = true;
|
|
10922
|
-
var
|
|
11247
|
+
var prevCropObj = extend({}, this.cropObj, {}, true);
|
|
11248
|
+
var prevObj = this.getCurrentObj();
|
|
11249
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
11250
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
11251
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
10923
11252
|
this.cropImg();
|
|
10924
11253
|
this.zoomFactor = 0;
|
|
10925
11254
|
this.enableDisableToolbarBtn();
|
|
10926
|
-
this.updateUndoRedoColl('crop',
|
|
11255
|
+
this.updateUndoRedoColl('crop', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
10927
11256
|
}
|
|
10928
11257
|
}
|
|
10929
11258
|
return isCrop;
|
|
@@ -10936,9 +11265,17 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
10936
11265
|
*/
|
|
10937
11266
|
ImageEditor.prototype.flip = function (direction) {
|
|
10938
11267
|
if (!this.disabled && this.isImageLoaded) {
|
|
10939
|
-
var zoomFactor = this.zoomFactor;
|
|
10940
11268
|
var transitionArgs = { direction: direction };
|
|
10941
11269
|
this.trigger('flipping', transitionArgs);
|
|
11270
|
+
var prevCropObj = extend({}, this.cropObj, {}, true);
|
|
11271
|
+
var prevObj = void 0;
|
|
11272
|
+
if (isNullOrUndefined(this.transformCurrentObj)) {
|
|
11273
|
+
prevObj = this.getCurrentObj();
|
|
11274
|
+
prevObj.objColl = extend([], this.objColl, null, true);
|
|
11275
|
+
prevObj.pointColl = extend({}, this.pointColl, null, true);
|
|
11276
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
11277
|
+
}
|
|
11278
|
+
this.afterCropActions.push(direction.toLowerCase() === 'horizontal' ? 'horizontalflip' : 'verticalflip');
|
|
10942
11279
|
var splitWords = [];
|
|
10943
11280
|
var activeObjShape = void 0;
|
|
10944
11281
|
if (!isNullOrUndefined(this.activeObj.activePoint)) {
|
|
@@ -10997,7 +11334,12 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
10997
11334
|
this.rotateFlipColl.push(direction.toLowerCase());
|
|
10998
11335
|
}
|
|
10999
11336
|
if (this.rotateFlipColl.length === 1) {
|
|
11000
|
-
this.
|
|
11337
|
+
if (this.getCurrentPanRegion() === '') {
|
|
11338
|
+
this.setClientTransformedDimension();
|
|
11339
|
+
}
|
|
11340
|
+
else {
|
|
11341
|
+
this.setDestPointsForFlipState();
|
|
11342
|
+
}
|
|
11001
11343
|
}
|
|
11002
11344
|
if (this.isCircleCrop) {
|
|
11003
11345
|
this.cropCircle(this.lowerContext);
|
|
@@ -11036,8 +11378,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
11036
11378
|
}
|
|
11037
11379
|
this.lowerContext.filter = tempFilter;
|
|
11038
11380
|
this.refreshActiveObj();
|
|
11039
|
-
|
|
11040
|
-
|
|
11381
|
+
this.updateCurrSelectionPoint(direction.toLowerCase());
|
|
11382
|
+
if (!this.isUndoRedo && isNullOrUndefined(this.transformCurrentObj)) {
|
|
11383
|
+
this.updateUndoRedoColl('flip', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
11041
11384
|
}
|
|
11042
11385
|
this.isUndoRedo = false;
|
|
11043
11386
|
this.clearOuterCanvas(this.lowerContext);
|
|
@@ -11057,7 +11400,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
11057
11400
|
else if (!this.isReverseFlip) {
|
|
11058
11401
|
this.refreshToolbar('main', true, true);
|
|
11059
11402
|
}
|
|
11060
|
-
this.alignRotateFlipColl();
|
|
11403
|
+
this.rotateFlipColl = this.alignRotateFlipColl(this.rotateFlipColl, true);
|
|
11061
11404
|
}
|
|
11062
11405
|
};
|
|
11063
11406
|
/**
|
|
@@ -11219,17 +11562,16 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
11219
11562
|
this.selectedFreehandColor = '#42a5f5';
|
|
11220
11563
|
this.isFreehandDrawCustomized = false;
|
|
11221
11564
|
this.isShapeInserted = false;
|
|
11222
|
-
this.
|
|
11223
|
-
this.
|
|
11565
|
+
this.isAllowCropPan = false;
|
|
11566
|
+
this.tempPannedPoint = { x: 0, y: 0 };
|
|
11224
11567
|
this.currObjType = { shape: '', isDragging: false, isActiveObj: false, isText: false, isInitialText: false, isLine: false,
|
|
11225
11568
|
isInitialLine: false, isCustomCrop: false, isZoomed: false, isUndoZoom: false,
|
|
11226
11569
|
isUndoAction: false, isFiltered: false, isSave: false };
|
|
11227
|
-
this.isAllowCropPan = false;
|
|
11228
|
-
this.tempPannedPoint = { x: 0, y: 0 };
|
|
11229
11570
|
this.cropObj = { cropZoom: 0, defaultZoom: 0, totalPannedPoint: { x: 0, y: 0 }, totalPannedClientPoint: { x: 0, y: 0 },
|
|
11230
|
-
totalPannedInternalPoint: { x: 0, y: 0 },
|
|
11231
|
-
|
|
11232
|
-
|
|
11571
|
+
totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {},
|
|
11572
|
+
rotateFlipColl: [], degree: 0, currFlipState: '',
|
|
11573
|
+
destPoints: { startX: 0, startY: 0, width: 0, height: 0 },
|
|
11574
|
+
srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '' };
|
|
11233
11575
|
this.afterCropActions = [];
|
|
11234
11576
|
this.isCancelAction = this.preventZoomBtn = this.isFreehandPointMoved = false;
|
|
11235
11577
|
this.isTouch = false;
|
|
@@ -11239,6 +11581,11 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
11239
11581
|
this.tempCurrentFreehandDrawIndex = 0;
|
|
11240
11582
|
this.cancelObjColl = [];
|
|
11241
11583
|
this.cancelPointColl = [];
|
|
11584
|
+
this.freehandDrawSelectedId = null;
|
|
11585
|
+
this.transformCurrentObj = null;
|
|
11586
|
+
this.rotatedFlipCropSelection = false;
|
|
11587
|
+
this.panStartObj = null;
|
|
11588
|
+
this.currDestinationPoint = null;
|
|
11242
11589
|
this.updateCanvas();
|
|
11243
11590
|
this.refreshDropDownBtn(false);
|
|
11244
11591
|
this.enableDisableToolbarBtn();
|
|
@@ -11258,6 +11605,15 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
11258
11605
|
isRotate = true;
|
|
11259
11606
|
var transitionArgs = { degree: degree };
|
|
11260
11607
|
this.trigger('rotating', transitionArgs);
|
|
11608
|
+
var prevCropObj = extend({}, this.cropObj, {}, true);
|
|
11609
|
+
var prevObj = void 0;
|
|
11610
|
+
if (isNullOrUndefined(this.transformCurrentObj)) {
|
|
11611
|
+
prevObj = this.getCurrentObj();
|
|
11612
|
+
prevObj.objColl = extend([], this.objColl, null, true);
|
|
11613
|
+
prevObj.pointColl = extend({}, this.pointColl, null, true);
|
|
11614
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
11615
|
+
}
|
|
11616
|
+
this.afterCropActions.push(degree === 90 ? 'rotateRight' : 'rotateLeft');
|
|
11261
11617
|
var splitWords = [];
|
|
11262
11618
|
var activeObjShape = void 0;
|
|
11263
11619
|
if (!isNullOrUndefined(this.activeObj.activePoint) && !isNullOrUndefined(this.activeObj.shape)) {
|
|
@@ -11273,7 +11629,6 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
11273
11629
|
}
|
|
11274
11630
|
this.redrawActObj();
|
|
11275
11631
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
11276
|
-
var zoomFactor = this.zoomFactor;
|
|
11277
11632
|
this.drawRotatedImage(degree);
|
|
11278
11633
|
this.clearOuterCanvas(this.lowerContext);
|
|
11279
11634
|
this.clearOuterCanvas(this.upperContext);
|
|
@@ -11286,8 +11641,8 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
11286
11641
|
this.refreshToolbar('main', true, true);
|
|
11287
11642
|
}
|
|
11288
11643
|
}
|
|
11289
|
-
if (!this.isUndoRedo) {
|
|
11290
|
-
this.updateUndoRedoColl('rotate',
|
|
11644
|
+
if (!this.isUndoRedo && isNullOrUndefined(this.transformCurrentObj)) {
|
|
11645
|
+
this.updateUndoRedoColl('rotate', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
11291
11646
|
}
|
|
11292
11647
|
this.isUndoRedo = false;
|
|
11293
11648
|
if (isNullOrUndefined(this.activeObj.shape) && !this.isReverseRotate) {
|
|
@@ -11296,7 +11651,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
11296
11651
|
else if (!this.isReverseRotate) {
|
|
11297
11652
|
this.refreshToolbar('main', true, true);
|
|
11298
11653
|
}
|
|
11299
|
-
this.alignRotateFlipColl();
|
|
11654
|
+
this.rotateFlipColl = this.alignRotateFlipColl(this.rotateFlipColl, true);
|
|
11300
11655
|
}
|
|
11301
11656
|
return isRotate;
|
|
11302
11657
|
};
|
|
@@ -11393,6 +11748,11 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
11393
11748
|
else if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
11394
11749
|
isPrevent = true;
|
|
11395
11750
|
}
|
|
11751
|
+
var prevCropObj = extend({}, this.cropObj, {}, true);
|
|
11752
|
+
var prevObj = this.getCurrentObj();
|
|
11753
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
11754
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
11755
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
11396
11756
|
this.redrawActObj();
|
|
11397
11757
|
this.refreshActiveObj();
|
|
11398
11758
|
this.keyHistory = '';
|
|
@@ -11404,19 +11764,26 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
11404
11764
|
if (this.defaultZoomFactor > 0) {
|
|
11405
11765
|
var zoomFactor = this.zoomFactor = this.defaultZoomFactor;
|
|
11406
11766
|
this.isCropTab = false;
|
|
11767
|
+
var isUndoRedo = this.isUndoRedo;
|
|
11407
11768
|
for (var i = 0; i < (zoomFactor * 10); i++) {
|
|
11769
|
+
this.isUndoRedo = true;
|
|
11408
11770
|
this.zoom(-0.1);
|
|
11409
11771
|
}
|
|
11772
|
+
this.isUndoRedo = isUndoRedo;
|
|
11410
11773
|
this.resetPanPoints();
|
|
11411
11774
|
}
|
|
11412
11775
|
this.cancelObjColl = extend([], this.objColl, [], true);
|
|
11413
11776
|
this.cancelPointColl = extend([], this.pointColl, [], true);
|
|
11777
|
+
this.updateObjAndFreeHandDrawColl();
|
|
11414
11778
|
this.isCropTab = true;
|
|
11415
11779
|
this.setCurrSelectionPoints(true);
|
|
11416
11780
|
this.zoomFactor = this.cropZoomFactor;
|
|
11417
11781
|
if (isNullOrUndefined(this.cropObj.activeObj.shape)) {
|
|
11418
11782
|
this.drawNewSelection(type, startX, startY, width, height);
|
|
11419
11783
|
}
|
|
11784
|
+
else {
|
|
11785
|
+
this.updateUndoRedoColl('crop-selection', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
11786
|
+
}
|
|
11420
11787
|
}
|
|
11421
11788
|
else {
|
|
11422
11789
|
if (type === 'custom') {
|
|
@@ -11491,23 +11858,6 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
11491
11858
|
}
|
|
11492
11859
|
}
|
|
11493
11860
|
};
|
|
11494
|
-
ImageEditor.prototype.setDestPointsForFlipState = function (isUpdate) {
|
|
11495
|
-
if (this.getCurrentPanRegion() !== '') {
|
|
11496
|
-
if (this.getCurrentPanRegion() === 'horizontal') {
|
|
11497
|
-
this.destLeft = this.lowerCanvas.clientWidth - (this.destWidth + this.destLeft);
|
|
11498
|
-
}
|
|
11499
|
-
else if (this.getCurrentPanRegion() === 'vertical') {
|
|
11500
|
-
this.destTop = this.lowerCanvas.clientHeight - (this.destHeight + this.destTop);
|
|
11501
|
-
}
|
|
11502
|
-
else {
|
|
11503
|
-
this.destLeft = this.lowerCanvas.clientWidth - (this.destWidth + this.destLeft);
|
|
11504
|
-
this.destTop = this.lowerCanvas.clientHeight - (this.destHeight + this.destTop);
|
|
11505
|
-
}
|
|
11506
|
-
if (!isNullOrUndefined(isUpdate)) {
|
|
11507
|
-
this.updateObjAndFreeHandDrawColl();
|
|
11508
|
-
}
|
|
11509
|
-
}
|
|
11510
|
-
};
|
|
11511
11861
|
/**
|
|
11512
11862
|
* Increase / Decrease the magnification of an image.
|
|
11513
11863
|
*
|
|
@@ -11516,7 +11866,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
11516
11866
|
*/
|
|
11517
11867
|
ImageEditor.prototype.zoom = function (value) {
|
|
11518
11868
|
if (!this.disabled && this.isImageLoaded) {
|
|
11519
|
-
if ((this.zoomFactor === 0 && value < 0) || (this.zoomFactor >
|
|
11869
|
+
if ((this.zoomFactor === 0 && value < 0) || (this.zoomFactor > 2 && value > 0 ||
|
|
11520
11870
|
(this.zoomFactor > 0 && value < 0 && this.disableZoomOutBtn()))) {
|
|
11521
11871
|
return;
|
|
11522
11872
|
}
|
|
@@ -11533,29 +11883,37 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
11533
11883
|
else if (!isNullOrUndefined(this.activeObj.shape) && splitWords[0] !== 'crop') {
|
|
11534
11884
|
isShape = true;
|
|
11535
11885
|
}
|
|
11886
|
+
var zoomPoint = void 0;
|
|
11887
|
+
var zoomLevel = void 0;
|
|
11888
|
+
if (this.isCropTab && !isNullOrUndefined(tempActiveObj)) {
|
|
11889
|
+
zoomLevel = this.cropZoomFactor;
|
|
11890
|
+
zoomPoint = { x: this.activeObj.activePoint.startX + (this.activeObj.activePoint.width / 2),
|
|
11891
|
+
y: this.activeObj.activePoint.startY + (this.activeObj.activePoint.height / 2) };
|
|
11892
|
+
}
|
|
11893
|
+
else {
|
|
11894
|
+
zoomLevel = this.defaultZoomFactor;
|
|
11895
|
+
zoomPoint = { x: this.lowerCanvas.clientWidth / 2, y: this.lowerCanvas.clientHeight / 2 };
|
|
11896
|
+
}
|
|
11897
|
+
var zoomEventArgs = { zoomPoint: zoomPoint, zoomLevel: zoomLevel };
|
|
11898
|
+
this.trigger('zooming', zoomEventArgs);
|
|
11899
|
+
var prevCropObj = extend({}, this.cropObj, {}, true);
|
|
11900
|
+
var prevObj = this.getCurrentObj();
|
|
11901
|
+
prevObj.objColl = extend([], this.objColl, [], true);
|
|
11902
|
+
prevObj.pointColl = extend([], this.pointColl, [], true);
|
|
11903
|
+
prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
|
|
11536
11904
|
this.redrawActObj();
|
|
11537
11905
|
this.refreshActiveObj();
|
|
11538
11906
|
this.upperContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
11539
11907
|
this.lowerContext.filter = this.canvasFilter;
|
|
11540
11908
|
this.upperCanvas.style.cursor = 'default';
|
|
11541
|
-
var zoomState = void 0;
|
|
11542
11909
|
var objColl = extend([], this.objColl, [], true);
|
|
11543
|
-
if (value === 3.75 || value === 1) {
|
|
11544
|
-
zoomState = 0.1;
|
|
11545
|
-
}
|
|
11546
|
-
else if (value === -3.75) {
|
|
11547
|
-
zoomState = -0.1;
|
|
11548
|
-
}
|
|
11549
|
-
else {
|
|
11550
|
-
zoomState = value;
|
|
11551
|
-
}
|
|
11552
11910
|
if (!this.isCropTab) {
|
|
11553
11911
|
if (this.degree !== 0) {
|
|
11554
11912
|
this.redrawActObj();
|
|
11555
11913
|
this.currentPannedPoint = { x: 0, y: 0 };
|
|
11556
|
-
this.rotatePan();
|
|
11914
|
+
this.rotatePan(true, true);
|
|
11557
11915
|
}
|
|
11558
|
-
this.
|
|
11916
|
+
this.updateObjAndFreeHandDrawColl();
|
|
11559
11917
|
}
|
|
11560
11918
|
if (this.degree === 0) {
|
|
11561
11919
|
this.drawZoomImgToCanvas(value, tempActiveObj);
|
|
@@ -11564,13 +11922,19 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
11564
11922
|
this.tempFlipPanPoint.y += this.totalPannedPoint.y;
|
|
11565
11923
|
objColl = extend([], this.objColl, [], true);
|
|
11566
11924
|
this.objColl = [];
|
|
11925
|
+
var destLeft = this.destLeft;
|
|
11926
|
+
var destTop = this.destTop;
|
|
11927
|
+
this.setDestPointsForFlipState();
|
|
11567
11928
|
this.rotatedFlip();
|
|
11568
|
-
|
|
11569
|
-
|
|
11570
|
-
|
|
11571
|
-
|
|
11572
|
-
|
|
11573
|
-
|
|
11929
|
+
this.destLeft = destLeft;
|
|
11930
|
+
this.destTop = destTop;
|
|
11931
|
+
this.objColl = objColl;
|
|
11932
|
+
this.zoomObjColl();
|
|
11933
|
+
this.zoomFreehandDrawColl();
|
|
11934
|
+
this.updateObjAndFreeHandDrawColl();
|
|
11935
|
+
}
|
|
11936
|
+
if (this.zoomFactor === 0 && !this.isCropTab) {
|
|
11937
|
+
this.totalPannedPoint = { x: 0, y: 0 };
|
|
11574
11938
|
}
|
|
11575
11939
|
}
|
|
11576
11940
|
else {
|
|
@@ -11593,19 +11957,6 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
11593
11957
|
this.zoomFreehandDrawColl();
|
|
11594
11958
|
this.lowerContext.filter = temp;
|
|
11595
11959
|
}
|
|
11596
|
-
else if (this.degree === 0) {
|
|
11597
|
-
var temp = this.lowerContext.filter;
|
|
11598
|
-
this.lowerContext.filter = 'none';
|
|
11599
|
-
var destLeft = this.destLeft;
|
|
11600
|
-
var destTop = this.destTop;
|
|
11601
|
-
this.setDestPointsForFlipState();
|
|
11602
|
-
this.objColl = objColl;
|
|
11603
|
-
this.zoomObjColl();
|
|
11604
|
-
this.zoomFreehandDrawColl();
|
|
11605
|
-
this.destLeft = destLeft;
|
|
11606
|
-
this.destTop = destTop;
|
|
11607
|
-
this.lowerContext.filter = temp;
|
|
11608
|
-
}
|
|
11609
11960
|
if ((!isNullOrUndefined(this.currSelectionPoint) && this.currSelectionPoint.shape === 'crop-circle') || this.isCircleCrop) {
|
|
11610
11961
|
this.cropCircle(this.lowerContext);
|
|
11611
11962
|
}
|
|
@@ -11614,18 +11965,12 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
11614
11965
|
if (!isNullOrUndefined(tempActiveObj)) {
|
|
11615
11966
|
this.activeObj = extend({}, tempActiveObj, {}, true);
|
|
11616
11967
|
this.drawObject('duplicate', this.activeObj);
|
|
11617
|
-
if (this.currentToolbar === 'crop') {
|
|
11618
|
-
this.refreshToolbar('main', true, true);
|
|
11619
|
-
}
|
|
11620
|
-
else {
|
|
11621
|
-
this.refreshToolbar(this.currentToolbar, true, true);
|
|
11622
|
-
}
|
|
11623
11968
|
if (this.zoomFactor === 0) {
|
|
11624
11969
|
this.currSelectionPoint = null;
|
|
11625
11970
|
}
|
|
11626
11971
|
}
|
|
11627
11972
|
if (!this.isUndoRedo) {
|
|
11628
|
-
this.updateUndoRedoColl('zoom',
|
|
11973
|
+
this.updateUndoRedoColl('zoom', prevObj, prevObj.objColl, prevObj.pointColl, prevCropObj);
|
|
11629
11974
|
}
|
|
11630
11975
|
this.isUndoRedo = false;
|
|
11631
11976
|
var zoomOut = document.querySelector('#' + this.element.id + '_zoomOut');
|
|
@@ -11637,9 +11982,6 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
11637
11982
|
zoomOut.classList.remove('e-disabled');
|
|
11638
11983
|
zoomOut.parentElement.classList.remove('e-overlay');
|
|
11639
11984
|
}
|
|
11640
|
-
if (!this.togglePan) {
|
|
11641
|
-
this.callMainToolbar(false, true);
|
|
11642
|
-
}
|
|
11643
11985
|
this.autoEnablePan();
|
|
11644
11986
|
if (!isNullOrUndefined(tempActiveObj)) {
|
|
11645
11987
|
this.activeObj = extend({}, tempActiveObj, {}, true);
|
|
@@ -11647,24 +11989,6 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
11647
11989
|
if (this.activeObj.shape === 'crop-custom') {
|
|
11648
11990
|
this.currObjType.isCustomCrop = true;
|
|
11649
11991
|
}
|
|
11650
|
-
if (isNullOrUndefined(this.activeObj.activePoint) || this.activeObj.activePoint.width === 0) {
|
|
11651
|
-
if (this.currentToolbar === 'crop' || !isNullOrUndefined(tempActiveObj)) {
|
|
11652
|
-
this.refreshToolbar('main', true, true);
|
|
11653
|
-
}
|
|
11654
|
-
else {
|
|
11655
|
-
this.refreshToolbar('main');
|
|
11656
|
-
this.currentToolbar = 'main';
|
|
11657
|
-
}
|
|
11658
|
-
}
|
|
11659
|
-
else {
|
|
11660
|
-
if (this.currentToolbar === 'crop' || !isNullOrUndefined(tempActiveObj)) {
|
|
11661
|
-
this.refreshToolbar('main', true, true);
|
|
11662
|
-
}
|
|
11663
|
-
else {
|
|
11664
|
-
this.refreshToolbar('main');
|
|
11665
|
-
this.currentToolbar = 'main';
|
|
11666
|
-
}
|
|
11667
|
-
}
|
|
11668
11992
|
var panBtn = this.element.querySelector('.e-img-pan .e-btn');
|
|
11669
11993
|
if (!isNullOrUndefined(panBtn) && this.togglePan) {
|
|
11670
11994
|
panBtn.classList.add('e-selected-btn');
|
|
@@ -11676,12 +12000,6 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
11676
12000
|
this.activeObj = extend({}, this.objColl[this.objColl.length - 1], {}, true);
|
|
11677
12001
|
this.objColl.pop();
|
|
11678
12002
|
this.drawObject('duplicate', this.activeObj);
|
|
11679
|
-
if (this.activeObj.shape === 'text') {
|
|
11680
|
-
this.refreshToolbar('text');
|
|
11681
|
-
}
|
|
11682
|
-
else {
|
|
11683
|
-
this.refreshToolbar('shapes');
|
|
11684
|
-
}
|
|
11685
12003
|
this.updateToolbarItems();
|
|
11686
12004
|
}
|
|
11687
12005
|
}
|
|
@@ -12085,14 +12403,13 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
12085
12403
|
else {
|
|
12086
12404
|
this.refreshToolbar('main');
|
|
12087
12405
|
}
|
|
12088
|
-
if (this.activeObj.activePoint.width !== 0) {
|
|
12406
|
+
if (!isNullOrUndefined(this.activeObj.activePoint) && this.activeObj.activePoint.width !== 0) {
|
|
12089
12407
|
this.tempActObj = this.activeObj;
|
|
12090
12408
|
}
|
|
12091
|
-
|
|
12409
|
+
this.refreshActiveObj();
|
|
12092
12410
|
this.undoRedoStep--;
|
|
12093
12411
|
this.enableDisableToolbarBtn();
|
|
12094
12412
|
this.isUndoRedo = true;
|
|
12095
|
-
this.lowerContext.filter = this.canvasFilter;
|
|
12096
12413
|
var obj = this.undoRedoColl[this.undoRedoStep];
|
|
12097
12414
|
if (this.undoRedoColl.length === this.undoRedoStep) {
|
|
12098
12415
|
this.currObjType.isUndoAction = false;
|
|
@@ -12100,82 +12417,47 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
12100
12417
|
else {
|
|
12101
12418
|
this.currObjType.isUndoAction = true;
|
|
12102
12419
|
}
|
|
12103
|
-
if (obj.operation !== '
|
|
12420
|
+
if (obj.operation !== 'textAreaCustomization' && this.textArea.style.display === 'block') {
|
|
12104
12421
|
this.textArea.style.display = 'none';
|
|
12105
12422
|
}
|
|
12106
12423
|
this.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
12107
|
-
|
|
12108
|
-
var
|
|
12109
|
-
|
|
12110
|
-
|
|
12111
|
-
|
|
12424
|
+
this.isCancelAction = true;
|
|
12425
|
+
var activeObj = void 0;
|
|
12426
|
+
this.cropObj = extend({}, obj.previousCropObj, {}, true);
|
|
12427
|
+
this.afterCropActions = obj.previousObj.afterCropActions;
|
|
12428
|
+
this.lowerContext.filter = this.canvasFilter = obj.previousObj.filter;
|
|
12112
12429
|
switch (obj.operation) {
|
|
12113
|
-
case '
|
|
12114
|
-
|
|
12115
|
-
|
|
12116
|
-
|
|
12117
|
-
else if (obj.value === -90) {
|
|
12118
|
-
value = 'rotateright';
|
|
12119
|
-
}
|
|
12120
|
-
this.performTransformation(value);
|
|
12121
|
-
break;
|
|
12122
|
-
case 'flip':
|
|
12123
|
-
if (obj.value.toLowerCase() === 'horizontal') {
|
|
12124
|
-
value = 'horizontalflip';
|
|
12125
|
-
}
|
|
12126
|
-
else if (obj.value.toLowerCase() === 'vertical') {
|
|
12127
|
-
value = 'verticalflip';
|
|
12128
|
-
}
|
|
12129
|
-
this.performTransformation(value);
|
|
12130
|
-
break;
|
|
12131
|
-
case 'zoom':
|
|
12132
|
-
if (this.zoomFactor === 0 && obj.zoomFactor !== 0) {
|
|
12133
|
-
this.zoomFactor = obj.zoomFactor;
|
|
12134
|
-
}
|
|
12135
|
-
this.zoom(-obj.value);
|
|
12430
|
+
case 'shapeTransform':
|
|
12431
|
+
this.objColl = extend([], obj.previousObjColl, [], true);
|
|
12432
|
+
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12433
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12136
12434
|
this.isUndoRedo = true;
|
|
12137
|
-
|
|
12138
|
-
|
|
12139
|
-
xDiff = this.destLeft;
|
|
12140
|
-
yDiff = this.destTop;
|
|
12141
|
-
this.destLeft = obj.previousObj.x;
|
|
12142
|
-
this.destTop = obj.previousObj.y;
|
|
12143
|
-
xDiff += this.destLeft;
|
|
12144
|
-
yDiff += this.destTop;
|
|
12145
|
-
this.drawPannedImage(xDiff, yDiff);
|
|
12146
|
-
break;
|
|
12147
|
-
case 'crop':
|
|
12148
|
-
if (!isNullOrUndefined(this.currSelectionPoint)) {
|
|
12149
|
-
tempUndoRedoColl = extend([], this.undoRedoColl, [], true);
|
|
12150
|
-
this.select('Custom');
|
|
12151
|
-
this.refreshToolbar('main', true, true);
|
|
12152
|
-
getComponent(this.element.querySelector('#' + this.element.id + '_cropBtn'), 'dropdown-btn').toggle();
|
|
12153
|
-
this.undoRedoColl = tempUndoRedoColl;
|
|
12154
|
-
this.enableDisableToolbarBtn();
|
|
12155
|
-
}
|
|
12435
|
+
this.redrawImgWithObj();
|
|
12436
|
+
this.refreshActiveObj();
|
|
12156
12437
|
break;
|
|
12157
12438
|
case 'freehanddraw':
|
|
12158
|
-
this.pointColl = obj.
|
|
12159
|
-
this.freehandCounter
|
|
12439
|
+
this.pointColl = obj.previousPointColl;
|
|
12440
|
+
this.freehandCounter = this.pointColl.length;
|
|
12160
12441
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12161
12442
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12162
12443
|
this.isUndoRedo = true;
|
|
12163
12444
|
this.redrawImgWithObj();
|
|
12164
12445
|
break;
|
|
12165
12446
|
case 'freehanddrawCustomized':
|
|
12166
|
-
this.pointColl = obj.
|
|
12447
|
+
this.pointColl = obj.previousPointColl;
|
|
12167
12448
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12168
12449
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12169
12450
|
this.isUndoRedo = true;
|
|
12170
12451
|
this.redrawImgWithObj();
|
|
12171
12452
|
break;
|
|
12172
|
-
case '
|
|
12173
|
-
|
|
12174
|
-
|
|
12175
|
-
this.
|
|
12453
|
+
case 'deleteFreehandDrawing':
|
|
12454
|
+
case 'deleteObj':
|
|
12455
|
+
if (obj.operation === 'deleteFreehandDrawing') {
|
|
12456
|
+
this.pointColl = obj.previousPointColl;
|
|
12457
|
+
this.freehandCounter = this.pointColl.length;
|
|
12176
12458
|
}
|
|
12177
|
-
else if (obj.
|
|
12178
|
-
this.objColl = obj.
|
|
12459
|
+
else if (obj.operation === 'deleteObj') {
|
|
12460
|
+
this.objColl = obj.previousObjColl;
|
|
12179
12461
|
}
|
|
12180
12462
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12181
12463
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
@@ -12183,7 +12465,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
12183
12465
|
this.redrawImgWithObj();
|
|
12184
12466
|
break;
|
|
12185
12467
|
case 'selectionTransform':
|
|
12186
|
-
this.activeObj = extend({}, obj.
|
|
12468
|
+
this.activeObj = extend({}, obj.previousObj.activeObj, {}, true);
|
|
12187
12469
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12188
12470
|
if (this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) {
|
|
12189
12471
|
this.drawObject('duplicate', this.activeObj);
|
|
@@ -12191,83 +12473,84 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
12191
12473
|
}
|
|
12192
12474
|
else {
|
|
12193
12475
|
this.refreshToolbar('main');
|
|
12476
|
+
this.performUndoDefaultAction(obj);
|
|
12194
12477
|
}
|
|
12195
12478
|
this.currObjType.isCustomCrop = false;
|
|
12196
12479
|
break;
|
|
12197
|
-
case '
|
|
12198
|
-
this.objColl = extend([], obj.
|
|
12199
|
-
|
|
12200
|
-
|
|
12201
|
-
|
|
12202
|
-
|
|
12203
|
-
|
|
12204
|
-
|
|
12205
|
-
|
|
12206
|
-
|
|
12207
|
-
|
|
12208
|
-
|
|
12209
|
-
prevObj = extend({}, obj.previousObj[i], {}, true);
|
|
12480
|
+
case 'textAreaCustomization':
|
|
12481
|
+
this.objColl = extend([], obj.previousObjColl, [], true);
|
|
12482
|
+
for (var i = 0; i < obj.previousObjColl.length; i++) {
|
|
12483
|
+
if (!isNullOrUndefined(this.tempActObj)) {
|
|
12484
|
+
if (this.tempActObj.currIndex === obj.previousObjColl[i].currIndex) {
|
|
12485
|
+
activeObj = extend({}, obj.previousObjColl[i], {}, true);
|
|
12486
|
+
this.objColl.splice(i, 1);
|
|
12487
|
+
break;
|
|
12488
|
+
}
|
|
12489
|
+
}
|
|
12490
|
+
else {
|
|
12491
|
+
activeObj = extend({}, obj.previousObjColl[obj.previousObjColl.length - 1], {}, true);
|
|
12210
12492
|
this.objColl.splice(i, 1);
|
|
12211
12493
|
break;
|
|
12212
12494
|
}
|
|
12213
12495
|
}
|
|
12214
|
-
if (!isNullOrUndefined(
|
|
12215
|
-
this.updateTextBox(
|
|
12496
|
+
if (!isNullOrUndefined(activeObj)) {
|
|
12497
|
+
this.updateTextBox(activeObj);
|
|
12216
12498
|
}
|
|
12217
12499
|
break;
|
|
12218
12500
|
case 'text':
|
|
12219
12501
|
if (!isNullOrUndefined(this.tempActObj)) {
|
|
12220
12502
|
this.activeObj = extend({}, this.tempActObj, {}, true);
|
|
12221
12503
|
}
|
|
12222
|
-
if (obj.
|
|
12504
|
+
if (obj.previousObjColl.length === 0 && this.objColl.length === 1) {
|
|
12223
12505
|
this.tempActObj = extend({}, this.objColl[0], {}, true);
|
|
12224
12506
|
}
|
|
12225
12507
|
else {
|
|
12226
12508
|
for (var i = 0; i < this.objColl.length; i++) {
|
|
12227
12509
|
if (!isNullOrUndefined(this.objColl[i]) &&
|
|
12228
|
-
isNullOrUndefined(obj.
|
|
12229
|
-
this.tempActObj = extend({},
|
|
12510
|
+
isNullOrUndefined(obj.previousObjColl[i])) {
|
|
12511
|
+
this.tempActObj = extend({}, this.objColl[i], {}, true);
|
|
12230
12512
|
break;
|
|
12231
12513
|
}
|
|
12232
|
-
if (obj.
|
|
12514
|
+
if (obj.previousObjColl[i].currIndex !== this.objColl[i].currIndex) {
|
|
12233
12515
|
this.tempActObj = extend({}, this.objColl[i], {}, true);
|
|
12234
12516
|
break;
|
|
12235
12517
|
}
|
|
12236
12518
|
}
|
|
12237
12519
|
}
|
|
12238
12520
|
this.activeObj = extend({}, this.tempActObj, {}, true);
|
|
12239
|
-
this.objColl = extend([], obj.
|
|
12521
|
+
this.objColl = extend([], obj.previousObjColl, [], true);
|
|
12240
12522
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12241
12523
|
this.isUndoRedo = true;
|
|
12242
12524
|
this.redrawImgWithObj();
|
|
12243
|
-
this.
|
|
12244
|
-
|
|
12245
|
-
|
|
12246
|
-
|
|
12247
|
-
|
|
12248
|
-
|
|
12249
|
-
|
|
12250
|
-
case 'opacity':
|
|
12251
|
-
case 'blur':
|
|
12252
|
-
case 'exposure':
|
|
12253
|
-
this.lowerContext.filter = this.canvasFilter = obj.previousObj;
|
|
12254
|
-
if (this.lowerContext.filter.split(' ').length > 1 &&
|
|
12255
|
-
this.lowerContext.filter.split(' ')[0].split('(')[1].split(')')[0] === '1') {
|
|
12256
|
-
this.isBrightnessAdjusted = false;
|
|
12525
|
+
if (!isNullOrUndefined(this.activeObj) && this.activeObj.activePoint.width !== 0
|
|
12526
|
+
&& this.activeObj.activePoint.height !== 0) {
|
|
12527
|
+
this.drawObject('duplicate');
|
|
12528
|
+
}
|
|
12529
|
+
else {
|
|
12530
|
+
this.textArea.style.display = 'block';
|
|
12531
|
+
this.textArea.value = obj.previousText;
|
|
12257
12532
|
}
|
|
12258
|
-
this.setAdjustment(obj.operation);
|
|
12259
|
-
this.isUndoRedo = true;
|
|
12260
12533
|
break;
|
|
12261
|
-
|
|
12262
|
-
|
|
12263
|
-
|
|
12264
|
-
|
|
12265
|
-
case 'grayscale':
|
|
12266
|
-
case 'sepia':
|
|
12267
|
-
case 'invert':
|
|
12268
|
-
this.updateFilter(obj);
|
|
12534
|
+
default:
|
|
12535
|
+
this.performUndoDefaultAction(obj);
|
|
12536
|
+
this.setAdjustment(obj.operation);
|
|
12537
|
+
this.updateFilter(obj.operation, obj.filter);
|
|
12269
12538
|
break;
|
|
12270
12539
|
}
|
|
12540
|
+
this.clearOuterCanvas(this.lowerContext);
|
|
12541
|
+
if (this.isCircleCrop && obj.operation !== 'crop') {
|
|
12542
|
+
this.cropCircle(this.lowerContext);
|
|
12543
|
+
}
|
|
12544
|
+
if (this.zoomFactor > 0) {
|
|
12545
|
+
this.dragCanvas = true;
|
|
12546
|
+
}
|
|
12547
|
+
this.isCancelAction = false;
|
|
12548
|
+
if (!isNullOrUndefined(this.activeObj.shape) && this.activeObj.shape.split('-')[0] === 'crop') {
|
|
12549
|
+
this.refreshToolbar('main', true, true);
|
|
12550
|
+
}
|
|
12551
|
+
else {
|
|
12552
|
+
this.refreshToolbar('main');
|
|
12553
|
+
}
|
|
12271
12554
|
}
|
|
12272
12555
|
}
|
|
12273
12556
|
};
|
|
@@ -12289,7 +12572,6 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
12289
12572
|
this.undoRedoStep++;
|
|
12290
12573
|
this.enableDisableToolbarBtn();
|
|
12291
12574
|
this.isUndoRedo = true;
|
|
12292
|
-
this.lowerContext.filter = this.canvasFilter;
|
|
12293
12575
|
var obj = this.undoRedoColl[this.undoRedoStep - 1];
|
|
12294
12576
|
if (this.undoRedoColl.length === this.undoRedoStep) {
|
|
12295
12577
|
this.currObjType.isUndoAction = false;
|
|
@@ -12297,74 +12579,49 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
12297
12579
|
else {
|
|
12298
12580
|
this.currObjType.isUndoAction = true;
|
|
12299
12581
|
}
|
|
12300
|
-
if (obj.operation !== '
|
|
12582
|
+
if (obj.operation !== 'textAreaCustomization' && this.textArea.style.display === 'block') {
|
|
12301
12583
|
this.textArea.style.display = 'none';
|
|
12302
12584
|
}
|
|
12303
12585
|
this.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
12304
|
-
|
|
12305
|
-
|
|
12306
|
-
|
|
12586
|
+
this.isCancelAction = true;
|
|
12587
|
+
this.cropObj = extend({}, obj.currentCropObj, {}, true);
|
|
12588
|
+
this.afterCropActions = obj.currentObj.afterCropActions;
|
|
12589
|
+
this.lowerContext.filter = this.canvasFilter = obj.currentObj.filter;
|
|
12590
|
+
var activeObj = void 0;
|
|
12307
12591
|
var tempUndoRedoColl = void 0;
|
|
12308
12592
|
var tempUndoRedoStep = void 0;
|
|
12309
|
-
var value = '';
|
|
12310
|
-
var currObj = void 0;
|
|
12311
12593
|
switch (obj.operation) {
|
|
12312
|
-
case '
|
|
12313
|
-
|
|
12314
|
-
|
|
12315
|
-
|
|
12316
|
-
|
|
12317
|
-
|
|
12318
|
-
|
|
12319
|
-
this.performTransformation(value);
|
|
12320
|
-
break;
|
|
12321
|
-
case 'flip':
|
|
12322
|
-
if (obj.value.toLowerCase() === 'horizontal') {
|
|
12323
|
-
value = 'horizontalflip';
|
|
12324
|
-
}
|
|
12325
|
-
else if (obj.value.toLowerCase() === 'vertical') {
|
|
12326
|
-
value = 'verticalflip';
|
|
12327
|
-
}
|
|
12328
|
-
this.performTransformation(value);
|
|
12329
|
-
break;
|
|
12330
|
-
case 'zoom':
|
|
12331
|
-
this.zoom(obj.value);
|
|
12332
|
-
break;
|
|
12333
|
-
case 'pan':
|
|
12334
|
-
xDiff = this.destLeft;
|
|
12335
|
-
yDiff = this.destTop;
|
|
12336
|
-
this.destLeft = obj.currentObj.x;
|
|
12337
|
-
this.destTop = obj.currentObj.y;
|
|
12338
|
-
xDiff += this.destLeft;
|
|
12339
|
-
yDiff += this.destTop;
|
|
12340
|
-
this.drawPannedImage(xDiff, yDiff);
|
|
12341
|
-
break;
|
|
12342
|
-
case 'crop':
|
|
12343
|
-
this.cropImg();
|
|
12344
|
-
this.refreshToolbar('main');
|
|
12594
|
+
case 'shapeTransform':
|
|
12595
|
+
this.objColl = extend([], obj.currentObjColl, [], true);
|
|
12596
|
+
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12597
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12598
|
+
this.isUndoRedo = true;
|
|
12599
|
+
this.redrawImgWithObj();
|
|
12600
|
+
this.refreshActiveObj();
|
|
12345
12601
|
break;
|
|
12346
12602
|
case 'freehanddraw':
|
|
12347
|
-
this.pointColl = obj.
|
|
12348
|
-
this.freehandCounter
|
|
12603
|
+
this.pointColl = obj.currentPointColl;
|
|
12604
|
+
this.freehandCounter = this.pointColl.length;
|
|
12349
12605
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12350
12606
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12351
12607
|
this.isUndoRedo = true;
|
|
12352
12608
|
this.redrawImgWithObj();
|
|
12353
12609
|
break;
|
|
12354
12610
|
case 'freehanddrawCustomized':
|
|
12355
|
-
this.pointColl = obj.
|
|
12611
|
+
this.pointColl = obj.currentPointColl;
|
|
12356
12612
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12357
12613
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12358
12614
|
this.isUndoRedo = true;
|
|
12359
12615
|
this.redrawImgWithObj();
|
|
12360
12616
|
break;
|
|
12361
|
-
case '
|
|
12362
|
-
|
|
12363
|
-
|
|
12364
|
-
this.
|
|
12617
|
+
case 'deleteFreehandDrawing':
|
|
12618
|
+
case 'deleteObj':
|
|
12619
|
+
if (obj.operation === 'deleteFreehandDrawing') {
|
|
12620
|
+
this.pointColl = obj.currentPointColl;
|
|
12621
|
+
this.freehandCounter = this.pointColl.length;
|
|
12365
12622
|
}
|
|
12366
|
-
else if (obj.
|
|
12367
|
-
this.objColl = obj.
|
|
12623
|
+
else if (obj.operation === 'deleteObj') {
|
|
12624
|
+
this.objColl = obj.currentObjColl;
|
|
12368
12625
|
}
|
|
12369
12626
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12370
12627
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
@@ -12372,15 +12629,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
12372
12629
|
this.redrawImgWithObj();
|
|
12373
12630
|
break;
|
|
12374
12631
|
case 'selectionTransform':
|
|
12375
|
-
|
|
12376
|
-
if (this.zoomFactor > 0) {
|
|
12377
|
-
this.zoom(-this.zoomFactor);
|
|
12378
|
-
}
|
|
12379
|
-
else {
|
|
12380
|
-
this.zoom(Math.abs(this.zoomFactor));
|
|
12381
|
-
}
|
|
12382
|
-
}
|
|
12383
|
-
this.activeObj = extend({}, obj.currentSelectionObj, {}, true);
|
|
12632
|
+
this.activeObj = extend({}, obj.currentObj.activeObj, {}, true);
|
|
12384
12633
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12385
12634
|
if (this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) {
|
|
12386
12635
|
this.drawObject('duplicate', this.activeObj);
|
|
@@ -12389,38 +12638,57 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
12389
12638
|
else {
|
|
12390
12639
|
this.refreshToolbar('main');
|
|
12391
12640
|
}
|
|
12641
|
+
this.currObjType.isCustomCrop = false;
|
|
12392
12642
|
break;
|
|
12393
|
-
case '
|
|
12394
|
-
this.objColl = extend([], obj.
|
|
12395
|
-
|
|
12396
|
-
|
|
12397
|
-
|
|
12398
|
-
|
|
12399
|
-
|
|
12400
|
-
|
|
12401
|
-
|
|
12402
|
-
|
|
12403
|
-
|
|
12404
|
-
|
|
12405
|
-
currObj = extend({}, obj.currentObj[i], {}, true);
|
|
12643
|
+
case 'textAreaCustomization':
|
|
12644
|
+
this.objColl = extend([], obj.currentObjColl, [], true);
|
|
12645
|
+
for (var i = 0; i < obj.currentObjColl.length; i++) {
|
|
12646
|
+
if (!isNullOrUndefined(this.tempActObj)) {
|
|
12647
|
+
if (this.tempActObj.currIndex === obj.currentObjColl[i].currIndex) {
|
|
12648
|
+
activeObj = extend({}, obj.currentObjColl[i], {}, true);
|
|
12649
|
+
this.objColl.splice(i, 1);
|
|
12650
|
+
break;
|
|
12651
|
+
}
|
|
12652
|
+
}
|
|
12653
|
+
else {
|
|
12654
|
+
activeObj = extend({}, obj.currentObjColl[obj.currentObjColl.length - 1], {}, true);
|
|
12406
12655
|
this.objColl.splice(i, 1);
|
|
12407
12656
|
break;
|
|
12408
12657
|
}
|
|
12409
12658
|
}
|
|
12410
|
-
if (!isNullOrUndefined(
|
|
12411
|
-
this.updateTextBox(
|
|
12659
|
+
if (!isNullOrUndefined(activeObj)) {
|
|
12660
|
+
this.updateTextBox(activeObj);
|
|
12412
12661
|
}
|
|
12413
12662
|
break;
|
|
12414
12663
|
case 'text':
|
|
12415
12664
|
if (!isNullOrUndefined(this.tempActObj)) {
|
|
12416
12665
|
this.activeObj = extend({}, this.tempActObj, {}, true);
|
|
12417
12666
|
}
|
|
12418
|
-
|
|
12667
|
+
if (obj.previousObjColl.length === 0 && this.objColl.length === 1) {
|
|
12668
|
+
this.tempActObj = extend({}, this.objColl[0], {}, true);
|
|
12669
|
+
}
|
|
12670
|
+
else {
|
|
12671
|
+
for (var i = 0; i < this.objColl.length; i++) {
|
|
12672
|
+
if (!isNullOrUndefined(this.objColl[i]) &&
|
|
12673
|
+
isNullOrUndefined(obj.previousObjColl[i])) {
|
|
12674
|
+
this.tempActObj = extend({}, this.objColl[i], {}, true);
|
|
12675
|
+
break;
|
|
12676
|
+
}
|
|
12677
|
+
if (obj.previousObjColl[i].currIndex !== this.objColl[i].currIndex) {
|
|
12678
|
+
this.tempActObj = extend({}, this.objColl[i], {}, true);
|
|
12679
|
+
break;
|
|
12680
|
+
}
|
|
12681
|
+
}
|
|
12682
|
+
}
|
|
12683
|
+
this.objColl = extend([], obj.currentObjColl, [], true);
|
|
12419
12684
|
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12420
12685
|
this.isUndoRedo = true;
|
|
12421
12686
|
this.redrawImgWithObj();
|
|
12687
|
+
if (!isNullOrUndefined(this.tempActObj)) {
|
|
12688
|
+
this.activeObj = extend({}, this.tempActObj, {}, true);
|
|
12689
|
+
}
|
|
12422
12690
|
this.textArea.style.display = 'block';
|
|
12423
|
-
this.textArea.value = obj.
|
|
12691
|
+
this.textArea.value = obj.currentText;
|
|
12424
12692
|
tempUndoRedoColl = extend([], this.undoRedoColl, [], true);
|
|
12425
12693
|
tempUndoRedoStep = this.undoRedoStep;
|
|
12426
12694
|
this.redrawActObj();
|
|
@@ -12428,39 +12696,49 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
12428
12696
|
this.undoRedoStep = tempUndoRedoStep;
|
|
12429
12697
|
this.textArea.style.display = 'none';
|
|
12430
12698
|
this.textArea.value = '';
|
|
12699
|
+
this.redrawActObj();
|
|
12431
12700
|
break;
|
|
12432
|
-
|
|
12433
|
-
|
|
12434
|
-
|
|
12435
|
-
|
|
12436
|
-
|
|
12437
|
-
|
|
12438
|
-
|
|
12439
|
-
|
|
12440
|
-
this.
|
|
12441
|
-
|
|
12442
|
-
|
|
12443
|
-
|
|
12444
|
-
|
|
12445
|
-
|
|
12446
|
-
|
|
12447
|
-
|
|
12448
|
-
|
|
12449
|
-
if (
|
|
12450
|
-
|
|
12451
|
-
}
|
|
12452
|
-
if (document.getElementById(this.element.id + '_' + obj.operation + 'Canvas')) {
|
|
12453
|
-
document.getElementById(this.element.id + '_' + obj.operation + 'Canvas').parentElement.classList.add('e-selected');
|
|
12701
|
+
default:
|
|
12702
|
+
this.objColl = [];
|
|
12703
|
+
this.pointColl = [];
|
|
12704
|
+
this.freehandCounter = 0;
|
|
12705
|
+
this.setCurrentObj(obj.currentObj);
|
|
12706
|
+
this.destLeft = obj.currentObj.destPoints.startX;
|
|
12707
|
+
this.destTop = obj.currentObj.destPoints.startY;
|
|
12708
|
+
activeObj = extend({}, this.activeObj, {}, true);
|
|
12709
|
+
this.objColl = extend([], obj.currentObjColl, [], true);
|
|
12710
|
+
this.pointColl = extend([], obj.currentPointColl, [], true);
|
|
12711
|
+
this.freehandCounter = this.pointColl.length;
|
|
12712
|
+
this.lowerContext.filter = 'none';
|
|
12713
|
+
this.iterateObjColl();
|
|
12714
|
+
this.freehandRedraw(this.lowerContext);
|
|
12715
|
+
this.lowerContext.filter = obj.currentObj.filter;
|
|
12716
|
+
this.activeObj = activeObj;
|
|
12717
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
12718
|
+
if (this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) {
|
|
12719
|
+
this.drawObject('duplicate');
|
|
12454
12720
|
}
|
|
12455
|
-
this.
|
|
12456
|
-
this.
|
|
12457
|
-
this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
|
|
12458
|
-
this.redrawImgWithObj();
|
|
12721
|
+
this.setAdjustment(obj.operation);
|
|
12722
|
+
this.updateFilter(obj.operation);
|
|
12459
12723
|
break;
|
|
12460
12724
|
}
|
|
12725
|
+
this.clearOuterCanvas(this.lowerContext);
|
|
12726
|
+
if (this.isCircleCrop) {
|
|
12727
|
+
this.cropCircle(this.lowerContext);
|
|
12728
|
+
}
|
|
12729
|
+
if (this.zoomFactor > 0) {
|
|
12730
|
+
this.dragCanvas = true;
|
|
12731
|
+
}
|
|
12732
|
+
this.isCancelAction = false;
|
|
12461
12733
|
if (this.undoRedoStep === this.undoRedoColl.length) {
|
|
12462
12734
|
this.isUndoRedo = false;
|
|
12463
12735
|
}
|
|
12736
|
+
if (!isNullOrUndefined(this.activeObj.shape) && this.activeObj.shape.split('-')[0] === 'crop') {
|
|
12737
|
+
this.refreshToolbar('main', true, true);
|
|
12738
|
+
}
|
|
12739
|
+
else {
|
|
12740
|
+
this.refreshToolbar('main');
|
|
12741
|
+
}
|
|
12464
12742
|
}
|
|
12465
12743
|
}
|
|
12466
12744
|
};
|