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