@syncfusion/ej2-image-editor 26.2.14 → 27.1.48
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/README.md +1 -1
- 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 +3202 -732
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +3281 -797
- 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 +14 -13
- package/src/image-editor/action/crop.d.ts +0 -1
- package/src/image-editor/action/crop.js +8 -19
- package/src/image-editor/action/draw.d.ts +4 -0
- package/src/image-editor/action/draw.js +377 -45
- package/src/image-editor/action/export.js +21 -13
- package/src/image-editor/action/filter.d.ts +13 -0
- package/src/image-editor/action/filter.js +272 -1
- package/src/image-editor/action/freehand-draw.d.ts +1 -0
- package/src/image-editor/action/freehand-draw.js +44 -23
- package/src/image-editor/action/selection.d.ts +6 -0
- package/src/image-editor/action/selection.js +382 -97
- package/src/image-editor/action/shape.d.ts +5 -0
- package/src/image-editor/action/shape.js +287 -141
- package/src/image-editor/action/transform.js +56 -82
- package/src/image-editor/action/undo-redo.d.ts +2 -0
- package/src/image-editor/action/undo-redo.js +100 -1
- package/src/image-editor/base/enum.d.ts +11 -0
- package/src/image-editor/base/enum.js +12 -0
- package/src/image-editor/base/image-editor-model.d.ts +13 -1
- package/src/image-editor/base/image-editor.d.ts +142 -20
- package/src/image-editor/base/image-editor.js +811 -149
- package/src/image-editor/base/interface.d.ts +140 -1
- package/src/image-editor/renderer/toolbar.d.ts +8 -0
- package/src/image-editor/renderer/toolbar.js +873 -191
- package/styles/bootstrap-dark-lite.css +746 -0
- package/styles/bootstrap-dark-lite.scss +13 -0
- package/styles/bootstrap-dark.css +150 -105
- package/styles/bootstrap-dark.scss +1 -0
- package/styles/bootstrap-lite.css +747 -0
- package/styles/bootstrap-lite.scss +13 -0
- package/styles/bootstrap.css +151 -106
- package/styles/bootstrap.scss +1 -0
- package/styles/bootstrap4-lite.css +747 -0
- package/styles/bootstrap4-lite.scss +13 -0
- package/styles/bootstrap4.css +150 -105
- package/styles/bootstrap4.scss +1 -0
- package/styles/bootstrap5-dark-lite.css +757 -0
- package/styles/bootstrap5-dark-lite.scss +13 -0
- package/styles/bootstrap5-dark.css +152 -113
- package/styles/bootstrap5-dark.scss +1 -0
- package/styles/bootstrap5-lite.css +757 -0
- package/styles/bootstrap5-lite.scss +13 -0
- package/styles/bootstrap5.3-lite.css +760 -0
- package/styles/bootstrap5.3-lite.scss +13 -0
- package/styles/bootstrap5.3.css +867 -0
- package/styles/bootstrap5.3.scss +14 -0
- package/styles/bootstrap5.css +152 -113
- package/styles/bootstrap5.scss +1 -0
- package/styles/fabric-dark-lite.css +749 -0
- package/styles/fabric-dark-lite.scss +13 -0
- package/styles/fabric-dark.css +150 -105
- package/styles/fabric-dark.scss +1 -0
- package/styles/fabric-lite.css +751 -0
- package/styles/fabric-lite.scss +13 -0
- package/styles/fabric.css +151 -106
- package/styles/fabric.scss +1 -0
- package/styles/fluent-dark-lite.css +758 -0
- package/styles/fluent-dark-lite.scss +13 -0
- package/styles/fluent-dark.css +150 -111
- package/styles/fluent-dark.scss +1 -0
- package/styles/fluent-lite.css +758 -0
- package/styles/fluent-lite.scss +13 -0
- package/styles/fluent.css +150 -111
- package/styles/fluent.scss +1 -0
- package/styles/fluent2-lite.css +791 -0
- package/styles/fluent2-lite.scss +13 -0
- package/styles/fluent2.css +173 -117
- package/styles/fluent2.scss +1 -0
- package/styles/highcontrast-light-lite.css +748 -0
- package/styles/highcontrast-light-lite.scss +13 -0
- package/styles/highcontrast-light.css +149 -104
- package/styles/highcontrast-light.scss +1 -0
- package/styles/highcontrast-lite.css +753 -0
- package/styles/highcontrast-lite.scss +13 -0
- package/styles/highcontrast.css +150 -104
- package/styles/highcontrast.scss +1 -0
- package/styles/image-editor/_bds-definition.scss +3 -1
- package/styles/image-editor/_bigger.scss +216 -0
- package/styles/image-editor/_bootstrap-dark-definition.scss +3 -1
- package/styles/image-editor/_bootstrap-definition.scss +3 -1
- package/styles/image-editor/_bootstrap4-definition.scss +3 -1
- package/styles/image-editor/_bootstrap5-definition.scss +3 -1
- package/styles/image-editor/_bootstrap5.3-definition.scss +3 -1
- package/styles/image-editor/_fabric-dark-definition.scss +3 -1
- package/styles/image-editor/_fabric-definition.scss +3 -1
- package/styles/image-editor/_fluent-definition.scss +3 -1
- package/styles/image-editor/_fluent2-definition.scss +4 -2
- package/styles/image-editor/_fusionnew-definition.scss +3 -1
- package/styles/image-editor/_highcontrast-definition.scss +3 -1
- package/styles/image-editor/_highcontrast-light-definition.scss +3 -1
- package/styles/image-editor/_layout.scss +75 -212
- package/styles/image-editor/_material-dark-definition.scss +3 -1
- package/styles/image-editor/_material-definition.scss +3 -1
- package/styles/image-editor/_material3-definition.scss +5 -3
- package/styles/image-editor/_tailwind-definition.scss +5 -3
- package/styles/image-editor/_theme.scss +48 -11
- package/styles/image-editor/bootstrap-dark.css +150 -105
- package/styles/image-editor/bootstrap-dark.scss +1 -0
- package/styles/image-editor/bootstrap.css +151 -106
- package/styles/image-editor/bootstrap.scss +1 -0
- package/styles/image-editor/bootstrap4.css +150 -105
- package/styles/image-editor/bootstrap4.scss +1 -0
- package/styles/image-editor/bootstrap5-dark.css +152 -113
- package/styles/image-editor/bootstrap5-dark.scss +1 -0
- package/styles/image-editor/bootstrap5.3.css +867 -0
- package/styles/image-editor/bootstrap5.3.scss +14 -0
- package/styles/image-editor/bootstrap5.css +152 -113
- package/styles/image-editor/bootstrap5.scss +1 -0
- package/styles/image-editor/fabric-dark.css +150 -105
- package/styles/image-editor/fabric-dark.scss +1 -0
- package/styles/image-editor/fabric.css +151 -106
- package/styles/image-editor/fabric.scss +1 -0
- package/styles/image-editor/fluent-dark.css +150 -111
- package/styles/image-editor/fluent-dark.scss +1 -0
- package/styles/image-editor/fluent.css +150 -111
- package/styles/image-editor/fluent.scss +1 -0
- package/styles/image-editor/fluent2.css +173 -117
- package/styles/image-editor/fluent2.scss +1 -0
- package/styles/image-editor/highcontrast-light.css +149 -104
- package/styles/image-editor/highcontrast-light.scss +1 -0
- package/styles/image-editor/highcontrast.css +150 -104
- package/styles/image-editor/highcontrast.scss +1 -0
- package/styles/image-editor/icons/_bds.scss +10 -1
- package/styles/image-editor/icons/_bootstrap-dark.scss +10 -1
- package/styles/image-editor/icons/_bootstrap.scss +10 -1
- package/styles/image-editor/icons/_bootstrap4.scss +10 -1
- package/styles/image-editor/icons/_bootstrap5.3.scss +10 -1
- package/styles/image-editor/icons/_bootstrap5.scss +10 -1
- package/styles/image-editor/icons/_fabric-dark.scss +10 -1
- package/styles/image-editor/icons/_fabric.scss +10 -1
- package/styles/image-editor/icons/_fluent.scss +10 -1
- package/styles/image-editor/icons/_fluent2.scss +10 -1
- package/styles/image-editor/icons/_fusionnew.scss +10 -1
- package/styles/image-editor/icons/_highcontrast-light.scss +10 -1
- package/styles/image-editor/icons/_highcontrast.scss +10 -1
- package/styles/image-editor/icons/_material-dark.scss +10 -1
- package/styles/image-editor/icons/_material.scss +10 -1
- package/styles/image-editor/icons/_material3.scss +10 -1
- package/styles/image-editor/icons/_tailwind.scss +10 -1
- package/styles/image-editor/material-dark.css +153 -108
- package/styles/image-editor/material-dark.scss +1 -0
- package/styles/image-editor/material.css +159 -114
- package/styles/image-editor/material.scss +1 -0
- package/styles/image-editor/material3-dark.css +171 -123
- package/styles/image-editor/material3-dark.scss +1 -0
- package/styles/image-editor/material3.css +171 -123
- package/styles/image-editor/material3.scss +1 -0
- package/styles/image-editor/tailwind-dark.css +154 -116
- package/styles/image-editor/tailwind-dark.scss +1 -0
- package/styles/image-editor/tailwind.css +154 -116
- package/styles/image-editor/tailwind.scss +1 -0
- package/styles/material-dark-lite.css +767 -0
- package/styles/material-dark-lite.scss +13 -0
- package/styles/material-dark.css +153 -108
- package/styles/material-dark.scss +1 -0
- package/styles/material-lite.css +769 -0
- package/styles/material-lite.scss +13 -0
- package/styles/material.css +159 -114
- package/styles/material.scss +1 -0
- package/styles/material3-dark-lite.css +799 -0
- package/styles/material3-dark-lite.scss +13 -0
- package/styles/material3-dark.css +171 -123
- package/styles/material3-dark.scss +1 -0
- package/styles/material3-lite.css +801 -0
- package/styles/material3-lite.scss +13 -0
- package/styles/material3.css +171 -123
- package/styles/material3.scss +1 -0
- package/styles/tailwind-dark-lite.css +751 -0
- package/styles/tailwind-dark-lite.scss +13 -0
- package/styles/tailwind-dark.css +154 -116
- package/styles/tailwind-dark.scss +1 -0
- package/styles/tailwind-lite.css +751 -0
- package/styles/tailwind-lite.scss +13 -0
- package/styles/tailwind.css +154 -116
- package/styles/tailwind.scss +1 -0
|
@@ -38,6 +38,7 @@ var Selection = /** @class */ (function () {
|
|
|
38
38
|
this.mouseDown = '';
|
|
39
39
|
this.isSliderActive = false;
|
|
40
40
|
this.arrowShape = [ArrowheadType.None, ArrowheadType.SolidArrow];
|
|
41
|
+
this.isTouchDblClick = false;
|
|
41
42
|
this.parent = parent;
|
|
42
43
|
this.addEventListener();
|
|
43
44
|
}
|
|
@@ -306,6 +307,18 @@ var Selection = /** @class */ (function () {
|
|
|
306
307
|
case 'updateSEPoints':
|
|
307
308
|
this.updateSEPoints(args.value['x'], args.value['y']);
|
|
308
309
|
break;
|
|
310
|
+
case 'drawMaskCircle':
|
|
311
|
+
this.drawMaskCircle(args.value['x'], args.value['y']);
|
|
312
|
+
break;
|
|
313
|
+
case 'isValueUpdated':
|
|
314
|
+
this.isValueUpdated();
|
|
315
|
+
break;
|
|
316
|
+
case 'getDistance':
|
|
317
|
+
this.getDistance(args.value['x'], args.value['y']);
|
|
318
|
+
break;
|
|
319
|
+
case 'redact':
|
|
320
|
+
this.currentDrawingShape = args.value['shape'];
|
|
321
|
+
break;
|
|
309
322
|
}
|
|
310
323
|
};
|
|
311
324
|
Selection.prototype.getModuleName = function () {
|
|
@@ -329,6 +342,7 @@ var Selection = /** @class */ (function () {
|
|
|
329
342
|
flipObjColl: [], triangle: [], triangleRatio: [], order: null };
|
|
330
343
|
this.isFirstMove = false;
|
|
331
344
|
this.cursorTargetId = this.dragElement = '';
|
|
345
|
+
this.isTouchDblClick = false;
|
|
332
346
|
this.startTouches = [];
|
|
333
347
|
this.tempTouches = [];
|
|
334
348
|
this.currMousePoint = { x: 0, y: 0 };
|
|
@@ -458,6 +472,12 @@ var Selection = /** @class */ (function () {
|
|
|
458
472
|
}
|
|
459
473
|
var isCropSelection = false;
|
|
460
474
|
var splitWords;
|
|
475
|
+
if (parent.activeObj.shape) {
|
|
476
|
+
splitWords = parent.activeObj.shape.split('-');
|
|
477
|
+
}
|
|
478
|
+
if ((!splitWords && parent.currObjType.isCustomCrop) || (splitWords && splitWords[0] === 'crop')) {
|
|
479
|
+
isCropSelection = true;
|
|
480
|
+
}
|
|
461
481
|
if (parent.currObjType.isDragging) {
|
|
462
482
|
if (this.dragElement === '') {
|
|
463
483
|
parent.upperCanvas.style.cursor = parent.cursor = 'move';
|
|
@@ -469,6 +489,10 @@ var Selection = /** @class */ (function () {
|
|
|
469
489
|
}
|
|
470
490
|
if (parent.togglePen) {
|
|
471
491
|
parent.upperCanvas.style.cursor = parent.cursor = 'crosshair';
|
|
492
|
+
if (parent.isMaskImage) {
|
|
493
|
+
this.drawMaskCircle(x, y);
|
|
494
|
+
parent.upperCanvas.style.cursor = 'none';
|
|
495
|
+
}
|
|
472
496
|
return;
|
|
473
497
|
}
|
|
474
498
|
if (parent.activeObj.shape) {
|
|
@@ -550,6 +574,22 @@ var Selection = /** @class */ (function () {
|
|
|
550
574
|
}
|
|
551
575
|
return highestOrder;
|
|
552
576
|
};
|
|
577
|
+
Selection.prototype.drawMaskCircle = function (x, y) {
|
|
578
|
+
var parent = this.parent;
|
|
579
|
+
if (parent.isMaskImage) {
|
|
580
|
+
var radius = parent.activeObj.strokeSettings.strokeWidth * 2;
|
|
581
|
+
var canvasDraw = parent.maskCanvas.getContext('2d');
|
|
582
|
+
canvasDraw.clearRect(0, 0, parent.maskCanvas.width, parent.maskCanvas.height);
|
|
583
|
+
canvasDraw.fillStyle = parent.activeObj.strokeSettings.strokeColor;
|
|
584
|
+
canvasDraw.strokeStyle = '#fff';
|
|
585
|
+
canvasDraw.beginPath();
|
|
586
|
+
canvasDraw.ellipse(x, y, radius / 2, radius / 2, 0, 0, 2 * Math.PI, false);
|
|
587
|
+
canvasDraw.fill();
|
|
588
|
+
canvasDraw.stroke();
|
|
589
|
+
canvasDraw.closePath();
|
|
590
|
+
parent.maskCanvas.style.cursor = 'none';
|
|
591
|
+
}
|
|
592
|
+
};
|
|
553
593
|
Selection.prototype.setCursorForActObj = function (splitWords, isCropSelection, x, y) {
|
|
554
594
|
var parent = this.parent;
|
|
555
595
|
if (parent.activeObj.horTopLine !== undefined) {
|
|
@@ -981,16 +1021,31 @@ var Selection = /** @class */ (function () {
|
|
|
981
1021
|
return false;
|
|
982
1022
|
}
|
|
983
1023
|
};
|
|
1024
|
+
Selection.prototype.preventResizing = function (tempActiveObj) {
|
|
1025
|
+
var parent = this.parent;
|
|
1026
|
+
if (parent.activeObj.preventShapeDragOut && this.isShapeDragOut()) {
|
|
1027
|
+
var actPoint = parent.activeObj.activePoint;
|
|
1028
|
+
actPoint.startX = tempActiveObj.activePoint.startX;
|
|
1029
|
+
actPoint.startY = tempActiveObj.activePoint.startY;
|
|
1030
|
+
actPoint.endX = tempActiveObj.activePoint.endX;
|
|
1031
|
+
actPoint.endY = tempActiveObj.activePoint.endY;
|
|
1032
|
+
actPoint.width = tempActiveObj.activePoint.width;
|
|
1033
|
+
actPoint.height = tempActiveObj.activePoint.height;
|
|
1034
|
+
parent.activeObj.rotatedAngle = tempActiveObj.rotatedAngle;
|
|
1035
|
+
parent.notify('draw', { prop: 'updateActiveObject', onPropertyChange: false,
|
|
1036
|
+
value: { actPoint: actPoint, obj: parent.activeObj, isMouseMove: null, x: null, y: null } });
|
|
1037
|
+
}
|
|
1038
|
+
};
|
|
984
1039
|
Selection.prototype.updateActivePoint = function (x, y, isCropSelection) {
|
|
985
1040
|
var parent = this.parent;
|
|
986
1041
|
var obj = { width: 0, height: 0 };
|
|
987
|
-
var _a = parent.activeObj.activePoint, startX = _a.startX, startY = _a.startY
|
|
1042
|
+
var _a = parent.activeObj.activePoint, startX = _a.startX, startY = _a.startY;
|
|
988
1043
|
var _b = parent.activeObj.activePoint, width = _b.width, height = _b.height;
|
|
989
1044
|
parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
|
|
990
1045
|
value: { width: width, height: height, obj: obj, isImgShape: null } });
|
|
991
1046
|
var previousShapeSettings = this.updatePrevShapeSettings();
|
|
992
|
-
var shapeResizingArgs = { cancel: false, action: 'resize', previousShapeSettings: previousShapeSettings };
|
|
993
|
-
var shapeMovingArgs = { cancel: false, action: 'move', previousShapeSettings: previousShapeSettings };
|
|
1047
|
+
var shapeResizingArgs = { cancel: false, action: 'resize', previousShapeSettings: previousShapeSettings, allowShapeOverflow: this.allowOutofBound() };
|
|
1048
|
+
var shapeMovingArgs = { cancel: false, action: 'move', previousShapeSettings: previousShapeSettings, allowShapeOverflow: this.allowOutofBound() };
|
|
994
1049
|
this.shapeResizingArgs = shapeResizingArgs;
|
|
995
1050
|
this.shapeMovingArgs = shapeMovingArgs;
|
|
996
1051
|
if (parent.activeObj.shape === 'text' && this.dragElement !== '') {
|
|
@@ -1031,51 +1086,68 @@ var Selection = /** @class */ (function () {
|
|
|
1031
1086
|
if (isCropSelection && parent.transform.straighten !== 0 && this.isMouseOutsideImg(x, y)) {
|
|
1032
1087
|
return;
|
|
1033
1088
|
}
|
|
1089
|
+
var tempActiveObj = extend({}, parent.activeObj, {}, true);
|
|
1090
|
+
var splitWords;
|
|
1091
|
+
var cropResize;
|
|
1092
|
+
if (parent.activeObj.shape !== undefined) {
|
|
1093
|
+
splitWords = parent.activeObj.shape.split('-');
|
|
1094
|
+
}
|
|
1095
|
+
if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
1096
|
+
cropResize = true;
|
|
1097
|
+
}
|
|
1034
1098
|
switch (this.dragElement.toLowerCase()) {
|
|
1035
1099
|
case 'nw-resize':
|
|
1036
1100
|
this.updateNWPoints(x, y);
|
|
1101
|
+
this.preventResizing(tempActiveObj);
|
|
1037
1102
|
parent.notify('shape', { prop: 'updateArrowDirection', onPropertyChange: false,
|
|
1038
1103
|
value: { obj: parent.activeObj, flip: null, rotatedDegree: null } });
|
|
1039
1104
|
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'resize');
|
|
1040
1105
|
break;
|
|
1041
1106
|
case 'n-resize':
|
|
1042
1107
|
this.updateNPoints(x, y);
|
|
1108
|
+
this.preventResizing(tempActiveObj);
|
|
1043
1109
|
parent.notify('shape', { prop: 'updateArrowDirection', onPropertyChange: false,
|
|
1044
1110
|
value: { obj: parent.activeObj, flip: null, rotatedDegree: null } });
|
|
1045
1111
|
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'resize');
|
|
1046
1112
|
break;
|
|
1047
1113
|
case 'ne-resize':
|
|
1048
1114
|
this.updateNEPoints(x, y);
|
|
1115
|
+
this.preventResizing(tempActiveObj);
|
|
1049
1116
|
parent.notify('shape', { prop: 'updateArrowDirection', onPropertyChange: false,
|
|
1050
1117
|
value: { obj: parent.activeObj, flip: null, rotatedDegree: null } });
|
|
1051
1118
|
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'resize');
|
|
1052
1119
|
break;
|
|
1053
1120
|
case 'w-resize':
|
|
1054
1121
|
this.updateWPoints(x, y);
|
|
1122
|
+
this.preventResizing(tempActiveObj);
|
|
1055
1123
|
parent.notify('shape', { prop: 'updateArrowDirection', onPropertyChange: false,
|
|
1056
1124
|
value: { obj: parent.activeObj, flip: null, rotatedDegree: null } });
|
|
1057
1125
|
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'resize');
|
|
1058
1126
|
break;
|
|
1059
1127
|
case 'e-resize':
|
|
1060
1128
|
this.updateEPoints(x, y);
|
|
1129
|
+
this.preventResizing(tempActiveObj);
|
|
1061
1130
|
parent.notify('shape', { prop: 'updateArrowDirection', onPropertyChange: false,
|
|
1062
1131
|
value: { obj: parent.activeObj, flip: null, rotatedDegree: null } });
|
|
1063
1132
|
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'resize');
|
|
1064
1133
|
break;
|
|
1065
1134
|
case 'sw-resize':
|
|
1066
1135
|
this.updateSWPoints(x, y);
|
|
1136
|
+
this.preventResizing(tempActiveObj);
|
|
1067
1137
|
parent.notify('shape', { prop: 'updateArrowDirection', onPropertyChange: false,
|
|
1068
1138
|
value: { obj: parent.activeObj, flip: null, rotatedDegree: null } });
|
|
1069
1139
|
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'resize');
|
|
1070
1140
|
break;
|
|
1071
1141
|
case 's-resize':
|
|
1072
1142
|
this.updateSPoints(x, y);
|
|
1143
|
+
this.preventResizing(tempActiveObj);
|
|
1073
1144
|
parent.notify('shape', { prop: 'updateArrowDirection', onPropertyChange: false,
|
|
1074
1145
|
value: { obj: parent.activeObj, flip: null, rotatedDegree: null } });
|
|
1075
1146
|
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'resize');
|
|
1076
1147
|
break;
|
|
1077
1148
|
case 'se-resize':
|
|
1078
1149
|
this.updateSEPoints(x, y);
|
|
1150
|
+
this.preventResizing(tempActiveObj);
|
|
1079
1151
|
parent.notify('shape', { prop: 'updateArrowDirection', onPropertyChange: false,
|
|
1080
1152
|
value: { obj: parent.activeObj, flip: null, rotatedDegree: null } });
|
|
1081
1153
|
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'resize');
|
|
@@ -1125,6 +1197,7 @@ var Selection = /** @class */ (function () {
|
|
|
1125
1197
|
parent.activeObj.rotatedAngle -= (180 * (Math.PI / 180));
|
|
1126
1198
|
}
|
|
1127
1199
|
}
|
|
1200
|
+
this.preventResizing(tempActiveObj);
|
|
1128
1201
|
break;
|
|
1129
1202
|
case 'pathdrag':
|
|
1130
1203
|
if (!isNullOrUndefined(this.pathAdjustedIndex)) {
|
|
@@ -1144,8 +1217,6 @@ var Selection = /** @class */ (function () {
|
|
|
1144
1217
|
activePoint.endY += height_1;
|
|
1145
1218
|
startX = activePoint.startX;
|
|
1146
1219
|
startY = activePoint.startY;
|
|
1147
|
-
endX = activePoint.endX;
|
|
1148
|
-
endY = activePoint.endY;
|
|
1149
1220
|
if (parent.activeObj.shape !== 'line' && parent.activeObj.shape !== 'arrow' &&
|
|
1150
1221
|
parent.activeObj.rotationCirclePointColl) {
|
|
1151
1222
|
parent.activeObj.rotationCirclePointColl.x += width_1;
|
|
@@ -1159,10 +1230,7 @@ var Selection = /** @class */ (function () {
|
|
|
1159
1230
|
parent.activeObj.pointColl[i].y += height_1;
|
|
1160
1231
|
}
|
|
1161
1232
|
}
|
|
1162
|
-
if (!this.isPreventDragging && parent.activeObj.
|
|
1163
|
-
startY < parent.img.destTop || endX >
|
|
1164
|
-
parent.img.destLeft + parent.img.destWidth || endY > parent.img.destTop
|
|
1165
|
-
+ parent.img.destHeight))) {
|
|
1233
|
+
if ((!this.isPreventDragging && this.isShapeDragOut()) && (parent.activeObj.preventShapeDragOut || parent.activeObj.shape === 'redact' || cropResize)) {
|
|
1166
1234
|
activePoint.startX -= width_1;
|
|
1167
1235
|
activePoint.endX -= width_1;
|
|
1168
1236
|
activePoint.startY -= height_1;
|
|
@@ -1174,8 +1242,33 @@ var Selection = /** @class */ (function () {
|
|
|
1174
1242
|
parent.activeObj.rotationCirclePoint.x -= width_1;
|
|
1175
1243
|
parent.activeObj.rotationCirclePoint.y -= height_1;
|
|
1176
1244
|
}
|
|
1177
|
-
|
|
1178
|
-
|
|
1245
|
+
else if (parent.activeObj.shape === 'path') {
|
|
1246
|
+
for (var l = 0, len = parent.activeObj.pointColl.length; l < len; l++) {
|
|
1247
|
+
parent.activeObj.pointColl[l].x -= width_1;
|
|
1248
|
+
parent.activeObj.pointColl[l].y -= height_1;
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
if (parent.activeObj.rotatedAngle === 0) {
|
|
1252
|
+
var tempEndX = parent.activeObj.activePoint.endX;
|
|
1253
|
+
var tempEndY = parent.activeObj.activePoint.endY;
|
|
1254
|
+
if (parent.activeObj.shape === 'path') {
|
|
1255
|
+
parent.activeObj.activePoint = parent.getSquarePointForPath(parent.activeObj);
|
|
1256
|
+
}
|
|
1257
|
+
this.setDragWidth(width_1);
|
|
1258
|
+
this.setDragHeight(height_1);
|
|
1259
|
+
var currObj = parent.activeObj;
|
|
1260
|
+
var xDiff = currObj.activePoint.endX - tempEndX;
|
|
1261
|
+
var yDiff = currObj.activePoint.endY - tempEndY;
|
|
1262
|
+
if (currObj.shape === 'path') {
|
|
1263
|
+
for (var l = 0, len = currObj.pointColl.length; l < len; l++) {
|
|
1264
|
+
currObj.pointColl[l].x += xDiff;
|
|
1265
|
+
currObj.pointColl[l].y += yDiff;
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
else {
|
|
1270
|
+
parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
|
|
1271
|
+
}
|
|
1179
1272
|
}
|
|
1180
1273
|
}
|
|
1181
1274
|
else {
|
|
@@ -1191,6 +1284,55 @@ var Selection = /** @class */ (function () {
|
|
|
1191
1284
|
break;
|
|
1192
1285
|
}
|
|
1193
1286
|
};
|
|
1287
|
+
Selection.prototype.isShapeDragOut = function () {
|
|
1288
|
+
var parent = this.parent;
|
|
1289
|
+
var isShapeDragOut = false;
|
|
1290
|
+
var allowPreventing = false;
|
|
1291
|
+
var shape = parent.activeObj.shape;
|
|
1292
|
+
if (parent.activeObj.preventShapeDragOut) {
|
|
1293
|
+
allowPreventing = true;
|
|
1294
|
+
}
|
|
1295
|
+
else if (parent.activeObj.rotatedAngle === 0 &&
|
|
1296
|
+
(shape !== 'line' && shape !== 'arrow' && shape !== 'path')) {
|
|
1297
|
+
allowPreventing = true;
|
|
1298
|
+
}
|
|
1299
|
+
if (allowPreventing) {
|
|
1300
|
+
var _a = parent.activeObj.activePoint, startX = _a.startX, startY = _a.startY, endX = _a.endX, endY = _a.endY;
|
|
1301
|
+
if (shape === 'path') {
|
|
1302
|
+
var path = parent.getSquarePointForPath(parent.activeObj);
|
|
1303
|
+
startX = path.startX;
|
|
1304
|
+
startY = path.startY;
|
|
1305
|
+
endX = path.endX;
|
|
1306
|
+
endY = path.endY;
|
|
1307
|
+
}
|
|
1308
|
+
if (parent.activeObj.rotatedAngle === 0 || shape === 'arrow') {
|
|
1309
|
+
isShapeDragOut = this.isObjOutsideImg(startX, startY, endX, endY, shape);
|
|
1310
|
+
}
|
|
1311
|
+
else {
|
|
1312
|
+
var obj = { isIntersect: null, arr: null };
|
|
1313
|
+
parent.notify('draw', { prop: 'updateImgCanvasPoints', onPropertyChange: false });
|
|
1314
|
+
parent.notify('draw', { prop: 'isLinesIntersect', onPropertyChange: false, value: { obj: obj } });
|
|
1315
|
+
if (obj['arr'][0] || obj['arr'][1] || obj['arr'][2] || obj['arr'][3]) {
|
|
1316
|
+
isShapeDragOut = true;
|
|
1317
|
+
}
|
|
1318
|
+
else {
|
|
1319
|
+
isShapeDragOut = this.isObjOutsideImg(startX, startY, endX, endY, shape);
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
return isShapeDragOut;
|
|
1324
|
+
};
|
|
1325
|
+
Selection.prototype.isObjOutsideImg = function (startX, startY, endX, endY, shape) {
|
|
1326
|
+
var parent = this.parent;
|
|
1327
|
+
var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop, destWidth = _a.destWidth, destHeight = _a.destHeight;
|
|
1328
|
+
if (startX < destLeft || startY < destTop || endX > destLeft + destWidth ||
|
|
1329
|
+
endY > destTop + destHeight || ((shape === 'line' || shape === 'arrow') &&
|
|
1330
|
+
(startX > destLeft + destWidth || startY > destTop + destHeight ||
|
|
1331
|
+
endX < destLeft || endY < destTop))) {
|
|
1332
|
+
return true;
|
|
1333
|
+
}
|
|
1334
|
+
return false;
|
|
1335
|
+
};
|
|
1194
1336
|
Selection.prototype.triggerShapeChange = function (shapeResizingArgs, shapeMovingArgs, type) {
|
|
1195
1337
|
var parent = this.parent;
|
|
1196
1338
|
var actPoint = parent.activeObj.activePoint;
|
|
@@ -1218,10 +1360,12 @@ var Selection = /** @class */ (function () {
|
|
|
1218
1360
|
if (this.currentDrawingShape !== '' && parent.upperCanvas.style.cursor === 'crosshair') {
|
|
1219
1361
|
shapeResizingArgs.action = 'drawing';
|
|
1220
1362
|
}
|
|
1221
|
-
parent.
|
|
1363
|
+
if (!parent.currObjType.isRedact || parent.activeObj.shape !== 'redact') {
|
|
1364
|
+
parent.trigger('shapeChanging', shapeResizingArgs);
|
|
1365
|
+
}
|
|
1366
|
+
parent.editCompleteArgs = shapeResizingArgs;
|
|
1222
1367
|
this.isPreventShaping = shapeResizingArgs.cancel;
|
|
1223
|
-
parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
|
|
1224
|
-
value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
|
|
1368
|
+
parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false, value: { shapeSettings: shapeResizingArgs.currentShapeSettings, allowShapeOverflow: shapeResizingArgs.allowShapeOverflow } });
|
|
1225
1369
|
}
|
|
1226
1370
|
else {
|
|
1227
1371
|
var selectionResizingArgs = { action: shapeResizingArgs.action,
|
|
@@ -1237,21 +1381,28 @@ var Selection = /** @class */ (function () {
|
|
|
1237
1381
|
height: shapeResizingArgs.currentShapeSettings.height } };
|
|
1238
1382
|
this.selectionResizingArgs = selectionResizingArgs;
|
|
1239
1383
|
parent.trigger('selectionChanging', selectionResizingArgs);
|
|
1384
|
+
parent.editCompleteArgs = selectionResizingArgs;
|
|
1240
1385
|
parent.notify('shape', { prop: 'updSelChangeEventArgs', onPropertyChange: false,
|
|
1241
1386
|
value: { selectionSettings: selectionResizingArgs.currentSelectionSettings } });
|
|
1242
1387
|
}
|
|
1243
1388
|
}
|
|
1244
1389
|
else if (type === 'mouse-down' || type === 'mouse-up') {
|
|
1245
|
-
parent.
|
|
1390
|
+
if (parent.activeObj.shape !== 'redact') {
|
|
1391
|
+
parent.trigger('shapeChanging', shapeResizingArgs);
|
|
1392
|
+
}
|
|
1393
|
+
parent.editCompleteArgs = shapeResizingArgs;
|
|
1246
1394
|
this.isPreventShaping = shapeResizingArgs.cancel;
|
|
1247
1395
|
parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
|
|
1248
|
-
value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
|
|
1396
|
+
value: { shapeSettings: shapeResizingArgs.currentShapeSettings, allowShapeOverflow: shapeResizingArgs.allowShapeOverflow } });
|
|
1249
1397
|
}
|
|
1250
1398
|
else {
|
|
1251
|
-
parent.
|
|
1399
|
+
if (parent.activeObj.shape !== 'redact') {
|
|
1400
|
+
parent.trigger('shapeChanging', shapeMovingArgs);
|
|
1401
|
+
}
|
|
1402
|
+
parent.editCompleteArgs = shapeMovingArgs;
|
|
1252
1403
|
this.isPreventShaping = shapeMovingArgs.cancel;
|
|
1253
1404
|
parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
|
|
1254
|
-
value: { shapeSettings: shapeMovingArgs.currentShapeSettings } });
|
|
1405
|
+
value: { shapeSettings: shapeMovingArgs.currentShapeSettings, allowShapeOverflow: shapeMovingArgs.allowShapeOverflow } });
|
|
1255
1406
|
}
|
|
1256
1407
|
parent.eventType = type;
|
|
1257
1408
|
};
|
|
@@ -1260,13 +1411,20 @@ var Selection = /** @class */ (function () {
|
|
|
1260
1411
|
var actPoint = parent.activeObj.activePoint;
|
|
1261
1412
|
var _a = parent.img, destLeft = _a.destLeft, destWidth = _a.destWidth;
|
|
1262
1413
|
var tempWidth = width;
|
|
1414
|
+
var shape = parent.activeObj.shape;
|
|
1415
|
+
var preventDragOut = false;
|
|
1416
|
+
if (parent.activeObj.preventShapeDragOut && (shape === 'line' || shape === 'arrow')) {
|
|
1417
|
+
preventDragOut = true;
|
|
1418
|
+
}
|
|
1263
1419
|
if (tempWidth >= 0) {
|
|
1264
1420
|
for (var i = 0; i < tempWidth; i++) {
|
|
1265
1421
|
width = tempWidth - i;
|
|
1266
1422
|
actPoint.startX += width;
|
|
1267
1423
|
actPoint.endX += width;
|
|
1268
|
-
if (actPoint.startX >= destLeft &&
|
|
1269
|
-
actPoint.endX <= destLeft + destWidth)
|
|
1424
|
+
if ((actPoint.startX >= destLeft &&
|
|
1425
|
+
actPoint.endX <= destLeft + destWidth && !preventDragOut) ||
|
|
1426
|
+
(actPoint.startX >= destLeft && actPoint.endX <= destLeft + destWidth &&
|
|
1427
|
+
actPoint.endX >= destLeft && actPoint.startX <= destLeft + destWidth && preventDragOut)) {
|
|
1270
1428
|
break;
|
|
1271
1429
|
}
|
|
1272
1430
|
else {
|
|
@@ -1280,8 +1438,10 @@ var Selection = /** @class */ (function () {
|
|
|
1280
1438
|
width = tempWidth + i;
|
|
1281
1439
|
actPoint.startX += width;
|
|
1282
1440
|
actPoint.endX += width;
|
|
1283
|
-
if (actPoint.startX >= destLeft &&
|
|
1284
|
-
actPoint.endX <= destLeft + destWidth)
|
|
1441
|
+
if ((actPoint.startX >= destLeft &&
|
|
1442
|
+
actPoint.endX <= destLeft + destWidth && !preventDragOut) ||
|
|
1443
|
+
(actPoint.startX >= destLeft && actPoint.endX <= destLeft + destWidth &&
|
|
1444
|
+
actPoint.endX >= destLeft && actPoint.startX <= destLeft + destWidth && preventDragOut)) {
|
|
1285
1445
|
break;
|
|
1286
1446
|
}
|
|
1287
1447
|
else {
|
|
@@ -1296,13 +1456,20 @@ var Selection = /** @class */ (function () {
|
|
|
1296
1456
|
var actPoint = parent.activeObj.activePoint;
|
|
1297
1457
|
var _a = parent.img, destTop = _a.destTop, destHeight = _a.destHeight;
|
|
1298
1458
|
var tempHeight = height;
|
|
1459
|
+
var shape = parent.activeObj.shape;
|
|
1460
|
+
var preventDragOut = false;
|
|
1461
|
+
if (parent.activeObj.preventShapeDragOut && (shape === 'line' || shape === 'arrow')) {
|
|
1462
|
+
preventDragOut = true;
|
|
1463
|
+
}
|
|
1299
1464
|
if (tempHeight >= 0) {
|
|
1300
1465
|
for (var i = 1; i < tempHeight; i++) {
|
|
1301
1466
|
height = tempHeight - i;
|
|
1302
1467
|
actPoint.startY += height;
|
|
1303
1468
|
actPoint.endY += height;
|
|
1304
|
-
if (actPoint.startY >= destTop &&
|
|
1305
|
-
actPoint.endY <= destTop + destHeight)
|
|
1469
|
+
if ((actPoint.startY >= destTop &&
|
|
1470
|
+
actPoint.endY <= destTop + destHeight && !preventDragOut) ||
|
|
1471
|
+
(actPoint.startY >= destTop && actPoint.endY <= destTop + destHeight &&
|
|
1472
|
+
actPoint.endY >= destTop && actPoint.startY <= destTop + destHeight && preventDragOut)) {
|
|
1306
1473
|
break;
|
|
1307
1474
|
}
|
|
1308
1475
|
else {
|
|
@@ -1316,8 +1483,10 @@ var Selection = /** @class */ (function () {
|
|
|
1316
1483
|
height = tempHeight + i;
|
|
1317
1484
|
actPoint.startY += height;
|
|
1318
1485
|
actPoint.endY += height;
|
|
1319
|
-
if (actPoint.startY >= destTop &&
|
|
1320
|
-
actPoint.endY <= destTop + destHeight)
|
|
1486
|
+
if ((actPoint.startY >= destTop &&
|
|
1487
|
+
actPoint.endY <= destTop + destHeight && !preventDragOut) ||
|
|
1488
|
+
(actPoint.startY >= destTop && actPoint.endY <= destTop + destHeight &&
|
|
1489
|
+
actPoint.endY >= destTop && actPoint.startY <= destTop + destHeight && preventDragOut)) {
|
|
1321
1490
|
break;
|
|
1322
1491
|
}
|
|
1323
1492
|
else {
|
|
@@ -1336,17 +1505,35 @@ var Selection = /** @class */ (function () {
|
|
|
1336
1505
|
var startY = isStart ? actPoint.startY : actPoint.endY;
|
|
1337
1506
|
var endX = isStart ? actPoint.endX : actPoint.startX;
|
|
1338
1507
|
var endY = isStart ? actPoint.endY : actPoint.startY;
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1508
|
+
var wrapperWidth = parent.upperCanvas.width;
|
|
1509
|
+
var wrapperHeight = parent.upperCanvas.height;
|
|
1510
|
+
if (Browser.isDevice) {
|
|
1511
|
+
if (startX < 0 && destLeft < 0) {
|
|
1512
|
+
startX = 0;
|
|
1513
|
+
}
|
|
1514
|
+
if (startY < 0 && destTop < 0) {
|
|
1515
|
+
startY = 0;
|
|
1516
|
+
}
|
|
1517
|
+
if (endX > wrapperWidth && destLeft + destWidth > wrapperWidth) {
|
|
1518
|
+
endX = wrapperWidth;
|
|
1519
|
+
}
|
|
1520
|
+
if (endY > wrapperHeight && destTop + destHeight > wrapperHeight) {
|
|
1521
|
+
endY = wrapperHeight;
|
|
1522
|
+
}
|
|
1347
1523
|
}
|
|
1348
|
-
|
|
1349
|
-
|
|
1524
|
+
else {
|
|
1525
|
+
if (startX < destLeft) {
|
|
1526
|
+
startX = destLeft;
|
|
1527
|
+
}
|
|
1528
|
+
if (startY < destTop) {
|
|
1529
|
+
startY = destTop;
|
|
1530
|
+
}
|
|
1531
|
+
if (endX > destLeft + destWidth) {
|
|
1532
|
+
endX = destLeft + destWidth;
|
|
1533
|
+
}
|
|
1534
|
+
if (endY > destTop + destHeight) {
|
|
1535
|
+
endY = destTop + destHeight;
|
|
1536
|
+
}
|
|
1350
1537
|
}
|
|
1351
1538
|
if (parent.transform.straighten !== 0) {
|
|
1352
1539
|
var obj = { isIntersect: null, arr: null };
|
|
@@ -1382,7 +1569,15 @@ var Selection = /** @class */ (function () {
|
|
|
1382
1569
|
if (parent.activeObj.shape === 'image') {
|
|
1383
1570
|
return isLimiting;
|
|
1384
1571
|
}
|
|
1385
|
-
|
|
1572
|
+
var splitWords;
|
|
1573
|
+
var cropResize;
|
|
1574
|
+
if (parent.activeObj.shape !== undefined) {
|
|
1575
|
+
splitWords = parent.activeObj.shape.split('-');
|
|
1576
|
+
}
|
|
1577
|
+
if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
1578
|
+
cropResize = true;
|
|
1579
|
+
}
|
|
1580
|
+
if ((!this.isPreventDragging && parent.activeObj.rotatedAngle === 0) && (parent.activeObj.preventShapeDragOut || parent.activeObj.shape === 'redact' || cropResize)) {
|
|
1386
1581
|
isLimiting = this.limitDrag(true);
|
|
1387
1582
|
var shapeColl = ['line', 'arrow', 'path'];
|
|
1388
1583
|
if (shapeColl.indexOf(parent.activeObj.shape) > -1) {
|
|
@@ -2591,7 +2786,15 @@ var Selection = /** @class */ (function () {
|
|
|
2591
2786
|
else {
|
|
2592
2787
|
var rotationCirclePoint = this.getTransRotationPoint(actObj);
|
|
2593
2788
|
var radius = actObj.topLeftCircle.radius;
|
|
2594
|
-
if (
|
|
2789
|
+
if (rotationCirclePoint &&
|
|
2790
|
+
x >= rotationCirclePoint.x - (radius * 2) &&
|
|
2791
|
+
x <= rotationCirclePoint.x + (radius * 2) &&
|
|
2792
|
+
y >= rotationCirclePoint.y - (radius * 2) &&
|
|
2793
|
+
y <= rotationCirclePoint.y + (radius * 2) && this.dragElement !== 'grabbing') {
|
|
2794
|
+
parent.upperCanvas.style.cursor = parent.cursor = 'grabbing';
|
|
2795
|
+
this.dragElement = parent.upperCanvas.style.cursor;
|
|
2796
|
+
}
|
|
2797
|
+
else if (x >= (actObj.topLeftCircle.startX - (radius * 2)) &&
|
|
2595
2798
|
x <= (actObj.topLeftCircle.startX + (radius * 2)) &&
|
|
2596
2799
|
y >= (actObj.topLeftCircle.startY - (radius * 2)) &&
|
|
2597
2800
|
y <= (actObj.topLeftCircle.startY + (radius * 2)) && this.dragElement !== 'nw-resize') {
|
|
@@ -2663,14 +2866,6 @@ var Selection = /** @class */ (function () {
|
|
|
2663
2866
|
isResize = true;
|
|
2664
2867
|
this.dragElement = parent.upperCanvas.style.cursor;
|
|
2665
2868
|
}
|
|
2666
|
-
else if (rotationCirclePoint &&
|
|
2667
|
-
x >= rotationCirclePoint.x - (radius * 2) &&
|
|
2668
|
-
x <= rotationCirclePoint.x + (radius * 2) &&
|
|
2669
|
-
y >= rotationCirclePoint.y - (radius * 2) &&
|
|
2670
|
-
y <= rotationCirclePoint.y + (radius * 2) && this.dragElement !== 'grabbing') {
|
|
2671
|
-
parent.upperCanvas.style.cursor = parent.cursor = 'grabbing';
|
|
2672
|
-
this.dragElement = parent.upperCanvas.style.cursor;
|
|
2673
|
-
}
|
|
2674
2869
|
else {
|
|
2675
2870
|
this.dragPoint.startX = this.previousPoint.x = this.dragPoint.endX = x;
|
|
2676
2871
|
this.dragPoint.startY = this.previousPoint.y = this.dragPoint.endY = y;
|
|
@@ -2960,8 +3155,8 @@ var Selection = /** @class */ (function () {
|
|
|
2960
3155
|
this.isGrabbing = true;
|
|
2961
3156
|
parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
|
|
2962
3157
|
var shapeSettings = obj['shapeSettingsObj'];
|
|
2963
|
-
var shapeResizingArgs = { cancel: false, action: 'rotate-start', previousShapeSettings: shapeSettings };
|
|
2964
|
-
var shapeMovingArgs = { cancel: false, action: 'rotate-start', previousShapeSettings: shapeSettings };
|
|
3158
|
+
var shapeResizingArgs = { cancel: false, action: 'rotate-start', previousShapeSettings: shapeSettings, allowShapeOverflow: this.allowOutofBound() };
|
|
3159
|
+
var shapeMovingArgs = { cancel: false, action: 'rotate-start', previousShapeSettings: shapeSettings, allowShapeOverflow: this.allowOutofBound() };
|
|
2965
3160
|
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'mouse-down');
|
|
2966
3161
|
}
|
|
2967
3162
|
var imageEditorClickEventArgs = { point: this.setXYPoints(e) };
|
|
@@ -2992,6 +3187,7 @@ var Selection = /** @class */ (function () {
|
|
|
2992
3187
|
var y = imageEditorClickEventArgs.point.y;
|
|
2993
3188
|
var cursor = parent.activeObj.shape && parent.activeObj.shape === 'text' ?
|
|
2994
3189
|
parent.cursor : 'default';
|
|
3190
|
+
var tempCursor = parent.upperCanvas.style.cursor;
|
|
2995
3191
|
if (parent.isResize) {
|
|
2996
3192
|
this.performEnterAction();
|
|
2997
3193
|
parent.upperCanvas.style.cursor = 'default';
|
|
@@ -3000,8 +3196,8 @@ var Selection = /** @class */ (function () {
|
|
|
3000
3196
|
else if (JSON.stringify(parent.frameObj) !== JSON.stringify(parent.tempFrameObj)) {
|
|
3001
3197
|
parent.okBtn();
|
|
3002
3198
|
}
|
|
3003
|
-
else if (this.currentDrawingShape !== '' && (
|
|
3004
|
-
||
|
|
3199
|
+
else if (this.currentDrawingShape !== '' && (!this.isShapeTouch(e, this.isCropSelection) &&
|
|
3200
|
+
((this.isTouch) || tempCursor === 'crosshair' || parent.isShapeDrawing))) {
|
|
3005
3201
|
if (parent.drawingShape && !parent.isShapeDrawing) {
|
|
3006
3202
|
parent.okBtn();
|
|
3007
3203
|
parent.enableShapeDrawing(parent.toPascalCase(parent.drawingShape), true);
|
|
@@ -3049,8 +3245,8 @@ var Selection = /** @class */ (function () {
|
|
|
3049
3245
|
}
|
|
3050
3246
|
parent.currObjType.isDragging = true;
|
|
3051
3247
|
var previousShapeSettings = this.updatePrevShapeSettings();
|
|
3052
|
-
var shapeResizingArgs = { cancel: false, action: 'draw-start', previousShapeSettings: previousShapeSettings };
|
|
3053
|
-
var shapeMovingArgs = { cancel: false, action: 'move', previousShapeSettings: previousShapeSettings };
|
|
3248
|
+
var shapeResizingArgs = { cancel: false, action: 'draw-start', previousShapeSettings: previousShapeSettings, allowShapeOverflow: this.allowOutofBound() };
|
|
3249
|
+
var shapeMovingArgs = { cancel: false, action: 'move', previousShapeSettings: previousShapeSettings, allowShapeOverflow: this.allowOutofBound() };
|
|
3054
3250
|
this.shapeResizingArgs = shapeResizingArgs;
|
|
3055
3251
|
this.shapeMovingArgs = shapeMovingArgs;
|
|
3056
3252
|
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'mouse-down');
|
|
@@ -3096,7 +3292,7 @@ var Selection = /** @class */ (function () {
|
|
|
3096
3292
|
parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
3097
3293
|
}
|
|
3098
3294
|
}
|
|
3099
|
-
if (!isShape && !parent.togglePen && !this.isCropSelection) {
|
|
3295
|
+
if (!isShape && !parent.togglePen && !this.isCropSelection && parent.activeObj.redactType !== 'blur' && parent.activeObj.redactType !== 'pixelate') {
|
|
3100
3296
|
parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
|
|
3101
3297
|
parent.notify('toolbar', { prop: 'close-contextual-toolbar', onPropertyChange: false });
|
|
3102
3298
|
}
|
|
@@ -3117,7 +3313,7 @@ var Selection = /** @class */ (function () {
|
|
|
3117
3313
|
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
3118
3314
|
}
|
|
3119
3315
|
var shape = parent.activeObj.shape;
|
|
3120
|
-
var shapeColl = ['rectangle', 'ellipse', 'line', 'arrow', 'path', 'text', 'image'];
|
|
3316
|
+
var shapeColl = ['rectangle', 'ellipse', 'line', 'arrow', 'path', 'text', 'image', 'redact'];
|
|
3121
3317
|
if (shape && shapeColl.indexOf(shape) > -1) {
|
|
3122
3318
|
parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
|
|
3123
3319
|
value: { x: null, y: null, isMouseDown: null } });
|
|
@@ -3125,6 +3321,16 @@ var Selection = /** @class */ (function () {
|
|
|
3125
3321
|
parent.notify('toolbar', { prop: 'setCurrentToolbar', value: { type: 'main' } });
|
|
3126
3322
|
parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
|
|
3127
3323
|
}
|
|
3324
|
+
var isCropSelection = false;
|
|
3325
|
+
if (parent.activeObj.shape && parent.activeObj.shape.indexOf('crop-') > -1) {
|
|
3326
|
+
isCropSelection = true;
|
|
3327
|
+
}
|
|
3328
|
+
if (parent.element.querySelector('.e-contextual-toolbar-wrapper') && !isCropSelection) {
|
|
3329
|
+
if (!parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.contains('e-hide')) {
|
|
3330
|
+
parent.okBtn();
|
|
3331
|
+
parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
3332
|
+
}
|
|
3333
|
+
}
|
|
3128
3334
|
this.canvasMouseDownHandler(e);
|
|
3129
3335
|
}
|
|
3130
3336
|
else {
|
|
@@ -3201,6 +3407,7 @@ var Selection = /** @class */ (function () {
|
|
|
3201
3407
|
index: point.order };
|
|
3202
3408
|
var shapeChangedArgs = { action: 'apply', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
3203
3409
|
parent.trigger('shapeChange', shapeChangedArgs);
|
|
3410
|
+
parent.editCompleteArgs = shapeChangedArgs;
|
|
3204
3411
|
}
|
|
3205
3412
|
var isPenDraw = parent.togglePen;
|
|
3206
3413
|
parent.notify('toolbar', { prop: 'close-contextual-toolbar', onPropertyChange: false });
|
|
@@ -3228,6 +3435,7 @@ var Selection = /** @class */ (function () {
|
|
|
3228
3435
|
}
|
|
3229
3436
|
this.upperContext.strokeStyle = parent.activeObj.strokeSettings.strokeColor;
|
|
3230
3437
|
this.upperContext.fillStyle = parent.activeObj.strokeSettings.strokeColor;
|
|
3438
|
+
parent.notify('freehand-draw', { prop: 'resetSelPoints', onPropertyChange: false });
|
|
3231
3439
|
parent.notify('freehand-draw', { prop: 'freehandDownHandler', onPropertyChange: false,
|
|
3232
3440
|
value: { e: e, canvas: parent.upperCanvas } });
|
|
3233
3441
|
}
|
|
@@ -3239,7 +3447,8 @@ var Selection = /** @class */ (function () {
|
|
|
3239
3447
|
this.dragElement = '';
|
|
3240
3448
|
this.dragPoint.startX = this.dragPoint.startY = this.dragPoint.endX = this.dragPoint.endY = 0;
|
|
3241
3449
|
}
|
|
3242
|
-
if ((
|
|
3450
|
+
if (((this.isTouch && tempCursor !== 'crosshair' || parent.cursor !== 'crosshair') &&
|
|
3451
|
+
e.type.toLowerCase() === 'touchstart') ||
|
|
3243
3452
|
(parent.currObjType.isActiveObj && parent.cursor !== 'default' && !parent.togglePen)) {
|
|
3244
3453
|
parent.notify('draw', { prop: 'updateTempObjColl' });
|
|
3245
3454
|
parent.notify('draw', { prop: 'updateTempPointColl' });
|
|
@@ -3262,19 +3471,24 @@ var Selection = /** @class */ (function () {
|
|
|
3262
3471
|
var cursor = parent.cursor;
|
|
3263
3472
|
var canvasCursor = parent.upperCanvas.style.cursor;
|
|
3264
3473
|
e.preventDefault();
|
|
3265
|
-
if (this.isPreventShaping
|
|
3474
|
+
if (this.isPreventShaping || (parent.isShapeDrawing && parent.currObjType.isDragging && this.isTouch &&
|
|
3475
|
+
parent.activeObj.shape && parent.activeObj.shape === 'path')) {
|
|
3266
3476
|
return;
|
|
3267
3477
|
}
|
|
3268
3478
|
if (parent.cursor === 'grabbing' && this.isGrabbing) {
|
|
3269
3479
|
var obj = { shapeSettingsObj: {} };
|
|
3270
3480
|
parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
|
|
3271
3481
|
var shapeSettings = obj['shapeSettingsObj'];
|
|
3272
|
-
var shapeResizingArgs = { cancel: false, action: 'rotating', previousShapeSettings: shapeSettings };
|
|
3273
|
-
var shapeMovingArgs = { cancel: false, action: 'rotating', previousShapeSettings: shapeSettings };
|
|
3482
|
+
var shapeResizingArgs = { cancel: false, action: 'rotating', previousShapeSettings: shapeSettings, allowShapeOverflow: this.allowOutofBound() };
|
|
3483
|
+
var shapeMovingArgs = { cancel: false, action: 'rotating', previousShapeSettings: shapeSettings, allowShapeOverflow: this.allowOutofBound() };
|
|
3274
3484
|
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'mouse-down');
|
|
3275
3485
|
}
|
|
3276
|
-
if (this.timer && this.timer > 0) {
|
|
3277
|
-
this.
|
|
3486
|
+
if (this.timer && this.timer > 0 && this.dragPoint.startX && this.dragPoint.startY) {
|
|
3487
|
+
var width = Math.abs(this.dragPoint.startX - e.touches[0].clientX);
|
|
3488
|
+
var height = Math.abs(this.dragPoint.startY - e.touches[0].clientY);
|
|
3489
|
+
if (width > 10 || height > 10) {
|
|
3490
|
+
this.timer = 0;
|
|
3491
|
+
}
|
|
3278
3492
|
}
|
|
3279
3493
|
var bbox = parent.lowerCanvas.getBoundingClientRect();
|
|
3280
3494
|
if (e.type === 'touchmove' && e.touches.length === 2) {
|
|
@@ -3367,14 +3581,16 @@ var Selection = /** @class */ (function () {
|
|
|
3367
3581
|
}
|
|
3368
3582
|
var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop, destWidth = _a.destWidth, destHeight = _a.destHeight;
|
|
3369
3583
|
if (parent.currObjType.isDragging) {
|
|
3584
|
+
if (parent.activeObj.shape && parent.activeObj.preventShapeDragOut) {
|
|
3585
|
+
if (x < destLeft || x > destLeft + destWidth || y < destTop || y > destTop + destHeight) {
|
|
3586
|
+
return;
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3370
3589
|
this.upperContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
3371
3590
|
this.updateActivePoint(x, y, isCropSelection);
|
|
3372
3591
|
parent.notify('shape', { prop: 'updateTrianglePoints', onPropertyChange: false, value: { obj: parent.activeObj } });
|
|
3373
3592
|
if (this.isPreventDragging) {
|
|
3374
|
-
if ((
|
|
3375
|
-
(parent.activeObj.activePoint.endX < destLeft + destWidth) &&
|
|
3376
|
-
(parent.activeObj.activePoint.startY > destTop)
|
|
3377
|
-
&& (parent.activeObj.activePoint.endY < destTop + destHeight)) {
|
|
3593
|
+
if (!this.isShapeDragOut()) {
|
|
3378
3594
|
this.isPreventDragging = false;
|
|
3379
3595
|
}
|
|
3380
3596
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: null, isCropRatio: null,
|
|
@@ -3397,14 +3613,16 @@ var Selection = /** @class */ (function () {
|
|
|
3397
3613
|
!parent.element.querySelector('#' + id + '_contextualToolbar').parentElement.classList.contains('e-hide')) ||
|
|
3398
3614
|
(parent.element.querySelector('#' + id + '_headWrapper')
|
|
3399
3615
|
&& !parent.element.querySelector('#' + id + '_headWrapper').parentElement.classList.contains('e-hide')))) {
|
|
3400
|
-
|
|
3616
|
+
if (!(parent.activeObj.shape && parent.activeObj.shape === 'redact' && parent.isShapeDrawing)) {
|
|
3617
|
+
return;
|
|
3618
|
+
}
|
|
3401
3619
|
}
|
|
3402
3620
|
if (parent.cursor === 'grabbing' && this.isGrabbing) {
|
|
3403
3621
|
var obj = { shapeSettingsObj: {} };
|
|
3404
3622
|
parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
|
|
3405
3623
|
var shapeSettings = obj['shapeSettingsObj'];
|
|
3406
|
-
var shapeResizingArgs = { cancel: false, action: 'rotate-end', previousShapeSettings: shapeSettings };
|
|
3407
|
-
var shapeMovingArgs = { cancel: false, action: 'rotate-end', previousShapeSettings: shapeSettings };
|
|
3624
|
+
var shapeResizingArgs = { cancel: false, action: 'rotate-end', previousShapeSettings: shapeSettings, allowShapeOverflow: this.allowOutofBound() };
|
|
3625
|
+
var shapeMovingArgs = { cancel: false, action: 'rotate-end', previousShapeSettings: shapeSettings, allowShapeOverflow: this.allowOutofBound() };
|
|
3408
3626
|
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'mouse-up');
|
|
3409
3627
|
}
|
|
3410
3628
|
this.isGrabbing = false;
|
|
@@ -3430,7 +3648,7 @@ var Selection = /** @class */ (function () {
|
|
|
3430
3648
|
x = e.clientX;
|
|
3431
3649
|
y = e.clientY;
|
|
3432
3650
|
}
|
|
3433
|
-
else {
|
|
3651
|
+
else if (!this.isTouchDblClick) {
|
|
3434
3652
|
x = this.touchEndPoint.x;
|
|
3435
3653
|
y = this.touchEndPoint.y;
|
|
3436
3654
|
}
|
|
@@ -3483,6 +3701,12 @@ var Selection = /** @class */ (function () {
|
|
|
3483
3701
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj, isCropRatio: null,
|
|
3484
3702
|
points: null, isPreventDrag: true, saveContext: null, isPreventSelection: true } });
|
|
3485
3703
|
}
|
|
3704
|
+
if (parent.currObjType.isDragging && this.isTouch &&
|
|
3705
|
+
parent.activeObj.shape && parent.activeObj.shape === 'path') {
|
|
3706
|
+
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
3707
|
+
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj, isCropRatio: null,
|
|
3708
|
+
points: null, isPreventDrag: true, saveContext: null, isPreventSelection: true } });
|
|
3709
|
+
}
|
|
3486
3710
|
return;
|
|
3487
3711
|
}
|
|
3488
3712
|
if (e.currentTarget === parent.upperCanvas && !parent.isResize) {
|
|
@@ -3515,6 +3739,9 @@ var Selection = /** @class */ (function () {
|
|
|
3515
3739
|
this.shapeMovingArgs = shapeMovingArgs;
|
|
3516
3740
|
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'mouse-up');
|
|
3517
3741
|
}
|
|
3742
|
+
if (parent.activeObj.shape && parent.activeObj.shape === 'path' && parent.activeObj.pointColl.length > 0) {
|
|
3743
|
+
parent.activeObj.activePoint = parent.getSquarePointForPath(parent.activeObj);
|
|
3744
|
+
}
|
|
3518
3745
|
this.adjustActObjForLineArrow();
|
|
3519
3746
|
this.updPtCollForShpRot();
|
|
3520
3747
|
parent.currObjType.shape = parent.currObjType.shape.toLowerCase();
|
|
@@ -3576,6 +3803,10 @@ var Selection = /** @class */ (function () {
|
|
|
3576
3803
|
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
3577
3804
|
}
|
|
3578
3805
|
}
|
|
3806
|
+
else if (shape === 'redact') {
|
|
3807
|
+
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'redact',
|
|
3808
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
3809
|
+
}
|
|
3579
3810
|
else if (this.isFhdEditing) {
|
|
3580
3811
|
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
|
|
3581
3812
|
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
@@ -3590,6 +3821,9 @@ var Selection = /** @class */ (function () {
|
|
|
3590
3821
|
parent.activeObj.textSettings.fontSize === 11 && Math.floor(parent.activeObj.activePoint.width) === 55 &&
|
|
3591
3822
|
Math.floor(parent.activeObj.activePoint.height) === 11) {
|
|
3592
3823
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
3824
|
+
if (parent.drawingShape === 'text' && !parent.activeObj.keyHistory) {
|
|
3825
|
+
parent.activeObj.keyHistory = 'Enter Text';
|
|
3826
|
+
}
|
|
3593
3827
|
}
|
|
3594
3828
|
if (!isCropSelection_1) {
|
|
3595
3829
|
this.adjustActObjForLineArrow();
|
|
@@ -3617,6 +3851,10 @@ var Selection = /** @class */ (function () {
|
|
|
3617
3851
|
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
|
|
3618
3852
|
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
3619
3853
|
}
|
|
3854
|
+
else if (parent.activeObj.shape === 'redact') {
|
|
3855
|
+
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'redact',
|
|
3856
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
3857
|
+
}
|
|
3620
3858
|
else {
|
|
3621
3859
|
var temp = this.currentDrawingShape;
|
|
3622
3860
|
this.currentDrawingShape = '';
|
|
@@ -3632,8 +3870,8 @@ var Selection = /** @class */ (function () {
|
|
|
3632
3870
|
if (parent.togglePen && e.currentTarget === parent.upperCanvas && !obj['freehandDrawSelectedId']) {
|
|
3633
3871
|
parent.notify('freehand-draw', { prop: 'freehandUpHandler', onPropertyChange: false,
|
|
3634
3872
|
value: { e: e, canvas: parent.upperCanvas, context: this.upperContext } });
|
|
3635
|
-
if (parent.togglePen && (isNullOrUndefined(parent.toolbar) ||
|
|
3636
|
-
|| !isNullOrUndefined(parent.toolbarTemplate))) {
|
|
3873
|
+
if (parent.togglePen && !parent.isMaskImage && (isNullOrUndefined(parent.toolbar) ||
|
|
3874
|
+
(parent.toolbar && parent.toolbar.length > 0) || !isNullOrUndefined(parent.toolbarTemplate))) {
|
|
3637
3875
|
parent.okBtn();
|
|
3638
3876
|
parent.freeHandDraw(true);
|
|
3639
3877
|
}
|
|
@@ -3657,6 +3895,7 @@ var Selection = /** @class */ (function () {
|
|
|
3657
3895
|
}
|
|
3658
3896
|
}
|
|
3659
3897
|
parent.isShapeDrawing = false;
|
|
3898
|
+
parent.notify('freehand-draw', { prop: 'resetSelPoints', onPropertyChange: false });
|
|
3660
3899
|
}
|
|
3661
3900
|
};
|
|
3662
3901
|
Selection.prototype.adjustActObjForLineArrow = function (obj) {
|
|
@@ -3816,7 +4055,8 @@ var Selection = /** @class */ (function () {
|
|
|
3816
4055
|
parent.objColl.splice(index, 1);
|
|
3817
4056
|
}
|
|
3818
4057
|
}
|
|
3819
|
-
else if (!isShape && activeObj.shape && (activeObj.activePoint.width !== 0 || activeObj.activePoint.height !== 0
|
|
4058
|
+
else if (!isShape && activeObj.shape && (activeObj.activePoint.width !== 0 || activeObj.activePoint.height !== 0 ||
|
|
4059
|
+
(activeObj.shape === 'path' && activeObj.pointColl.length > 0))) {
|
|
3820
4060
|
parent.activeObj = activeObj;
|
|
3821
4061
|
var index = this.getCurrentIndex();
|
|
3822
4062
|
if (!isCropSelection) {
|
|
@@ -4044,8 +4284,15 @@ var Selection = /** @class */ (function () {
|
|
|
4044
4284
|
}
|
|
4045
4285
|
else {
|
|
4046
4286
|
if (((new Date().getTime()) - this.touchTime) < 400) {
|
|
4287
|
+
this.isTouchDblClick = true;
|
|
4288
|
+
var temp = parent.isShapeDrawing;
|
|
4047
4289
|
parent.notify('shape', { prop: 'stopPathDrawing', onPropertyChange: false, value: { e: e, isApply: null } });
|
|
4290
|
+
this.isTouchDblClick = false;
|
|
4048
4291
|
this.touchTime = 0;
|
|
4292
|
+
if (temp !== parent.isShapeDrawing && parent.activeObj.shape &&
|
|
4293
|
+
parent.activeObj.shape === 'path') {
|
|
4294
|
+
return;
|
|
4295
|
+
}
|
|
4049
4296
|
}
|
|
4050
4297
|
else {
|
|
4051
4298
|
this.touchTime = new Date().getTime();
|
|
@@ -4227,6 +4474,7 @@ var Selection = /** @class */ (function () {
|
|
|
4227
4474
|
Selection.prototype.focusRatioBtn = function () {
|
|
4228
4475
|
var id = this.parent.element.id;
|
|
4229
4476
|
if (this.parent.isKBDNavigation) {
|
|
4477
|
+
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
4230
4478
|
setTimeout(function () {
|
|
4231
4479
|
if (document.getElementById(id + '_aspectratio')) {
|
|
4232
4480
|
document.getElementById(id + '_aspectratio').focus();
|
|
@@ -4545,7 +4793,7 @@ var Selection = /** @class */ (function () {
|
|
|
4545
4793
|
}
|
|
4546
4794
|
else {
|
|
4547
4795
|
if (this.isTouch || parent.cursor === 'move' || parent.cursor === 'grab' || this.isShapeInserted) {
|
|
4548
|
-
if (prevIndex === 0 || prevIndex < actObj.order) {
|
|
4796
|
+
if (prevIndex === 0 || (prevIndex < actObj.order && (actObj.shape !== 'redact' || parent.drawingShape === 'redact'))) {
|
|
4549
4797
|
prevIndex = actObj.order;
|
|
4550
4798
|
i = index;
|
|
4551
4799
|
}
|
|
@@ -4575,7 +4823,7 @@ var Selection = /** @class */ (function () {
|
|
|
4575
4823
|
else {
|
|
4576
4824
|
if (this.isTouch || cursor === 'move' || cursor === 'grabbing' || this.isShapeInserted
|
|
4577
4825
|
|| parent.cursor === 'move' || parent.cursor === 'grabbing') {
|
|
4578
|
-
if (prevIndex === 0 || prevIndex < actObj.order) {
|
|
4826
|
+
if (prevIndex === 0 || (prevIndex < actObj.order && (actObj.shape !== 'redact' || parent.drawingShape === 'redact'))) {
|
|
4579
4827
|
prevIndex = actObj.order;
|
|
4580
4828
|
i = index;
|
|
4581
4829
|
}
|
|
@@ -4636,7 +4884,7 @@ var Selection = /** @class */ (function () {
|
|
|
4636
4884
|
parent.notify('draw', { prop: 'setTempTextSettings', onPropertyChange: false, value: { tempTextSettings: tempTextSettings } });
|
|
4637
4885
|
var shapeSettings = this.updatePrevShapeSettings();
|
|
4638
4886
|
var shapeChangingArgs = { cancel: false, action: 'select', previousShapeSettings: shapeSettings,
|
|
4639
|
-
currentShapeSettings: shapeSettings };
|
|
4887
|
+
currentShapeSettings: shapeSettings, allowShapeOverflow: this.allowOutofBound() };
|
|
4640
4888
|
if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow') {
|
|
4641
4889
|
shapeChangingArgs.currentShapeSettings.width = parent.activeObj.activePoint.endX - parent.activeObj.activePoint.startX;
|
|
4642
4890
|
shapeChangingArgs.currentShapeSettings.height = parent.activeObj.activePoint.endY - parent.activeObj.activePoint.startY;
|
|
@@ -4649,9 +4897,10 @@ var Selection = /** @class */ (function () {
|
|
|
4649
4897
|
if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
4650
4898
|
this.isCropSelection = true;
|
|
4651
4899
|
}
|
|
4652
|
-
if (!this.isCropSelection) {
|
|
4900
|
+
if (!this.isCropSelection && parent.activeObj.shape !== 'redact') {
|
|
4653
4901
|
parent.trigger('shapeChanging', shapeChangingArgs);
|
|
4654
4902
|
this.shapeEvent(shapeChangingArgs);
|
|
4903
|
+
parent.editCompleteArgs = shapeChangingArgs;
|
|
4655
4904
|
}
|
|
4656
4905
|
else {
|
|
4657
4906
|
var selectionChangingArgs = { action: shapeChangingArgs.action,
|
|
@@ -4666,6 +4915,7 @@ var Selection = /** @class */ (function () {
|
|
|
4666
4915
|
width: shapeChangingArgs.currentShapeSettings.width,
|
|
4667
4916
|
height: shapeChangingArgs.currentShapeSettings.height } };
|
|
4668
4917
|
parent.trigger('selectionChanging', selectionChangingArgs);
|
|
4918
|
+
parent.editCompleteArgs = selectionChangingArgs;
|
|
4669
4919
|
shapeChangingArgs.currentShapeSettings.startX = selectionChangingArgs.currentSelectionSettings.startX;
|
|
4670
4920
|
shapeChangingArgs.currentShapeSettings.startY = selectionChangingArgs.currentSelectionSettings.startY;
|
|
4671
4921
|
shapeChangingArgs.currentShapeSettings.width = selectionChangingArgs.currentSelectionSettings.width;
|
|
@@ -4680,7 +4930,7 @@ var Selection = /** @class */ (function () {
|
|
|
4680
4930
|
Selection.prototype.shapeEvent = function (shapeChangingArgs) {
|
|
4681
4931
|
var parent = this.parent;
|
|
4682
4932
|
parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
|
|
4683
|
-
value: { shapeSettings: shapeChangingArgs.currentShapeSettings } });
|
|
4933
|
+
value: { shapeSettings: shapeChangingArgs.currentShapeSettings, allowShapeOverflow: shapeChangingArgs.allowShapeOverflow } });
|
|
4684
4934
|
if (parent.activeObj.activePoint) {
|
|
4685
4935
|
var obj = { prevActObj: null };
|
|
4686
4936
|
parent.notify('draw', { prop: 'getPrevActObj', onPropertyChange: false, value: { obj: obj } });
|
|
@@ -4695,18 +4945,15 @@ var Selection = /** @class */ (function () {
|
|
|
4695
4945
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj, isCropRatio: null,
|
|
4696
4946
|
points: null, isPreventDrag: true, saveContext: null, isPreventSelection: true } });
|
|
4697
4947
|
if (!this.isShapeInserted) {
|
|
4698
|
-
|
|
4699
|
-
var _a = parent.img, destLeft = _a.destLeft, destWidth = _a.destWidth, destTop = _a.destTop, destHeight = _a.destHeight;
|
|
4700
|
-
this.isPreventDragging =
|
|
4701
|
-
activePoint.startX < destLeft ||
|
|
4702
|
-
activePoint.endX > destLeft + destWidth ||
|
|
4703
|
-
activePoint.startY < destTop ||
|
|
4704
|
-
activePoint.endY > destTop + destHeight;
|
|
4948
|
+
this.isPreventDragging = this.isShapeDragOut();
|
|
4705
4949
|
}
|
|
4706
4950
|
}
|
|
4707
4951
|
};
|
|
4708
4952
|
Selection.prototype.upgradeImageQuality = function () {
|
|
4709
4953
|
var parent = this.parent;
|
|
4954
|
+
if (!parent.activeObj.imageCanvas) {
|
|
4955
|
+
return;
|
|
4956
|
+
}
|
|
4710
4957
|
var activeObj = extend({}, parent.activeObj, null, true);
|
|
4711
4958
|
var ctx = parent.activeObj.imageCanvas.getContext('2d');
|
|
4712
4959
|
var dimObj = { width: 0, height: 0 };
|
|
@@ -4766,6 +5013,17 @@ var Selection = /** @class */ (function () {
|
|
|
4766
5013
|
for (var i = 0, len = parent.objColl.length; i < len; i++) {
|
|
4767
5014
|
if (JSON.stringify(obj) === JSON.stringify(parent.objColl[i])) {
|
|
4768
5015
|
parent.objColl.splice(i, 1);
|
|
5016
|
+
if (obj.shape && parent.textArea.style.display === 'none') {
|
|
5017
|
+
var actObj = extend({}, obj, {}, true);
|
|
5018
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
5019
|
+
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
5020
|
+
parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null } });
|
|
5021
|
+
if (parent.rotateFlipColl.length > 0 && (parent.panPoint.totalPannedClientPoint.x !== 0 ||
|
|
5022
|
+
parent.panPoint.totalPannedClientPoint.y !== 0)) {
|
|
5023
|
+
parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
|
|
5024
|
+
}
|
|
5025
|
+
obj = parent.activeObj = actObj;
|
|
5026
|
+
}
|
|
4769
5027
|
break;
|
|
4770
5028
|
}
|
|
4771
5029
|
}
|
|
@@ -4793,6 +5051,11 @@ var Selection = /** @class */ (function () {
|
|
|
4793
5051
|
points: null, isPreventDrag: true, saveContext: null, isPreventSelection: null } });
|
|
4794
5052
|
}
|
|
4795
5053
|
else {
|
|
5054
|
+
if (parent.activeObj.shape === 'redact') {
|
|
5055
|
+
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
5056
|
+
parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
|
|
5057
|
+
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
5058
|
+
}
|
|
4796
5059
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: null, isCropRatio: null,
|
|
4797
5060
|
points: null, isPreventDrag: true, saveContext: null, isPreventSelection: null } });
|
|
4798
5061
|
}
|
|
@@ -4833,8 +5096,9 @@ var Selection = /** @class */ (function () {
|
|
|
4833
5096
|
else if (actObj.shape === 'line' || actObj.shape === 'arrow') {
|
|
4834
5097
|
var smallPoint = { x: startX < endX ? startX : endX, y: startY < endY ? startY : endY };
|
|
4835
5098
|
var largePoint = { x: startX > endX ? startX : endX, y: startY > endY ? startY : endY };
|
|
4836
|
-
if (x >= (Math.floor(smallPoint.x) - 5) && x <= (Math.ceil(largePoint.x) + 5) &&
|
|
4837
|
-
y >= (Math.floor(smallPoint.y) - 5) && y <= (Math.ceil(largePoint.y) + 5))
|
|
5099
|
+
if ((x >= (Math.floor(smallPoint.x) - 5) && x <= (Math.ceil(largePoint.x) + 5) &&
|
|
5100
|
+
y >= (Math.floor(smallPoint.y) - 5) && y <= (Math.ceil(largePoint.y) + 5)) ||
|
|
5101
|
+
parent.activeObj.preventShapeDragOut) {
|
|
4838
5102
|
isInside = true;
|
|
4839
5103
|
}
|
|
4840
5104
|
}
|
|
@@ -4866,7 +5130,11 @@ var Selection = /** @class */ (function () {
|
|
|
4866
5130
|
parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
|
|
4867
5131
|
if (parent.activeObj.horTopLine !== undefined && parent.activeObj.horTopLine.startX !== 0 && parent.activeObj.horTopLine.endX
|
|
4868
5132
|
!== 0 && !parent.currObjType.isCustomCrop && parent.currObjType.shape !== '') {
|
|
4869
|
-
parent.objColl.
|
|
5133
|
+
if (parent.objColl.length > 0 &&
|
|
5134
|
+
JSON.stringify(parent.objColl[parent.objColl.length - 1].activePoint) !==
|
|
5135
|
+
JSON.stringify(parent.activeObj.activePoint)) {
|
|
5136
|
+
parent.objColl.push(extend({}, parent.activeObj, {}, true));
|
|
5137
|
+
}
|
|
4870
5138
|
}
|
|
4871
5139
|
var shapeColl = ['rectangle', 'ellipse', 'line', 'arrow', 'path', 'text', 'image'];
|
|
4872
5140
|
if (shapeColl.indexOf(parent.activeObj.shape) > -1) {
|
|
@@ -4874,16 +5142,6 @@ var Selection = /** @class */ (function () {
|
|
|
4874
5142
|
this.lowerContext.filter = 'brightness(' + 1 + ') ' + 'contrast(' + 100 + '%) ' + 'hue-rotate(' + 0 + 'deg) ' +
|
|
4875
5143
|
'saturate(' + 100 + '%) ' + 'opacity(' + 1 + ') ' + 'blur(' + 0 + 'px) ' + 'sepia(0%) ' + 'grayscale(0%) ' +
|
|
4876
5144
|
'invert(0%)';
|
|
4877
|
-
for (var i = 0; i < parent.objColl.length; i++) {
|
|
4878
|
-
var obj = { isInside: false };
|
|
4879
|
-
parent.notify('crop', { prop: 'isObjInImage', onPropertyChange: false,
|
|
4880
|
-
value: { obj: parent.objColl[i], object: obj } });
|
|
4881
|
-
if (obj['isInside']) {
|
|
4882
|
-
parent.notify('shape', { prop: 'apply', onPropertyChange: false,
|
|
4883
|
-
value: { shape: parent.objColl[i].shape, obj: parent.objColl[i], canvas: null } });
|
|
4884
|
-
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
4885
|
-
}
|
|
4886
|
-
}
|
|
4887
5145
|
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
4888
5146
|
value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: null } });
|
|
4889
5147
|
this.lowerContext.filter = tempFilter;
|
|
@@ -4921,6 +5179,20 @@ var Selection = /** @class */ (function () {
|
|
|
4921
5179
|
&& parent.textArea.style.color.split('(')[1].split(',')[3] ?
|
|
4922
5180
|
this.rgbToHex(parseFloat(parent.textArea.style.color.split('(')[1].split(',')[0]), parseFloat(parent.textArea.style.color.split('(')[1].split(',')[1]), parseFloat(parent.textArea.style.color.split('(')[1].split(',')[2]), parseFloat(parent.textArea.style.color.split('(')[1].split(',')[3])) :
|
|
4923
5181
|
parent.textArea.style.color;
|
|
5182
|
+
parent.activeObj.strokeSettings.fillColor = parent.textArea.style.backgroundColor !== '' &&
|
|
5183
|
+
parent.textArea.style.backgroundColor.split('(')[1] && parent.textArea.style.backgroundColor.split('(')[1].split(',')[0] &&
|
|
5184
|
+
parent.textArea.style.backgroundColor.split('(')[1].split(',')[1] && parent.textArea.style.backgroundColor.split('(')[1].split(',')[2]
|
|
5185
|
+
&& parent.textArea.style.backgroundColor.split('(')[1].split(',')[3] ?
|
|
5186
|
+
this.rgbToHex(parseFloat(parent.textArea.style.backgroundColor.split('(')[1].split(',')[0]), parseFloat(parent.textArea.style.backgroundColor.split('(')[1].split(',')[1]), parseFloat(parent.textArea.style.backgroundColor.split('(')[1].split(',')[2]), parseFloat(parent.textArea.style.backgroundColor.split('(')[1].split(',')[3])) :
|
|
5187
|
+
parent.textArea.style.backgroundColor;
|
|
5188
|
+
parent.activeObj.strokeSettings.outlineColor = parent.textArea.style.textShadow !== '' &&
|
|
5189
|
+
parent.textArea.style.textShadow.split('(')[1] && parent.textArea.style.textShadow.split('(')[1].split(',')[0] &&
|
|
5190
|
+
parent.textArea.style.textShadow.split('(')[1].split(',')[1] && parent.textArea.style.textShadow.split('(')[1].split(',')[2]
|
|
5191
|
+
&& parent.textArea.style.textShadow.split('(')[1].split(',')[3] ?
|
|
5192
|
+
this.rgbToHex(parseFloat(parent.textArea.style.textShadow.split('(')[1].split(',')[0]), parseFloat(parent.textArea.style.textShadow.split('(')[1].split(',')[1]), parseFloat(parent.textArea.style.textShadow.split('(')[1].split(',')[2]), parseFloat(parent.textArea.style.textShadow.split('(')[1].split(',')[3])) :
|
|
5193
|
+
(parent.textArea.style.textShadow.match(/^(\s*[\w#]+)\s/) ?
|
|
5194
|
+
parent.textArea.style.textShadow.match(/^(\s*[\w#]+)\s/)[1].trim() :
|
|
5195
|
+
parent.textArea.style.textShadow);
|
|
4924
5196
|
if (parent.textArea.style.fontWeight === 'bold') {
|
|
4925
5197
|
parent.activeObj.textSettings.bold = true;
|
|
4926
5198
|
}
|
|
@@ -4944,7 +5216,13 @@ var Selection = /** @class */ (function () {
|
|
|
4944
5216
|
var hexG = this.padLeft(g.toString(16), 2, '0');
|
|
4945
5217
|
var hexB = this.padLeft(b.toString(16), 2, '0');
|
|
4946
5218
|
var hexA = this.padLeft(Math.round(a * 255).toString(16), 2, '0');
|
|
4947
|
-
var hex
|
|
5219
|
+
var hex;
|
|
5220
|
+
if (isNaN(Number(hexA))) {
|
|
5221
|
+
hex = "#" + hexR + hexG + hexB;
|
|
5222
|
+
}
|
|
5223
|
+
else {
|
|
5224
|
+
hex = "#" + hexR + hexG + hexB + hexA;
|
|
5225
|
+
}
|
|
4948
5226
|
return hex;
|
|
4949
5227
|
};
|
|
4950
5228
|
Selection.prototype.padLeft = function (value, length, padChar) {
|
|
@@ -5026,6 +5304,7 @@ var Selection = /** @class */ (function () {
|
|
|
5026
5304
|
parent.notify('shape', { prop: 'setKeyHistory', onPropertyChange: false, value: { keyHistory: '' } });
|
|
5027
5305
|
parent.clearSelection();
|
|
5028
5306
|
parent.trigger('shapeChanging', shapeChangingArgs);
|
|
5307
|
+
parent.editCompleteArgs = shapeChangingArgs;
|
|
5029
5308
|
parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
|
|
5030
5309
|
parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null } });
|
|
5031
5310
|
if (!isNullOrUndefined(prevObj.objColl[prevObj.objColl.length - 1].currIndex)) {
|
|
@@ -5232,6 +5511,12 @@ var Selection = /** @class */ (function () {
|
|
|
5232
5511
|
}
|
|
5233
5512
|
return isValue;
|
|
5234
5513
|
};
|
|
5514
|
+
Selection.prototype.allowOutofBound = function () {
|
|
5515
|
+
var shapes = ['ellipse', 'rectangle', 'text', 'image', 'redact'];
|
|
5516
|
+
// eslint-disable-next-line max-len
|
|
5517
|
+
var allowOutofBound = (shapes.indexOf(this.parent.activeObj.shape) !== -1 && this.parent.activeObj.rotatedAngle === 0) ? false : true;
|
|
5518
|
+
return allowOutofBound;
|
|
5519
|
+
};
|
|
5235
5520
|
return Selection;
|
|
5236
5521
|
}());
|
|
5237
5522
|
export { Selection };
|