@syncfusion/ej2-image-editor 29.2.5 → 30.1.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +2 -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 +898 -227
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +920 -237
- 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 +15 -47
- package/src/image-editor/action/crop.js +1 -1
- package/src/image-editor/action/draw.d.ts +1 -0
- package/src/image-editor/action/draw.js +103 -31
- package/src/image-editor/action/export.js +3 -0
- package/src/image-editor/action/selection.d.ts +1 -0
- package/src/image-editor/action/selection.js +43 -5
- package/src/image-editor/action/shape.d.ts +1 -0
- package/src/image-editor/action/shape.js +334 -49
- package/src/image-editor/action/transform.js +50 -43
- package/src/image-editor/action/undo-redo.d.ts +2 -0
- package/src/image-editor/action/undo-redo.js +22 -1
- package/src/image-editor/base/enum.d.ts +3 -1
- package/src/image-editor/base/enum.js +2 -0
- package/src/image-editor/base/image-editor.d.ts +13 -2
- package/src/image-editor/base/image-editor.js +242 -27
- package/src/image-editor/base/interface.d.ts +17 -1
- package/src/image-editor/renderer/toolbar.d.ts +2 -0
- package/src/image-editor/renderer/toolbar.js +121 -80
- package/styles/bds-lite.css +4 -0
- package/styles/bds.css +8 -0
- package/styles/bootstrap-dark-lite.css +4 -0
- package/styles/bootstrap-dark.css +4 -0
- package/styles/bootstrap-lite.css +4 -0
- package/styles/bootstrap.css +4 -0
- package/styles/bootstrap4-lite.css +4 -0
- package/styles/bootstrap4.css +4 -0
- package/styles/bootstrap5-dark-lite.css +4 -0
- package/styles/bootstrap5-dark.css +4 -0
- package/styles/bootstrap5-lite.css +4 -0
- package/styles/bootstrap5.3-lite.css +4 -0
- package/styles/bootstrap5.3.css +4 -0
- package/styles/bootstrap5.css +4 -0
- package/styles/fabric-dark-lite.css +4 -0
- package/styles/fabric-dark.css +19 -0
- package/styles/fabric-lite.css +4 -0
- package/styles/fabric.css +19 -0
- package/styles/fluent-dark-lite.css +4 -0
- package/styles/fluent-dark.css +13 -0
- package/styles/fluent-lite.css +4 -0
- package/styles/fluent.css +13 -0
- package/styles/fluent2-lite.css +8 -0
- package/styles/fluent2.css +12 -0
- package/styles/highcontrast-light-lite.css +4 -0
- package/styles/highcontrast-light.css +4 -0
- package/styles/highcontrast-lite.css +9 -1
- package/styles/highcontrast.css +14 -1
- package/styles/image-editor/_bigger.scss +56 -0
- package/styles/image-editor/_highcontrast-definition.scss +1 -1
- package/styles/image-editor/_layout.scss +39 -0
- package/styles/image-editor/bds.css +8 -0
- package/styles/image-editor/bootstrap-dark.css +4 -0
- package/styles/image-editor/bootstrap.css +4 -0
- package/styles/image-editor/bootstrap4.css +4 -0
- package/styles/image-editor/bootstrap5-dark.css +4 -0
- package/styles/image-editor/bootstrap5.3.css +4 -0
- package/styles/image-editor/bootstrap5.css +4 -0
- package/styles/image-editor/fabric-dark.css +19 -0
- package/styles/image-editor/fabric.css +19 -0
- package/styles/image-editor/fluent-dark.css +13 -0
- package/styles/image-editor/fluent.css +13 -0
- package/styles/image-editor/fluent2.css +12 -0
- package/styles/image-editor/highcontrast-light.css +4 -0
- package/styles/image-editor/highcontrast.css +14 -1
- package/styles/image-editor/material-dark.css +4 -0
- package/styles/image-editor/material.css +8 -0
- package/styles/image-editor/material3-dark.css +24 -1
- package/styles/image-editor/material3.css +24 -1
- package/styles/image-editor/tailwind-dark.css +8 -0
- package/styles/image-editor/tailwind.css +8 -0
- package/styles/image-editor/tailwind3.css +4 -0
- package/styles/material-dark-lite.css +4 -0
- package/styles/material-dark.css +4 -0
- package/styles/material-lite.css +4 -0
- package/styles/material.css +8 -0
- package/styles/material3-dark-lite.css +15 -0
- package/styles/material3-dark.css +24 -1
- package/styles/material3-lite.css +15 -0
- package/styles/material3.css +24 -1
- package/styles/tailwind-dark-lite.css +4 -0
- package/styles/tailwind-dark.css +8 -0
- package/styles/tailwind-lite.css +4 -0
- package/styles/tailwind.css +8 -0
- package/styles/tailwind3-lite.css +4 -0
- package/styles/tailwind3.css +4 -0
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version :
|
|
3
|
+
* version : 30.1.38
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2024. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
package/package.json
CHANGED
|
@@ -1,49 +1,22 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
"registry": true,
|
|
11
|
-
"raw": "@syncfusion/ej2-image-editor@*",
|
|
12
|
-
"name": "@syncfusion/ej2-image-editor",
|
|
13
|
-
"escapedName": "@syncfusion%2fej2-image-editor",
|
|
14
|
-
"scope": "@syncfusion",
|
|
15
|
-
"rawSpec": "*",
|
|
16
|
-
"saveSpec": null,
|
|
17
|
-
"fetchSpec": "*"
|
|
18
|
-
},
|
|
19
|
-
"_requiredBy": [
|
|
20
|
-
"/",
|
|
21
|
-
"/@syncfusion/ej2",
|
|
22
|
-
"/@syncfusion/ej2-angular-image-editor",
|
|
23
|
-
"/@syncfusion/ej2-react-image-editor",
|
|
24
|
-
"/@syncfusion/ej2-vue-image-editor"
|
|
25
|
-
],
|
|
26
|
-
"_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-image-editor/-/ej2-image-editor-29.2.4.tgz",
|
|
27
|
-
"_shasum": "66450f7daa2da9e5ad610c2d891b093d4a2c913f",
|
|
28
|
-
"_spec": "@syncfusion/ej2-image-editor@*",
|
|
29
|
-
"_where": "/jenkins/workspace/elease-automation_release_29.1.1/packages/included",
|
|
30
|
-
"author": {
|
|
31
|
-
"name": "Syncfusion Inc."
|
|
32
|
-
},
|
|
33
|
-
"bundleDependencies": false,
|
|
2
|
+
"name": "@syncfusion/ej2-image-editor",
|
|
3
|
+
"version": "30.1.38",
|
|
4
|
+
"description": "Essential JS 2 ImageEditor",
|
|
5
|
+
"author": "Syncfusion Inc.",
|
|
6
|
+
"license": "SEE LICENSE IN license",
|
|
7
|
+
"main": "./dist/ej2-image-editor.umd.min.js",
|
|
8
|
+
"module": "./index.js",
|
|
9
|
+
"es2015": "./dist/es6/ej2-image-editor.es5.js",
|
|
34
10
|
"dependencies": {
|
|
35
|
-
"@syncfusion/ej2-base": "~
|
|
36
|
-
"@syncfusion/ej2-buttons": "~
|
|
37
|
-
"@syncfusion/ej2-dropdowns": "~
|
|
38
|
-
"@syncfusion/ej2-inputs": "~
|
|
39
|
-
"@syncfusion/ej2-navigations": "~
|
|
40
|
-
"@syncfusion/ej2-popups": "~
|
|
41
|
-
"@syncfusion/ej2-splitbuttons": "~
|
|
11
|
+
"@syncfusion/ej2-base": "~30.1.38",
|
|
12
|
+
"@syncfusion/ej2-buttons": "~30.1.37",
|
|
13
|
+
"@syncfusion/ej2-dropdowns": "~30.1.37",
|
|
14
|
+
"@syncfusion/ej2-inputs": "~30.1.38",
|
|
15
|
+
"@syncfusion/ej2-navigations": "~30.1.37",
|
|
16
|
+
"@syncfusion/ej2-popups": "~30.1.37",
|
|
17
|
+
"@syncfusion/ej2-splitbuttons": "~30.1.37"
|
|
42
18
|
},
|
|
43
|
-
"deprecated": false,
|
|
44
|
-
"description": "Essential JS 2 ImageEditor",
|
|
45
19
|
"devDependencies": {},
|
|
46
|
-
"es2015": "./dist/es6/ej2-image-editor.es5.js",
|
|
47
20
|
"keywords": [
|
|
48
21
|
"ej2",
|
|
49
22
|
"syncfusion",
|
|
@@ -59,16 +32,11 @@
|
|
|
59
32
|
"web image editor",
|
|
60
33
|
"image editing software"
|
|
61
34
|
],
|
|
62
|
-
"license": "SEE LICENSE IN license",
|
|
63
|
-
"main": "./dist/ej2-image-editor.umd.min.js",
|
|
64
|
-
"module": "./index.js",
|
|
65
|
-
"name": "@syncfusion/ej2-image-editor",
|
|
66
35
|
"repository": {
|
|
67
36
|
"type": "git",
|
|
68
37
|
"url": "https://github.com/syncfusion/ej2-javascript-ui-controls/tree/master/controls/imageeditor"
|
|
69
38
|
},
|
|
70
39
|
"typings": "index.d.ts",
|
|
71
|
-
"version": "29.2.5",
|
|
72
40
|
"sideEffects": false,
|
|
73
41
|
"homepage": "https://www.syncfusion.com/javascript-ui-controls"
|
|
74
42
|
}
|
|
@@ -165,7 +165,7 @@ var Crop = /** @class */ (function () {
|
|
|
165
165
|
srcTop: (actPoint.startY * ratio.height) - (img.destTop * ratio.height),
|
|
166
166
|
srcWidth: (actPoint.width * ratio.width), srcHeight: (actPoint.height * ratio.height),
|
|
167
167
|
destLeft: (parent.lowerCanvas.clientWidth - maxDimension.width) / 2,
|
|
168
|
-
destTop: (parent.lowerCanvas.clientHeight - maxDimension.height
|
|
168
|
+
destTop: (parent.lowerCanvas.clientHeight - maxDimension.height) / 2,
|
|
169
169
|
destWidth: maxDimension.width, destHeight: maxDimension.height };
|
|
170
170
|
var temp = this.lowerContext.filter;
|
|
171
171
|
parent.notify('draw', { prop: 'drawImage', onPropertyChange: false });
|
|
@@ -36,6 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
/* eslint-disable no-constant-condition */
|
|
37
37
|
/* eslint-disable radix */
|
|
38
38
|
import { extend, isNullOrUndefined, Browser, getComponent } from '@syncfusion/ej2-base';
|
|
39
|
+
import { FileType } from '../index';
|
|
39
40
|
import { Dialog, hideSpinner, showSpinner } from '@syncfusion/ej2-popups';
|
|
40
41
|
var Draw = /** @class */ (function () {
|
|
41
42
|
function Draw(parent) {
|
|
@@ -45,7 +46,7 @@ var Draw = /** @class */ (function () {
|
|
|
45
46
|
this.isShapeTextInserted = false;
|
|
46
47
|
this.isRotateZoom = false; // To restore zoomed image on selection crop selection
|
|
47
48
|
this.tempStrokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null, outlineColor: '', radius: null, outlineWidth: null }; // restore stroke settings on cancel
|
|
48
|
-
this.tempTextSettings = { text: 'Enter Text', fontFamily: '', fontSize: null, fontRatio: null, bold: false, italic: false, underline: false }; // restore text settings on cancel
|
|
49
|
+
this.tempTextSettings = { text: 'Enter Text', fontFamily: '', fontSize: null, fontRatio: null, bold: false, italic: false, underline: false, strikethrough: false }; // restore text settings on cancel
|
|
49
50
|
this.tempAdjValue = ''; // for temp internal slider value
|
|
50
51
|
this.tempFilter = ''; // restore filter style on cancel
|
|
51
52
|
this.tempUndoRedoStep = 0;
|
|
@@ -391,7 +392,7 @@ var Draw = /** @class */ (function () {
|
|
|
391
392
|
this.tempAdjValue = '';
|
|
392
393
|
this.tempStrokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null, radius: null, outlineColor: '', outlineWidth: null };
|
|
393
394
|
this.tempTextSettings =
|
|
394
|
-
{ text: 'Enter Text', fontFamily: this.parent.fontFamily.default, fontSize: null, fontRatio: null, bold: false, italic: false, underline: false };
|
|
395
|
+
{ text: 'Enter Text', fontFamily: this.parent.fontFamily.default, fontSize: null, fontRatio: null, bold: false, italic: false, underline: false, strikethrough: false };
|
|
395
396
|
this.tempUndoRedoStep = this.tempFreehandCounter = this.tempCurrFhdIndex = 0;
|
|
396
397
|
this.tempZoomFactor = null;
|
|
397
398
|
this.isCancelAction = false;
|
|
@@ -1988,7 +1989,7 @@ var Draw = /** @class */ (function () {
|
|
|
1988
1989
|
var actObj = parent.activeObj;
|
|
1989
1990
|
var _a = actObj.activePoint, startX = _a.startX, startY = _a.startY, width = _a.width, height = _a.height;
|
|
1990
1991
|
var rows = actObj.keyHistory.split('\n');
|
|
1991
|
-
var _b = actObj.textSettings, fontFamily = _b.fontFamily, bold = _b.bold, italic = _b.italic;
|
|
1992
|
+
var _b = actObj.textSettings, fontFamily = _b.fontFamily, bold = _b.bold, italic = _b.italic, underline = _b.underline, strikethrough = _b.strikethrough;
|
|
1992
1993
|
var fontSize = actObj.textSettings.fontSize;
|
|
1993
1994
|
var lHeight = fontSize + fontSize * 0.25;
|
|
1994
1995
|
var lineHeight = ((lHeight * rows.length) - (fontSize * rows.length)) / rows.length;
|
|
@@ -2002,18 +2003,18 @@ var Draw = /** @class */ (function () {
|
|
|
2002
2003
|
canvasDraw.fillStyle = tempFill;
|
|
2003
2004
|
for (var i = 0; i < rows.length; i++) {
|
|
2004
2005
|
var text = rows[i];
|
|
2005
|
-
var yPoint = ((i + 1) * fontSize * 0.
|
|
2006
|
+
var yPoint = ((i + 1) * fontSize * 0.9) + (i * lineHeight);
|
|
2006
2007
|
if (parent.transform.degree === -360) {
|
|
2007
2008
|
parent.transform.degree = 0;
|
|
2008
2009
|
}
|
|
2009
2010
|
if (parent.transform.degree === 0 || parent.transform.degree === 180) {
|
|
2010
2011
|
if (fontSize > height) {
|
|
2011
|
-
fontSize = actObj.textSettings.fontSize = height
|
|
2012
|
+
fontSize = actObj.textSettings.fontSize = height / 1.18;
|
|
2012
2013
|
}
|
|
2013
2014
|
}
|
|
2014
2015
|
else {
|
|
2015
2016
|
if (fontSize > width) {
|
|
2016
|
-
fontSize = actObj.textSettings.fontSize = width
|
|
2017
|
+
fontSize = actObj.textSettings.fontSize = width / 1.18;
|
|
2017
2018
|
}
|
|
2018
2019
|
}
|
|
2019
2020
|
canvasDraw.strokeStyle = actObj.strokeSettings.outlineColor;
|
|
@@ -2060,6 +2061,14 @@ var Draw = /** @class */ (function () {
|
|
|
2060
2061
|
else {
|
|
2061
2062
|
canvasDraw.strokeText(text, startX + fontSize * 0.1, startY + yPoint);
|
|
2062
2063
|
canvasDraw.fillText(text, startX + fontSize * 0.1, startY + yPoint);
|
|
2064
|
+
if (underline) {
|
|
2065
|
+
var yOffset = yPoint + fontSize * 0.1;
|
|
2066
|
+
this.drawTextDecoration(canvasDraw, text, startX, startY, yOffset, fontSize, 0.1);
|
|
2067
|
+
}
|
|
2068
|
+
if (strikethrough) {
|
|
2069
|
+
var yOffset = yPoint - lineHeight - fontSize * 0.025;
|
|
2070
|
+
this.drawTextDecoration(canvasDraw, text, startX, startY, yOffset, fontSize, 0.1);
|
|
2071
|
+
}
|
|
2063
2072
|
}
|
|
2064
2073
|
canvasDraw.lineWidth = tempWidth;
|
|
2065
2074
|
}
|
|
@@ -2069,6 +2078,19 @@ var Draw = /** @class */ (function () {
|
|
|
2069
2078
|
this.drawOuterSelection(canvasDraw);
|
|
2070
2079
|
}
|
|
2071
2080
|
};
|
|
2081
|
+
Draw.prototype.drawTextDecoration = function (canvasDraw, text, startX, startY, yOffset, fontSize, horizontalPadding) {
|
|
2082
|
+
if (horizontalPadding === void 0) { horizontalPadding = 0.1; }
|
|
2083
|
+
var tempWidth = canvasDraw.lineWidth;
|
|
2084
|
+
var textWidth = canvasDraw.measureText(text).width;
|
|
2085
|
+
canvasDraw.lineWidth = fontSize * 0.1;
|
|
2086
|
+
canvasDraw.beginPath();
|
|
2087
|
+
canvasDraw.moveTo(startX + fontSize * horizontalPadding, startY + yOffset);
|
|
2088
|
+
canvasDraw.lineTo(startX + textWidth + fontSize * horizontalPadding, startY + yOffset);
|
|
2089
|
+
canvasDraw.strokeStyle = canvasDraw.fillStyle;
|
|
2090
|
+
canvasDraw.stroke();
|
|
2091
|
+
canvasDraw.lineWidth = tempWidth;
|
|
2092
|
+
canvasDraw.strokeStyle = this.parent.activeObj.strokeSettings.outlineColor;
|
|
2093
|
+
};
|
|
2072
2094
|
Draw.prototype.updateActPoint = function (degree, canvasDraw) {
|
|
2073
2095
|
var parent = this.parent;
|
|
2074
2096
|
var actObj = parent.activeObj;
|
|
@@ -2319,6 +2341,14 @@ var Draw = /** @class */ (function () {
|
|
|
2319
2341
|
yPoint + (i > 0 ? fontSize * 0.25 : -fontSize * 0.35));
|
|
2320
2342
|
canvasDraw.fillText(text, startX + fontSize * 0.15, startY +
|
|
2321
2343
|
yPoint + (i > 0 ? fontSize * 0.25 : -fontSize * 0.35));
|
|
2344
|
+
if (actObj.textSettings.underline) {
|
|
2345
|
+
var yOffset = yPoint + (i > 0 ? fontSize * 0.35 : -fontSize * 0.25);
|
|
2346
|
+
this.drawTextDecoration(canvasDraw, text, startX, startY, yOffset, fontSize, 0.15);
|
|
2347
|
+
}
|
|
2348
|
+
if (actObj.textSettings.strikethrough) {
|
|
2349
|
+
var yOffset = yPoint - lineHeight + (i > 0 ? -fontSize * 0.04 : -fontSize * 0.64);
|
|
2350
|
+
this.drawTextDecoration(canvasDraw, text, startX, startY, yOffset, fontSize, 0.1);
|
|
2351
|
+
}
|
|
2322
2352
|
}
|
|
2323
2353
|
};
|
|
2324
2354
|
Draw.prototype.clearOuterCanvas = function (context) {
|
|
@@ -2368,7 +2398,7 @@ var Draw = /** @class */ (function () {
|
|
|
2368
2398
|
}
|
|
2369
2399
|
parent.img.destLeft = (parent.lowerCanvas.clientWidth - maxDimension.width) / 2;
|
|
2370
2400
|
if (degree === 0) {
|
|
2371
|
-
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height
|
|
2401
|
+
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height) / 2;
|
|
2372
2402
|
}
|
|
2373
2403
|
else {
|
|
2374
2404
|
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height) / 2;
|
|
@@ -2554,6 +2584,7 @@ var Draw = /** @class */ (function () {
|
|
|
2554
2584
|
var parent = this.parent;
|
|
2555
2585
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
2556
2586
|
var proxy = this;
|
|
2587
|
+
parent.imageLoaded = false;
|
|
2557
2588
|
parent.baseImg.src = src;
|
|
2558
2589
|
parent.baseImg.onload = function () {
|
|
2559
2590
|
parent.imgSrc = src;
|
|
@@ -2598,6 +2629,10 @@ var Draw = /** @class */ (function () {
|
|
|
2598
2629
|
var action = { action: 'file-open', actionEventArgs: fileOpened };
|
|
2599
2630
|
parent.triggerEditCompleteEvent(action);
|
|
2600
2631
|
}
|
|
2632
|
+
if (_this.fileType === 'Bmp') {
|
|
2633
|
+
_this.fileType = FileType.Png;
|
|
2634
|
+
}
|
|
2635
|
+
parent.imageLoaded = true;
|
|
2601
2636
|
};
|
|
2602
2637
|
parent.baseImg.onerror = function () {
|
|
2603
2638
|
hideSpinner(parent.element);
|
|
@@ -2612,9 +2647,20 @@ var Draw = /** @class */ (function () {
|
|
|
2612
2647
|
};
|
|
2613
2648
|
Draw.prototype.updateBaseImgCanvas = function () {
|
|
2614
2649
|
var parent = this.parent;
|
|
2615
|
-
parent.
|
|
2616
|
-
|
|
2617
|
-
|
|
2650
|
+
if (!parent.aspectRatioBaseDimension && parent.imageSettings.width && parent.imageSettings.height) {
|
|
2651
|
+
var widthRatio = parent.baseImg.width / parent.imageSettings.width;
|
|
2652
|
+
var heightRatio = parent.baseImg.height / parent.imageSettings.height;
|
|
2653
|
+
var ratio = (widthRatio + heightRatio) / 2;
|
|
2654
|
+
ratio = ratio < 1 ? 1 : ratio;
|
|
2655
|
+
parent.baseImgCanvas.width = parent.imageSettings.width * ratio;
|
|
2656
|
+
parent.baseImgCanvas.height = parent.imageSettings.height * ratio;
|
|
2657
|
+
parent.baseImgCanvas.getContext('2d').drawImage(parent.baseImg, 0, 0, parent.baseImgCanvas.width, parent.baseImgCanvas.height);
|
|
2658
|
+
}
|
|
2659
|
+
else {
|
|
2660
|
+
parent.baseImgCanvas.width = parent.baseImg.width;
|
|
2661
|
+
parent.baseImgCanvas.height = parent.baseImg.height;
|
|
2662
|
+
parent.baseImgCanvas.getContext('2d').drawImage(parent.baseImg, 0, 0);
|
|
2663
|
+
}
|
|
2618
2664
|
};
|
|
2619
2665
|
Draw.prototype.updateCanvas = function (isCropped, isSameDimension) {
|
|
2620
2666
|
var parent = this.parent;
|
|
@@ -2641,7 +2687,7 @@ var Draw = /** @class */ (function () {
|
|
|
2641
2687
|
value: { width: parent.img.srcWidth, height: parent.img.srcHeight, obj: obj, isImgShape: null } });
|
|
2642
2688
|
var maxDimension = obj;
|
|
2643
2689
|
parent.img.destLeft = (parent.lowerCanvas.clientWidth - maxDimension.width) / 2;
|
|
2644
|
-
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height
|
|
2690
|
+
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height) / 2;
|
|
2645
2691
|
this.drawImgToCanvas(maxDimension);
|
|
2646
2692
|
this.origDim.width = parent.img.destWidth;
|
|
2647
2693
|
this.origDim.height = parent.img.destHeight;
|
|
@@ -2978,7 +3024,7 @@ var Draw = /** @class */ (function () {
|
|
|
2978
3024
|
}
|
|
2979
3025
|
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
2980
3026
|
this.tempTextSettings = { text: 'Enter Text', fontFamily: parent.fontFamily.default, fontSize: null, fontRatio: null, bold: false,
|
|
2981
|
-
italic: false, underline: false };
|
|
3027
|
+
italic: false, underline: false, strikethrough: false };
|
|
2982
3028
|
parent.objColl = extend([], this.tempObjColl, [], true);
|
|
2983
3029
|
parent.pointColl = extend([], this.tempPointColl, [], true);
|
|
2984
3030
|
this.renderImage();
|
|
@@ -3464,7 +3510,7 @@ var Draw = /** @class */ (function () {
|
|
|
3464
3510
|
var parent = this.parent;
|
|
3465
3511
|
if (parent.transform.degree % 90 === 0 && parent.transform.degree % 180 !== 0) {
|
|
3466
3512
|
parent.img.destLeft = (parent.lowerCanvas.clientWidth - parent.img.destHeight) / 2;
|
|
3467
|
-
parent.img.destTop = (parent.lowerCanvas.clientHeight - parent.img.destWidth
|
|
3513
|
+
parent.img.destTop = (parent.lowerCanvas.clientHeight - parent.img.destWidth) / 2;
|
|
3468
3514
|
var temp = parent.img.destWidth;
|
|
3469
3515
|
parent.img.destWidth = parent.img.destHeight;
|
|
3470
3516
|
parent.img.destHeight = temp;
|
|
@@ -3472,7 +3518,7 @@ var Draw = /** @class */ (function () {
|
|
|
3472
3518
|
else {
|
|
3473
3519
|
if (isNullOrUndefined(isPreventDimension)) {
|
|
3474
3520
|
parent.img.destLeft = (parent.lowerCanvas.clientWidth - parent.img.destWidth) / 2;
|
|
3475
|
-
parent.img.destTop = (parent.lowerCanvas.clientHeight - parent.img.destHeight
|
|
3521
|
+
parent.img.destTop = (parent.lowerCanvas.clientHeight - parent.img.destHeight) / 2;
|
|
3476
3522
|
}
|
|
3477
3523
|
}
|
|
3478
3524
|
};
|
|
@@ -3931,7 +3977,7 @@ var Draw = /** @class */ (function () {
|
|
|
3931
3977
|
this.fileType = 'Jpeg';
|
|
3932
3978
|
fileType = 'jpeg';
|
|
3933
3979
|
}
|
|
3934
|
-
if (fileType !== 'jpeg' && fileType !== 'png' && fileType !== 'svg' && fileType !== 'webp') {
|
|
3980
|
+
if (fileType !== 'jpeg' && fileType !== 'png' && fileType !== 'svg' && fileType !== 'webp' && fileType !== 'bmp') {
|
|
3935
3981
|
this.fileType = null;
|
|
3936
3982
|
}
|
|
3937
3983
|
}
|
|
@@ -3962,24 +4008,33 @@ var Draw = /** @class */ (function () {
|
|
|
3962
4008
|
};
|
|
3963
4009
|
Draw.prototype.getImageSizeFromURL = function (imageUrl, callback) {
|
|
3964
4010
|
return __awaiter(this, void 0, void 0, function () {
|
|
3965
|
-
var response,
|
|
3966
|
-
return __generator(this, function (
|
|
3967
|
-
switch (
|
|
4011
|
+
var response, isBlob, imageSizeMB, _a, ex_1;
|
|
4012
|
+
return __generator(this, function (_b) {
|
|
4013
|
+
switch (_b.label) {
|
|
3968
4014
|
case 0:
|
|
3969
|
-
|
|
3970
|
-
|
|
4015
|
+
_b.trys.push([0, 5, , 6]);
|
|
4016
|
+
isBlob = imageUrl.indexOf('blob:') === 0;
|
|
4017
|
+
return [4 /*yield*/, fetch(imageUrl, { method: isBlob ? 'GET' : 'HEAD' })];
|
|
3971
4018
|
case 1:
|
|
3972
|
-
response =
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
callback(imageSizeMB);
|
|
3976
|
-
return [3 /*break*/, 3];
|
|
4019
|
+
response = _b.sent();
|
|
4020
|
+
if (!isBlob) return [3 /*break*/, 3];
|
|
4021
|
+
return [4 /*yield*/, response.blob()];
|
|
3977
4022
|
case 2:
|
|
3978
|
-
|
|
4023
|
+
_a = (_b.sent()).size;
|
|
4024
|
+
return [3 /*break*/, 4];
|
|
4025
|
+
case 3:
|
|
4026
|
+
_a = parseInt(response.headers.get('content-length') || '0', 10);
|
|
4027
|
+
_b.label = 4;
|
|
4028
|
+
case 4:
|
|
4029
|
+
imageSizeMB = _a;
|
|
4030
|
+
callback(imageSizeMB);
|
|
4031
|
+
return [3 /*break*/, 6];
|
|
4032
|
+
case 5:
|
|
4033
|
+
ex_1 = _b.sent();
|
|
3979
4034
|
// eslint-disable-next-line no-console
|
|
3980
4035
|
console.log(ex_1.message);
|
|
3981
|
-
return [3 /*break*/,
|
|
3982
|
-
case
|
|
4036
|
+
return [3 /*break*/, 6];
|
|
4037
|
+
case 6: return [2 /*return*/];
|
|
3983
4038
|
}
|
|
3984
4039
|
});
|
|
3985
4040
|
});
|
|
@@ -4178,6 +4233,8 @@ var Draw = /** @class */ (function () {
|
|
|
4178
4233
|
this.errorLoading();
|
|
4179
4234
|
return;
|
|
4180
4235
|
}
|
|
4236
|
+
parent.imageSettings = { width: null, height: null };
|
|
4237
|
+
parent.aspectRatioBaseDimension = null;
|
|
4181
4238
|
showSpinner(parent.element);
|
|
4182
4239
|
parent.element.style.opacity = '0.5';
|
|
4183
4240
|
this.inputElem = inputElement;
|
|
@@ -4310,7 +4367,7 @@ var Draw = /** @class */ (function () {
|
|
|
4310
4367
|
}
|
|
4311
4368
|
var panX = (parent.lowerCanvas.clientWidth / 2) - (currObj.activePoint.startX +
|
|
4312
4369
|
(currObj.activePoint.width / 2));
|
|
4313
|
-
var panY = ((parent.lowerCanvas.clientHeight
|
|
4370
|
+
var panY = ((parent.lowerCanvas.clientHeight) / 2) - (currObj.activePoint.startY +
|
|
4314
4371
|
(currObj.activePoint.height / 2));
|
|
4315
4372
|
if (isNullOrUndefined(parent.activeObj.shape)) {
|
|
4316
4373
|
parent.activeObj = extend({}, activeObj, {}, true);
|
|
@@ -5090,8 +5147,20 @@ var Draw = /** @class */ (function () {
|
|
|
5090
5147
|
var point = [];
|
|
5091
5148
|
var parent = this.parent;
|
|
5092
5149
|
var degree = parent.transform.degree;
|
|
5093
|
-
var width
|
|
5094
|
-
var height
|
|
5150
|
+
var width;
|
|
5151
|
+
var height;
|
|
5152
|
+
if (!parent.aspectRatioBaseDimension && parent.imageSettings.width && parent.imageSettings.height) {
|
|
5153
|
+
var widthRatio = parent.baseImg.width / parent.imageSettings.width;
|
|
5154
|
+
var heightRatio = parent.baseImg.height / parent.imageSettings.height;
|
|
5155
|
+
var ratio = (widthRatio + heightRatio) / 2;
|
|
5156
|
+
ratio = ratio < 1 ? 1 : ratio;
|
|
5157
|
+
width = parent.imageSettings.width * ratio;
|
|
5158
|
+
height = parent.imageSettings.height * ratio;
|
|
5159
|
+
}
|
|
5160
|
+
else {
|
|
5161
|
+
width = parent.baseImg.width;
|
|
5162
|
+
height = parent.baseImg.height;
|
|
5163
|
+
}
|
|
5095
5164
|
var obj = { dim: null, width: height, height: width, angle: parent.transform.straighten };
|
|
5096
5165
|
obj['dim'] = parent.getRotatedCanvasDim(obj['width'], obj['height'], obj['angle']);
|
|
5097
5166
|
var baseImgCanvasWidth = degree % 90 === 0 && degree % 180 !== 0 ? obj['dim']['width'] : parent.baseImgCanvas.width;
|
|
@@ -5363,6 +5432,9 @@ var Draw = /** @class */ (function () {
|
|
|
5363
5432
|
}
|
|
5364
5433
|
canvasDraw.imageSmoothingEnabled = false;
|
|
5365
5434
|
canvasDraw.drawImage(offscreenCanvas, 0, 0, offscreenCanvas.width, offscreenCanvas.height, startX, startY, width, height);
|
|
5435
|
+
if (this.parent.imageSmoothingEnabled) {
|
|
5436
|
+
canvasDraw.imageSmoothingEnabled = true;
|
|
5437
|
+
}
|
|
5366
5438
|
}
|
|
5367
5439
|
obj.redactImage = this.parent.createElement('canvas');
|
|
5368
5440
|
obj.redactImage.width = offscreenCanvas.width;
|
|
@@ -39,6 +39,9 @@ var Export = /** @class */ (function () {
|
|
|
39
39
|
case 'drawAnnotation':
|
|
40
40
|
this.drawAnnotation(args.value['context'], args.value['ratio']);
|
|
41
41
|
break;
|
|
42
|
+
case 'downScaleImgCanvas':
|
|
43
|
+
this.downScaleImgCanvas(args.value['canvas'], args.value['width'], args.value['height']);
|
|
44
|
+
break;
|
|
42
45
|
}
|
|
43
46
|
};
|
|
44
47
|
Export.prototype.getModuleName = function () {
|
|
@@ -43,6 +43,7 @@ var Selection = /** @class */ (function () {
|
|
|
43
43
|
this.isMouseUp = false;
|
|
44
44
|
this.mouseWheel = 0;
|
|
45
45
|
this.isTransformedShape = false;
|
|
46
|
+
this.mouseClickPoint = { x: 0, y: 0 };
|
|
46
47
|
this.parent = parent;
|
|
47
48
|
this.addEventListener();
|
|
48
49
|
}
|
|
@@ -213,7 +214,8 @@ var Selection = /** @class */ (function () {
|
|
|
213
214
|
parent.activeObj.textSettings.fontSize = 11;
|
|
214
215
|
parent.activeObj.keyHistory = 'Enter Text';
|
|
215
216
|
parent.notify('shape', { prop: 'initializeTextShape', onPropertyChange: false,
|
|
216
|
-
value: { text: null, fontFamily: null, fontSize: null, bold: null, italic: null,
|
|
217
|
+
value: { text: null, fontFamily: null, fontSize: null, bold: null, italic: null,
|
|
218
|
+
underline: null, strikethrough: null, strokeColor: null } });
|
|
217
219
|
}
|
|
218
220
|
else if (args.value['shape'] === 'path') {
|
|
219
221
|
parent.activeObj.pointColl = [];
|
|
@@ -426,6 +428,7 @@ var Selection = /** @class */ (function () {
|
|
|
426
428
|
this.isSliderActive = false;
|
|
427
429
|
this.arrowShape = [ArrowheadType.None, ArrowheadType.SolidArrow];
|
|
428
430
|
this.isMouseDown = this.isMouseUp = this.isTransformedShape = false;
|
|
431
|
+
this.mouseClickPoint = { x: 0, y: 0 };
|
|
429
432
|
};
|
|
430
433
|
Selection.prototype.performTabAction = function () {
|
|
431
434
|
var parent = this.parent;
|
|
@@ -1602,6 +1605,9 @@ var Selection = /** @class */ (function () {
|
|
|
1602
1605
|
endY = destTop + destHeight;
|
|
1603
1606
|
}
|
|
1604
1607
|
}
|
|
1608
|
+
if (actPoint.width < 0 && actPoint.height < 0 && this.isCropSelection) {
|
|
1609
|
+
isLimiting = true;
|
|
1610
|
+
}
|
|
1605
1611
|
if (parent.transform.straighten !== 0) {
|
|
1606
1612
|
var obj = { isIntersect: null, arr: null };
|
|
1607
1613
|
parent.notify('draw', { prop: 'updateImgCanvasPoints', onPropertyChange: false });
|
|
@@ -2345,7 +2351,7 @@ var Selection = /** @class */ (function () {
|
|
|
2345
2351
|
scale = Math.max(width, height);
|
|
2346
2352
|
var newScale = this.getScaleRatio(scale);
|
|
2347
2353
|
actPoint.endX += newScale.x;
|
|
2348
|
-
actPoint.endY += newScale.
|
|
2354
|
+
actPoint.endY += newScale.y;
|
|
2349
2355
|
if (actPoint.endX > (destLeft + destWidth) ||
|
|
2350
2356
|
actPoint.endY > (destTop + destHeight)) {
|
|
2351
2357
|
actPoint.endX -= newScale.x;
|
|
@@ -2460,7 +2466,7 @@ var Selection = /** @class */ (function () {
|
|
|
2460
2466
|
var width_2 = this.upperContext.measureText(parent.activeObj.textSettings.text).width +
|
|
2461
2467
|
parent.activeObj.textSettings.fontSize * 0.5;
|
|
2462
2468
|
actPoint.endX = actPoint.startX + width_2;
|
|
2463
|
-
actPoint.endY = actPoint.startY + parent.activeObj.textSettings.fontSize;
|
|
2469
|
+
actPoint.endY = actPoint.startY + (parent.activeObj.textSettings.fontSize * 1.18);
|
|
2464
2470
|
actPoint.width = actPoint.endX - actPoint.startX;
|
|
2465
2471
|
actPoint.height = actPoint.endY - actPoint.startY;
|
|
2466
2472
|
tempActiveObj = extend({}, parent.activeObj, null, true);
|
|
@@ -3264,6 +3270,7 @@ var Selection = /** @class */ (function () {
|
|
|
3264
3270
|
var activePoint = parent.activeObj.activePoint;
|
|
3265
3271
|
var x = imageEditorClickEventArgs.point.x;
|
|
3266
3272
|
var y = imageEditorClickEventArgs.point.y;
|
|
3273
|
+
this.mouseClickPoint = { x: x, y: y };
|
|
3267
3274
|
var cursor = parent.activeObj.shape && parent.activeObj.shape === 'text' ?
|
|
3268
3275
|
parent.cursor : 'default';
|
|
3269
3276
|
var tempCursor = parent.upperCanvas.style.cursor;
|
|
@@ -3314,7 +3321,7 @@ var Selection = /** @class */ (function () {
|
|
|
3314
3321
|
value: { isTextBox: null } });
|
|
3315
3322
|
var width = this.upperContext.measureText(parent.activeObj.textSettings.text).width + parent.activeObj.textSettings.fontSize * 0.5;
|
|
3316
3323
|
activePoint.endX = activePoint.startX + width;
|
|
3317
|
-
activePoint.endY = activePoint.startY + parent.activeObj.textSettings.fontSize;
|
|
3324
|
+
activePoint.endY = activePoint.startY + (parent.activeObj.textSettings.fontSize * 1.18);
|
|
3318
3325
|
activePoint.width = activePoint.endX - activePoint.startX;
|
|
3319
3326
|
activePoint.height = activePoint.endY - activePoint.startY;
|
|
3320
3327
|
}
|
|
@@ -3743,6 +3750,12 @@ var Selection = /** @class */ (function () {
|
|
|
3743
3750
|
var bbox = parent.lowerCanvas.getBoundingClientRect();
|
|
3744
3751
|
x -= bbox.left;
|
|
3745
3752
|
y -= bbox.top;
|
|
3753
|
+
if (parent.drawingShape === 'text' && this.mouseDownPoint && this.mouseDownPoint.x === x && this.mouseDownPoint.y === y) {
|
|
3754
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
3755
|
+
if (!parent.activeObj.keyHistory) {
|
|
3756
|
+
parent.activeObj.keyHistory = 'Enter Text';
|
|
3757
|
+
}
|
|
3758
|
+
}
|
|
3746
3759
|
var activeObjShape = void 0;
|
|
3747
3760
|
var currentDrawingShape = this.currentDrawingShape;
|
|
3748
3761
|
var dummyClick = false;
|
|
@@ -3920,6 +3933,12 @@ var Selection = /** @class */ (function () {
|
|
|
3920
3933
|
}
|
|
3921
3934
|
}
|
|
3922
3935
|
if (!isCropSelection_1) {
|
|
3936
|
+
var isDummyClick = false;
|
|
3937
|
+
if (Math.round(x) === Math.round(this.mouseClickPoint.x) && Math.round(y) ===
|
|
3938
|
+
Math.round(this.mouseClickPoint.y)) {
|
|
3939
|
+
isDummyClick = true;
|
|
3940
|
+
parent.notify('undo-redo', { prop: 'preventApplyEditComplete', value: { bool: true } });
|
|
3941
|
+
}
|
|
3923
3942
|
this.adjustActObjForLineArrow();
|
|
3924
3943
|
if (parent.isShapeDrawing) {
|
|
3925
3944
|
var temp = this.currentDrawingShape;
|
|
@@ -3929,6 +3948,9 @@ var Selection = /** @class */ (function () {
|
|
|
3929
3948
|
else {
|
|
3930
3949
|
parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
|
|
3931
3950
|
}
|
|
3951
|
+
if (isDummyClick) {
|
|
3952
|
+
parent.notify('undo-redo', { prop: 'preventApplyEditComplete', value: { bool: false } });
|
|
3953
|
+
}
|
|
3932
3954
|
}
|
|
3933
3955
|
}
|
|
3934
3956
|
}
|
|
@@ -3992,6 +4014,7 @@ var Selection = /** @class */ (function () {
|
|
|
3992
4014
|
parent.notify('freehand-draw', { prop: 'resetSelPoints', onPropertyChange: false });
|
|
3993
4015
|
}
|
|
3994
4016
|
this.isMouseUp = false;
|
|
4017
|
+
this.mouseClickPoint = { x: 0, y: 0 };
|
|
3995
4018
|
};
|
|
3996
4019
|
Selection.prototype.adjustActObjForLineArrow = function (obj) {
|
|
3997
4020
|
var isAdjusted = false;
|
|
@@ -4273,7 +4296,8 @@ var Selection = /** @class */ (function () {
|
|
|
4273
4296
|
(obj.textSettings && Math.round(obj.textSettings.fontRatio) !== Math.round(this.tempActiveObj.textSettings.fontRatio)) ||
|
|
4274
4297
|
(obj.textSettings && obj.textSettings.bold !== this.tempActiveObj.textSettings.bold) ||
|
|
4275
4298
|
(obj.textSettings && obj.textSettings.italic !== this.tempActiveObj.textSettings.italic) ||
|
|
4276
|
-
(obj.textSettings && obj.textSettings.underline !== this.tempActiveObj.textSettings.underline)
|
|
4299
|
+
(obj.textSettings && obj.textSettings.underline !== this.tempActiveObj.textSettings.underline) ||
|
|
4300
|
+
(obj.textSettings && obj.textSettings.strikethrough !== this.tempActiveObj.textSettings.strikethrough)) {
|
|
4277
4301
|
isApply = true;
|
|
4278
4302
|
}
|
|
4279
4303
|
if (this.isInitialTextEdited && !isApply) {
|
|
@@ -5317,6 +5341,17 @@ var Selection = /** @class */ (function () {
|
|
|
5317
5341
|
else {
|
|
5318
5342
|
parent.activeObj.textSettings.italic = false;
|
|
5319
5343
|
}
|
|
5344
|
+
parent.activeObj.textSettings.underline = parent.activeObj.textSettings.strikethrough = false;
|
|
5345
|
+
if (parent.textArea.style.textDecoration === 'underline line-through') {
|
|
5346
|
+
parent.activeObj.textSettings.underline = true;
|
|
5347
|
+
parent.activeObj.textSettings.strikethrough = true;
|
|
5348
|
+
}
|
|
5349
|
+
else if (parent.textArea.style.textDecoration === 'underline') {
|
|
5350
|
+
parent.activeObj.textSettings.underline = true;
|
|
5351
|
+
}
|
|
5352
|
+
else if (parent.textArea.style.textDecoration === 'line-through') {
|
|
5353
|
+
parent.activeObj.textSettings.strikethrough = true;
|
|
5354
|
+
}
|
|
5320
5355
|
parent.activeObj.textSettings.fontSize = (parseFloat(parent.textArea.style.fontSize));
|
|
5321
5356
|
};
|
|
5322
5357
|
Selection.prototype.rgbToHex = function (r, g, b, a) {
|
|
@@ -5468,6 +5503,9 @@ var Selection = /** @class */ (function () {
|
|
|
5468
5503
|
if (parent.activeObj.textSettings.underline) {
|
|
5469
5504
|
fontStyle.push('underline');
|
|
5470
5505
|
}
|
|
5506
|
+
if (parent.activeObj.textSettings.strikethrough) {
|
|
5507
|
+
fontStyle.push('strikethrough');
|
|
5508
|
+
}
|
|
5471
5509
|
}
|
|
5472
5510
|
var _a = parent.activeObj.activePoint, startX = _a.startX, startY = _a.startY, endX = _a.endX, endY = _a.endY, width = _a.width, height = _a.height;
|
|
5473
5511
|
var _b = parent.activeObj, keyHistory = _b.keyHistory, currIndex = _b.currIndex, shape = _b.shape, textSettings = _b.textSettings, strokeSettings = _b.strokeSettings, rotatedAngle = _b.rotatedAngle, imageElement = _b.imageElement, opacity = _b.opacity;
|