@syncfusion/ej2-image-editor 22.2.10 → 23.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/ej2-image-editor.umd.min.js +2 -2
- package/dist/ej2-image-editor.umd.min.js.map +1 -1
- package/dist/es6/ej2-image-editor.es2015.js +4272 -687
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +4234 -640
- 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 +12 -12
- package/src/image-editor/action/crop.js +47 -30
- package/src/image-editor/action/draw.d.ts +16 -0
- package/src/image-editor/action/draw.js +827 -81
- package/src/image-editor/action/export.d.ts +3 -0
- package/src/image-editor/action/export.js +84 -20
- package/src/image-editor/action/filter.d.ts +0 -1
- package/src/image-editor/action/filter.js +28 -41
- package/src/image-editor/action/freehand-draw.js +45 -32
- package/src/image-editor/action/selection.d.ts +6 -0
- package/src/image-editor/action/selection.js +380 -66
- package/src/image-editor/action/shape.d.ts +8 -0
- package/src/image-editor/action/shape.js +286 -91
- package/src/image-editor/action/transform.d.ts +9 -0
- package/src/image-editor/action/transform.js +402 -52
- package/src/image-editor/action/undo-redo.d.ts +1 -0
- package/src/image-editor/action/undo-redo.js +138 -10
- package/src/image-editor/base/enum.d.ts +38 -1
- package/src/image-editor/base/enum.js +39 -0
- package/src/image-editor/base/image-editor-model.d.ts +16 -2
- package/src/image-editor/base/image-editor.d.ts +134 -7
- package/src/image-editor/base/image-editor.js +611 -69
- package/src/image-editor/base/interface.d.ts +233 -2
- package/src/image-editor/renderer/toolbar.d.ts +25 -0
- package/src/image-editor/renderer/toolbar.js +1273 -72
- package/styles/bootstrap-dark.css +68 -1
- package/styles/bootstrap.css +68 -1
- package/styles/bootstrap4.css +68 -1
- package/styles/bootstrap5-dark.css +68 -1
- package/styles/bootstrap5.css +68 -1
- package/styles/fabric-dark.css +68 -1
- package/styles/fabric.css +68 -1
- package/styles/fluent-dark.css +68 -1
- package/styles/fluent.css +68 -1
- package/styles/highcontrast-light.css +70 -3
- package/styles/highcontrast.css +69 -7
- package/styles/image-editor/_bootstrap-dark-definition.scss +1 -0
- package/styles/image-editor/_bootstrap-definition.scss +1 -0
- package/styles/image-editor/_bootstrap4-definition.scss +1 -0
- package/styles/image-editor/_bootstrap5-definition.scss +1 -0
- package/styles/image-editor/_fabric-dark-definition.scss +1 -0
- package/styles/image-editor/_fabric-definition.scss +1 -0
- package/styles/image-editor/_fluent-definition.scss +1 -0
- package/styles/image-editor/_fusionnew-definition.scss +1 -0
- package/styles/image-editor/_highcontrast-definition.scss +2 -1
- package/styles/image-editor/_highcontrast-light-definition.scss +2 -1
- package/styles/image-editor/_layout.scss +92 -0
- package/styles/image-editor/_material-dark-definition.scss +1 -0
- package/styles/image-editor/_material-definition.scss +1 -0
- package/styles/image-editor/_material3-definition.scss +2 -1
- package/styles/image-editor/_tailwind-definition.scss +1 -0
- package/styles/image-editor/_theme.scss +4 -2
- package/styles/image-editor/bootstrap-dark.css +68 -1
- package/styles/image-editor/bootstrap-dark.scss +1 -1
- package/styles/image-editor/bootstrap.css +68 -1
- package/styles/image-editor/bootstrap.scss +1 -1
- package/styles/image-editor/bootstrap4.css +68 -1
- package/styles/image-editor/bootstrap4.scss +1 -1
- package/styles/image-editor/bootstrap5-dark.css +68 -1
- package/styles/image-editor/bootstrap5-dark.scss +1 -1
- package/styles/image-editor/bootstrap5.css +68 -1
- package/styles/image-editor/bootstrap5.scss +1 -1
- package/styles/image-editor/fabric-dark.css +68 -1
- package/styles/image-editor/fabric-dark.scss +1 -1
- package/styles/image-editor/fabric.css +68 -1
- package/styles/image-editor/fabric.scss +1 -1
- package/styles/image-editor/fluent-dark.css +68 -1
- package/styles/image-editor/fluent-dark.scss +1 -1
- package/styles/image-editor/fluent.css +68 -1
- package/styles/image-editor/fluent.scss +1 -1
- package/styles/image-editor/highcontrast-light.css +70 -3
- package/styles/image-editor/highcontrast-light.scss +1 -1
- package/styles/image-editor/highcontrast.css +69 -7
- package/styles/image-editor/highcontrast.scss +1 -1
- package/styles/image-editor/icons/_bootstrap-dark.scss +1 -0
- package/styles/image-editor/icons/_bootstrap.scss +1 -0
- package/styles/image-editor/icons/_bootstrap4.scss +1 -0
- package/styles/image-editor/icons/_bootstrap5.scss +1 -0
- package/styles/image-editor/icons/_fabric-dark.scss +1 -0
- package/styles/image-editor/icons/_fabric.scss +1 -0
- package/styles/image-editor/icons/_fluent.scss +1 -0
- package/styles/image-editor/icons/_fusionnew.scss +1 -0
- package/styles/image-editor/icons/_highcontrast-light.scss +1 -0
- package/styles/image-editor/icons/_highcontrast.scss +1 -0
- package/styles/image-editor/icons/_material-dark.scss +1 -0
- package/styles/image-editor/icons/_material.scss +1 -0
- package/styles/image-editor/icons/_material3.scss +1 -0
- package/styles/image-editor/icons/_tailwind.scss +1 -0
- package/styles/image-editor/material-dark.css +68 -2
- package/styles/image-editor/material-dark.scss +1 -1
- package/styles/image-editor/material.css +68 -2
- package/styles/image-editor/material.scss +1 -1
- package/styles/image-editor/material3-dark.css +73 -4
- package/styles/image-editor/material3-dark.scss +1 -1
- package/styles/image-editor/material3.css +73 -4
- package/styles/image-editor/material3.scss +1 -1
- package/styles/image-editor/tailwind-dark.css +68 -2
- package/styles/image-editor/tailwind-dark.scss +1 -1
- package/styles/image-editor/tailwind.css +68 -2
- package/styles/image-editor/tailwind.scss +1 -1
- package/styles/material-dark.css +68 -2
- package/styles/material.css +68 -2
- package/styles/material3-dark.css +73 -4
- package/styles/material3-dark.scss +1 -1
- package/styles/material3.css +73 -4
- package/styles/material3.scss +1 -1
- package/styles/tailwind-dark.css +68 -2
- package/styles/tailwind.css +68 -2
|
@@ -31,6 +31,7 @@ var Selection = /** @class */ (function () {
|
|
|
31
31
|
this.initialPrevObj = {};
|
|
32
32
|
this.touchTime = 0;
|
|
33
33
|
this.resizedElement = '';
|
|
34
|
+
this.isImageClarity = true;
|
|
34
35
|
this.parent = parent;
|
|
35
36
|
this.addEventListener();
|
|
36
37
|
}
|
|
@@ -243,6 +244,18 @@ var Selection = /** @class */ (function () {
|
|
|
243
244
|
case 'updPtCollForShpRot':
|
|
244
245
|
this.updPtCollForShpRot(args.value['obj']);
|
|
245
246
|
break;
|
|
247
|
+
case 'findImageRatio':
|
|
248
|
+
this.findImageRatio(args.value['width'], args.value['height'], args.value['obj']);
|
|
249
|
+
break;
|
|
250
|
+
case 'getNumTextValue':
|
|
251
|
+
this.getNumTextValue(args.value['obj']);
|
|
252
|
+
break;
|
|
253
|
+
case 'setImageClarity':
|
|
254
|
+
this.isImageClarity = args.value['bool'];
|
|
255
|
+
break;
|
|
256
|
+
case 'upgradeImageQuality':
|
|
257
|
+
this.upgradeImageQuality();
|
|
258
|
+
break;
|
|
246
259
|
}
|
|
247
260
|
};
|
|
248
261
|
Selection.prototype.getModuleName = function () {
|
|
@@ -284,6 +297,7 @@ var Selection = /** @class */ (function () {
|
|
|
284
297
|
this.isFhdEditing = false;
|
|
285
298
|
this.pathAdjustedIndex = null;
|
|
286
299
|
this.touchTime = 0;
|
|
300
|
+
this.isImageClarity = true;
|
|
287
301
|
this.currentDrawingShape = '';
|
|
288
302
|
this.initialPrevObj = {};
|
|
289
303
|
this.resizedElement = '';
|
|
@@ -378,6 +392,12 @@ var Selection = /** @class */ (function () {
|
|
|
378
392
|
};
|
|
379
393
|
Selection.prototype.setCursor = function (x, y) {
|
|
380
394
|
var parent = this.parent;
|
|
395
|
+
var frameObject = { bool: null };
|
|
396
|
+
parent.notify('toolbar', { prop: 'getFrameToolbar', onPropertyChange: false, value: { obj: frameObject } });
|
|
397
|
+
if (parent.isResize || frameObject['bool']) {
|
|
398
|
+
parent.upperCanvas.style.cursor = 'default';
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
381
401
|
var lowerCanvas = document.querySelector('#' + parent.element.id + '_lowerCanvas');
|
|
382
402
|
var upperCanvas = document.querySelector('#' + parent.element.id + '_upperCanvas');
|
|
383
403
|
var isCropSelection = false;
|
|
@@ -853,7 +873,7 @@ var Selection = /** @class */ (function () {
|
|
|
853
873
|
var parent = this.parent;
|
|
854
874
|
var obj = { width: 0, height: 0 };
|
|
855
875
|
parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
|
|
856
|
-
value: { width: parent.activeObj.activePoint.width, height: parent.activeObj.activePoint.height, obj: obj } });
|
|
876
|
+
value: { width: parent.activeObj.activePoint.width, height: parent.activeObj.activePoint.height, obj: obj, isImgShape: null } });
|
|
857
877
|
var maxDimension = obj;
|
|
858
878
|
var previousShapeSettings = this.updatePrevShapeSettings();
|
|
859
879
|
var shapeResizingArgs = { action: 'resize', previousShapeSettings: previousShapeSettings };
|
|
@@ -1021,10 +1041,10 @@ var Selection = /** @class */ (function () {
|
|
|
1021
1041
|
parent.activeObj.pointColl[i].y += height;
|
|
1022
1042
|
}
|
|
1023
1043
|
}
|
|
1024
|
-
if (!this.isPreventDragging && (parent.activeObj.activePoint.startX < parent.img.destLeft ||
|
|
1044
|
+
if (!this.isPreventDragging && parent.activeObj.shape !== 'line' && (parent.activeObj.rotatedAngle === 0 && (parent.activeObj.activePoint.startX < parent.img.destLeft ||
|
|
1025
1045
|
parent.activeObj.activePoint.startY < parent.img.destTop || parent.activeObj.activePoint.endX >
|
|
1026
1046
|
parent.img.destLeft + parent.img.destWidth || parent.activeObj.activePoint.endY > parent.img.destTop
|
|
1027
|
-
+ parent.img.destHeight)) {
|
|
1047
|
+
+ parent.img.destHeight))) {
|
|
1028
1048
|
parent.activeObj.activePoint.startX -= width;
|
|
1029
1049
|
parent.activeObj.activePoint.endX -= width;
|
|
1030
1050
|
parent.activeObj.activePoint.startY -= height;
|
|
@@ -1233,6 +1253,9 @@ var Selection = /** @class */ (function () {
|
|
|
1233
1253
|
};
|
|
1234
1254
|
Selection.prototype.preventDraggingInvertly = function () {
|
|
1235
1255
|
var parent = this.parent;
|
|
1256
|
+
if (parent.activeObj.shape === 'image') {
|
|
1257
|
+
return;
|
|
1258
|
+
}
|
|
1236
1259
|
if (!this.isPreventDragging && parent.activeObj.rotatedAngle === 0) {
|
|
1237
1260
|
this.limitDrag(true);
|
|
1238
1261
|
if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' ||
|
|
@@ -1272,9 +1295,11 @@ var Selection = /** @class */ (function () {
|
|
|
1272
1295
|
var point = { x: scale, y: scale };
|
|
1273
1296
|
if (parent.activeObj.shape && parent.activeObj.shape !== 'crop-custom' &&
|
|
1274
1297
|
parent.activeObj.shape !== 'crop-circle' && parent.activeObj.shape !== 'crop-square') {
|
|
1275
|
-
var ratio = parent.activeObj.shape
|
|
1276
|
-
|
|
1277
|
-
|
|
1298
|
+
var ratio = parent.activeObj.shape === 'image' ?
|
|
1299
|
+
this.findImageRatio(parent.activeObj.activePoint.width, parent.activeObj.activePoint.height).split('-') :
|
|
1300
|
+
parent.activeObj.shape.split('-');
|
|
1301
|
+
if (ratio.length > 1 || parent.activeObj.shape === 'image') {
|
|
1302
|
+
ratio = parent.activeObj.shape === 'image' ? ratio[0].split(':') : ratio[1].split(':');
|
|
1278
1303
|
var newScale = scale / (parseInt(ratio[1], 10));
|
|
1279
1304
|
point.x = newScale * (parseInt(ratio[0], 10));
|
|
1280
1305
|
point.y = newScale * (parseInt(ratio[1], 10));
|
|
@@ -1282,6 +1307,21 @@ var Selection = /** @class */ (function () {
|
|
|
1282
1307
|
}
|
|
1283
1308
|
return point;
|
|
1284
1309
|
};
|
|
1310
|
+
Selection.prototype.findImageRatio = function (width, height, obj) {
|
|
1311
|
+
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
1312
|
+
var gcd = function (a, b) {
|
|
1313
|
+
if (b === 0) {
|
|
1314
|
+
return a;
|
|
1315
|
+
}
|
|
1316
|
+
return gcd(b, a % b);
|
|
1317
|
+
};
|
|
1318
|
+
var divisor = gcd(width, height);
|
|
1319
|
+
var ratio = width / divisor + ":" + height / divisor;
|
|
1320
|
+
if (obj) {
|
|
1321
|
+
obj['ratio'] = ratio;
|
|
1322
|
+
}
|
|
1323
|
+
return ratio;
|
|
1324
|
+
};
|
|
1285
1325
|
Selection.prototype.updateNWPoints = function (x, y, maxDimension) {
|
|
1286
1326
|
var parent = this.parent;
|
|
1287
1327
|
var diff;
|
|
@@ -1327,7 +1367,12 @@ var Selection = /** @class */ (function () {
|
|
|
1327
1367
|
splitWords = parent.activeObj.shape.split('-');
|
|
1328
1368
|
}
|
|
1329
1369
|
if (parent.activeObj.shape === 'crop-custom' || (parent.activeObj.shape !== undefined && splitWords[0] !== 'crop')) {
|
|
1330
|
-
|
|
1370
|
+
if (parent.activeObj.shape === 'image') {
|
|
1371
|
+
this.resizeImg(x, y, 'nw-resize', tempActiveObj);
|
|
1372
|
+
}
|
|
1373
|
+
else {
|
|
1374
|
+
this.adjustNWPoints(parent.activeObj.activePoint, x, y, parent.activeObj.rotatedAngle);
|
|
1375
|
+
}
|
|
1331
1376
|
if (parent.activeObj.activePoint.startX > parent.activeObj.activePoint.endX) {
|
|
1332
1377
|
var temp = parent.activeObj.activePoint.startX;
|
|
1333
1378
|
parent.activeObj.activePoint.startX = parent.activeObj.activePoint.endX;
|
|
@@ -1489,7 +1534,12 @@ var Selection = /** @class */ (function () {
|
|
|
1489
1534
|
splitWords = parent.activeObj.shape.split('-');
|
|
1490
1535
|
}
|
|
1491
1536
|
if (parent.activeObj.shape === 'crop-custom' || (parent.activeObj.shape !== undefined && splitWords[0] !== 'crop')) {
|
|
1492
|
-
|
|
1537
|
+
if (parent.activeObj.shape === 'image') {
|
|
1538
|
+
this.resizeImg(x, y, 'ne-resize', tempActiveObj);
|
|
1539
|
+
}
|
|
1540
|
+
else {
|
|
1541
|
+
this.adjustNEPoints(parent.activeObj.activePoint, x, y, parent.activeObj.rotatedAngle);
|
|
1542
|
+
}
|
|
1493
1543
|
if (parent.activeObj.activePoint.endX < parent.activeObj.activePoint.startX) {
|
|
1494
1544
|
var temp = parent.activeObj.activePoint.endX;
|
|
1495
1545
|
parent.activeObj.activePoint.endX = parent.activeObj.activePoint.startX;
|
|
@@ -1746,7 +1796,12 @@ var Selection = /** @class */ (function () {
|
|
|
1746
1796
|
splitWords = parent.activeObj.shape.split('-');
|
|
1747
1797
|
}
|
|
1748
1798
|
if (parent.activeObj.shape === 'crop-custom' || (parent.activeObj.shape !== undefined && splitWords[0] !== 'crop')) {
|
|
1749
|
-
|
|
1799
|
+
if (parent.activeObj.shape === 'image') {
|
|
1800
|
+
this.resizeImg(x, y, 'sw-resize', tempActiveObj);
|
|
1801
|
+
}
|
|
1802
|
+
else {
|
|
1803
|
+
this.adjustSWPoints(parent.activeObj.activePoint, x, y, parent.activeObj.rotatedAngle);
|
|
1804
|
+
}
|
|
1750
1805
|
if (parent.activeObj.activePoint.startX > parent.activeObj.activePoint.endX) {
|
|
1751
1806
|
var temp = parent.activeObj.activePoint.startX;
|
|
1752
1807
|
parent.activeObj.activePoint.startX = parent.activeObj.activePoint.endX;
|
|
@@ -1906,11 +1961,17 @@ var Selection = /** @class */ (function () {
|
|
|
1906
1961
|
}
|
|
1907
1962
|
else {
|
|
1908
1963
|
var splitWords = void 0;
|
|
1964
|
+
var newScale = void 0;
|
|
1909
1965
|
if (parent.activeObj.shape !== undefined) {
|
|
1910
1966
|
splitWords = parent.activeObj.shape.split('-');
|
|
1911
1967
|
}
|
|
1912
1968
|
if (parent.activeObj.shape === 'crop-custom' || (parent.activeObj.shape !== undefined && splitWords[0] !== 'crop')) {
|
|
1913
|
-
|
|
1969
|
+
if (parent.activeObj.shape === 'image') {
|
|
1970
|
+
this.resizeImg(x, y, 'se-resize', tempActiveObj);
|
|
1971
|
+
}
|
|
1972
|
+
else {
|
|
1973
|
+
this.adjustSEPoints(parent.activeObj.activePoint, x, y, parent.activeObj.rotatedAngle);
|
|
1974
|
+
}
|
|
1914
1975
|
if (parent.activeObj.activePoint.endX < parent.activeObj.activePoint.startX) {
|
|
1915
1976
|
var temp = parent.activeObj.activePoint.endX;
|
|
1916
1977
|
parent.activeObj.activePoint.endX = parent.activeObj.activePoint.startX;
|
|
@@ -1930,7 +1991,7 @@ var Selection = /** @class */ (function () {
|
|
|
1930
1991
|
width = parent.activeObj.activePoint.endX - x;
|
|
1931
1992
|
height = parent.activeObj.activePoint.endY - y;
|
|
1932
1993
|
scale = Math.min(width, height);
|
|
1933
|
-
|
|
1994
|
+
newScale = this.getScaleRatio(scale);
|
|
1934
1995
|
parent.activeObj.activePoint.endX -= newScale.x;
|
|
1935
1996
|
parent.activeObj.activePoint.endY -= newScale.y;
|
|
1936
1997
|
var endX = parent.img.destLeft + parent.img.destWidth < parent.lowerCanvas.width ?
|
|
@@ -1946,7 +2007,7 @@ var Selection = /** @class */ (function () {
|
|
|
1946
2007
|
width = x - parent.activeObj.activePoint.endX;
|
|
1947
2008
|
height = y - parent.activeObj.activePoint.endY;
|
|
1948
2009
|
scale = Math.max(width, height);
|
|
1949
|
-
|
|
2010
|
+
newScale = this.getScaleRatio(scale);
|
|
1950
2011
|
parent.activeObj.activePoint.endX += newScale.x;
|
|
1951
2012
|
parent.activeObj.activePoint.endY += newScale.y;
|
|
1952
2013
|
var endX = parent.img.destLeft + parent.img.destWidth < parent.lowerCanvas.width ? parent.img.destLeft +
|
|
@@ -1964,6 +2025,106 @@ var Selection = /** @class */ (function () {
|
|
|
1964
2025
|
this.preventInverseResize(tempActiveObj);
|
|
1965
2026
|
}
|
|
1966
2027
|
};
|
|
2028
|
+
Selection.prototype.resizeImg = function (x, y, elem, tempActiveObj) {
|
|
2029
|
+
var parent = this.parent;
|
|
2030
|
+
var width;
|
|
2031
|
+
var height;
|
|
2032
|
+
var scale;
|
|
2033
|
+
var newScale;
|
|
2034
|
+
if (this.previousPoint.x !== 0 && this.previousPoint.y !== 0) {
|
|
2035
|
+
switch (parent.upperCanvas.style.cursor) {
|
|
2036
|
+
case 'se-resize':
|
|
2037
|
+
case 's-resize':
|
|
2038
|
+
if (this.previousPoint.x > x || this.previousPoint.y > y) {
|
|
2039
|
+
width = (this.previousPoint.x - x);
|
|
2040
|
+
height = (this.previousPoint.y - y);
|
|
2041
|
+
scale = (width + height) / 2;
|
|
2042
|
+
newScale = this.getScaleRatio(scale);
|
|
2043
|
+
this.adjustRotationPoints(parent.activeObj.activePoint, -Math.abs(newScale.x), -Math.abs(newScale.y), parent.activeObj.rotatedAngle, 'img-resize', elem);
|
|
2044
|
+
}
|
|
2045
|
+
else if (this.previousPoint.x !== 0 && this.previousPoint.y !== 0) {
|
|
2046
|
+
width = (x - this.previousPoint.x);
|
|
2047
|
+
height = (y - this.previousPoint.y);
|
|
2048
|
+
scale = (width + height) / 2;
|
|
2049
|
+
newScale = this.getScaleRatio(scale);
|
|
2050
|
+
this.adjustRotationPoints(parent.activeObj.activePoint, Math.abs(newScale.x), Math.abs(newScale.y), parent.activeObj.rotatedAngle, 'img-resize', elem);
|
|
2051
|
+
}
|
|
2052
|
+
break;
|
|
2053
|
+
case 'sw-resize':
|
|
2054
|
+
if (this.previousPoint.x < x || this.previousPoint.y > y) {
|
|
2055
|
+
width = (x - this.previousPoint.x);
|
|
2056
|
+
height = (this.previousPoint.y - y);
|
|
2057
|
+
scale = (width + height) / 2;
|
|
2058
|
+
newScale = this.getScaleRatio(scale);
|
|
2059
|
+
this.adjustRotationPoints(parent.activeObj.activePoint, -Math.abs(newScale.x), -Math.abs(newScale.y), parent.activeObj.rotatedAngle, 'img-resize', elem);
|
|
2060
|
+
}
|
|
2061
|
+
else if (this.previousPoint.x !== 0 && this.previousPoint.y !== 0) {
|
|
2062
|
+
width = (this.previousPoint.x - x);
|
|
2063
|
+
height = (y - this.previousPoint.y);
|
|
2064
|
+
scale = (width + height) / 2;
|
|
2065
|
+
newScale = this.getScaleRatio(scale);
|
|
2066
|
+
this.adjustRotationPoints(parent.activeObj.activePoint, Math.abs(newScale.x), Math.abs(newScale.y), parent.activeObj.rotatedAngle, 'img-resize', elem);
|
|
2067
|
+
}
|
|
2068
|
+
break;
|
|
2069
|
+
case 'w-resize':
|
|
2070
|
+
case 'nw-resize':
|
|
2071
|
+
if (this.previousPoint.x < x || this.previousPoint.y < y) {
|
|
2072
|
+
width = (x - this.previousPoint.x);
|
|
2073
|
+
height = (y - this.previousPoint.y);
|
|
2074
|
+
scale = (width + height) / 2;
|
|
2075
|
+
newScale = this.getScaleRatio(scale);
|
|
2076
|
+
this.adjustRotationPoints(parent.activeObj.activePoint, -Math.abs(newScale.x), -Math.abs(newScale.y), parent.activeObj.rotatedAngle, 'img-resize', elem);
|
|
2077
|
+
}
|
|
2078
|
+
else if (this.previousPoint.x !== 0 && this.previousPoint.y !== 0) {
|
|
2079
|
+
width = (this.previousPoint.x - x);
|
|
2080
|
+
height = (this.previousPoint.y - y);
|
|
2081
|
+
scale = (width + height) / 2;
|
|
2082
|
+
newScale = this.getScaleRatio(scale);
|
|
2083
|
+
this.adjustRotationPoints(parent.activeObj.activePoint, Math.abs(newScale.x), Math.abs(newScale.y), parent.activeObj.rotatedAngle, 'img-resize', elem);
|
|
2084
|
+
}
|
|
2085
|
+
break;
|
|
2086
|
+
case 'n-resize':
|
|
2087
|
+
case 'ne-resize':
|
|
2088
|
+
if (this.previousPoint.x > x || this.previousPoint.y < y) {
|
|
2089
|
+
width = (this.previousPoint.x - x);
|
|
2090
|
+
height = (y - this.previousPoint.y);
|
|
2091
|
+
scale = (width + height) / 2;
|
|
2092
|
+
newScale = this.getScaleRatio(scale);
|
|
2093
|
+
this.adjustRotationPoints(parent.activeObj.activePoint, -Math.abs(newScale.x), -Math.abs(newScale.y), parent.activeObj.rotatedAngle, 'img-resize', elem);
|
|
2094
|
+
}
|
|
2095
|
+
else if (this.previousPoint.x !== 0 && this.previousPoint.y !== 0) {
|
|
2096
|
+
width = (x - this.previousPoint.x);
|
|
2097
|
+
height = (this.previousPoint.y - y);
|
|
2098
|
+
scale = (width + height) / 2;
|
|
2099
|
+
newScale = this.getScaleRatio(scale);
|
|
2100
|
+
this.adjustRotationPoints(parent.activeObj.activePoint, Math.abs(newScale.x), Math.abs(newScale.y), parent.activeObj.rotatedAngle, 'img-resize', elem);
|
|
2101
|
+
}
|
|
2102
|
+
break;
|
|
2103
|
+
case 'e-resize':
|
|
2104
|
+
if (this.previousPoint.x > x || this.previousPoint.y > y) {
|
|
2105
|
+
width = (this.previousPoint.x - x);
|
|
2106
|
+
height = (this.previousPoint.y - y);
|
|
2107
|
+
scale = (width + height) / 2;
|
|
2108
|
+
newScale = this.getScaleRatio(scale);
|
|
2109
|
+
this.adjustRotationPoints(parent.activeObj.activePoint, -Math.abs(newScale.x), -Math.abs(newScale.y), parent.activeObj.rotatedAngle, 'img-resize', elem);
|
|
2110
|
+
}
|
|
2111
|
+
else if (this.previousPoint.x !== 0 && this.previousPoint.y !== 0) {
|
|
2112
|
+
width = (x - this.previousPoint.x);
|
|
2113
|
+
height = (y - this.previousPoint.y);
|
|
2114
|
+
scale = (width + height) / 2;
|
|
2115
|
+
newScale = this.getScaleRatio(scale);
|
|
2116
|
+
this.adjustRotationPoints(parent.activeObj.activePoint, Math.abs(newScale.x), Math.abs(newScale.y), parent.activeObj.rotatedAngle, 'img-resize', elem);
|
|
2117
|
+
}
|
|
2118
|
+
break;
|
|
2119
|
+
}
|
|
2120
|
+
parent.activeObj.activePoint.width = parent.activeObj.activePoint.endX - parent.activeObj.activePoint.startX;
|
|
2121
|
+
parent.activeObj.activePoint.height = parent.activeObj.activePoint.endY - parent.activeObj.activePoint.startY;
|
|
2122
|
+
if (parent.activeObj.activePoint.width < 10 || parent.activeObj.activePoint.height < 10) {
|
|
2123
|
+
parent.activeObj = extend({}, tempActiveObj, null, true);
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
2126
|
+
this.previousPoint = { x: x, y: y };
|
|
2127
|
+
};
|
|
1967
2128
|
Selection.prototype.adjustNWPoints = function (rectangle, x, y, angle) {
|
|
1968
2129
|
var cx = rectangle.startX + rectangle.width / 2;
|
|
1969
2130
|
var cy = rectangle.startY + rectangle.height / 2;
|
|
@@ -2024,10 +2185,10 @@ var Selection = /** @class */ (function () {
|
|
|
2024
2185
|
rectangle.endY = rectangle.startY + rectangle.height;
|
|
2025
2186
|
return rectangle;
|
|
2026
2187
|
};
|
|
2027
|
-
Selection.prototype.adjustRotationPoints = function (rectangle, x, y, angle) {
|
|
2188
|
+
Selection.prototype.adjustRotationPoints = function (rectangle, x, y, angle, type, elem) {
|
|
2028
2189
|
var cx = rectangle.startX + rectangle.width / 2;
|
|
2029
2190
|
var cy = rectangle.startY + rectangle.height / 2;
|
|
2030
|
-
this.getResizeDirection(rectangle, x, y, angle);
|
|
2191
|
+
this.getResizeDirection(rectangle, x, y, angle, type, elem);
|
|
2031
2192
|
var rotatedA = this.rotatePoints(rectangle.startX, rectangle.startY, cx, cy, angle);
|
|
2032
2193
|
var rotatedB = this.rotatePoints(rectangle.endX, rectangle.startY, cx, cy, angle);
|
|
2033
2194
|
var rotatedC = this.rotatePoints(rectangle.endX, rectangle.endY, cx, cy, angle);
|
|
@@ -2076,10 +2237,16 @@ var Selection = /** @class */ (function () {
|
|
|
2076
2237
|
case 'x-y':
|
|
2077
2238
|
value += (x + (y / 2));
|
|
2078
2239
|
break;
|
|
2240
|
+
case 'img-resize-x':
|
|
2241
|
+
value += x;
|
|
2242
|
+
break;
|
|
2243
|
+
case 'img-resize-y':
|
|
2244
|
+
value += y;
|
|
2245
|
+
break;
|
|
2079
2246
|
}
|
|
2080
2247
|
return value;
|
|
2081
2248
|
};
|
|
2082
|
-
Selection.prototype.getResizeDirection = function (rectangle, x, y, angle) {
|
|
2249
|
+
Selection.prototype.getResizeDirection = function (rectangle, x, y, angle, type, elem) {
|
|
2083
2250
|
var rotatedAngle = angle * (180 / Math.PI);
|
|
2084
2251
|
var element = this.getResizedElement(rotatedAngle, this.resizedElement);
|
|
2085
2252
|
if (this.resizedElement === 'e-resize') {
|
|
@@ -2098,6 +2265,26 @@ var Selection = /** @class */ (function () {
|
|
|
2098
2265
|
rectangle.height = this.setResizedValue(element, rectangle.height, x, y);
|
|
2099
2266
|
rectangle.endY = rectangle.height + rectangle.startY;
|
|
2100
2267
|
}
|
|
2268
|
+
else if (type && type === 'img-resize') {
|
|
2269
|
+
rectangle.width = this.setResizedValue('img-resize-x', rectangle.width, x, y);
|
|
2270
|
+
rectangle.height = this.setResizedValue('img-resize-y', rectangle.height, x, y);
|
|
2271
|
+
if (elem === 'se-resize') {
|
|
2272
|
+
rectangle.endX = rectangle.width + rectangle.startX;
|
|
2273
|
+
rectangle.endY = rectangle.height + rectangle.startY;
|
|
2274
|
+
}
|
|
2275
|
+
else if (elem === 'sw-resize') {
|
|
2276
|
+
rectangle.startX = rectangle.endX - rectangle.width;
|
|
2277
|
+
rectangle.endY = rectangle.height + rectangle.startY;
|
|
2278
|
+
}
|
|
2279
|
+
else if (elem === 'ne-resize') {
|
|
2280
|
+
rectangle.endX = rectangle.width + rectangle.startX;
|
|
2281
|
+
rectangle.startY = rectangle.endY - rectangle.height;
|
|
2282
|
+
}
|
|
2283
|
+
else if (elem === 'nw-resize') {
|
|
2284
|
+
rectangle.startX = rectangle.endX - rectangle.width;
|
|
2285
|
+
rectangle.startY = rectangle.endY - rectangle.height;
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2101
2288
|
};
|
|
2102
2289
|
Selection.prototype.getResizedElement = function (degree, element) {
|
|
2103
2290
|
var resizeMappings = [];
|
|
@@ -2544,7 +2731,7 @@ var Selection = /** @class */ (function () {
|
|
|
2544
2731
|
var textWidth = startX ? startX : 0;
|
|
2545
2732
|
var textHeight = startY ? startY : parent.activeObj.textSettings.fontSize;
|
|
2546
2733
|
if (parent.activeObj.textSettings.fontSize === undefined) {
|
|
2547
|
-
parent.activeObj.textSettings.fontSize = (Math.abs(parent.
|
|
2734
|
+
parent.activeObj.textSettings.fontSize = (Math.abs(parent.baseImgCanvas.width - parent.baseImgCanvas.height)) * 0.1;
|
|
2548
2735
|
}
|
|
2549
2736
|
this.setTextSelection(textWidth, textHeight);
|
|
2550
2737
|
this.mouseDownPoint.x = parent.activeObj.activePoint.endX;
|
|
@@ -2625,7 +2812,15 @@ var Selection = /** @class */ (function () {
|
|
|
2625
2812
|
var y = imageEditorClickEventArgs.point.y;
|
|
2626
2813
|
var cursor = parent.activeObj.shape && parent.activeObj.shape === 'text' ?
|
|
2627
2814
|
parent.cursor : 'default';
|
|
2628
|
-
if (
|
|
2815
|
+
if (parent.isResize) {
|
|
2816
|
+
// parent.okBtn();
|
|
2817
|
+
this.performEnterAction();
|
|
2818
|
+
return;
|
|
2819
|
+
}
|
|
2820
|
+
else if (JSON.stringify(parent.frameObj) !== JSON.stringify(parent.tempFrameObj)) {
|
|
2821
|
+
parent.okBtn();
|
|
2822
|
+
}
|
|
2823
|
+
else if (this.currentDrawingShape !== '') {
|
|
2629
2824
|
var object_1 = { currObj: {} };
|
|
2630
2825
|
parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object_1 } });
|
|
2631
2826
|
this.initialPrevObj = object_1['currObj'];
|
|
@@ -2652,6 +2847,7 @@ var Selection = /** @class */ (function () {
|
|
|
2652
2847
|
parent.currObjType.isDragging = true;
|
|
2653
2848
|
return;
|
|
2654
2849
|
}
|
|
2850
|
+
parent.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false });
|
|
2655
2851
|
if (this.isCropSelection && this.dragCanvas) {
|
|
2656
2852
|
this.setCursor(x, y);
|
|
2657
2853
|
if (parent.cursor !== 'move' && parent.cursor !== 'crosshair' &&
|
|
@@ -2715,7 +2911,8 @@ var Selection = /** @class */ (function () {
|
|
|
2715
2911
|
}
|
|
2716
2912
|
if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' ||
|
|
2717
2913
|
parent.activeObj.shape === 'ellipse' || parent.activeObj.shape === 'line' ||
|
|
2718
|
-
parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path' || parent.activeObj.shape === 'text'
|
|
2914
|
+
parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path' || parent.activeObj.shape === 'text' ||
|
|
2915
|
+
parent.activeObj.shape === 'image')) {
|
|
2719
2916
|
parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
|
|
2720
2917
|
value: { x: null, y: null, isMouseDown: null } });
|
|
2721
2918
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
@@ -2769,6 +2966,8 @@ var Selection = /** @class */ (function () {
|
|
|
2769
2966
|
parent.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
|
|
2770
2967
|
if (!isNullOrUndefined(obj['index']) && obj['index'] > -1) {
|
|
2771
2968
|
parent.notify('freehand-draw', { prop: 'selectFhd', value: { type: 'ok' } });
|
|
2969
|
+
parent.notify('freehand-draw', { prop: 'hoverFhd', onPropertyChange: false,
|
|
2970
|
+
value: { strokeColor: null, strokeWidth: null } });
|
|
2772
2971
|
if (!isBlazor()) {
|
|
2773
2972
|
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
|
|
2774
2973
|
}
|
|
@@ -2783,6 +2982,9 @@ var Selection = /** @class */ (function () {
|
|
|
2783
2982
|
parent.notify('freehand-draw', { prop: 'hoverFhd', onPropertyChange: false,
|
|
2784
2983
|
value: { strokeColor: strokeColor, strokeWidth: parent.pointColl[indexObj['freehandSelectedIndex']].strokeWidth } });
|
|
2785
2984
|
}
|
|
2985
|
+
else if (this.findTargetObj(x_1, y_1, false)) {
|
|
2986
|
+
this.findTarget(x_1, y_1, e.type);
|
|
2987
|
+
}
|
|
2786
2988
|
}
|
|
2787
2989
|
else {
|
|
2788
2990
|
if (this.isFhdEditing) {
|
|
@@ -2830,9 +3032,6 @@ var Selection = /** @class */ (function () {
|
|
|
2830
3032
|
}
|
|
2831
3033
|
if ((parent.cursor !== 'crosshair' && e.type.toLowerCase() === 'touchstart') ||
|
|
2832
3034
|
(parent.currObjType.isActiveObj && parent.cursor !== 'default' && !parent.togglePen)) {
|
|
2833
|
-
if (parent.currObjType.isUndoAction) {
|
|
2834
|
-
parent.notify('undo-redo', { prop: 'refreshUrc', value: { bool: null } });
|
|
2835
|
-
}
|
|
2836
3035
|
this.findTarget(x_1, y_1, e.type);
|
|
2837
3036
|
}
|
|
2838
3037
|
else if ((parent.currObjType.shape === '' || parent.currObjType.isCustomCrop) && !parent.togglePen && parent.cursor !== 'default') {
|
|
@@ -3049,9 +3248,20 @@ var Selection = /** @class */ (function () {
|
|
|
3049
3248
|
this.parent.eventType = null;
|
|
3050
3249
|
}
|
|
3051
3250
|
if (this.currentDrawingShape === 'path') {
|
|
3251
|
+
var elem = e.srcElement;
|
|
3252
|
+
if (e.currentTarget !== parent.upperCanvas && e.currentTarget !== parent.lowerCanvas &&
|
|
3253
|
+
(elem.classList.contains('e-upload-icon') || elem.parentElement.id === parent.element.id + '_zoomIn' ||
|
|
3254
|
+
elem.parentElement.id === parent.element.id + '_zoomOut' || elem.parentElement.id === parent.element.id + '_annotationBtn' ||
|
|
3255
|
+
elem.parentElement.id === parent.element.id + '_borderColorBtn' || elem.parentElement.id === parent.element.id + '_borderWidthBtn' ||
|
|
3256
|
+
elem.parentElement.id === parent.element.id + '_saveBtn')) {
|
|
3257
|
+
this.parent.notify('shape', { prop: 'stopPathDrawing', onPropertyChange: false, value: { e: e, isApply: true } });
|
|
3258
|
+
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
3259
|
+
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj, isCropRatio: null,
|
|
3260
|
+
points: null, isPreventDrag: true, saveContext: null, isPreventSelection: true } });
|
|
3261
|
+
}
|
|
3052
3262
|
return;
|
|
3053
3263
|
}
|
|
3054
|
-
if (e.currentTarget === parent.upperCanvas) {
|
|
3264
|
+
if (e.currentTarget === parent.upperCanvas && !parent.isResize) {
|
|
3055
3265
|
this.pathAdjustedIndex = null;
|
|
3056
3266
|
if (this.currentDrawingShape !== '') {
|
|
3057
3267
|
if (this.currentDrawingShape === 'text') {
|
|
@@ -3142,7 +3352,8 @@ var Selection = /** @class */ (function () {
|
|
|
3142
3352
|
}
|
|
3143
3353
|
else {
|
|
3144
3354
|
if ((parent.activeObj.shape === 'rectangle') || (parent.activeObj.shape === 'ellipse')
|
|
3145
|
-
|| (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path'
|
|
3355
|
+
|| (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path'
|
|
3356
|
+
|| parent.activeObj.shape === 'image')) {
|
|
3146
3357
|
parent.updateToolbar(parent.element, parent.activeObj.shape);
|
|
3147
3358
|
}
|
|
3148
3359
|
else if (parent.activeObj.shape === 'text' && parent.textArea.style.display === 'none') {
|
|
@@ -3300,6 +3511,10 @@ var Selection = /** @class */ (function () {
|
|
|
3300
3511
|
isShape = this.findTargetObj(x, y, isCropSelection);
|
|
3301
3512
|
if (!isCropSelection) {
|
|
3302
3513
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
3514
|
+
if (isShape) {
|
|
3515
|
+
parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
|
|
3516
|
+
value: { x: null, y: null, isMouseDown: true } });
|
|
3517
|
+
}
|
|
3303
3518
|
}
|
|
3304
3519
|
if (isTextArea) {
|
|
3305
3520
|
parent.textArea.value = parent.objColl[parent.objColl.length - 1].keyHistory;
|
|
@@ -3422,7 +3637,7 @@ var Selection = /** @class */ (function () {
|
|
|
3422
3637
|
var isApply = false;
|
|
3423
3638
|
if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse' ||
|
|
3424
3639
|
parent.activeObj.shape === 'text' || parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' ||
|
|
3425
|
-
parent.activeObj.shape === 'path')) {
|
|
3640
|
+
parent.activeObj.shape === 'path' || parent.activeObj.shape === 'image')) {
|
|
3426
3641
|
if (x >= (parent.activeObj.activePoint.startX - (parent.activeObj.topLeftCircle.radius * 2)) &&
|
|
3427
3642
|
x <= (parent.activeObj.activePoint.endX + (parent.activeObj.topLeftCircle.radius * 2)) &&
|
|
3428
3643
|
y >= (parent.activeObj.activePoint.startY - (parent.activeObj.topLeftCircle.radius * 2)) &&
|
|
@@ -3518,6 +3733,12 @@ var Selection = /** @class */ (function () {
|
|
|
3518
3733
|
};
|
|
3519
3734
|
Selection.prototype.canvasMouseMoveHandler = function (e) {
|
|
3520
3735
|
var parent = this.parent;
|
|
3736
|
+
var frameObject = { bool: null };
|
|
3737
|
+
parent.notify('toolbar', { prop: 'getFrameToolbar', onPropertyChange: false, value: { obj: frameObject } });
|
|
3738
|
+
if (parent.isResize || frameObject['bool']) {
|
|
3739
|
+
parent.upperCanvas.style.cursor = 'default';
|
|
3740
|
+
return;
|
|
3741
|
+
}
|
|
3521
3742
|
if (this.dragCanvas) {
|
|
3522
3743
|
parent.lowerCanvas.style.cursor = 'grab';
|
|
3523
3744
|
}
|
|
@@ -3572,7 +3793,7 @@ var Selection = /** @class */ (function () {
|
|
|
3572
3793
|
}
|
|
3573
3794
|
else {
|
|
3574
3795
|
if (((new Date().getTime()) - this.touchTime) < 400) {
|
|
3575
|
-
this.parent.notify('shape', { prop: 'stopPathDrawing', onPropertyChange: false, value: { e: e } });
|
|
3796
|
+
this.parent.notify('shape', { prop: 'stopPathDrawing', onPropertyChange: false, value: { e: e, isApply: null } });
|
|
3576
3797
|
this.touchTime = 0;
|
|
3577
3798
|
}
|
|
3578
3799
|
else {
|
|
@@ -3605,7 +3826,6 @@ var Selection = /** @class */ (function () {
|
|
|
3605
3826
|
var obj = { fileName: '', fileType: null };
|
|
3606
3827
|
parent.notify('draw', { prop: 'getFileName', onPropertyChange: false, value: { obj: obj } });
|
|
3607
3828
|
var beforeSave = { fileName: obj['fileName'], fileType: obj['fileType'], cancel: false };
|
|
3608
|
-
var splitWords;
|
|
3609
3829
|
switch (e.key) {
|
|
3610
3830
|
case (e.ctrlKey && 's'):
|
|
3611
3831
|
if (isBlazor() && parent.events && parent.events.saving.hasDelegate === true) {
|
|
@@ -3633,14 +3853,14 @@ var Selection = /** @class */ (function () {
|
|
|
3633
3853
|
if ((parent.zoomSettings.zoomTrigger & ZoomTrigger.Commands) === ZoomTrigger.Commands) {
|
|
3634
3854
|
this.zoomType = 'Commands';
|
|
3635
3855
|
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3636
|
-
value: { zoomFactor: .1, zoomPoint: null } });
|
|
3856
|
+
value: { zoomFactor: .1, zoomPoint: null }, isResize: null });
|
|
3637
3857
|
}
|
|
3638
3858
|
break;
|
|
3639
3859
|
case (e.ctrlKey && '-'):
|
|
3640
3860
|
if ((parent.zoomSettings.zoomTrigger & ZoomTrigger.Commands) === ZoomTrigger.Commands) {
|
|
3641
3861
|
this.zoomType = 'Commands';
|
|
3642
3862
|
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3643
|
-
value: { zoomFactor: -.1, zoomPoint: null } });
|
|
3863
|
+
value: { zoomFactor: -.1, zoomPoint: null }, isResize: null });
|
|
3644
3864
|
}
|
|
3645
3865
|
break;
|
|
3646
3866
|
case 'Delete':
|
|
@@ -3650,13 +3870,7 @@ var Selection = /** @class */ (function () {
|
|
|
3650
3870
|
parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
|
|
3651
3871
|
break;
|
|
3652
3872
|
case 'Enter':
|
|
3653
|
-
|
|
3654
|
-
splitWords = parent.activeObj.shape.split('-');
|
|
3655
|
-
}
|
|
3656
|
-
if (this.isKeyBoardCrop(e) &&
|
|
3657
|
-
parent.activeObj.horTopLine && (parent.activeObj.shape && splitWords[0] === 'crop')) {
|
|
3658
|
-
parent.crop();
|
|
3659
|
-
}
|
|
3873
|
+
this.performEnterAction(e);
|
|
3660
3874
|
break;
|
|
3661
3875
|
case 'Tab':
|
|
3662
3876
|
this.performTabAction();
|
|
@@ -3668,6 +3882,32 @@ var Selection = /** @class */ (function () {
|
|
|
3668
3882
|
break;
|
|
3669
3883
|
}
|
|
3670
3884
|
};
|
|
3885
|
+
Selection.prototype.performEnterAction = function (e) {
|
|
3886
|
+
var parent = this.parent;
|
|
3887
|
+
if (parent.isResize) {
|
|
3888
|
+
var point = this.getNumTextValue();
|
|
3889
|
+
var aspectRatioElement = this.parent.element.querySelector('#' + this.parent.element.id + '_aspectratio');
|
|
3890
|
+
var blrAspRatElem = this.parent.element.querySelector('.e-ie-toolbar-aspect-ratio-btn');
|
|
3891
|
+
if (point && point.x && point.y) {
|
|
3892
|
+
if (aspectRatioElement || (blrAspRatElem && !blrAspRatElem.classList.contains('e-hidden'))) {
|
|
3893
|
+
parent.notify('transform', { prop: 'resize', value: { width: point.x, height: null, isAspectRatio: true } });
|
|
3894
|
+
}
|
|
3895
|
+
else {
|
|
3896
|
+
parent.notify('transform', { prop: 'resize', value: { width: point.x, height: point.y, isAspectRatio: false } });
|
|
3897
|
+
}
|
|
3898
|
+
}
|
|
3899
|
+
}
|
|
3900
|
+
else {
|
|
3901
|
+
var splitWords = void 0;
|
|
3902
|
+
if (parent.activeObj.shape) {
|
|
3903
|
+
splitWords = parent.activeObj.shape.split('-');
|
|
3904
|
+
}
|
|
3905
|
+
if (e && this.isKeyBoardCrop(e) &&
|
|
3906
|
+
parent.activeObj.horTopLine && (parent.activeObj.shape && splitWords[0] === 'crop')) {
|
|
3907
|
+
parent.crop();
|
|
3908
|
+
}
|
|
3909
|
+
}
|
|
3910
|
+
};
|
|
3671
3911
|
Selection.prototype.isKeyBoardCrop = function (e) {
|
|
3672
3912
|
var bool = false;
|
|
3673
3913
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
@@ -3910,16 +4150,23 @@ var Selection = /** @class */ (function () {
|
|
|
3910
4150
|
x <= actObj.pointColl[j].x + (actObj.topLeftCircle.radius * 2) &&
|
|
3911
4151
|
y >= actObj.pointColl[j].y - (actObj.topLeftCircle.radius * 2) &&
|
|
3912
4152
|
y <= actObj.pointColl[j].y + (actObj.topLeftCircle.radius * 2)) {
|
|
3913
|
-
if (this.
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
4153
|
+
if (this.tempActiveObj && this.tempActiveObj.activePoint &&
|
|
4154
|
+
JSON.stringify(this.tempActiveObj.activePoint) === JSON.stringify(actObj.activePoint)) {
|
|
4155
|
+
i = index;
|
|
4156
|
+
break;
|
|
4157
|
+
}
|
|
4158
|
+
else {
|
|
4159
|
+
if (this.isTouch || parent.cursor === 'move' ||
|
|
4160
|
+
parent.cursor === 'grab' || this.isShapeInserted) {
|
|
4161
|
+
if (diffX === 0 || diffX > x - actObj.activePoint.startX) {
|
|
4162
|
+
diffX = x - parent.objColl[index].activePoint.startX;
|
|
4163
|
+
i = index;
|
|
4164
|
+
}
|
|
4165
|
+
}
|
|
4166
|
+
else if (parent.objColl[index].currIndex === this.tempActiveObj.currIndex) {
|
|
3917
4167
|
i = index;
|
|
3918
4168
|
}
|
|
3919
4169
|
}
|
|
3920
|
-
else if (parent.objColl[index].currIndex === this.tempActiveObj.currIndex) {
|
|
3921
|
-
i = index;
|
|
3922
|
-
}
|
|
3923
4170
|
break;
|
|
3924
4171
|
}
|
|
3925
4172
|
}
|
|
@@ -3927,29 +4174,43 @@ var Selection = /** @class */ (function () {
|
|
|
3927
4174
|
else if (actObj.shape === 'path') {
|
|
3928
4175
|
var cursor_1 = this.setCursorForPath(actObj, x, y, parent.upperCanvas);
|
|
3929
4176
|
if (cursor_1 !== 'default' && cursor_1 !== 'grab') {
|
|
3930
|
-
if (this.
|
|
3931
|
-
|
|
3932
|
-
|
|
4177
|
+
if (this.tempActiveObj && this.tempActiveObj.activePoint &&
|
|
4178
|
+
JSON.stringify(this.tempActiveObj.activePoint) === JSON.stringify(actObj.activePoint)) {
|
|
4179
|
+
i = index;
|
|
4180
|
+
break;
|
|
4181
|
+
}
|
|
4182
|
+
else {
|
|
4183
|
+
if (this.isTouch || parent.cursor === 'move' || parent.cursor === 'grab' || this.isShapeInserted) {
|
|
4184
|
+
if (diffX === 0 || diffX > x - actObj.activePoint.startX) {
|
|
4185
|
+
diffX = x - parent.objColl[index].activePoint.startX;
|
|
4186
|
+
i = index;
|
|
4187
|
+
}
|
|
4188
|
+
}
|
|
4189
|
+
else if (parent.objColl[index].currIndex === this.tempActiveObj.currIndex) {
|
|
3933
4190
|
i = index;
|
|
3934
4191
|
}
|
|
3935
4192
|
}
|
|
3936
|
-
else if (parent.objColl[index].currIndex === this.tempActiveObj.currIndex) {
|
|
3937
|
-
i = index;
|
|
3938
|
-
}
|
|
3939
4193
|
}
|
|
3940
4194
|
}
|
|
3941
4195
|
else if (actObj.rotatedAngle !== 0) {
|
|
3942
4196
|
var cursor_2 = this.setCursorForRotatedObject(actObj, x, y, parent.upperCanvas);
|
|
3943
4197
|
if (cursor_2 !== 'default' && cursor_2 !== 'grab') {
|
|
3944
|
-
if (this.
|
|
3945
|
-
|
|
3946
|
-
|
|
4198
|
+
if (this.tempActiveObj && this.tempActiveObj.activePoint &&
|
|
4199
|
+
JSON.stringify(this.tempActiveObj.activePoint) === JSON.stringify(actObj.activePoint)) {
|
|
4200
|
+
i = index;
|
|
4201
|
+
break;
|
|
4202
|
+
}
|
|
4203
|
+
else {
|
|
4204
|
+
if (this.isTouch || parent.cursor === 'move' || parent.cursor === 'grab' || this.isShapeInserted) {
|
|
4205
|
+
if (diffX === 0 || diffX > x - actObj.activePoint.startX) {
|
|
4206
|
+
diffX = x - parent.objColl[index].activePoint.startX;
|
|
4207
|
+
i = index;
|
|
4208
|
+
}
|
|
4209
|
+
}
|
|
4210
|
+
else if (parent.objColl[index].currIndex === this.tempActiveObj.currIndex) {
|
|
3947
4211
|
i = index;
|
|
3948
4212
|
}
|
|
3949
4213
|
}
|
|
3950
|
-
else if (parent.objColl[index].currIndex === this.tempActiveObj.currIndex) {
|
|
3951
|
-
i = index;
|
|
3952
|
-
}
|
|
3953
4214
|
}
|
|
3954
4215
|
}
|
|
3955
4216
|
else {
|
|
@@ -3963,16 +4224,23 @@ var Selection = /** @class */ (function () {
|
|
|
3963
4224
|
x <= (rotationCirclePoint.x + (actObj.topLeftCircle.radius * 2)) &&
|
|
3964
4225
|
y >= (rotationCirclePoint.y - (actObj.topLeftCircle.radius * 2)) &&
|
|
3965
4226
|
y <= (rotationCirclePoint.y + (actObj.topLeftCircle.radius * 2)))) {
|
|
3966
|
-
if (this.
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
4227
|
+
if (this.tempActiveObj && this.tempActiveObj.activePoint &&
|
|
4228
|
+
JSON.stringify(this.tempActiveObj.activePoint) === JSON.stringify(actObj.activePoint)) {
|
|
4229
|
+
i = index;
|
|
4230
|
+
break;
|
|
4231
|
+
}
|
|
4232
|
+
else {
|
|
4233
|
+
if (this.isTouch || cursor === 'move' || cursor === 'grabbing' || this.isShapeInserted
|
|
4234
|
+
|| parent.cursor === 'move' || parent.cursor === 'grabbing') {
|
|
4235
|
+
if (diffX === 0 || diffX > x - actObj.activePoint.startX) {
|
|
4236
|
+
diffX = x - parent.objColl[index].activePoint.startX;
|
|
4237
|
+
i = index;
|
|
4238
|
+
}
|
|
4239
|
+
}
|
|
4240
|
+
else if (parent.objColl[index].currIndex === this.tempActiveObj.currIndex) {
|
|
3970
4241
|
i = index;
|
|
3971
4242
|
}
|
|
3972
4243
|
}
|
|
3973
|
-
else if (parent.objColl[index].currIndex === this.tempActiveObj.currIndex) {
|
|
3974
|
-
i = index;
|
|
3975
|
-
}
|
|
3976
4244
|
}
|
|
3977
4245
|
}
|
|
3978
4246
|
}
|
|
@@ -3989,8 +4257,7 @@ var Selection = /** @class */ (function () {
|
|
|
3989
4257
|
if (parent.transform.degree === 0) {
|
|
3990
4258
|
var temp_1 = this.lowerContext.filter;
|
|
3991
4259
|
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
3992
|
-
parent.notify('
|
|
3993
|
-
this.lowerContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, parent.img.destLeft, parent.img.destTop, parent.img.destWidth, parent.img.destHeight);
|
|
4260
|
+
parent.notify('draw', { prop: 'drawImage', onPropertyChange: false });
|
|
3994
4261
|
this.lowerContext.filter = 'none';
|
|
3995
4262
|
parent.notify('shape', { prop: 'iterateObjColl', onPropertyChange: false });
|
|
3996
4263
|
parent.activeObj = extend({}, temp_1, {}, true);
|
|
@@ -4009,6 +4276,7 @@ var Selection = /** @class */ (function () {
|
|
|
4009
4276
|
parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
|
|
4010
4277
|
value: { context: this.lowerContext, isSave: null, isFlip: null } });
|
|
4011
4278
|
}
|
|
4279
|
+
parent.activeObj = extend({}, temp, {}, true);
|
|
4012
4280
|
this.setActivePoint();
|
|
4013
4281
|
parent.activeObj = extend({}, temp, {}, true);
|
|
4014
4282
|
var tempStrokeSettings = extend({}, parent.activeObj.strokeSettings, {}, true);
|
|
@@ -4089,6 +4357,10 @@ var Selection = /** @class */ (function () {
|
|
|
4089
4357
|
parent.notify('draw', { prop: 'setPrevActObj', onPropertyChange: false,
|
|
4090
4358
|
value: { prevActObj: extend({}, parent.activeObj, {}, true) } });
|
|
4091
4359
|
}
|
|
4360
|
+
if (parent.activeObj.shape === 'image' && !this.isImageClarity) {
|
|
4361
|
+
this.upgradeImageQuality();
|
|
4362
|
+
this.isImageClarity = true;
|
|
4363
|
+
}
|
|
4092
4364
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj, isCropRatio: null,
|
|
4093
4365
|
points: null, isPreventDrag: true, saveContext: null, isPreventSelection: true } });
|
|
4094
4366
|
if (!this.isShapeInserted) {
|
|
@@ -4107,6 +4379,19 @@ var Selection = /** @class */ (function () {
|
|
|
4107
4379
|
}
|
|
4108
4380
|
}
|
|
4109
4381
|
};
|
|
4382
|
+
Selection.prototype.upgradeImageQuality = function () {
|
|
4383
|
+
var parent = this.parent;
|
|
4384
|
+
var activeObj = extend({}, parent.activeObj, null, true);
|
|
4385
|
+
var ctx = parent.activeObj.imageCanvas.getContext('2d');
|
|
4386
|
+
var dimObj = { width: 0, height: 0 };
|
|
4387
|
+
parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
|
|
4388
|
+
value: { width: parent.activeObj.imageElement.width, height: parent.activeObj.imageElement.height, obj: dimObj, isImgShape: null } });
|
|
4389
|
+
parent.notify('shape', { prop: 'updateObj', onPropertyChange: false, value: { dimObj: dimObj, x: null, y: null } });
|
|
4390
|
+
ctx.clearRect(0, 0, parent.activeObj.imageCanvas.width, parent.activeObj.imageCanvas.height);
|
|
4391
|
+
parent.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
|
|
4392
|
+
value: { ctx: ctx, isImgAnnotation: true, isHFlip: null, isVFlip: null } });
|
|
4393
|
+
parent.activeObj = activeObj;
|
|
4394
|
+
};
|
|
4110
4395
|
// eslint-disable-next-line
|
|
4111
4396
|
Selection.prototype.targetTouches = function (touches) {
|
|
4112
4397
|
var bbox = this.parent.lowerCanvas.getBoundingClientRect();
|
|
@@ -4194,7 +4479,7 @@ var Selection = /** @class */ (function () {
|
|
|
4194
4479
|
this.tempActiveObj = { activePoint: { startX: 0, startY: 0, endX: 0, endY: 0, width: 0, height: 0 },
|
|
4195
4480
|
flipObjColl: [], triangle: [], triangleRatio: [] };
|
|
4196
4481
|
}
|
|
4197
|
-
else if (actObj.shape === 'text' && this.dragElement !== '') {
|
|
4482
|
+
else if ((actObj.shape === 'text' || actObj.shape === 'image') && this.dragElement !== '') {
|
|
4198
4483
|
isInside = true;
|
|
4199
4484
|
}
|
|
4200
4485
|
else if (actObj.shape === 'line' || actObj.shape === 'arrow') {
|
|
@@ -4238,7 +4523,8 @@ var Selection = /** @class */ (function () {
|
|
|
4238
4523
|
parent.objColl.push(extend({}, parent.activeObj, {}, true));
|
|
4239
4524
|
}
|
|
4240
4525
|
if (parent.activeObj.shape === 'text' || (parent.currObjType.shape === 'ellipse' || parent.currObjType.shape === 'rectangle' ||
|
|
4241
|
-
parent.currObjType.shape === 'line' || parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path'
|
|
4526
|
+
parent.currObjType.shape === 'line' || parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path' ||
|
|
4527
|
+
parent.activeObj.shape === 'image')) {
|
|
4242
4528
|
var tempFilter = this.lowerContext.filter;
|
|
4243
4529
|
this.lowerContext.filter = 'brightness(' + 1 + ') ' + 'contrast(' + 100 + '%) ' + 'hue-rotate(' + 0 + 'deg) ' +
|
|
4244
4530
|
'saturate(' + 100 + '%) ' + 'opacity(' + 1 + ') ' + 'blur(' + 0 + 'px) ' + 'sepia(0%) ' + 'grayscale(0%) ' +
|
|
@@ -4452,7 +4738,10 @@ var Selection = /** @class */ (function () {
|
|
|
4452
4738
|
fontSize: parent.activeObj.shape === 'text' ? (parent.activeObj.textSettings ? parent.activeObj.textSettings.fontSize : null) : null,
|
|
4453
4739
|
fontFamily: parent.activeObj.shape === 'text' ? (parent.activeObj.textSettings ? parent.activeObj.textSettings.fontFamily : null) : null,
|
|
4454
4740
|
fontStyle: parent.activeObj.shape === 'text' ? fontStyle : null,
|
|
4455
|
-
color: parent.activeObj.shape === 'text' ? (parent.activeObj.strokeSettings ? parent.activeObj.strokeSettings.strokeColor : null) : null
|
|
4741
|
+
color: parent.activeObj.shape === 'text' ? (parent.activeObj.strokeSettings ? parent.activeObj.strokeSettings.strokeColor : null) : null,
|
|
4742
|
+
degree: parent.activeObj.shape === 'ellipse' || parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'image' ?
|
|
4743
|
+
parent.activeObj.rotatedAngle * (180 / Math.PI) : null,
|
|
4744
|
+
imageData: parent.activeObj.shape === 'image' ? parent.activeObj.imageElement.src : null
|
|
4456
4745
|
};
|
|
4457
4746
|
if (obj) {
|
|
4458
4747
|
obj['shapeSettingsObj'] = shapeSettingsObj;
|
|
@@ -4549,6 +4838,31 @@ var Selection = /** @class */ (function () {
|
|
|
4549
4838
|
}
|
|
4550
4839
|
return rotationCirclePoint;
|
|
4551
4840
|
};
|
|
4841
|
+
Selection.prototype.getNumTextValue = function (obj) {
|
|
4842
|
+
var height;
|
|
4843
|
+
var width;
|
|
4844
|
+
var widthElement;
|
|
4845
|
+
var heightElement;
|
|
4846
|
+
if (!isBlazor()) {
|
|
4847
|
+
widthElement = this.parent.element.querySelector('#' + this.parent.element.id + '_resizeWidth');
|
|
4848
|
+
heightElement = this.parent.element.querySelector('#' + this.parent.element.id + '_resizeHeight');
|
|
4849
|
+
}
|
|
4850
|
+
else {
|
|
4851
|
+
widthElement = this.parent.element.querySelector('.e-ie-toolbar-e-resize-width-input .e-numerictextbox');
|
|
4852
|
+
heightElement = this.parent.element.querySelector('.e-ie-toolbar-e-resize-height-input .e-numerictextbox');
|
|
4853
|
+
}
|
|
4854
|
+
if (widthElement && heightElement) {
|
|
4855
|
+
var heightString = heightElement.value.replace(/,/g, '');
|
|
4856
|
+
var widthString = widthElement.value.replace(/,/g, '');
|
|
4857
|
+
height = parseFloat(heightString);
|
|
4858
|
+
width = parseFloat(widthString);
|
|
4859
|
+
}
|
|
4860
|
+
if (obj) {
|
|
4861
|
+
obj['width'] = width;
|
|
4862
|
+
obj['height'] = height;
|
|
4863
|
+
}
|
|
4864
|
+
return { x: width, y: height };
|
|
4865
|
+
};
|
|
4552
4866
|
return Selection;
|
|
4553
4867
|
}());
|
|
4554
4868
|
export { Selection };
|