@syncfusion/ej2-image-editor 29.2.4 → 30.1.37

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.
Files changed (95) hide show
  1. package/.eslintrc.json +2 -0
  2. package/dist/ej2-image-editor.umd.min.js +2 -2
  3. package/dist/ej2-image-editor.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-image-editor.es2015.js +884 -225
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +906 -235
  7. package/dist/es6/ej2-image-editor.es5.js.map +1 -1
  8. package/dist/global/ej2-image-editor.min.js +2 -2
  9. package/dist/global/ej2-image-editor.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/package.json +15 -47
  12. package/src/image-editor/action/crop.js +1 -1
  13. package/src/image-editor/action/draw.d.ts +1 -0
  14. package/src/image-editor/action/draw.js +103 -31
  15. package/src/image-editor/action/export.js +3 -0
  16. package/src/image-editor/action/selection.d.ts +1 -0
  17. package/src/image-editor/action/selection.js +39 -4
  18. package/src/image-editor/action/shape.d.ts +1 -0
  19. package/src/image-editor/action/shape.js +334 -49
  20. package/src/image-editor/action/transform.js +51 -43
  21. package/src/image-editor/action/undo-redo.d.ts +2 -0
  22. package/src/image-editor/action/undo-redo.js +22 -1
  23. package/src/image-editor/base/enum.d.ts +3 -1
  24. package/src/image-editor/base/enum.js +2 -0
  25. package/src/image-editor/base/image-editor.d.ts +13 -2
  26. package/src/image-editor/base/image-editor.js +242 -27
  27. package/src/image-editor/base/interface.d.ts +17 -1
  28. package/src/image-editor/renderer/toolbar.d.ts +2 -0
  29. package/src/image-editor/renderer/toolbar.js +110 -79
  30. package/styles/bds-lite.css +4 -0
  31. package/styles/bds.css +8 -0
  32. package/styles/bootstrap-dark-lite.css +4 -0
  33. package/styles/bootstrap-dark.css +4 -0
  34. package/styles/bootstrap-lite.css +4 -0
  35. package/styles/bootstrap.css +4 -0
  36. package/styles/bootstrap4-lite.css +4 -0
  37. package/styles/bootstrap4.css +4 -0
  38. package/styles/bootstrap5-dark-lite.css +4 -0
  39. package/styles/bootstrap5-dark.css +4 -0
  40. package/styles/bootstrap5-lite.css +4 -0
  41. package/styles/bootstrap5.3-lite.css +4 -0
  42. package/styles/bootstrap5.3.css +4 -0
  43. package/styles/bootstrap5.css +4 -0
  44. package/styles/fabric-dark-lite.css +4 -0
  45. package/styles/fabric-dark.css +19 -0
  46. package/styles/fabric-lite.css +4 -0
  47. package/styles/fabric.css +19 -0
  48. package/styles/fluent-dark-lite.css +4 -0
  49. package/styles/fluent-dark.css +13 -0
  50. package/styles/fluent-lite.css +4 -0
  51. package/styles/fluent.css +13 -0
  52. package/styles/fluent2-lite.css +8 -0
  53. package/styles/fluent2.css +12 -0
  54. package/styles/highcontrast-light-lite.css +4 -0
  55. package/styles/highcontrast-light.css +4 -0
  56. package/styles/highcontrast-lite.css +9 -1
  57. package/styles/highcontrast.css +14 -1
  58. package/styles/image-editor/_bigger.scss +56 -0
  59. package/styles/image-editor/_highcontrast-definition.scss +1 -1
  60. package/styles/image-editor/_layout.scss +36 -0
  61. package/styles/image-editor/bds.css +8 -0
  62. package/styles/image-editor/bootstrap-dark.css +4 -0
  63. package/styles/image-editor/bootstrap.css +4 -0
  64. package/styles/image-editor/bootstrap4.css +4 -0
  65. package/styles/image-editor/bootstrap5-dark.css +4 -0
  66. package/styles/image-editor/bootstrap5.3.css +4 -0
  67. package/styles/image-editor/bootstrap5.css +4 -0
  68. package/styles/image-editor/fabric-dark.css +19 -0
  69. package/styles/image-editor/fabric.css +19 -0
  70. package/styles/image-editor/fluent-dark.css +13 -0
  71. package/styles/image-editor/fluent.css +13 -0
  72. package/styles/image-editor/fluent2.css +12 -0
  73. package/styles/image-editor/highcontrast-light.css +4 -0
  74. package/styles/image-editor/highcontrast.css +14 -1
  75. package/styles/image-editor/material-dark.css +4 -0
  76. package/styles/image-editor/material.css +8 -0
  77. package/styles/image-editor/material3-dark.css +21 -1
  78. package/styles/image-editor/material3.css +21 -1
  79. package/styles/image-editor/tailwind-dark.css +8 -0
  80. package/styles/image-editor/tailwind.css +8 -0
  81. package/styles/image-editor/tailwind3.css +4 -0
  82. package/styles/material-dark-lite.css +4 -0
  83. package/styles/material-dark.css +4 -0
  84. package/styles/material-lite.css +4 -0
  85. package/styles/material.css +8 -0
  86. package/styles/material3-dark-lite.css +12 -0
  87. package/styles/material3-dark.css +21 -1
  88. package/styles/material3-lite.css +12 -0
  89. package/styles/material3.css +21 -1
  90. package/styles/tailwind-dark-lite.css +4 -0
  91. package/styles/tailwind-dark.css +8 -0
  92. package/styles/tailwind-lite.css +4 -0
  93. package/styles/tailwind.css +8 -0
  94. package/styles/tailwind3-lite.css +4 -0
  95. package/styles/tailwind3.css +4 -0
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 29.2.4
3
+ * version : 30.1.37
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
- "_from": "@syncfusion/ej2-image-editor@*",
3
- "_id": "@syncfusion/ej2-image-editor@29.1.38",
4
- "_inBundle": false,
5
- "_integrity": "sha512-f6lymCLrcFDJ3lvUoEp+l8EPQlCF3qeIfqbENVxkd7hqZ7hA6BXe5ehfn83QKZ4klccXIge26HGcc3kYQT9qng==",
6
- "_location": "/@syncfusion/ej2-image-editor",
7
- "_phantomChildren": {},
8
- "_requested": {
9
- "type": "range",
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.1.38.tgz",
27
- "_shasum": "9621a0d2572d12d45fd2571637400702426145b6",
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.37",
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": "~29.2.4",
36
- "@syncfusion/ej2-buttons": "~29.2.4",
37
- "@syncfusion/ej2-dropdowns": "~29.2.4",
38
- "@syncfusion/ej2-inputs": "~29.2.4",
39
- "@syncfusion/ej2-navigations": "~29.2.4",
40
- "@syncfusion/ej2-popups": "~29.2.4",
41
- "@syncfusion/ej2-splitbuttons": "~29.2.4"
11
+ "@syncfusion/ej2-base": "~30.1.37",
12
+ "@syncfusion/ej2-buttons": "~30.1.37",
13
+ "@syncfusion/ej2-dropdowns": "~30.1.37",
14
+ "@syncfusion/ej2-inputs": "~30.1.37",
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.4",
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 + 1) / 2,
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 });
@@ -98,6 +98,7 @@ export declare class Draw {
98
98
  private arrowBar;
99
99
  private shapeImage;
100
100
  private shapeText;
101
+ private drawTextDecoration;
101
102
  private updateActPoint;
102
103
  private rotateImage;
103
104
  private rotateText;
@@ -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.85) + (i * lineHeight);
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 - (height * 0.1);
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 - (width * 0.1);
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 + 1) / 2;
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.baseImgCanvas.width = parent.baseImg.width;
2616
- parent.baseImgCanvas.height = parent.baseImg.height;
2617
- parent.baseImgCanvas.getContext('2d').drawImage(parent.baseImg, 0, 0);
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 + 1) / 2;
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 + 1) / 2;
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 + 1) / 2;
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, contentLength, imageSizeMB, ex_1;
3966
- return __generator(this, function (_a) {
3967
- switch (_a.label) {
4011
+ var response, isBlob, imageSizeMB, _a, ex_1;
4012
+ return __generator(this, function (_b) {
4013
+ switch (_b.label) {
3968
4014
  case 0:
3969
- _a.trys.push([0, 2, , 3]);
3970
- return [4 /*yield*/, fetch(imageUrl, { method: 'HEAD' })];
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 = _a.sent();
3973
- contentLength = parseInt(response.headers.get('content-length') || '0', 10);
3974
- imageSizeMB = contentLength;
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
- ex_1 = _a.sent();
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*/, 3];
3982
- case 3: return [2 /*return*/];
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 + 1) / 2) - (currObj.activePoint.startY +
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 = parent.baseImg.width;
5094
- var height = parent.baseImg.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 () {
@@ -53,6 +53,7 @@ export declare class Selection {
53
53
  private isMouseUp;
54
54
  private mouseWheel;
55
55
  private isTransformedShape;
56
+ private mouseClickPoint;
56
57
  constructor(parent: ImageEditor);
57
58
  destroy(): void;
58
59
  private addEventListener;
@@ -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, strokeColor: 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;
@@ -2460,7 +2463,7 @@ var Selection = /** @class */ (function () {
2460
2463
  var width_2 = this.upperContext.measureText(parent.activeObj.textSettings.text).width +
2461
2464
  parent.activeObj.textSettings.fontSize * 0.5;
2462
2465
  actPoint.endX = actPoint.startX + width_2;
2463
- actPoint.endY = actPoint.startY + parent.activeObj.textSettings.fontSize;
2466
+ actPoint.endY = actPoint.startY + (parent.activeObj.textSettings.fontSize * 1.18);
2464
2467
  actPoint.width = actPoint.endX - actPoint.startX;
2465
2468
  actPoint.height = actPoint.endY - actPoint.startY;
2466
2469
  tempActiveObj = extend({}, parent.activeObj, null, true);
@@ -3264,6 +3267,7 @@ var Selection = /** @class */ (function () {
3264
3267
  var activePoint = parent.activeObj.activePoint;
3265
3268
  var x = imageEditorClickEventArgs.point.x;
3266
3269
  var y = imageEditorClickEventArgs.point.y;
3270
+ this.mouseClickPoint = { x: x, y: y };
3267
3271
  var cursor = parent.activeObj.shape && parent.activeObj.shape === 'text' ?
3268
3272
  parent.cursor : 'default';
3269
3273
  var tempCursor = parent.upperCanvas.style.cursor;
@@ -3314,7 +3318,7 @@ var Selection = /** @class */ (function () {
3314
3318
  value: { isTextBox: null } });
3315
3319
  var width = this.upperContext.measureText(parent.activeObj.textSettings.text).width + parent.activeObj.textSettings.fontSize * 0.5;
3316
3320
  activePoint.endX = activePoint.startX + width;
3317
- activePoint.endY = activePoint.startY + parent.activeObj.textSettings.fontSize;
3321
+ activePoint.endY = activePoint.startY + (parent.activeObj.textSettings.fontSize * 1.18);
3318
3322
  activePoint.width = activePoint.endX - activePoint.startX;
3319
3323
  activePoint.height = activePoint.endY - activePoint.startY;
3320
3324
  }
@@ -3743,6 +3747,12 @@ var Selection = /** @class */ (function () {
3743
3747
  var bbox = parent.lowerCanvas.getBoundingClientRect();
3744
3748
  x -= bbox.left;
3745
3749
  y -= bbox.top;
3750
+ if (parent.drawingShape === 'text' && this.mouseDownPoint && this.mouseDownPoint.x === x && this.mouseDownPoint.y === y) {
3751
+ parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
3752
+ if (!parent.activeObj.keyHistory) {
3753
+ parent.activeObj.keyHistory = 'Enter Text';
3754
+ }
3755
+ }
3746
3756
  var activeObjShape = void 0;
3747
3757
  var currentDrawingShape = this.currentDrawingShape;
3748
3758
  var dummyClick = false;
@@ -3920,6 +3930,12 @@ var Selection = /** @class */ (function () {
3920
3930
  }
3921
3931
  }
3922
3932
  if (!isCropSelection_1) {
3933
+ var isDummyClick = false;
3934
+ if (Math.round(x) === Math.round(this.mouseClickPoint.x) && Math.round(y) ===
3935
+ Math.round(this.mouseClickPoint.y)) {
3936
+ isDummyClick = true;
3937
+ parent.notify('undo-redo', { prop: 'preventApplyEditComplete', value: { bool: true } });
3938
+ }
3923
3939
  this.adjustActObjForLineArrow();
3924
3940
  if (parent.isShapeDrawing) {
3925
3941
  var temp = this.currentDrawingShape;
@@ -3929,6 +3945,9 @@ var Selection = /** @class */ (function () {
3929
3945
  else {
3930
3946
  parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
3931
3947
  }
3948
+ if (isDummyClick) {
3949
+ parent.notify('undo-redo', { prop: 'preventApplyEditComplete', value: { bool: false } });
3950
+ }
3932
3951
  }
3933
3952
  }
3934
3953
  }
@@ -3992,6 +4011,7 @@ var Selection = /** @class */ (function () {
3992
4011
  parent.notify('freehand-draw', { prop: 'resetSelPoints', onPropertyChange: false });
3993
4012
  }
3994
4013
  this.isMouseUp = false;
4014
+ this.mouseClickPoint = { x: 0, y: 0 };
3995
4015
  };
3996
4016
  Selection.prototype.adjustActObjForLineArrow = function (obj) {
3997
4017
  var isAdjusted = false;
@@ -4273,7 +4293,8 @@ var Selection = /** @class */ (function () {
4273
4293
  (obj.textSettings && Math.round(obj.textSettings.fontRatio) !== Math.round(this.tempActiveObj.textSettings.fontRatio)) ||
4274
4294
  (obj.textSettings && obj.textSettings.bold !== this.tempActiveObj.textSettings.bold) ||
4275
4295
  (obj.textSettings && obj.textSettings.italic !== this.tempActiveObj.textSettings.italic) ||
4276
- (obj.textSettings && obj.textSettings.underline !== this.tempActiveObj.textSettings.underline)) {
4296
+ (obj.textSettings && obj.textSettings.underline !== this.tempActiveObj.textSettings.underline) ||
4297
+ (obj.textSettings && obj.textSettings.strikethrough !== this.tempActiveObj.textSettings.strikethrough)) {
4277
4298
  isApply = true;
4278
4299
  }
4279
4300
  if (this.isInitialTextEdited && !isApply) {
@@ -5317,6 +5338,17 @@ var Selection = /** @class */ (function () {
5317
5338
  else {
5318
5339
  parent.activeObj.textSettings.italic = false;
5319
5340
  }
5341
+ parent.activeObj.textSettings.underline = parent.activeObj.textSettings.strikethrough = false;
5342
+ if (parent.textArea.style.textDecoration === 'underline line-through') {
5343
+ parent.activeObj.textSettings.underline = true;
5344
+ parent.activeObj.textSettings.strikethrough = true;
5345
+ }
5346
+ else if (parent.textArea.style.textDecoration === 'underline') {
5347
+ parent.activeObj.textSettings.underline = true;
5348
+ }
5349
+ else if (parent.textArea.style.textDecoration === 'line-through') {
5350
+ parent.activeObj.textSettings.strikethrough = true;
5351
+ }
5320
5352
  parent.activeObj.textSettings.fontSize = (parseFloat(parent.textArea.style.fontSize));
5321
5353
  };
5322
5354
  Selection.prototype.rgbToHex = function (r, g, b, a) {
@@ -5468,6 +5500,9 @@ var Selection = /** @class */ (function () {
5468
5500
  if (parent.activeObj.textSettings.underline) {
5469
5501
  fontStyle.push('underline');
5470
5502
  }
5503
+ if (parent.activeObj.textSettings.strikethrough) {
5504
+ fontStyle.push('strikethrough');
5505
+ }
5471
5506
  }
5472
5507
  var _a = parent.activeObj.activePoint, startX = _a.startX, startY = _a.startY, endX = _a.endX, endY = _a.endY, width = _a.width, height = _a.height;
5473
5508
  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;
@@ -84,6 +84,7 @@ export declare class Shape {
84
84
  private panObjColl;
85
85
  private updateFontStyles;
86
86
  private applyFontStyle;
87
+ private getFontStyleArray;
87
88
  private updateFontStyle;
88
89
  private updateArrowRatio;
89
90
  private updateArrowSize;