@syncfusion/ej2-image-editor 25.2.3 → 26.1.35
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/.eslintrc.json +3 -2
- 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 +2679 -829
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +2762 -872
- package/dist/es6/ej2-image-editor.es5.js.map +1 -1
- package/dist/global/ej2-image-editor.min.js +2 -2
- package/dist/global/ej2-image-editor.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +13 -12
- package/src/image-editor/action/crop.d.ts +0 -1
- package/src/image-editor/action/crop.js +35 -77
- package/src/image-editor/action/draw.d.ts +3 -0
- package/src/image-editor/action/draw.js +190 -81
- package/src/image-editor/action/export.d.ts +3 -0
- package/src/image-editor/action/export.js +99 -40
- package/src/image-editor/action/filter.d.ts +0 -1
- package/src/image-editor/action/filter.js +4 -24
- package/src/image-editor/action/freehand-draw.js +30 -8
- package/src/image-editor/action/selection.d.ts +10 -0
- package/src/image-editor/action/selection.js +444 -99
- package/src/image-editor/action/shape.d.ts +11 -1
- package/src/image-editor/action/shape.js +520 -127
- package/src/image-editor/action/transform.d.ts +0 -1
- package/src/image-editor/action/transform.js +53 -69
- package/src/image-editor/action/undo-redo.d.ts +2 -0
- package/src/image-editor/action/undo-redo.js +114 -29
- package/src/image-editor/base/enum.d.ts +5 -1
- package/src/image-editor/base/enum.js +4 -0
- package/src/image-editor/base/image-editor-model.d.ts +8 -6
- package/src/image-editor/base/image-editor.d.ts +116 -7
- package/src/image-editor/base/image-editor.js +378 -52
- package/src/image-editor/base/interface.d.ts +17 -0
- package/src/image-editor/base/interface.js +0 -1
- package/src/image-editor/renderer/toolbar.d.ts +14 -1
- package/src/image-editor/renderer/toolbar.js +831 -191
- package/styles/bootstrap-dark.css +279 -97
- package/styles/bootstrap-dark.scss +13 -1
- package/styles/bootstrap.css +282 -98
- package/styles/bootstrap.scss +13 -1
- package/styles/bootstrap4.css +280 -97
- package/styles/bootstrap4.scss +13 -1
- package/styles/bootstrap5-dark.css +280 -101
- package/styles/bootstrap5-dark.scss +13 -1
- package/styles/bootstrap5.css +280 -101
- package/styles/bootstrap5.scss +13 -1
- package/styles/fabric-dark.css +281 -97
- package/styles/fabric-dark.scss +13 -1
- package/styles/fabric.css +284 -97
- package/styles/fabric.scss +13 -1
- package/styles/fluent-dark.css +287 -101
- package/styles/fluent-dark.scss +13 -1
- package/styles/fluent.css +287 -101
- package/styles/fluent.scss +13 -1
- package/styles/fluent2.css +1851 -0
- package/styles/fluent2.scss +13 -0
- package/styles/highcontrast-light.css +279 -97
- package/styles/highcontrast-light.scss +13 -1
- package/styles/highcontrast.css +284 -97
- package/styles/highcontrast.scss +13 -1
- package/styles/image-editor/_bds-definition.scss +5 -0
- package/styles/image-editor/_bootstrap-dark-definition.scss +5 -0
- package/styles/image-editor/_bootstrap-definition.scss +5 -0
- package/styles/image-editor/_bootstrap4-definition.scss +5 -0
- package/styles/image-editor/_bootstrap5-definition.scss +5 -0
- package/styles/image-editor/_bootstrap5.3-definition.scss +26 -0
- package/styles/image-editor/_fabric-dark-definition.scss +5 -0
- package/styles/image-editor/_fabric-definition.scss +5 -0
- package/styles/image-editor/_fluent-definition.scss +5 -0
- package/styles/image-editor/_fluent2-definition.scss +26 -0
- package/styles/image-editor/_fusionnew-definition.scss +5 -0
- package/styles/image-editor/_highcontrast-definition.scss +5 -0
- package/styles/image-editor/_highcontrast-light-definition.scss +5 -0
- package/styles/image-editor/_layout.scss +352 -13
- package/styles/image-editor/_material-dark-definition.scss +5 -0
- package/styles/image-editor/_material-definition.scss +5 -0
- package/styles/image-editor/_material3-definition.scss +5 -0
- package/styles/image-editor/_tailwind-definition.scss +5 -0
- package/styles/image-editor/bootstrap-dark.css +279 -97
- package/styles/image-editor/bootstrap.css +282 -98
- package/styles/image-editor/bootstrap4.css +280 -97
- package/styles/image-editor/bootstrap5-dark.css +280 -101
- package/styles/image-editor/bootstrap5.css +280 -101
- package/styles/image-editor/fabric-dark.css +281 -97
- package/styles/image-editor/fabric.css +284 -97
- package/styles/image-editor/fluent-dark.css +287 -101
- package/styles/image-editor/fluent.css +287 -101
- package/styles/image-editor/fluent2.css +1851 -0
- package/styles/image-editor/fluent2.scss +13 -0
- package/styles/image-editor/highcontrast-light.css +279 -97
- package/styles/image-editor/highcontrast.css +284 -97
- package/styles/image-editor/icons/_bds.scss +1 -162
- package/styles/image-editor/icons/_bootstrap-dark.scss +1 -162
- package/styles/image-editor/icons/_bootstrap.scss +1 -162
- package/styles/image-editor/icons/_bootstrap4.scss +1 -162
- package/styles/image-editor/icons/_bootstrap5.3.scss +250 -0
- package/styles/image-editor/icons/_bootstrap5.scss +1 -168
- package/styles/image-editor/icons/_fabric-dark.scss +1 -162
- package/styles/image-editor/icons/_fabric.scss +1 -162
- package/styles/image-editor/icons/_fluent.scss +1 -168
- package/styles/image-editor/icons/_fluent2.scss +256 -0
- package/styles/image-editor/icons/_fusionnew.scss +1 -138
- package/styles/image-editor/icons/_highcontrast-light.scss +1 -162
- package/styles/image-editor/icons/_highcontrast.scss +1 -162
- package/styles/image-editor/icons/_material-dark.scss +2 -163
- package/styles/image-editor/icons/_material.scss +1 -162
- package/styles/image-editor/icons/_material3.scss +2 -169
- package/styles/image-editor/icons/_tailwind.scss +1 -162
- package/styles/image-editor/material-dark.css +299 -100
- package/styles/image-editor/material.css +302 -100
- package/styles/image-editor/material3-dark.css +314 -103
- package/styles/image-editor/material3.css +314 -103
- package/styles/image-editor/tailwind-dark.css +284 -97
- package/styles/image-editor/tailwind.css +284 -97
- package/styles/material-dark.css +299 -100
- package/styles/material-dark.scss +13 -1
- package/styles/material.css +302 -100
- package/styles/material.scss +13 -1
- package/styles/material3-dark.css +314 -103
- package/styles/material3-dark.scss +13 -1
- package/styles/material3.css +314 -103
- package/styles/material3.scss +13 -1
- package/styles/tailwind-dark.css +284 -97
- package/styles/tailwind-dark.scss +13 -1
- package/styles/tailwind.css +284 -97
- package/styles/tailwind.scss +13 -1
- package/CHANGELOG.md +0 -281
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable prefer-const */
|
|
1
2
|
import { Browser, extend, getComponent, isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
2
3
|
import { Direction } from '../index';
|
|
3
4
|
import { hideSpinner, showSpinner } from '@syncfusion/ej2-popups';
|
|
@@ -32,9 +33,6 @@ var Transform = /** @class */ (function () {
|
|
|
32
33
|
Transform.prototype.transform = function (args) {
|
|
33
34
|
this.initTransformPvtVar();
|
|
34
35
|
switch (args.prop) {
|
|
35
|
-
case 'rotateImage':
|
|
36
|
-
this.rotateImage(args.value['degree']);
|
|
37
|
-
break;
|
|
38
36
|
case 'flipImage':
|
|
39
37
|
this.flipImage(args.value['direction']);
|
|
40
38
|
break;
|
|
@@ -65,15 +63,6 @@ var Transform = /** @class */ (function () {
|
|
|
65
63
|
case 'rotatePan':
|
|
66
64
|
this.rotatePan(args.value['isCropSelection'], args.value['isDefaultZoom']);
|
|
67
65
|
break;
|
|
68
|
-
case 'drawRotatedImage':
|
|
69
|
-
this.drawRotatedImage(args.value['degree']);
|
|
70
|
-
break;
|
|
71
|
-
case 'limitPan':
|
|
72
|
-
this.limitPan();
|
|
73
|
-
break;
|
|
74
|
-
case 'updateFlipActiveObj':
|
|
75
|
-
this.updateFlipActiveObj(args.value['panRegion']);
|
|
76
|
-
break;
|
|
77
66
|
case 'resetZoom':
|
|
78
67
|
this.resetZoom();
|
|
79
68
|
break;
|
|
@@ -155,9 +144,6 @@ var Transform = /** @class */ (function () {
|
|
|
155
144
|
case 'resizeCrop':
|
|
156
145
|
this.resizeCrop(args.value['width'], args.value['height']);
|
|
157
146
|
break;
|
|
158
|
-
case 'setPreventDownScale':
|
|
159
|
-
this.preventDownScale = args.value['bool'];
|
|
160
|
-
break;
|
|
161
147
|
case 'updateResize':
|
|
162
148
|
this.updateResize();
|
|
163
149
|
break;
|
|
@@ -713,8 +699,8 @@ var Transform = /** @class */ (function () {
|
|
|
713
699
|
parent.img.destLeft = destLeft;
|
|
714
700
|
parent.img.destTop = destTop;
|
|
715
701
|
parent.objColl = objColl;
|
|
716
|
-
parent.notify('shape', { prop: '
|
|
717
|
-
|
|
702
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
703
|
+
value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: isPreventApply } });
|
|
718
704
|
if (parent.transform.straighten === 0 && !this.isPreventSelect) {
|
|
719
705
|
parent.notify('freehand-draw', { prop: 'updateFHDColl', onPropertyChange: false, value: { isPreventApply: isPreventApply } });
|
|
720
706
|
}
|
|
@@ -735,8 +721,8 @@ var Transform = /** @class */ (function () {
|
|
|
735
721
|
if (panObj_2['panRegion'] !== '') {
|
|
736
722
|
var temp = this.lowerContext.filter;
|
|
737
723
|
this.lowerContext.filter = 'none';
|
|
738
|
-
parent.notify('shape', { prop: '
|
|
739
|
-
|
|
724
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
725
|
+
value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: isPreventApply } });
|
|
740
726
|
this.lowerContext.filter = temp;
|
|
741
727
|
}
|
|
742
728
|
}
|
|
@@ -751,8 +737,8 @@ var Transform = /** @class */ (function () {
|
|
|
751
737
|
if (panObj['panRegion'] === '') {
|
|
752
738
|
var temp = this.lowerContext.filter;
|
|
753
739
|
this.lowerContext.filter = 'none';
|
|
754
|
-
parent.notify('shape', { prop: '
|
|
755
|
-
|
|
740
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
741
|
+
value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: isPreventApply } });
|
|
756
742
|
this.lowerContext.filter = temp;
|
|
757
743
|
}
|
|
758
744
|
if ((parent.currSelectionPoint && parent.currSelectionPoint.shape === 'crop-circle') || parent.isCircleCrop) {
|
|
@@ -779,7 +765,9 @@ var Transform = /** @class */ (function () {
|
|
|
779
765
|
zoomOut.classList.remove('e-disabled');
|
|
780
766
|
zoomOut.parentElement.classList.remove('e-overlay');
|
|
781
767
|
}
|
|
768
|
+
var drawingShape = parent.drawingShape;
|
|
782
769
|
this.autoEnablePan();
|
|
770
|
+
parent.drawingShape = drawingShape;
|
|
783
771
|
if (this.tempActiveObj) {
|
|
784
772
|
parent.activeObj = extend({}, this.tempActiveObj, {}, true);
|
|
785
773
|
}
|
|
@@ -803,10 +791,35 @@ var Transform = /** @class */ (function () {
|
|
|
803
791
|
}
|
|
804
792
|
parent.notify('toolbar', { prop: 'enable-disable-btns', onPropertyChange: false });
|
|
805
793
|
parent.notify('selection', { prop: 'setZoomType', onPropertyChange: false, value: { zoomType: 'Toolbar' } });
|
|
794
|
+
// eslint-disable-next-line max-len
|
|
806
795
|
zoomEventArgs = { zoomPoint: zoomEventArgs.zoomPoint, previousZoomFactor: zoomEventArgs.previousZoomFactor, currentZoomFactor: zoomEventArgs.currentZoomFactor, zoomTrigger: zoomEventArgs.zoomTrigger };
|
|
807
796
|
if (!parent.isCropToolbar && parent.isZoomBtnClick) {
|
|
808
797
|
parent.isZoomBtnClick = false;
|
|
809
798
|
}
|
|
799
|
+
if (parent.drawingShape) {
|
|
800
|
+
var activeObj = extend({}, parent.activeObj, {}, true);
|
|
801
|
+
parent.enableShapeDrawing(parent.toPascalCase(parent.drawingShape), true);
|
|
802
|
+
parent.activeObj = activeObj;
|
|
803
|
+
if (activeObj.activePoint.width > 0 || activeObj.activePoint.height > 0 ||
|
|
804
|
+
(activeObj.pointColl && activeObj.pointColl.length > 0)) {
|
|
805
|
+
var zOrderElem = parent.element.querySelector('#' + parent.element.id + '_zOrderBtn');
|
|
806
|
+
var dupElem = parent.element.querySelector('#' + parent.element.id + '_duplicate');
|
|
807
|
+
var removeElem = parent.element.querySelector('#' + parent.element.id + '_remove');
|
|
808
|
+
var editTextElem = parent.element.querySelector('#' + parent.element.id + '_editText');
|
|
809
|
+
if (zOrderElem) {
|
|
810
|
+
zOrderElem.classList.remove('e-disabled');
|
|
811
|
+
}
|
|
812
|
+
if (dupElem) {
|
|
813
|
+
dupElem.classList.remove('e-disabled');
|
|
814
|
+
}
|
|
815
|
+
if (removeElem) {
|
|
816
|
+
removeElem.classList.remove('e-disabled');
|
|
817
|
+
}
|
|
818
|
+
if (editTextElem) {
|
|
819
|
+
editTextElem.classList.remove('e-disabled');
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
}
|
|
810
823
|
};
|
|
811
824
|
Transform.prototype.disableZoomOutBtn = function (isZoomOut) {
|
|
812
825
|
var parent = this.parent;
|
|
@@ -1219,10 +1232,9 @@ var Transform = /** @class */ (function () {
|
|
|
1219
1232
|
if (isObjCreated) {
|
|
1220
1233
|
parent.isCropTab = false;
|
|
1221
1234
|
}
|
|
1222
|
-
parent.notify('shape', { prop: '
|
|
1223
|
-
value: {
|
|
1224
|
-
|
|
1225
|
-
value: { xDiff: point.x, yDiff: point.y, panRegion: '' } });
|
|
1235
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
1236
|
+
value: { ctx: this.lowerContext, shape: 'pan', pen: 'pan', x: point.x,
|
|
1237
|
+
y: point.y, panRegion: '' } });
|
|
1226
1238
|
if (isObjCreated) {
|
|
1227
1239
|
parent.isCropTab = true;
|
|
1228
1240
|
}
|
|
@@ -1387,10 +1399,9 @@ var Transform = /** @class */ (function () {
|
|
|
1387
1399
|
if (isObjCreated) {
|
|
1388
1400
|
parent.isCropTab = false;
|
|
1389
1401
|
}
|
|
1390
|
-
parent.notify('shape', { prop: '
|
|
1391
|
-
value: {
|
|
1392
|
-
|
|
1393
|
-
value: { xDiff: parent.panPoint.currentPannedPoint.x, yDiff: parent.panPoint.currentPannedPoint.y, panRegion: '' } });
|
|
1402
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
1403
|
+
value: { ctx: this.lowerContext, shape: 'pan', pen: 'pan', x: parent.panPoint.currentPannedPoint.x,
|
|
1404
|
+
y: parent.panPoint.currentPannedPoint.y, panRegion: '' } });
|
|
1394
1405
|
if (isObjCreated) {
|
|
1395
1406
|
parent.isCropTab = true;
|
|
1396
1407
|
}
|
|
@@ -1423,37 +1434,6 @@ var Transform = /** @class */ (function () {
|
|
|
1423
1434
|
}
|
|
1424
1435
|
}
|
|
1425
1436
|
};
|
|
1426
|
-
Transform.prototype.updateFlipActiveObj = function (panRegion) {
|
|
1427
|
-
var parent = this.parent;
|
|
1428
|
-
var actPoint = parent.activeObj.activePoint;
|
|
1429
|
-
var _a = parent.lowerCanvas, width = _a.width, height = _a.height;
|
|
1430
|
-
var endX;
|
|
1431
|
-
var endY;
|
|
1432
|
-
if (panRegion === 'horizontal') {
|
|
1433
|
-
endX = actPoint.startX > width / 2 ? (width / 2) - (actPoint.startX - (width / 2)) :
|
|
1434
|
-
(width / 2) + ((width / 2) - actPoint.startX);
|
|
1435
|
-
actPoint.startX = endX - actPoint.width;
|
|
1436
|
-
actPoint.endX = endX;
|
|
1437
|
-
}
|
|
1438
|
-
else if (panRegion === 'vertical') {
|
|
1439
|
-
endY = actPoint.startX > width / 2 ? (height / 2) - (actPoint.startY - (height / 2)) :
|
|
1440
|
-
(height / 2) + ((height / 2) - actPoint.startY);
|
|
1441
|
-
actPoint.startY = endY - actPoint.height;
|
|
1442
|
-
actPoint.endY = endY;
|
|
1443
|
-
}
|
|
1444
|
-
else if (panRegion === 'verticalHorizontal' || panRegion === 'horizontalVertical') {
|
|
1445
|
-
endX = actPoint.startX > width / 2 ? (width / 2) - (actPoint.startX - (width / 2)) :
|
|
1446
|
-
(width / 2) + ((width / 2) - actPoint.startX);
|
|
1447
|
-
endY = actPoint.startX > width / 2 ? (height / 2) - (actPoint.startY - (height / 2)) :
|
|
1448
|
-
(height / 2) + ((height / 2) - actPoint.startY);
|
|
1449
|
-
actPoint.startX = endX - actPoint.width;
|
|
1450
|
-
actPoint.startY = endY - actPoint.height;
|
|
1451
|
-
actPoint.endX = endX;
|
|
1452
|
-
actPoint.endY = endY;
|
|
1453
|
-
}
|
|
1454
|
-
parent.notify('draw', { prop: 'updateActiveObject', onPropertyChange: false, value: { actPoint: actPoint,
|
|
1455
|
-
obj: parent.activeObj, isMouseMove: null, x: null, y: null } });
|
|
1456
|
-
};
|
|
1457
1437
|
Transform.prototype.pan = function (value, x, y) {
|
|
1458
1438
|
var parent = this.parent;
|
|
1459
1439
|
if (!parent.disabled && parent.isImageLoaded) {
|
|
@@ -1568,7 +1548,7 @@ var Transform = /** @class */ (function () {
|
|
|
1568
1548
|
(hdWrapper && !hdWrapper.parentElement.classList.contains('e-hide')))) {
|
|
1569
1549
|
ctWrapper.classList.add('e-hide');
|
|
1570
1550
|
if (!isCropSelection) {
|
|
1571
|
-
parent.okBtn();
|
|
1551
|
+
parent.okBtn(null, true);
|
|
1572
1552
|
}
|
|
1573
1553
|
parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
|
|
1574
1554
|
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
@@ -1689,8 +1669,8 @@ var Transform = /** @class */ (function () {
|
|
|
1689
1669
|
parent.notify('draw', { prop: 'updateCurrTransState', onPropertyChange: false,
|
|
1690
1670
|
value: { type: 'reverse', isPreventDestination: null, isRotatePan: null } });
|
|
1691
1671
|
}
|
|
1692
|
-
parent.notify('shape', { prop: '
|
|
1693
|
-
|
|
1672
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
1673
|
+
value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: null } });
|
|
1694
1674
|
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
1695
1675
|
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
|
|
1696
1676
|
if (parent.isCircleCrop) {
|
|
@@ -1718,8 +1698,8 @@ var Transform = /** @class */ (function () {
|
|
|
1718
1698
|
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
1719
1699
|
parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null } });
|
|
1720
1700
|
parent.objColl.push(activeObj);
|
|
1721
|
-
parent.notify('shape', { prop: '
|
|
1722
|
-
|
|
1701
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
1702
|
+
value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: null } });
|
|
1723
1703
|
activeObj = extend({}, parent.objColl[parent.objColl.length - 1], null, true);
|
|
1724
1704
|
parent.objColl.pop();
|
|
1725
1705
|
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
@@ -1960,8 +1940,8 @@ var Transform = /** @class */ (function () {
|
|
|
1960
1940
|
parent.objColl = extend([], obj1['prevObj']['objColl'], [], true);
|
|
1961
1941
|
parent.pointColl = extend([], obj1['prevObj']['pointColl'], [], true);
|
|
1962
1942
|
parent.transform.straighten = 0;
|
|
1963
|
-
parent.notify('shape', { prop: '
|
|
1964
|
-
|
|
1943
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
1944
|
+
value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: null } });
|
|
1965
1945
|
if (parent.transform.straighten === 0 && !this.isPreventSelect) {
|
|
1966
1946
|
parent.notify('freehand-draw', { prop: 'updateFHDColl', onPropertyChange: false });
|
|
1967
1947
|
}
|
|
@@ -2173,6 +2153,7 @@ var Transform = /** @class */ (function () {
|
|
|
2173
2153
|
aspectRatioWidthValue = parseFloat(aspectRatioWidth.value === '' ? aspectRatioWidth.placeholder : aspectRatioWidth.value);
|
|
2174
2154
|
if (aspectRatioHeight) {
|
|
2175
2155
|
var value = aspectRatioWidthValue / (originalWidth / originalHeight);
|
|
2156
|
+
// eslint-disable-next-line max-len
|
|
2176
2157
|
var height = value % 1 >= 0.5 || value % 1 <= -0.5 ? Math.round(value) : (value < 0) ? Math.ceil(value) : Math.floor(value);
|
|
2177
2158
|
getComponent(aspectRatioHeight, 'numerictextbox').value = height;
|
|
2178
2159
|
aspectRatioHeight.value = height.toString() + ' px';
|
|
@@ -2181,6 +2162,7 @@ var Transform = /** @class */ (function () {
|
|
|
2181
2162
|
var aspectRatioHeightValue = parseFloat(aspectRatioHeight.value === '' ? aspectRatioHeight.placeholder :
|
|
2182
2163
|
aspectRatioHeight.value);
|
|
2183
2164
|
value = aspectRatioHeightValue / (originalHeight / originalWidth);
|
|
2165
|
+
// eslint-disable-next-line max-len
|
|
2184
2166
|
var width = value % 1 >= 0.5 || value % 1 <= -0.5 ? Math.round(value) : (value < 0) ? Math.ceil(value) : Math.floor(value);
|
|
2185
2167
|
getComponent(aspectRatioWidth, 'numerictextbox').value = width;
|
|
2186
2168
|
aspectRatioWidth.value = width.toString() + ' px';
|
|
@@ -2189,12 +2171,14 @@ var Transform = /** @class */ (function () {
|
|
|
2189
2171
|
}
|
|
2190
2172
|
else if (heightElem) {
|
|
2191
2173
|
var value = aspectRatioWidthValue / (originalWidth / originalHeight);
|
|
2174
|
+
// eslint-disable-next-line max-len
|
|
2192
2175
|
var height = value % 1 >= 0.5 || value % 1 <= -0.5 ? Math.round(value) : (value < 0) ? Math.ceil(value) : Math.floor(value);
|
|
2193
2176
|
heightElem.value = height.toString();
|
|
2194
2177
|
parent.aspectHeight = height;
|
|
2195
2178
|
if (widthElem && widthElem.value === '') {
|
|
2196
2179
|
var aspectRatioHeightValue = parseFloat(heightElem.value === '' ? heightElem.placeholder : heightElem.value);
|
|
2197
2180
|
value = aspectRatioHeightValue / (originalHeight / originalWidth);
|
|
2181
|
+
// eslint-disable-next-line max-len
|
|
2198
2182
|
var width = value % 1 >= 0.5 || value % 1 <= -0.5 ? Math.round(value) : (value < 0) ? Math.ceil(value) : Math.floor(value);
|
|
2199
2183
|
widthElem.value = width.toString();
|
|
2200
2184
|
parent.aspectWidth = width;
|
|
@@ -2214,7 +2198,7 @@ var Transform = /** @class */ (function () {
|
|
|
2214
2198
|
parent.notify('transform', { prop: 'setPreventDownScale', value: { bool: true } });
|
|
2215
2199
|
parent.notify('transform', { prop: 'resizeCrop', value: { width: args.width, height: args.height } });
|
|
2216
2200
|
parent.notify('undo-redo', { prop: 'setPreventUR', value: { bool: true } });
|
|
2217
|
-
parent.okBtn();
|
|
2201
|
+
parent.okBtn(null, true);
|
|
2218
2202
|
parent.notify('undo-redo', { prop: 'setPreventUR', value: { bool: false } });
|
|
2219
2203
|
parent.resizeSrc = { startX: parent.img.srcLeft, startY: parent.img.srcTop, width: parent.img.srcWidth,
|
|
2220
2204
|
height: parent.img.srcHeight };
|
|
@@ -2237,7 +2221,7 @@ var Transform = /** @class */ (function () {
|
|
|
2237
2221
|
value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
|
|
2238
2222
|
}
|
|
2239
2223
|
parent.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: null } });
|
|
2240
|
-
parent.setStraighten(degree
|
|
2224
|
+
parent.setStraighten(degree);
|
|
2241
2225
|
parent.okBtn();
|
|
2242
2226
|
};
|
|
2243
2227
|
return Transform;
|
|
@@ -42,7 +42,7 @@ var UndoRedo = /** @class */ (function () {
|
|
|
42
42
|
this.refreshUrc(args.value['bool']);
|
|
43
43
|
break;
|
|
44
44
|
case 'updateCurrUrc':
|
|
45
|
-
this.updateCurrUrc(args.value['type']);
|
|
45
|
+
this.updateCurrUrc(args.value['type'], args.value['isCancel']);
|
|
46
46
|
break;
|
|
47
47
|
case 'call-undo':
|
|
48
48
|
this.callUndo();
|
|
@@ -77,6 +77,14 @@ var UndoRedo = /** @class */ (function () {
|
|
|
77
77
|
case 'setPreventUR':
|
|
78
78
|
this.isPreventing = args.value['bool'];
|
|
79
79
|
break;
|
|
80
|
+
case 'updateUndoRedoStack':
|
|
81
|
+
if (args.value && args.value['isPenDraw']) {
|
|
82
|
+
this.updateUndoRedoStack(args.value['isPenDraw']);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
this.updateUndoRedoStack();
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
80
88
|
case 'reset':
|
|
81
89
|
this.reset();
|
|
82
90
|
break;
|
|
@@ -109,9 +117,9 @@ var UndoRedo = /** @class */ (function () {
|
|
|
109
117
|
parent.isUndoRedo = parent.currObjType.isUndoAction = false;
|
|
110
118
|
parent.notify('toolbar', { prop: 'enable-disable-btns' });
|
|
111
119
|
};
|
|
112
|
-
UndoRedo.prototype.updateCurrUrc = function (type) {
|
|
120
|
+
UndoRedo.prototype.updateCurrUrc = function (type, isCancel) {
|
|
113
121
|
var parent = this.parent;
|
|
114
|
-
if (parent.isResize || this.isPreventing) {
|
|
122
|
+
if (parent.isResize || this.isPreventing || parent.noPushUndo) {
|
|
115
123
|
return;
|
|
116
124
|
}
|
|
117
125
|
parent.notify('toolbar', { prop: 'setEnableDisableUndoRedo', value: { isPrevent: false } });
|
|
@@ -167,9 +175,22 @@ var UndoRedo = /** @class */ (function () {
|
|
|
167
175
|
this.tempUndoRedoColl = [];
|
|
168
176
|
this.tempUndoRedoStep = 0;
|
|
169
177
|
}
|
|
178
|
+
var lastObj = this.appliedUndoRedoColl[this.appliedUndoRedoColl.length - 1];
|
|
179
|
+
var lastPrevObj = this.appliedUndoRedoColl[this.appliedUndoRedoColl.length - 2];
|
|
170
180
|
if (this.appliedUndoRedoColl.length > 16) {
|
|
171
181
|
this.appliedUndoRedoColl.splice(0, 1);
|
|
172
182
|
}
|
|
183
|
+
else if (!isCancel && lastObj && lastPrevObj) {
|
|
184
|
+
if ((((lastObj.operation === 'shapeTransform' && lastPrevObj.operation === 'shapeTransform') ||
|
|
185
|
+
(lastObj.operation === 'shapeInsert' && lastPrevObj.operation === 'shapeInsert')) &&
|
|
186
|
+
JSON.stringify(lastObj.currentObjColl) === JSON.stringify(lastPrevObj.currentObjColl)) ||
|
|
187
|
+
(lastObj.operation === 'freehand-draw' && lastPrevObj.operation === 'freehand-draw' &&
|
|
188
|
+
JSON.stringify(lastObj.currentPointColl) === JSON.stringify(lastPrevObj.currentPointColl)) ||
|
|
189
|
+
(lastObj.operation === 'freehanddrawCustomized' && lastPrevObj.operation === 'freehanddrawCustomized' &&
|
|
190
|
+
JSON.stringify(lastObj.currentPointColl) === JSON.stringify(lastPrevObj.currentPointColl))) {
|
|
191
|
+
this.appliedUndoRedoColl.splice(this.appliedUndoRedoColl.length - 1, 1);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
173
194
|
this.undoRedoColl = [];
|
|
174
195
|
this.undoRedoColl = extend([], this.appliedUndoRedoColl, [], true);
|
|
175
196
|
if (type === 'ok') {
|
|
@@ -301,21 +322,21 @@ var UndoRedo = /** @class */ (function () {
|
|
|
301
322
|
case 'sharpen':
|
|
302
323
|
case 'imageRotate':
|
|
303
324
|
case 'shapeInsert':
|
|
304
|
-
this.shapeTransform(obj.previousObjColl);
|
|
325
|
+
this.shapeTransform(obj.previousObjColl, obj.previousPointColl);
|
|
305
326
|
break;
|
|
306
327
|
case 'freehanddraw':
|
|
307
328
|
case 'freehand-draw':
|
|
308
329
|
this.updateFreehandDraw(obj.previousPointColl, obj.previousSelPointColl);
|
|
309
330
|
break;
|
|
310
331
|
case 'freehanddrawCustomized':
|
|
311
|
-
this.updateFreehandDrawCustomized(obj.previousPointColl);
|
|
332
|
+
this.updateFreehandDrawCustomized(obj.previousObjColl, obj.previousPointColl);
|
|
312
333
|
break;
|
|
313
334
|
case 'deleteFreehandDrawing':
|
|
314
335
|
case 'deleteObj':
|
|
315
336
|
this.updateDelete(obj.operation, obj.previousObjColl, obj.previousPointColl, obj.previousSelPointColl);
|
|
316
337
|
break;
|
|
317
338
|
case 'textAreaCustomization':
|
|
318
|
-
this.shapeTransform(obj.previousObjColl);
|
|
339
|
+
this.shapeTransform(obj.previousObjColl, obj.previousPointColl);
|
|
319
340
|
this.updateTextAreaCustomization(activeObj, obj.previousObjColl);
|
|
320
341
|
break;
|
|
321
342
|
case 'text':
|
|
@@ -431,21 +452,21 @@ var UndoRedo = /** @class */ (function () {
|
|
|
431
452
|
case 'sharpen':
|
|
432
453
|
case 'imageRotate':
|
|
433
454
|
case 'shapeInsert':
|
|
434
|
-
this.shapeTransform(obj.currentObjColl);
|
|
455
|
+
this.shapeTransform(obj.currentObjColl, obj.currentPointColl);
|
|
435
456
|
break;
|
|
436
457
|
case 'freehanddraw':
|
|
437
458
|
case 'freehand-draw':
|
|
438
459
|
this.updateFreehandDraw(obj.currentPointColl, obj.currentSelPointColl);
|
|
439
460
|
break;
|
|
440
461
|
case 'freehanddrawCustomized':
|
|
441
|
-
this.updateFreehandDrawCustomized(obj.currentPointColl);
|
|
462
|
+
this.updateFreehandDrawCustomized(obj.currentObjColl, obj.currentPointColl);
|
|
442
463
|
break;
|
|
443
464
|
case 'deleteFreehandDrawing':
|
|
444
465
|
case 'deleteObj':
|
|
445
466
|
this.updateDelete(obj.operation, obj.currentObjColl, obj.currentPointColl, obj.currentSelPointColl);
|
|
446
467
|
break;
|
|
447
468
|
case 'textAreaCustomization':
|
|
448
|
-
this.shapeTransform(obj.currentObjColl);
|
|
469
|
+
this.shapeTransform(obj.currentObjColl, obj.currentPointColl);
|
|
449
470
|
this.updateTextAreaCustomization(activeObj, obj.currentObjColl);
|
|
450
471
|
break;
|
|
451
472
|
case 'text':
|
|
@@ -478,8 +499,8 @@ var UndoRedo = /** @class */ (function () {
|
|
|
478
499
|
value: { obj: { selPointColl: extend([], obj.currentSelPointColl, [], true) } } });
|
|
479
500
|
parent.transform.straighten = 0;
|
|
480
501
|
this.lowerContext.filter = 'none';
|
|
481
|
-
parent.notify('shape', { prop: '
|
|
482
|
-
|
|
502
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
503
|
+
value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: null } });
|
|
483
504
|
this.lowerContext.filter = obj.currentObj.filter;
|
|
484
505
|
parent.prevStraightenedDegree = parent.transform.straighten;
|
|
485
506
|
parent.activeObj = activeObj;
|
|
@@ -515,7 +536,7 @@ var UndoRedo = /** @class */ (function () {
|
|
|
515
536
|
};
|
|
516
537
|
UndoRedo.prototype.imageFlip = function (type, objColl) {
|
|
517
538
|
var parent = this.parent;
|
|
518
|
-
this.shapeTransform(objColl);
|
|
539
|
+
this.shapeTransform(objColl, null);
|
|
519
540
|
parent.activeObj = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
|
|
520
541
|
var _a = parent.activeObj, shape = _a.shape, isHorImageFlip = _a.isHorImageFlip, isVerImageFlip = _a.isVerImageFlip;
|
|
521
542
|
parent.objColl.pop();
|
|
@@ -558,10 +579,15 @@ var UndoRedo = /** @class */ (function () {
|
|
|
558
579
|
parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: true } });
|
|
559
580
|
}
|
|
560
581
|
};
|
|
561
|
-
UndoRedo.prototype.shapeTransform = function (objColl) {
|
|
582
|
+
UndoRedo.prototype.shapeTransform = function (objColl, pointColl) {
|
|
562
583
|
var parent = this.parent;
|
|
563
584
|
parent.objColl = extend([], objColl, [], true);
|
|
564
|
-
|
|
585
|
+
if (pointColl) {
|
|
586
|
+
parent.pointColl = extend([], pointColl, [], true);
|
|
587
|
+
parent.freehandCounter = parent.pointColl.length;
|
|
588
|
+
}
|
|
589
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
590
|
+
value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: null } });
|
|
565
591
|
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
566
592
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
567
593
|
parent.isUndoRedo = true;
|
|
@@ -574,16 +600,19 @@ var UndoRedo = /** @class */ (function () {
|
|
|
574
600
|
parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
|
|
575
601
|
value: { obj: { selPointColl: selPointColl } } });
|
|
576
602
|
parent.freehandCounter = parent.pointColl.length;
|
|
577
|
-
parent.notify('
|
|
603
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
604
|
+
value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: null } });
|
|
578
605
|
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
579
606
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
580
607
|
parent.isUndoRedo = true;
|
|
581
608
|
parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
|
|
582
609
|
};
|
|
583
|
-
UndoRedo.prototype.updateFreehandDrawCustomized = function (pointColl) {
|
|
610
|
+
UndoRedo.prototype.updateFreehandDrawCustomized = function (objColl, pointColl) {
|
|
584
611
|
var parent = this.parent;
|
|
612
|
+
parent.objColl = extend([], objColl, [], true);
|
|
585
613
|
parent.pointColl = pointColl;
|
|
586
|
-
parent.notify('
|
|
614
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
615
|
+
value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: null } });
|
|
587
616
|
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
588
617
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
589
618
|
parent.isUndoRedo = true;
|
|
@@ -596,11 +625,13 @@ var UndoRedo = /** @class */ (function () {
|
|
|
596
625
|
parent.freehandCounter = parent.pointColl.length;
|
|
597
626
|
parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
|
|
598
627
|
value: { obj: { selPointColl: selPointColl } } });
|
|
599
|
-
parent.notify('
|
|
628
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
629
|
+
value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: null } });
|
|
600
630
|
}
|
|
601
631
|
else if (operation === 'deleteObj') {
|
|
602
632
|
parent.objColl = objColl;
|
|
603
|
-
parent.notify('shape', { prop: '
|
|
633
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
634
|
+
value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: null } });
|
|
604
635
|
}
|
|
605
636
|
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
606
637
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
@@ -610,7 +641,8 @@ var UndoRedo = /** @class */ (function () {
|
|
|
610
641
|
UndoRedo.prototype.updateTextAreaCustomization = function (activeObj, objColl) {
|
|
611
642
|
var parent = this.parent;
|
|
612
643
|
parent.objColl = extend([], objColl, [], true);
|
|
613
|
-
parent.notify('shape', { prop: '
|
|
644
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
645
|
+
value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: null } });
|
|
614
646
|
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
615
647
|
parent.isUndoRedo = true;
|
|
616
648
|
parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
|
|
@@ -660,7 +692,8 @@ var UndoRedo = /** @class */ (function () {
|
|
|
660
692
|
parent.activeObj = extend({}, this.tempActObj, {}, true);
|
|
661
693
|
}
|
|
662
694
|
parent.objColl = extend([], objColl, [], true);
|
|
663
|
-
parent.notify('shape', { prop: '
|
|
695
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
696
|
+
value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: true } });
|
|
664
697
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
665
698
|
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
666
699
|
parent.isUndoRedo = true;
|
|
@@ -709,8 +742,8 @@ var UndoRedo = /** @class */ (function () {
|
|
|
709
742
|
value: { obj: { selPointColl: extend([], obj.previousSelPointColl, [], true) } } });
|
|
710
743
|
parent.transform.straighten = 0;
|
|
711
744
|
this.lowerContext.filter = 'none';
|
|
712
|
-
parent.notify('shape', { prop: '
|
|
713
|
-
|
|
745
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
746
|
+
value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: null } });
|
|
714
747
|
this.lowerContext.filter = obj.previousObj.filter;
|
|
715
748
|
parent.activeObj = activeObj;
|
|
716
749
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
@@ -812,7 +845,7 @@ var UndoRedo = /** @class */ (function () {
|
|
|
812
845
|
UndoRedo.prototype.updateUrObj = function (objColl, operation) {
|
|
813
846
|
var parent = this.parent;
|
|
814
847
|
if (parent.allowUndoRedo) {
|
|
815
|
-
if (parent.currObjType.isUndoAction) {
|
|
848
|
+
if (parent.currObjType.isUndoAction && !parent.isShapeDrawing) {
|
|
816
849
|
this.refreshUrc(true);
|
|
817
850
|
}
|
|
818
851
|
if (isNullOrUndefined(parent.activeObj.imageRatio)) {
|
|
@@ -869,6 +902,7 @@ var UndoRedo = /** @class */ (function () {
|
|
|
869
902
|
};
|
|
870
903
|
UndoRedo.prototype.getZeroZoomObjPointValue = function (obj, point) {
|
|
871
904
|
var parent = this.parent;
|
|
905
|
+
this.updateObjColl();
|
|
872
906
|
var object = { currObj: {} };
|
|
873
907
|
parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
|
|
874
908
|
var currentObj = object['currObj'];
|
|
@@ -903,8 +937,8 @@ var UndoRedo = /** @class */ (function () {
|
|
|
903
937
|
var isCropTab = parent.isCropTab;
|
|
904
938
|
if (parent.transform.zoomFactor !== 0) {
|
|
905
939
|
parent.isUndoRedo = true;
|
|
906
|
-
parent.notify('shape', { prop: '
|
|
907
|
-
|
|
940
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
941
|
+
value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: true } });
|
|
908
942
|
parent.notify('freehand-draw', { prop: 'updateFHDColl', onPropertyChange: false });
|
|
909
943
|
parent.isCropTab = true;
|
|
910
944
|
var zoomSettings = extend({}, parent.zoomSettings, null, true);
|
|
@@ -947,9 +981,8 @@ var UndoRedo = /** @class */ (function () {
|
|
|
947
981
|
this.lowerContext.filter = 'none';
|
|
948
982
|
parent.transform.straighten = 0;
|
|
949
983
|
this.applyImgTranform();
|
|
950
|
-
parent.notify('shape', { prop: '
|
|
951
|
-
|
|
952
|
-
value: { context: this.lowerContext, points: null } });
|
|
984
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
985
|
+
value: { ctx: this.lowerContext, shape: 'iterate', pen: 'iterate', isPreventApply: null } });
|
|
953
986
|
parent.notify('freehand-draw', { prop: 'updateFHDCurPts', onPropertyChange: false });
|
|
954
987
|
this.lowerContext.filter = currentObj.filter;
|
|
955
988
|
if (parent.transform.degree !== 0) {
|
|
@@ -965,6 +998,20 @@ var UndoRedo = /** @class */ (function () {
|
|
|
965
998
|
}
|
|
966
999
|
return { obj: getZeroZoomObjColl, point: getZeroZoomPointColl };
|
|
967
1000
|
};
|
|
1001
|
+
UndoRedo.prototype.updateObjColl = function () {
|
|
1002
|
+
var parent = this.parent;
|
|
1003
|
+
for (var i = 0; i < parent.objColl.length; i++) {
|
|
1004
|
+
var obj = parent.objColl[i];
|
|
1005
|
+
if (obj.shape === 'line' || obj.shape === 'arrow') {
|
|
1006
|
+
if (obj.activePoint.width < 0) {
|
|
1007
|
+
obj.activePoint.width = Math.abs(obj.activePoint.width);
|
|
1008
|
+
}
|
|
1009
|
+
if (obj.activePoint.height < 0) {
|
|
1010
|
+
obj.activePoint.height = Math.abs(obj.activePoint.height);
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
};
|
|
968
1015
|
UndoRedo.prototype.applyImgTranform = function () {
|
|
969
1016
|
var parent = this.parent;
|
|
970
1017
|
var obj = extend({}, parent.activeObj, {}, true);
|
|
@@ -979,6 +1026,44 @@ var UndoRedo = /** @class */ (function () {
|
|
|
979
1026
|
}
|
|
980
1027
|
parent.activeObj = obj;
|
|
981
1028
|
};
|
|
1029
|
+
UndoRedo.prototype.updateUndoRedoStack = function (isPenDraw) {
|
|
1030
|
+
var parent = this.parent;
|
|
1031
|
+
if ((parent.activeObj.currIndex && parent.activeObj.activePoint.width !== 0 ||
|
|
1032
|
+
parent.activeObj.activePoint.height !== 0 || (parent.activeObj.pointColl &&
|
|
1033
|
+
parent.activeObj.pointColl.length > 0)) || isPenDraw) {
|
|
1034
|
+
var isTextArea = parent.textArea.style.display === 'none' ? false : true;
|
|
1035
|
+
var temp = parent.noPushUndo;
|
|
1036
|
+
parent.noPushUndo = false;
|
|
1037
|
+
parent.isUndoRedoStack = true;
|
|
1038
|
+
if (isPenDraw) {
|
|
1039
|
+
var tempTogglePen = parent.togglePen;
|
|
1040
|
+
var obj = { freehandDrawSelectedId: null };
|
|
1041
|
+
parent.notify('freehand-draw', { prop: 'getFreehandDrawSelectedId', onPropertyChange: false, value: { obj: obj } });
|
|
1042
|
+
parent.okBtn();
|
|
1043
|
+
parent.noPushUndo = temp;
|
|
1044
|
+
if (obj['freehandDrawSelectedId']) {
|
|
1045
|
+
parent.selectShape(obj['freehandDrawSelectedId']);
|
|
1046
|
+
}
|
|
1047
|
+
else {
|
|
1048
|
+
parent.freeHandDraw(true);
|
|
1049
|
+
}
|
|
1050
|
+
parent.togglePen = tempTogglePen;
|
|
1051
|
+
}
|
|
1052
|
+
else if (parent.activeObj.currIndex) {
|
|
1053
|
+
var shapeId = parent.activeObj.currIndex;
|
|
1054
|
+
parent.okBtn();
|
|
1055
|
+
parent.noPushUndo = temp;
|
|
1056
|
+
parent.selectShape(shapeId);
|
|
1057
|
+
if (parent.drawingShape) {
|
|
1058
|
+
parent.notify('selection', { prop: 'setCurrentDrawingShape', onPropertyChange: false, value: { value: parent.drawingShape.toLowerCase() } });
|
|
1059
|
+
}
|
|
1060
|
+
if (isTextArea) {
|
|
1061
|
+
parent.enableTextEditing();
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
parent.isUndoRedoStack = false;
|
|
1065
|
+
}
|
|
1066
|
+
};
|
|
982
1067
|
return UndoRedo;
|
|
983
1068
|
}());
|
|
984
1069
|
export { UndoRedo };
|
|
@@ -91,7 +91,11 @@ export declare enum Theme {
|
|
|
91
91
|
/** The dark variant of the Fabric theme. */
|
|
92
92
|
FabricDark = "FabricDark",
|
|
93
93
|
/** The high contrast theme. */
|
|
94
|
-
Highcontrast = "Highcontrast"
|
|
94
|
+
Highcontrast = "Highcontrast",
|
|
95
|
+
/** The Fluent 2.0 UI theme. */
|
|
96
|
+
Fluent2 = "Fluent2",
|
|
97
|
+
/** The dark variant of the Fluent 2.0 UI theme. */
|
|
98
|
+
Fluent2Dark = "Fluent2Dark"
|
|
95
99
|
}
|
|
96
100
|
/**
|
|
97
101
|
* An enum representing the available toolbar commands in the image editor.
|
|
@@ -97,6 +97,10 @@ export var Theme;
|
|
|
97
97
|
Theme["FabricDark"] = "FabricDark";
|
|
98
98
|
/** The high contrast theme. */
|
|
99
99
|
Theme["Highcontrast"] = "Highcontrast";
|
|
100
|
+
/** The Fluent 2.0 UI theme. */
|
|
101
|
+
Theme["Fluent2"] = "Fluent2";
|
|
102
|
+
/** The dark variant of the Fluent 2.0 UI theme. */
|
|
103
|
+
Theme["Fluent2Dark"] = "Fluent2Dark";
|
|
100
104
|
})(Theme || (Theme = {}));
|
|
101
105
|
/**
|
|
102
106
|
* An enum representing the available toolbar commands in the image editor.
|