@syncfusion/ej2-image-editor 20.3.48 → 20.3.56

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.
@@ -1,4 +1,4 @@
1
- import { Browser, Event, EventHandler, L10n, NotifyPropertyChanges, Property, addClass, compile, extend, getComponent, getInstance, getUniqueID, isNullOrUndefined, removeClass } from '@syncfusion/ej2-base';
1
+ import { Browser, Event, EventHandler, L10n, NotifyPropertyChanges, Property, addClass, compile, detach, extend, getComponent, getInstance, getUniqueID, isNullOrUndefined, removeClass, select } from '@syncfusion/ej2-base';
2
2
  import { ColorPicker, SignatureBase, Uploader } from '@syncfusion/ej2-inputs';
3
3
  import { Toolbar } from '@syncfusion/ej2-navigations';
4
4
  import { DropDownButton } from '@syncfusion/ej2-splitbuttons';
@@ -260,6 +260,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
260
260
  if (!this.element.getAttribute('class')) {
261
261
  this.element.removeAttribute('class');
262
262
  }
263
+ this.destroySubComponents();
263
264
  this.unwireEvent();
264
265
  _super.prototype.destroy.call(this);
265
266
  this.element.innerHTML = '';
@@ -326,6 +327,27 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
326
327
  EventHandler.remove(this.lowerCanvas, 'mouseup', this.canvasMouseUpHandler);
327
328
  EventHandler.remove(document, 'mouseup', this.canvasMouseUpHandler);
328
329
  };
330
+ ImageEditor.prototype.destroySubComponents = function () {
331
+ var inputElement = this.element.querySelectorAll('input.e-control');
332
+ var divElement = this.element.querySelectorAll('div.e-control:not(.e-handle)');
333
+ var btnElement = this.element.querySelectorAll('button.e-control');
334
+ for (var i = 0, len = inputElement.length; i < len; i++) {
335
+ if (inputElement[i].classList.contains('e-color-picker')) {
336
+ getComponent(inputElement[i], 'color-picker').destroy();
337
+ detach(select('input#' + inputElement[i].id, this.element));
338
+ }
339
+ }
340
+ for (var i = 0, len = btnElement.length; i < len; i++) {
341
+ if (btnElement[i].classList.contains('e-dropdown-btn')) {
342
+ getComponent(btnElement[i], 'dropdown-btn').destroy();
343
+ detach(select('button#' + btnElement[i].id, this.element));
344
+ }
345
+ else if (btnElement[i].classList.contains('e-btn')) {
346
+ getComponent(btnElement[i], 'btn').destroy();
347
+ detach(select('button#' + btnElement[i].id, this.element));
348
+ }
349
+ }
350
+ };
329
351
  ImageEditor.prototype.updateTheme = function () {
330
352
  if (this.theme !== '') {
331
353
  this.theme = this.toPascalCase(this.theme);
@@ -1055,7 +1077,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
1055
1077
  args.element.parentElement.offsetHeight + 'px';
1056
1078
  }
1057
1079
  var activeBtn = spanElem_1.innerHTML;
1058
- args.element.querySelector('[aria-label = ' + '"' + activeBtn + '"' + ']').classList.add('e-selected-btn');
1080
+ if (activeBtn !== '') {
1081
+ args.element.querySelector('[aria-label = ' + '"' + activeBtn + '"' + ']').classList.add('e-selected-btn');
1082
+ }
1059
1083
  },
1060
1084
  select: function (args) {
1061
1085
  spanElem_1.textContent = args.item.text;
@@ -1671,75 +1695,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
1671
1695
  }
1672
1696
  this.callMainToolbar(false);
1673
1697
  break;
1674
- case 'text':
1675
- this.currObjType.isCustomCrop = false;
1676
- imageEditorObj.drawShapeText();
1677
- this.refreshToolbar(type);
1678
- break;
1679
- case 'pen':
1680
- this.currObjType.isCustomCrop = false;
1681
- this.freeHandDraw(true);
1682
- this.refreshToolbar(type);
1683
- break;
1684
1698
  case 'reset':
1685
1699
  imageEditorObj.reset();
1686
1700
  break;
