@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';
@@ -244,6 +244,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
244
244
  if (!this.element.getAttribute('class')) {
245
245
  this.element.removeAttribute('class');
246
246
  }
247
+ this.destroySubComponents();
247
248
  this.unwireEvent();
248
249
  super.destroy();
249
250
  this.element.innerHTML = '';
@@ -310,6 +311,27 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
310
311
  EventHandler.remove(this.lowerCanvas, 'mouseup', this.canvasMouseUpHandler);
311
312
  EventHandler.remove(document, 'mouseup', this.canvasMouseUpHandler);
312
313
  }
314
+ destroySubComponents() {
315
+ const inputElement = this.element.querySelectorAll('input.e-control');
316
+ const divElement = this.element.querySelectorAll('div.e-control:not(.e-handle)');
317
+ const btnElement = this.element.querySelectorAll('button.e-control');
318
+ for (let i = 0, len = inputElement.length; i < len; i++) {
319
+ if (inputElement[i].classList.contains('e-color-picker')) {
320
+ getComponent(inputElement[i], 'color-picker').destroy();
321
+ detach(select('input#' + inputElement[i].id, this.element));
322
+ }
323
+ }
324
+ for (let i = 0, len = btnElement.length; i < len; i++) {
325
+ if (btnElement[i].classList.contains('e-dropdown-btn')) {
326
+ getComponent(btnElement[i], 'dropdown-btn').destroy();
327
+ detach(select('button#' + btnElement[i].id, this.element));
328
+ }
329
+ else if (btnElement[i].classList.contains('e-btn')) {
330
+ getComponent(btnElement[i], 'btn').destroy();
331
+ detach(select('button#' + btnElement[i].id, this.element));
332
+ }
333
+ }
334
+ }
313
335
  updateTheme() {
314
336
  if (this.theme !== '') {
315
337
  this.theme = this.toPascalCase(this.theme);
@@ -1029,7 +1051,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
1029
1051
  args.element.parentElement.offsetHeight + 'px';
1030
1052
  }
1031
1053
  const activeBtn = spanElem.innerHTML;
1032
- args.element.querySelector('[aria-label = ' + '"' + activeBtn + '"' + ']').classList.add('e-selected-btn');
1054
+ if (activeBtn !== '') {
1055
+ args.element.querySelector('[aria-label = ' + '"' + activeBtn + '"' + ']').classList.add('e-selected-btn');
1056
+ }
1033
1057
  },
1034
1058
  select: (args) => {
1035
1059
  spanElem.textContent = args.item.text;
@@ -1641,75 +1665,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
1641
1665
  }
1642
1666
  this.callMainToolbar(false);
1643
1667
  break;
1644
- case 'text':
1645
- this.currObjType.isCustomCrop = false;
1646
- imageEditorObj.drawShapeText();
1647
- this.refreshToolbar(type);
1648
- break;
1649
- case 'pen':
1650
- this.currObjType.isCustomCrop = false;
1651
- this.freeHandDraw(true);
1652
- this.refreshToolbar(type);
1653
- break;
1654
1668
  case 'reset':
1655
1669
  imageEditorObj.reset();
1656
1670
  break;