1687
- case 'load':
1688
- break;
1689
- case 'save':
1690
- break;
1691
- case 'select':
1692
- break;
1693
- case 'bold':
1694
- this.currObjType.isCustomCrop = false;
1695
- if (!this.isBoldbtn) {
1696
- this.activeObj.textSettings.bold = true;
1697
- this.isBoldbtn = true;
1698
- this.redrawText(ratio);
1699
- }
1700
- else {
1701
- this.activeObj.textSettings.bold = false;
1702
- this.isBoldbtn = false;
1703
- this.redrawText(ratio);
1704
- }
1705
- break;
1706
- case 'italic':
1707
- this.currObjType.isCustomCrop = false;
1708
- if (!this.isItalicbtn) {
1709
- this.activeObj.textSettings.italic = true;
1710
- if (this.activeObj.textSettings.bold) {
1711
- this.upperContext.font = 'italic bold ' + this.activeObj.textSettings.fontSize + 'px' +
1712
- ' ' + this.activeObj.textSettings.fontFamily;
1713
- }
1714
- else {
1715
- this.upperContext.font = 'italic ' + this.activeObj.textSettings.fontSize + 'px' + ' ' +
1716
- this.activeObj.textSettings.fontFamily;
1717
- }
1718
- var width = this.upperContext.measureText(this.activeObj.keyHistory).width +
1719
- this.activeObj.textSettings.fontSize * 0.5;
1720
- var height = this.activeObj.textSettings.fontSize + this.activeObj.textSettings.fontSize * 0.25;
1721
- this.setTextSelection(width, height);
1722
- this.updateActiveObject(ratio, this.activeObj.activePoint, this.activeObj);
1723
- this.redrawShape(this.activeObj);
1724
- this.isItalicbtn = true;
1725
- }
1726
- else {
1727
- this.activeObj.textSettings.italic = false;
1728
- if (this.activeObj.textSettings.bold) {
1729
- this.upperContext.font = 'bold ' + this.activeObj.textSettings.fontSize + 'px' + ' ' + this.activeObj.textSettings.fontFamily;
1730
- }
1731
- else {
1732
- this.upperContext.font = this.activeObj.textSettings.fontSize + 'px' + ' ' + this.activeObj.textSettings.fontFamily;
1733
- }
1734
- var width = this.upperContext.measureText(this.activeObj.keyHistory).width +
1735
- this.activeObj.textSettings.fontSize * 0.5;
1736
- var height = this.activeObj.textSettings.fontSize + this.activeObj.textSettings.fontSize * 0.25;
1737
- this.setTextSelection(width, height);
1738
- this.updateActiveObject(ratio, this.activeObj.activePoint, this.activeObj);
1739
- this.redrawShape(this.activeObj);
1740
- this.isItalicbtn = false;
1741
- }
1742
- break;
1743
1701
  }
1744
1702
  }
1745
1703
  this.trigger('toolbarItemClicked', args);
@@ -2139,12 +2097,21 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
2139
2097
  wrapperWidth = this.element.clientWidth;
2140
2098
  }
2141
2099
  var maxDimension = this.calcMaxDimension(this.baseImg.width, this.baseImg.height);
2100
+ var toolbarHeight = 0;
2101
+ if (!isNullOrUndefined(this.toolbarTemplate) && !isNullOrUndefined(document.querySelector('.e-toolbar'))) {
2102
+ toolbarHeight = document.querySelector('.e-toolbar').clientHeight;
2103
+ maxDimension.width -= toolbarHeight;
2104
+ maxDimension.height -= toolbarHeight;
2105
+ }
2142
2106
  this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
2143
2107
  this.lowerCanvas.width = this.upperCanvas.width = this.inMemoryCanvas.width = this.baseImg.width;
2144
2108
  this.lowerCanvas.height = this.upperCanvas.height = this.inMemoryCanvas.height = this.baseImg.height;
2145
2109
  this.lowerCanvas.style.maxWidth = this.upperCanvas.style.maxWidth = maxDimension.width + 'px';
2146
2110
  this.lowerCanvas.style.maxHeight = this.upperCanvas.style.maxHeight = maxDimension.height + 'px';
2147
2111
  this.lowerCanvas.style.left = this.upperCanvas.style.left = (wrapperWidth - maxDimension.width) / 2 + 1 + 'px';