1657
- case 'load':
1658
- break;
1659
- case 'save':
1660
- break;
1661
- case 'select':
1662
- break;
1663
- case 'bold':
1664
- this.currObjType.isCustomCrop = false;
1665
- if (!this.isBoldbtn) {
1666
- this.activeObj.textSettings.bold = true;
1667
- this.isBoldbtn = true;
1668
- this.redrawText(ratio);
1669
- }
1670
- else {
1671
- this.activeObj.textSettings.bold = false;
1672
- this.isBoldbtn = false;
1673
- this.redrawText(ratio);
1674
- }
1675
- break;
1676
- case 'italic':
1677
- this.currObjType.isCustomCrop = false;
1678
- if (!this.isItalicbtn) {
1679
- this.activeObj.textSettings.italic = true;
1680
- if (this.activeObj.textSettings.bold) {
1681
- this.upperContext.font = 'italic bold ' + this.activeObj.textSettings.fontSize + 'px' +
1682
- ' ' + this.activeObj.textSettings.fontFamily;
1683
- }
1684
- else {
1685
- this.upperContext.font = 'italic ' + this.activeObj.textSettings.fontSize + 'px' + ' ' +
1686
- this.activeObj.textSettings.fontFamily;
1687
- }
1688
- const width = this.upperContext.measureText(this.activeObj.keyHistory).width +
1689
- this.activeObj.textSettings.fontSize * 0.5;
1690
- const height = this.activeObj.textSettings.fontSize + this.activeObj.textSettings.fontSize * 0.25;
1691
- this.setTextSelection(width, height);
1692
- this.updateActiveObject(ratio, this.activeObj.activePoint, this.activeObj);
1693
- this.redrawShape(this.activeObj);
1694
- this.isItalicbtn = true;
1695
- }
1696
- else {
1697
- this.activeObj.textSettings.italic = false;
1698
- if (this.activeObj.textSettings.bold) {
1699
- this.upperContext.font = 'bold ' + this.activeObj.textSettings.fontSize + 'px' + ' ' + this.activeObj.textSettings.fontFamily;
1700
- }
1701
- else {
1702
- this.upperContext.font = this.activeObj.textSettings.fontSize + 'px' + ' ' + this.activeObj.textSettings.fontFamily;
1703
- }
1704
- const width = this.upperContext.measureText(this.activeObj.keyHistory).width +
1705
- this.activeObj.textSettings.fontSize * 0.5;
1706
- const height = this.activeObj.textSettings.fontSize + this.activeObj.textSettings.fontSize * 0.25;
1707
- this.setTextSelection(width, height);
1708
- this.updateActiveObject(ratio, this.activeObj.activePoint, this.activeObj);
1709
- this.redrawShape(this.activeObj);
1710
- this.isItalicbtn = false;
1711
- }
1712
- break;
1713
1671
  }
1714
1672
  }
1715
1673
  this.trigger('toolbarItemClicked', args);
@@ -2106,12 +2064,21 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
2106
2064
  wrapperWidth = this.element.clientWidth;
2107
2065
  }
2108
2066
  const maxDimension = this.calcMaxDimension(this.baseImg.width, this.baseImg.height);
2067
+ let toolbarHeight = 0;
2068
+ if (!isNullOrUndefined(this.toolbarTemplate) && !isNullOrUndefined(document.querySelector('.e-toolbar'))) {
2069
+ toolbarHeight = document.querySelector('.e-toolbar').clientHeight;
2070
+ maxDimension.width -= toolbarHeight;
2071
+ maxDimension.height -= toolbarHeight;
2072
+ }
2109
2073
  this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
2110
2074
  this.lowerCanvas.width = this.upperCanvas.width = this.inMemoryCanvas.width = this.baseImg.width;
2111
2075
  this.lowerCanvas.height = this.upperCanvas.height = this.inMemoryCanvas.height = this.baseImg.height;
2112
2076
  this.lowerCanvas.style.maxWidth = this.upperCanvas.style.maxWidth = maxDimension.width + 'px';
2113
2077
  this.lowerCanvas.style.maxHeight = this.upperCanvas.style.maxHeight = maxDimension.height + 'px';
2114
2078
  this.lowerCanvas.style.left = this.upperCanvas.style.left = (wrapperWidth - maxDimension.width) / 2 + 1 + 'px';
2079
+ if (!isNullOrUndefined(this.toolbarTemplate)) {
2080
+ this.lowerCanvas.style.left = parseFloat(this.lowerCanvas.style.left) + (toolbarHeight / 2) + 'px';
2081
+ }
2115
2082
  if (canvasWrapper) {
2116
2083
  this.lowerCanvas.style.top = this.upperCanvas.style.top = (parseFloat(canvasWrapper.style.height) - maxDimension.height - 1) / 2 + 'px';
2117
2084
  }
@@ -2883,7 +2850,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
2883
2850
  // eslint-disable-next-line @typescript-eslint/no-this-alias
2884
2851
  const proxy = this;
2885
2852
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2886
- let xform = new DOMMatrix();
2853
+ let xform = new DOMMatrix([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
2887
2854
  ctx.getTransform = () => {
2888
2855
  return xform;
2889
2856
  };
@@ -2924,7 +2891,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
2924
2891
  const transform = ctx.transform;
2925
2892
  ctx.transform = (a, b, c, d, e, f) => {
2926
2893
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2927
- const m2 = new DOMMatrix();
2894
+ const m2 = new DOMMatrix([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
2928
2895
  m2.a = a;
2929
2896
  m2.b = b;
2930
2897
  m2.c = c;
@@ -6052,22 +6019,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
6052
6019
  this.updateActiveObject(ratio, this.objColl[i].activePoint, this.objColl[i]);
6053
6020
  }
6054
6021
  }
6055
- else if (degree === 'zoom') {
6056
- for (let i = 0; i < this.objColl.length; i++) {
6057
- this.objColl[i].activePoint.startX /= ratio.width;
6058
- this.objColl[i].activePoint.startY /= ratio.height;
6059
- this.objColl[i].activePoint.endX /= ratio.width;
6060
- this.objColl[i].activePoint.endY /= ratio.height;
6061
- this.objColl[i].activePoint.height = this.objColl[i].activePoint.endX - this.objColl[i].activePoint.startX;
6062
- this.objColl[i].activePoint.width = this.objColl[i].activePoint.endY - this.objColl[i].activePoint.startY;
6063
- this.objColl[i].activePoint.startX *= ratio.width;
6064
- this.objColl[i].activePoint.startY *= ratio.height;
6065
- this.objColl[i].activePoint.endX *= ratio.width;
6066
- this.objColl[i].activePoint.endY *= ratio.height;
6067
- this.objColl[i].activePoint.width = this.objColl[i].activePoint.endX - this.objColl[i].activePoint.startX;
6068
- this.objColl[i].activePoint.height = this.objColl[i].activePoint.endY - this.objColl[i].activePoint.startY;
6069
- }
6070
- }
6071
6022
  }
6072
6023
  calcCurrPoints(degree, obj) {
6073
6024
  const oldRatio = this.calcPrevRatio();
@@ -6403,6 +6354,51 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
6403
6354
  }
6404
6355
  return inRange;
6405
6356
  }
6357
+ rotateMultiple(length, degree) {
6358
+ for (let i = 0; i < length; i++) {
6359
+ if (degree > 0) {
6360
+ this.degree += 90;
6361
+ }
6362
+ else {
6363
+ this.degree -= 90;
6364
+ }
6365
+ if (this.degree === 360) {
6366
+ this.degree = 0;
6367
+ }
6368
+ this.lowerContext.save();
6369
+ this.setMaximumDimension(90 * (i + 1));
6370
+ this.lowerContext.translate(this.lowerCanvas.width / 2, this.lowerCanvas.height / 2);
6371
+ if (degree > 0) {
6372
+ this.lowerContext.rotate(Math.PI / 180 * 90);
6373
+ }
6374
+ else {
6375
+ this.lowerContext.rotate(Math.PI / 180 * -90);
6376
+ }
6377
+ this.lowerCanvas.style.left = this.upperCanvas.style.left = (this.element.clientWidth - parseInt(this.lowerCanvas.style.maxWidth, 10) - 18) / 2 + 1 + 'px';
6378
+ this.lowerCanvas.style.top = this.upperCanvas.style.top = (this.element.clientHeight - this.toolbarHeight - parseInt(this.lowerCanvas.style.maxHeight, 10)) / 2 + 1 + 'px';
6379
+ this.lowerContext.drawImage(this.inMemoryCanvas, -this.lowerCanvas.height / 2, -this.lowerCanvas.width / 2);
6380
+ if (degree > 0) {
6381
+ this.lowerContext.rotate(Math.PI / 180 * -90);
6382
+ }
6383
+ else {
6384
+ this.lowerContext.rotate(Math.PI / 180 * 90);
6385
+ }
6386
+ this.lowerContext.translate(-this.lowerCanvas.width / 2, -this.lowerCanvas.height / 2);
6387
+ this.lowerContext.restore();
6388
+ this.currImgData = this.lowerContext.getImageData(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
6389
+ this.inMemoryContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
6390
+ this.inMemoryCanvas.width = this.currImgData.width;
6391
+ this.inMemoryCanvas.height = this.currImgData.height;
6392
+ this.inMemoryContext.putImageData(this.currImgData, 0, 0);
6393
+ this.lowerContext.drawImage(this.inMemoryCanvas, 0, 0);
6394
+ if (degree > 0) {
6395
+ this.redrawObj(90);
6396
+ }
6397
+ else {
6398
+ this.redrawObj(-90);
6399
+ }
6400
+ }
6401
+ }
6406
6402
  /**
6407
6403
  * Clear a current selection.
6408
6404
  *
@@ -6738,7 +6734,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
6738
6734
  (isNullOrUndefined(document.getElementById(this.element.id + '_toolbar')))) {
6739
6735
  this.toolbarHeight = 0;
6740
6736
  }
6741
- this.update();
6737
+ if (isNullOrUndefined(this.toolbarTemplate)) {
6738
+ this.update();
6739
+ }
6742
6740
  const type = typeof (data);
6743
6741
  if (type === 'string') {
6744
6742
  this.imageOnLoad(data);
@@ -6849,8 +6847,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
6849
6847
  isRotate = true;
6850
6848
  const transitionArgs = { degree: degree };
6851
6849
  this.trigger('rotating', transitionArgs);
6852
- this.rotateMethod = true;
6853
- this.lastAction = 'rotate';
6854
6850
  let splitWords = [];
6855
6851
  let activeObjShape;
6856
6852
  if (!isNullOrUndefined(this.activeObj.activePoint)) {
@@ -6862,32 +6858,40 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
6862
6858
  }
6863
6859
  }
6864
6860
  this.redrawActObj();
6861
+ const factor = this.factor;
6865
6862
  if (this.factor !== 1) {
6866
6863
  this.lowerContext.setTransform(1, 0, 0, 1, 0, 0);
6867
6864
  this.upperContext.setTransform(1, 0, 0, 1, 0, 0);
6868
6865
  this.factor = 1;
6869
6866
  this.refreshToolbar('main');
6870
6867
  }
6871
- this.degree += degree;
6872
- if (this.degree === 360) {
6873
- this.degree = 0;
6868
+ const length = Math.abs(degree / 90);
6869
+ if (length > 1) {
6870
+ this.rotateMultiple(length, degree);
6871
+ }
6872
+ else {
6873
+ this.degree += degree;
6874
+ if (this.degree === 360) {
6875
+ this.degree = 0;
6876
+ }
6877
+ this.lowerContext.save();
6878
+ this.setMaximumDimension(this.degree);
6879
+ this.lowerContext.translate(this.lowerCanvas.width / 2, this.lowerCanvas.height / 2);
6880
+ this.lowerContext.rotate(Math.PI / 180 * degree);
6881
+ this.lowerCanvas.style.left = this.upperCanvas.style.left = (this.element.clientWidth - parseInt(this.lowerCanvas.style.maxWidth, 10) - 18) / 2 + 1 + 'px';
6882
+ this.lowerCanvas.style.top = this.upperCanvas.style.top = (this.element.clientHeight - this.toolbarHeight - parseInt(this.lowerCanvas.style.maxHeight, 10)) / 2 + 1 + 'px';
6883
+ this.lowerContext.drawImage(this.inMemoryCanvas, -this.lowerCanvas.height / 2, -this.lowerCanvas.width / 2);
6884
+ this.lowerContext.rotate(Math.PI / 180 * -degree);
6885
+ this.lowerContext.translate(-this.lowerCanvas.width / 2, -this.lowerCanvas.height / 2);
6886
+ this.lowerContext.restore();
6887
+ this.currImgData = this.lowerContext.getImageData(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
6888
+ this.inMemoryContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
6889
+ this.inMemoryCanvas.width = this.currImgData.width;
6890
+ this.inMemoryCanvas.height = this.currImgData.height;
6891
+ this.inMemoryContext.putImageData(this.currImgData, 0, 0);
6892
+ this.lowerContext.drawImage(this.inMemoryCanvas, 0, 0);
6893
+ this.redrawObj(degree);
6874
6894
  }
6875
- this.lowerContext.save();
6876
- this.setMaximumDimension(this.degree);
6877
- this.lowerContext.translate(this.lowerCanvas.width / 2, this.lowerCanvas.height / 2);
6878
- this.lowerContext.rotate(Math.PI / 180 * degree);
6879
- this.lowerCanvas.style.left = this.upperCanvas.style.left = (this.element.clientWidth - parseInt(this.lowerCanvas.style.maxWidth, 10) - 18) / 2 + 1 + 'px';
6880
- this.lowerCanvas.style.top = this.upperCanvas.style.top = (this.element.clientHeight - this.toolbarHeight - parseInt(this.lowerCanvas.style.maxHeight, 10)) / 2 + 1 + 'px';
6881
- this.lowerContext.drawImage(this.inMemoryCanvas, -this.lowerCanvas.height / 2, -this.lowerCanvas.width / 2);
6882
- this.lowerContext.rotate(Math.PI / 180 * -degree);
6883
- this.lowerContext.translate(-this.lowerCanvas.width / 2, -this.lowerCanvas.height / 2);
6884
- this.lowerContext.restore();
6885
- this.currImgData = this.lowerContext.getImageData(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
6886
- this.inMemoryContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
6887
- this.inMemoryCanvas.width = this.currImgData.width;
6888
- this.inMemoryCanvas.height = this.currImgData.height;
6889
- this.inMemoryContext.putImageData(this.currImgData, 0, 0);
6890
- this.redrawObj(degree);
6891
6895
  if (!isNullOrUndefined(activeObjShape)) {
6892
6896
  if (activeObjShape === 'custom') {
6893
6897
  const endPoint = { x: this.lowerCanvas.width - this.pannEnd.startX, y: this.lowerCanvas.height - this.pannEnd.startY };
@@ -6903,11 +6907,11 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
6903
6907
  }
6904
6908
  this.factor = 1;
6905
6909
  if (!this.isUndoRedo) {
6906
- this.updateUndoRedoColl('rotate', degree, this.objColl);
6910
+ this.updateUndoRedoColl('rotate', degree, this.objColl, null);
6907
6911
  }
6908
6912
  this.isUndoRedo = false;
6913
+ this.refreshToolbar('main');
6909
6914
  }
6910
- this.rotateMethod = false;
6911
6915
  return isRotate;
6912
6916
  }
6913
6917
  /**
@@ -6939,8 +6943,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
6939
6943
  }
6940
6944
  type = type ? type : 'Png';
6941
6945
  this.redrawActObj();
6942
- const beforeSave = { cancel: false, fileName: 'ImageEditor', fileType: type };
6943
- const saved = { fileName: 'ImageEditor', fileType: type };
6946
+ const beforeSave = { cancel: false, fileName: fileName ? fileName : 'ImageEditor', fileType: type };
6947
+ const saved = { fileName: fileName ? fileName : 'ImageEditor', fileType: type };
6944
6948
  this.trigger('beforeSave', beforeSave, (observableSaveArgs) => {
6945
6949
  if (!observableSaveArgs.cancel) {
6946
6950
  fileName = observableSaveArgs.fileName ? observableSaveArgs.fileName : fileName;
@@ -7050,7 +7054,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
7050
7054
  *
7051
7055
  * @param {boolean} value - Specifies a value whether enable or disable freehand drawing.
7052
7056
  *
7053
- * @returns {void}.
7057
+ * @returns {void}.
7058
+ * @private
7054
7059
  */
7055
7060
  freeHandDraw(value) {
7056
7061
  if (value) {
@@ -7064,6 +7069,16 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
7064
7069
  }
7065
7070
  this.refreshToolbar('pen');
7066
7071
  }
7072
+ /**
7073
+ * Enable or disable a freehand drawing in an Image Editor.
7074
+ *
7075
+ * @param {boolean} value - Specifies a value whether enable or disable freehand drawing.
7076
+ *
7077
+ * @returns {void}.
7078
+ */
7079
+ freehandDraw(value) {
7080
+ this.freeHandDraw(value);
7081
+ }
7067
7082
  /**
7068
7083
  * Enable or disable a panning on the Image Editor.
7069
7084
  *
@@ -7205,7 +7220,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
7205
7220
  }
7206
7221
  this.currObjType.isCustomCrop = false;
7207
7222
  const start = { x: x, y: y };
7208
- this.drawShape('circle', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY);
7223
+ this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY);
7209
7224
  }
7210
7225
  return isEllipse;
7211
7226
  }
@@ -7344,7 +7359,15 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
7344
7359
  isSelected = true;
7345
7360
  this.activeObj = obj;
7346
7361
  this.redrawShape(this.activeObj);
7347
- this.refreshToolbar('shapes');
7362
+ if (this.activeObj.shape === 'text') {
7363
+ this.refreshToolbar('text');
7364
+ }
7365
+ else if (this.activeObj.shape === 'pen') {
7366
+ this.refreshToolbar('pen');
7367
+ }
7368
+ else {
7369
+ this.refreshToolbar('shapes');
7370
+ }
7348
7371
  this.updateToolbarItems(this.calcRatio());
7349
7372
  }
7350
7373
  return isSelected;
@@ -7449,6 +7472,137 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends SignatureBase {
7449
7472
  this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
7450
7473
  this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
7451
7474
  }
7475
+ /**
7476
+ * To check whether the undo collection is empty or not.
7477
+ *
7478
+ * @returns {boolean}.
7479
+ * @private
7480
+ */
7481
+ canUndo() {
7482
+ return false;
7483
+ }
7484
+ /**
7485
+ * To check whether the redo collection is empty or not.
7486
+ *
7487
+ * @returns {boolean}.
7488
+ * @private
7489
+ */
7490
+ canRedo() {
7491
+ return false;
7492
+ }
7493
+ /**
7494
+ * Erases all the signature strokes signed by user.
7495
+ *
7496
+ * @returns {void}.
7497
+ * @private
7498
+ */
7499
+ clear() {
7500
+ if (this.getModuleName() !== 'image-editor') {
7501
+ super.clear();
7502
+ }
7503
+ }
7504
+ /**
7505
+ * To draw the signature based on the given text, with the font family and font size.
7506
+ *
7507
+ * @param {string} text - specify text to be drawn as signature.
7508
+ * @param {string} fontFamily - specify font family of a signature.
7509
+ * @param {number} fontSize - specify font size of a signature.
7510
+ *
7511
+ * @returns {void}.
7512
+ * @private
7513
+ */
7514
+ draw(text, fontFamily, fontSize) {
7515
+ if (this.getModuleName() !== 'image-editor') {
7516
+ super.draw(text, fontFamily, fontSize);
7517
+ }
7518
+ }
7519
+ /**
7520
+ * To get the signature as Blob.
7521
+ *
7522
+ * @param {string} url - specify the url/base 64 string to get blob of the signature.
7523
+ * @returns {Blob}.
7524
+ * @private
7525
+ */
7526
+ getBlob(url) {
7527
+ return null;
7528
+ }
7529
+ /**
7530
+ * To check whether the signature is empty or not.
7531
+ *
7532
+ * @returns {boolean}.
7533
+ * @private
7534
+ */
7535
+ isEmpty() {
7536
+ return false;
7537
+ }
7538
+ /**
7539
+ * To load the signature with the given base 64 string, height and width.
7540
+ *
7541
+ * @param {string} signature - specify the url/base 64 string to be drawn as signature.
7542
+ * @param {number} width - specify the width of the loaded signature image.
7543
+ * @param {number} height - specify the height of the loaded signature image.
7544
+ * @returns {void}.
7545
+ * @private
7546
+ */
7547
+ load(signature, width, height) {
7548
+ if (this.getModuleName() !== 'image-editor') {
7549
+ super.load(signature, width, height);
7550
+ }
7551
+ }
7552
+ /**
7553
+ * Undo the last user action.
7554
+ *
7555
+ * @returns {void}.
7556
+ * @private
7557
+ */
7558
+ undo() {
7559
+ if (this.getModuleName() !== 'image-editor') {
7560
+ super.undo();
7561
+ }
7562
+ }
7563
+ /**
7564
+ * Redo the last user action.
7565
+ *
7566
+ * @returns {void}.
7567
+ * @private
7568
+ */
7569
+ redo() {
7570
+ if (this.getModuleName() !== 'image-editor') {
7571
+ super.redo();
7572
+ }
7573
+ }
7574
+ /**
7575
+ * To save the signature with the given file type and file name.
7576
+ *
7577
+ * @param {SignatureFileType} type - specify type of the file to be saved a signature.
7578
+ * @param {string} fileName - specify name of the file to be saved a signature.
7579
+ *
7580
+ * @returns {void}.
7581
+ * @private
7582
+ */
7583
+ save(type, fileName) {
7584
+ if (this.getModuleName() !== 'image-editor') {
7585
+ super.save(type, fileName);
7586
+ }
7587
+ }
7588
+ /**
7589
+ * To save the signature as Blob.
7590
+ *
7591
+ * @returns {Blob}.
7592
+ * @private
7593
+ */
7594
+ saveAsBlob() {
7595
+ return null;
7596
+ }
7597
+ /**
7598
+ * Returns the persistence data for component.
7599
+ *
7600
+ * @returns any.
7601
+ * @private
7602
+ */
7603
+ getLocalData() {
7604
+ return null;
7605
+ }
7452
7606
  };
7453
7607
  __decorate([
7454
7608
  Property('')
@@ -7471,6 +7625,36 @@ __decorate([
7471
7625
  __decorate([
7472
7626
  Property('100%')
7473
7627
  ], ImageEditor.prototype, "width", void 0);
7628
+ __decorate([
7629
+ Property('')
7630
+ ], ImageEditor.prototype, "backgroundColor", void 0);
7631
+ __decorate([
7632
+ Property('')
7633
+ ], ImageEditor.prototype, "backgroundImage", void 0);
7634
+ __decorate([
7635
+ Property(false)
7636
+ ], ImageEditor.prototype, "isReadOnly", void 0);
7637
+ __decorate([
7638
+ Property(true)
7639
+ ], ImageEditor.prototype, "saveWithBackground", void 0);
7640
+ __decorate([
7641
+ Property('#000000')
7642
+ ], ImageEditor.prototype, "strokeColor", void 0);
7643
+ __decorate([
7644
+ Property(0.5)
7645
+ ], ImageEditor.prototype, "minStrokeWidth", void 0);
7646
+ __decorate([
7647
+ Property(2)
7648
+ ], ImageEditor.prototype, "maxStrokeWidth", void 0);
7649
+ __decorate([
7650
+ Property(0.7)
7651
+ ], ImageEditor.prototype, "velocity", void 0);
7652
+ __decorate([
7653
+ Property(false)
7654
+ ], ImageEditor.prototype, "enableRtl", void 0);
7655
+ __decorate([
7656
+ Property(false)
7657
+ ], ImageEditor.prototype, "enablePersistence", void 0);
7474
7658
  __decorate([
7475
7659
  Event()
7476
7660
  ], ImageEditor.prototype, "beforeSave", void 0);