2112
+ if (!isNullOrUndefined(this.toolbarTemplate)) {
2113
+ this.lowerCanvas.style.left = parseFloat(this.lowerCanvas.style.left) + (toolbarHeight / 2) + 'px';
2114
+ }
2148
2115
  if (canvasWrapper) {
2149
2116
  this.lowerCanvas.style.top = this.upperCanvas.style.top = (parseFloat(canvasWrapper.style.height) - maxDimension.height - 1) / 2 + 'px';
2150
2117
  }
@@ -2919,7 +2886,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
2919
2886
  // eslint-disable-next-line @typescript-eslint/no-this-alias
2920
2887
  var proxy = this;
2921
2888
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2922
- var xform = new DOMMatrix();
2889
+ var xform = new DOMMatrix([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
2923
2890
  ctx.getTransform = function () {
2924
2891
  return xform;
2925
2892
  };
@@ -2960,7 +2927,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
2960
2927
  var transform = ctx.transform;
2961
2928
  ctx.transform = function (a, b, c, d, e, f) {
2962
2929
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2963
- var m2 = new DOMMatrix();
2930
+ var m2 = new DOMMatrix([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
2964
2931
  m2.a = a;
2965
2932
  m2.b = b;
2966
2933
  m2.c = c;
@@ -6088,22 +6055,6 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
6088
6055
  this.updateActiveObject(ratio, this.objColl[i].activePoint, this.objColl[i]);
6089
6056
  }
6090
6057
  }
6091
- else if (degree === 'zoom') {
6092
- for (var i = 0; i < this.objColl.length; i++) {
6093
- this.objColl[i].activePoint.startX /= ratio.width;
6094
- this.objColl[i].activePoint.startY /= ratio.height;
6095
- this.objColl[i].activePoint.endX /= ratio.width;
6096
- this.objColl[i].activePoint.endY /= ratio.height;
6097
- this.objColl[i].activePoint.height = this.objColl[i].activePoint.endX - this.objColl[i].activePoint.startX;
6098
- this.objColl[i].activePoint.width = this.objColl[i].activePoint.endY - this.objColl[i].activePoint.startY;
6099
- this.objColl[i].activePoint.startX *= ratio.width;
6100
- this.objColl[i].activePoint.startY *= ratio.height;
6101
- this.objColl[i].activePoint.endX *= ratio.width;
6102
- this.objColl[i].activePoint.endY *= ratio.height;
6103
- this.objColl[i].activePoint.width = this.objColl[i].activePoint.endX - this.objColl[i].activePoint.startX;
6104
- this.objColl[i].activePoint.height = this.objColl[i].activePoint.endY - this.objColl[i].activePoint.startY;
6105
- }
6106
- }
6107
6058
  };
6108
6059
  ImageEditor.prototype.calcCurrPoints = function (degree, obj) {
6109
6060
  var oldRatio = this.calcPrevRatio();
@@ -6439,6 +6390,51 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
6439
6390
  }
6440
6391
  return inRange;
6441
6392
  };
6393
+ ImageEditor.prototype.rotateMultiple = function (length, degree) {
6394
+ for (var i = 0; i < length; i++) {
6395
+ if (degree > 0) {
6396
+ this.degree += 90;
6397
+ }
6398
+ else {
6399
+ this.degree -= 90;
6400
+ }
6401
+ if (this.degree === 360) {
6402
+ this.degree = 0;
6403
+ }
6404
+ this.lowerContext.save();
6405
+ this.setMaximumDimension(90 * (i + 1));
6406
+ this.lowerContext.translate(this.lowerCanvas.width / 2, this.lowerCanvas.height / 2);
6407
+ if (degree > 0) {
6408
+ this.lowerContext.rotate(Math.PI / 180 * 90);
6409
+ }
6410
+ else {
6411
+ this.lowerContext.rotate(Math.PI / 180 * -90);
6412
+ }
6413
+ this.lowerCanvas.style.left = this.upperCanvas.style.left = (this.element.clientWidth - parseInt(this.lowerCanvas.style.maxWidth, 10) - 18) / 2 + 1 + 'px';
6414
+ this.lowerCanvas.style.top = this.upperCanvas.style.top = (this.element.clientHeight - this.toolbarHeight - parseInt(this.lowerCanvas.style.maxHeight, 10)) / 2 + 1 + 'px';
6415
+ this.lowerContext.drawImage(this.inMemoryCanvas, -this.lowerCanvas.height / 2, -this.lowerCanvas.width / 2);
6416
+ if (degree > 0) {
6417
+ this.lowerContext.rotate(Math.PI / 180 * -90);
6418
+ }
6419
+ else {
6420
+ this.lowerContext.rotate(Math.PI / 180 * 90);
6421
+ }
6422
+ this.lowerContext.translate(-this.lowerCanvas.width / 2, -this.lowerCanvas.height / 2);
6423
+ this.lowerContext.restore();
6424
+ this.currImgData = this.lowerContext.getImageData(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
6425
+ this.inMemoryContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
6426
+ this.inMemoryCanvas.width = this.currImgData.width;
6427
+ this.inMemoryCanvas.height = this.currImgData.height;
6428
+ this.inMemoryContext.putImageData(this.currImgData, 0, 0);
6429
+ this.lowerContext.drawImage(this.inMemoryCanvas, 0, 0);
6430
+ if (degree > 0) {
6431
+ this.redrawObj(90);
6432
+ }
6433
+ else {
6434
+ this.redrawObj(-90);
6435
+ }
6436
+ }
6437
+ };
6442
6438
  /**
6443
6439
  * Clear a current selection.
6444
6440
  *
@@ -6774,7 +6770,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
6774
6770
  (isNullOrUndefined(document.getElementById(this.element.id + '_toolbar')))) {
6775
6771
  this.toolbarHeight = 0;
6776
6772
  }
6777
- this.update();
6773
+ if (isNullOrUndefined(this.toolbarTemplate)) {
6774
+ this.update();
6775
+ }
6778
6776
  var type = typeof (data);
6779
6777
  if (type === 'string') {
6780
6778
  this.imageOnLoad(data);
@@ -6885,8 +6883,6 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
6885
6883
  isRotate = true;
6886
6884
  var transitionArgs = { degree: degree };
6887
6885
  this.trigger('rotating', transitionArgs);
6888
- this.rotateMethod = true;
6889
- this.lastAction = 'rotate';
6890
6886
  var splitWords = [];
6891
6887
  var activeObjShape = void 0;
6892
6888
  if (!isNullOrUndefined(this.activeObj.activePoint)) {
@@ -6898,32 +6894,40 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
6898
6894
  }
6899
6895
  }
6900
6896
  this.redrawActObj();
6897
+ var factor = this.factor;
6901
6898
  if (this.factor !== 1) {
6902
6899
  this.lowerContext.setTransform(1, 0, 0, 1, 0, 0);
6903
6900
  this.upperContext.setTransform(1, 0, 0, 1, 0, 0);
6904
6901
  this.factor = 1;
6905
6902
  this.refreshToolbar('main');
6906
6903
  }
6907
- this.degree += degree;
6908
- if (this.degree === 360) {
6909
- this.degree = 0;
6904
+ var length_1 = Math.abs(degree / 90);
6905
+ if (length_1 > 1) {
6906
+ this.rotateMultiple(length_1, degree);
6907
+ }
6908
+ else {
6909
+ this.degree += degree;
6910
+ if (this.degree === 360) {
6911
+ this.degree = 0;
6912
+ }
6913
+ this.lowerContext.save();
6914
+ this.setMaximumDimension(this.degree);
6915
+ this.lowerContext.translate(this.lowerCanvas.width / 2, this.lowerCanvas.height / 2);
6916
+ this.lowerContext.rotate(Math.PI / 180 * degree);
6917
+ this.lowerCanvas.style.left = this.upperCanvas.style.left = (this.element.clientWidth - parseInt(this.lowerCanvas.style.maxWidth, 10) - 18) / 2 + 1 + 'px';
6918
+ this.lowerCanvas.style.top = this.upperCanvas.style.top = (this.element.clientHeight - this.toolbarHeight - parseInt(this.lowerCanvas.style.maxHeight, 10)) / 2 + 1 + 'px';
6919
+ this.lowerContext.drawImage(this.inMemoryCanvas, -this.lowerCanvas.height / 2, -this.lowerCanvas.width / 2);
6920
+ this.lowerContext.rotate(Math.PI / 180 * -degree);
6921
+ this.lowerContext.translate(-this.lowerCanvas.width / 2, -this.lowerCanvas.height / 2);
6922
+ this.lowerContext.restore();
6923
+ this.currImgData = this.lowerContext.getImageData(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
6924
+ this.inMemoryContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
6925
+ this.inMemoryCanvas.width = this.currImgData.width;
6926
+ this.inMemoryCanvas.height = this.currImgData.height;
6927
+ this.inMemoryContext.putImageData(this.currImgData, 0, 0);
6928
+ this.lowerContext.drawImage(this.inMemoryCanvas, 0, 0);
6929
+ this.redrawObj(degree);
6910
6930
  }
6911
- this.lowerContext.save();
6912
- this.setMaximumDimension(this.degree);
6913
- this.lowerContext.translate(this.lowerCanvas.width / 2, this.lowerCanvas.height / 2);
6914
- this.lowerContext.rotate(Math.PI / 180 * degree);
6915
- this.lowerCanvas.style.left = this.upperCanvas.style.left = (this.element.clientWidth - parseInt(this.lowerCanvas.style.maxWidth, 10) - 18) / 2 + 1 + 'px';
6916
- this.lowerCanvas.style.top = this.upperCanvas.style.top = (this.element.clientHeight - this.toolbarHeight - parseInt(this.lowerCanvas.style.maxHeight, 10)) / 2 + 1 + 'px';
6917
- this.lowerContext.drawImage(this.inMemoryCanvas, -this.lowerCanvas.height / 2, -this.lowerCanvas.width / 2);
6918
- this.lowerContext.rotate(Math.PI / 180 * -degree);
6919
- this.lowerContext.translate(-this.lowerCanvas.width / 2, -this.lowerCanvas.height / 2);
6920
- this.lowerContext.restore();
6921
- this.currImgData = this.lowerContext.getImageData(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
6922
- this.inMemoryContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
6923
- this.inMemoryCanvas.width = this.currImgData.width;
6924
- this.inMemoryCanvas.height = this.currImgData.height;
6925
- this.inMemoryContext.putImageData(this.currImgData, 0, 0);
6926
- this.redrawObj(degree);
6927
6931
  if (!isNullOrUndefined(activeObjShape)) {
6928
6932
  if (activeObjShape === 'custom') {
6929
6933
  var endPoint = { x: this.lowerCanvas.width - this.pannEnd.startX, y: this.lowerCanvas.height - this.pannEnd.startY };
@@ -6939,11 +6943,11 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
6939
6943
  }
6940
6944
  this.factor = 1;
6941
6945
  if (!this.isUndoRedo) {
6942
- this.updateUndoRedoColl('rotate', degree, this.objColl);
6946
+ this.updateUndoRedoColl('rotate', degree, this.objColl, null);
6943
6947
  }
6944
6948
  this.isUndoRedo = false;
6949
+ this.refreshToolbar('main');
6945
6950
  }
6946
- this.rotateMethod = false;
6947
6951
  return isRotate;
6948
6952
  };
6949
6953
  /**
@@ -6976,8 +6980,8 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
6976
6980
  }
6977
6981
  type = type ? type : 'Png';
6978
6982
  this.redrawActObj();
6979
- var beforeSave = { cancel: false, fileName: 'ImageEditor', fileType: type };
6980
- var saved_1 = { fileName: 'ImageEditor', fileType: type };
6983
+ var beforeSave = { cancel: false, fileName: fileName ? fileName : 'ImageEditor', fileType: type };
6984
+ var saved_1 = { fileName: fileName ? fileName : 'ImageEditor', fileType: type };
6981
6985
  this.trigger('beforeSave', beforeSave, function (observableSaveArgs) {
6982
6986
  if (!observableSaveArgs.cancel) {
6983
6987
  fileName = observableSaveArgs.fileName ? observableSaveArgs.fileName : fileName;
@@ -7087,7 +7091,8 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
7087
7091
  *
7088
7092
  * @param {boolean} value - Specifies a value whether enable or disable freehand drawing.
7089
7093
  *
7090
- * @returns {void}.
7094
+ * @returns {void}.
7095
+ * @private
7091
7096
  */
7092
7097
  ImageEditor.prototype.freeHandDraw = function (value) {
7093
7098
  if (value) {
@@ -7101,6 +7106,16 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
7101
7106
  }
7102
7107
  this.refreshToolbar('pen');
7103
7108
  };
7109
+ /**
7110
+ * Enable or disable a freehand drawing in an Image Editor.
7111
+ *
7112
+ * @param {boolean} value - Specifies a value whether enable or disable freehand drawing.
7113
+ *
7114
+ * @returns {void}.
7115
+ */
7116
+ ImageEditor.prototype.freehandDraw = function (value) {
7117
+ this.freeHandDraw(value);
7118
+ };
7104
7119
  /**
7105
7120
  * Enable or disable a panning on the Image Editor.
7106
7121
  *
@@ -7242,7 +7257,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
7242
7257
  }
7243
7258
  this.currObjType.isCustomCrop = false;
7244
7259
  var start = { x: x, y: y };
7245
- this.drawShape('circle', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY);
7260
+ this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY);
7246
7261
  }
7247
7262
  return isEllipse;
7248
7263
  };
@@ -7381,7 +7396,15 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
7381
7396
  isSelected = true;
7382
7397
  this.activeObj = obj;
7383
7398
  this.redrawShape(this.activeObj);
7384
- this.refreshToolbar('shapes');
7399
+ if (this.activeObj.shape === 'text') {
7400
+ this.refreshToolbar('text');
7401
+ }
7402
+ else if (this.activeObj.shape === 'pen') {
7403
+ this.refreshToolbar('pen');
7404
+ }
7405
+ else {
7406
+ this.refreshToolbar('shapes');
7407
+ }
7385
7408
  this.updateToolbarItems(this.calcRatio());
7386
7409
  }
7387
7410
  return isSelected;
@@ -7486,6 +7509,137 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
7486
7509
  this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
7487
7510
  this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
7488
7511
  };
7512
+ /**
7513
+ * To check whether the undo collection is empty or not.
7514
+ *
7515
+ * @returns {boolean}.
7516
+ * @private
7517
+ */
7518
+ ImageEditor.prototype.canUndo = function () {
7519
+ return false;
7520
+ };
7521
+ /**
7522
+ * To check whether the redo collection is empty or not.
7523
+ *
7524
+ * @returns {boolean}.
7525
+ * @private
7526
+ */
7527
+ ImageEditor.prototype.canRedo = function () {
7528
+ return false;
7529
+ };
7530
+ /**
7531
+ * Erases all the signature strokes signed by user.
7532
+ *
7533
+ * @returns {void}.
7534
+ * @private
7535
+ */
7536
+ ImageEditor.prototype.clear = function () {
7537
+ if (this.getModuleName() !== 'image-editor') {
7538
+ _super.prototype.clear.call(this);
7539
+ }
7540
+ };
7541
+ /**
7542
+ * To draw the signature based on the given text, with the font family and font size.
7543
+ *
7544
+ * @param {string} text - specify text to be drawn as signature.
7545
+ * @param {string} fontFamily - specify font family of a signature.
7546
+ * @param {number} fontSize - specify font size of a signature.
7547
+ *
7548
+ * @returns {void}.
7549
+ * @private
7550
+ */
7551
+ ImageEditor.prototype.draw = function (text, fontFamily, fontSize) {
7552
+ if (this.getModuleName() !== 'image-editor') {
7553
+ _super.prototype.draw.call(this, text, fontFamily, fontSize);
7554
+ }
7555
+ };
7556
+ /**
7557
+ * To get the signature as Blob.
7558
+ *
7559
+ * @param {string} url - specify the url/base 64 string to get blob of the signature.
7560
+ * @returns {Blob}.
7561
+ * @private
7562
+ */
7563
+ ImageEditor.prototype.getBlob = function (url) {
7564
+ return null;
7565
+ };
7566
+ /**
7567
+ * To check whether the signature is empty or not.
7568
+ *
7569
+ * @returns {boolean}.
7570
+ * @private
7571
+ */
7572
+ ImageEditor.prototype.isEmpty = function () {
7573
+ return false;
7574
+ };
7575
+ /**
7576
+ * To load the signature with the given base 64 string, height and width.
7577
+ *
7578
+ * @param {string} signature - specify the url/base 64 string to be drawn as signature.
7579
+ * @param {number} width - specify the width of the loaded signature image.
7580
+ * @param {number} height - specify the height of the loaded signature image.
7581
+ * @returns {void}.
7582
+ * @private
7583
+ */
7584
+ ImageEditor.prototype.load = function (signature, width, height) {
7585
+ if (this.getModuleName() !== 'image-editor') {
7586
+ _super.prototype.load.call(this, signature, width, height);
7587
+ }
7588
+ };
7589
+ /**
7590
+ * Undo the last user action.
7591
+ *
7592
+ * @returns {void}.
7593
+ * @private
7594
+ */
7595
+ ImageEditor.prototype.undo = function () {
7596
+ if (this.getModuleName() !== 'image-editor') {
7597
+ _super.prototype.undo.call(this);
7598
+ }
7599
+ };
7600
+ /**
7601
+ * Redo the last user action.
7602
+ *
7603
+ * @returns {void}.
7604
+ * @private
7605
+ */
7606
+ ImageEditor.prototype.redo = function () {
7607
+ if (this.getModuleName() !== 'image-editor') {
7608
+ _super.prototype.redo.call(this);
7609
+ }
7610
+ };
7611
+ /**
7612
+ * To save the signature with the given file type and file name.
7613
+ *
7614
+ * @param {SignatureFileType} type - specify type of the file to be saved a signature.
7615
+ * @param {string} fileName - specify name of the file to be saved a signature.
7616
+ *
7617
+ * @returns {void}.
7618
+ * @private
7619
+ */
7620
+ ImageEditor.prototype.save = function (type, fileName) {
7621
+ if (this.getModuleName() !== 'image-editor') {
7622
+ _super.prototype.save.call(this, type, fileName);
7623
+ }
7624
+ };
7625
+ /**
7626
+ * To save the signature as Blob.
7627
+ *
7628
+ * @returns {Blob}.
7629
+ * @private
7630
+ */
7631
+ ImageEditor.prototype.saveAsBlob = function () {
7632
+ return null;
7633
+ };
7634
+ /**
7635
+ * Returns the persistence data for component.
7636
+ *
7637
+ * @returns any.
7638
+ * @private
7639
+ */
7640
+ ImageEditor.prototype.getLocalData = function () {
7641
+ return null;
7642
+ };
7489
7643
  var ImageEditor_1;
7490
7644
  __decorate([
7491
7645
  Property('')
@@ -7508,6 +7662,36 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
7508
7662
  __decorate([
7509
7663
  Property('100%')
7510
7664
  ], ImageEditor.prototype, "width", void 0);
7665
+ __decorate([
7666
+ Property('')
7667
+ ], ImageEditor.prototype, "backgroundColor", void 0);
7668
+ __decorate([
7669
+ Property('')
7670
+ ], ImageEditor.prototype, "backgroundImage", void 0);
7671
+ __decorate([
7672
+ Property(false)
7673
+ ], ImageEditor.prototype, "isReadOnly", void 0);
7674
+ __decorate([
7675
+ Property(true)
7676
+ ], ImageEditor.prototype, "saveWithBackground", void 0);
7677
+ __decorate([
7678
+ Property('#000000')
7679
+ ], ImageEditor.prototype, "strokeColor", void 0);
7680
+ __decorate([
7681
+ Property(0.5)
7682
+ ], ImageEditor.prototype, "minStrokeWidth", void 0);
7683
+ __decorate([
7684
+ Property(2)
7685
+ ], ImageEditor.prototype, "maxStrokeWidth", void 0);
7686
+ __decorate([
7687
+ Property(0.7)
7688
+ ], ImageEditor.prototype, "velocity", void 0);
7689
+ __decorate([
7690
+ Property(false)
7691
+ ], ImageEditor.prototype, "enableRtl", void 0);
7692
+ __decorate([
7693
+ Property(false)
7694
+ ], ImageEditor.prototype, "enablePersistence", void 0);
7511
7695
  __decorate([
7512
7696
  Event()
7513
7697
  ], ImageEditor.prototype, "beforeSave", void 0);