@syncfusion/ej2-image-editor 29.2.5 → 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.
- package/.eslintrc.json +2 -0
- package/dist/ej2-image-editor.umd.min.js +2 -2
- package/dist/ej2-image-editor.umd.min.js.map +1 -1
- package/dist/es6/ej2-image-editor.es2015.js +883 -225
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +905 -235
- package/dist/es6/ej2-image-editor.es5.js.map +1 -1
- package/dist/global/ej2-image-editor.min.js +2 -2
- package/dist/global/ej2-image-editor.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +15 -47
- package/src/image-editor/action/crop.js +1 -1
- package/src/image-editor/action/draw.d.ts +1 -0
- package/src/image-editor/action/draw.js +103 -31
- package/src/image-editor/action/export.js +3 -0
- package/src/image-editor/action/selection.d.ts +1 -0
- package/src/image-editor/action/selection.js +39 -4
- package/src/image-editor/action/shape.d.ts +1 -0
- package/src/image-editor/action/shape.js +334 -49
- package/src/image-editor/action/transform.js +50 -43
- package/src/image-editor/action/undo-redo.d.ts +2 -0
- package/src/image-editor/action/undo-redo.js +22 -1
- package/src/image-editor/base/enum.d.ts +3 -1
- package/src/image-editor/base/enum.js +2 -0
- package/src/image-editor/base/image-editor.d.ts +13 -2
- package/src/image-editor/base/image-editor.js +242 -27
- package/src/image-editor/base/interface.d.ts +17 -1
- package/src/image-editor/renderer/toolbar.d.ts +2 -0
- package/src/image-editor/renderer/toolbar.js +110 -79
- package/styles/bds-lite.css +4 -0
- package/styles/bds.css +8 -0
- package/styles/bootstrap-dark-lite.css +4 -0
- package/styles/bootstrap-dark.css +4 -0
- package/styles/bootstrap-lite.css +4 -0
- package/styles/bootstrap.css +4 -0
- package/styles/bootstrap4-lite.css +4 -0
- package/styles/bootstrap4.css +4 -0
- package/styles/bootstrap5-dark-lite.css +4 -0
- package/styles/bootstrap5-dark.css +4 -0
- package/styles/bootstrap5-lite.css +4 -0
- package/styles/bootstrap5.3-lite.css +4 -0
- package/styles/bootstrap5.3.css +4 -0
- package/styles/bootstrap5.css +4 -0
- package/styles/fabric-dark-lite.css +4 -0
- package/styles/fabric-dark.css +19 -0
- package/styles/fabric-lite.css +4 -0
- package/styles/fabric.css +19 -0
- package/styles/fluent-dark-lite.css +4 -0
- package/styles/fluent-dark.css +13 -0
- package/styles/fluent-lite.css +4 -0
- package/styles/fluent.css +13 -0
- package/styles/fluent2-lite.css +8 -0
- package/styles/fluent2.css +12 -0
- package/styles/highcontrast-light-lite.css +4 -0
- package/styles/highcontrast-light.css +4 -0
- package/styles/highcontrast-lite.css +9 -1
- package/styles/highcontrast.css +14 -1
- package/styles/image-editor/_bigger.scss +56 -0
- package/styles/image-editor/_highcontrast-definition.scss +1 -1
- package/styles/image-editor/_layout.scss +36 -0
- package/styles/image-editor/bds.css +8 -0
- package/styles/image-editor/bootstrap-dark.css +4 -0
- package/styles/image-editor/bootstrap.css +4 -0
- package/styles/image-editor/bootstrap4.css +4 -0
- package/styles/image-editor/bootstrap5-dark.css +4 -0
- package/styles/image-editor/bootstrap5.3.css +4 -0
- package/styles/image-editor/bootstrap5.css +4 -0
- package/styles/image-editor/fabric-dark.css +19 -0
- package/styles/image-editor/fabric.css +19 -0
- package/styles/image-editor/fluent-dark.css +13 -0
- package/styles/image-editor/fluent.css +13 -0
- package/styles/image-editor/fluent2.css +12 -0
- package/styles/image-editor/highcontrast-light.css +4 -0
- package/styles/image-editor/highcontrast.css +14 -1
- package/styles/image-editor/material-dark.css +4 -0
- package/styles/image-editor/material.css +8 -0
- package/styles/image-editor/material3-dark.css +21 -1
- package/styles/image-editor/material3.css +21 -1
- package/styles/image-editor/tailwind-dark.css +8 -0
- package/styles/image-editor/tailwind.css +8 -0
- package/styles/image-editor/tailwind3.css +4 -0
- package/styles/material-dark-lite.css +4 -0
- package/styles/material-dark.css +4 -0
- package/styles/material-lite.css +4 -0
- package/styles/material.css +8 -0
- package/styles/material3-dark-lite.css +12 -0
- package/styles/material3-dark.css +21 -1
- package/styles/material3-lite.css +12 -0
- package/styles/material3.css +21 -1
- package/styles/tailwind-dark-lite.css +4 -0
- package/styles/tailwind-dark.css +8 -0
- package/styles/tailwind-lite.css +4 -0
- package/styles/tailwind.css +8 -0
- package/styles/tailwind3-lite.css +4 -0
- package/styles/tailwind3.css +4 -0
|
@@ -171,7 +171,7 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
171
171
|
srcTop: (actPoint.startY * ratio.height) - (img.destTop * ratio.height),
|
|
172
172
|
srcWidth: (actPoint.width * ratio.width), srcHeight: (actPoint.height * ratio.height),
|
|
173
173
|
destLeft: (parent.lowerCanvas.clientWidth - maxDimension.width) / 2,
|
|
174
|
-
destTop: (parent.lowerCanvas.clientHeight - maxDimension.height
|
|
174
|
+
destTop: (parent.lowerCanvas.clientHeight - maxDimension.height) / 2,
|
|
175
175
|
destWidth: maxDimension.width, destHeight: maxDimension.height };
|
|
176
176
|
var temp = this.lowerContext.filter;
|
|
177
177
|
parent.notify('draw', { prop: 'drawImage', onPropertyChange: false });
|
|
@@ -972,7 +972,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
972
972
|
this.isShapeTextInserted = false;
|
|
973
973
|
this.isRotateZoom = false; // To restore zoomed image on selection crop selection
|
|
974
974
|
this.tempStrokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null, outlineColor: '', radius: null, outlineWidth: null }; // restore stroke settings on cancel
|
|
975
|
-
this.tempTextSettings = { text: 'Enter Text', fontFamily: '', fontSize: null, fontRatio: null, bold: false, italic: false, underline: false }; // restore text settings on cancel
|
|
975
|
+
this.tempTextSettings = { text: 'Enter Text', fontFamily: '', fontSize: null, fontRatio: null, bold: false, italic: false, underline: false, strikethrough: false }; // restore text settings on cancel
|
|
976
976
|
this.tempAdjValue = ''; // for temp internal slider value
|
|
977
977
|
this.tempFilter = ''; // restore filter style on cancel
|
|
978
978
|
this.tempUndoRedoStep = 0;
|
|
@@ -1318,7 +1318,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
1318
1318
|
this.tempAdjValue = '';
|
|
1319
1319
|
this.tempStrokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null, radius: null, outlineColor: '', outlineWidth: null };
|
|
1320
1320
|
this.tempTextSettings =
|
|
1321
|
-
{ text: 'Enter Text', fontFamily: this.parent.fontFamily.default, fontSize: null, fontRatio: null, bold: false, italic: false, underline: false };
|
|
1321
|
+
{ text: 'Enter Text', fontFamily: this.parent.fontFamily.default, fontSize: null, fontRatio: null, bold: false, italic: false, underline: false, strikethrough: false };
|
|
1322
1322
|
this.tempUndoRedoStep = this.tempFreehandCounter = this.tempCurrFhdIndex = 0;
|
|
1323
1323
|
this.tempZoomFactor = null;
|
|
1324
1324
|
this.isCancelAction = false;
|
|
@@ -2915,7 +2915,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
2915
2915
|
var actObj = parent.activeObj;
|
|
2916
2916
|
var _a = actObj.activePoint, startX = _a.startX, startY = _a.startY, width = _a.width, height = _a.height;
|
|
2917
2917
|
var rows = actObj.keyHistory.split('\n');
|
|
2918
|
-
var _b = actObj.textSettings, fontFamily = _b.fontFamily, bold = _b.bold, italic = _b.italic;
|
|
2918
|
+
var _b = actObj.textSettings, fontFamily = _b.fontFamily, bold = _b.bold, italic = _b.italic, underline = _b.underline, strikethrough = _b.strikethrough;
|
|
2919
2919
|
var fontSize = actObj.textSettings.fontSize;
|
|
2920
2920
|
var lHeight = fontSize + fontSize * 0.25;
|
|
2921
2921
|
var lineHeight = ((lHeight * rows.length) - (fontSize * rows.length)) / rows.length;
|
|
@@ -2929,18 +2929,18 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
2929
2929
|
canvasDraw.fillStyle = tempFill;
|
|
2930
2930
|
for (var i = 0; i < rows.length; i++) {
|
|
2931
2931
|
var text = rows[i];
|
|
2932
|
-
var yPoint = ((i + 1) * fontSize * 0.
|
|
2932
|
+
var yPoint = ((i + 1) * fontSize * 0.9) + (i * lineHeight);
|
|
2933
2933
|
if (parent.transform.degree === -360) {
|
|
2934
2934
|
parent.transform.degree = 0;
|
|
2935
2935
|
}
|
|
2936
2936
|
if (parent.transform.degree === 0 || parent.transform.degree === 180) {
|
|
2937
2937
|
if (fontSize > height) {
|
|
2938
|
-
fontSize = actObj.textSettings.fontSize = height
|
|
2938
|
+
fontSize = actObj.textSettings.fontSize = height / 1.18;
|
|
2939
2939
|
}
|
|
2940
2940
|
}
|
|
2941
2941
|
else {
|
|
2942
2942
|
if (fontSize > width) {
|
|
2943
|
-
fontSize = actObj.textSettings.fontSize = width
|
|
2943
|
+
fontSize = actObj.textSettings.fontSize = width / 1.18;
|
|
2944
2944
|
}
|
|
2945
2945
|
}
|
|
2946
2946
|
canvasDraw.strokeStyle = actObj.strokeSettings.outlineColor;
|
|
@@ -2987,6 +2987,14 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
2987
2987
|
else {
|
|
2988
2988
|
canvasDraw.strokeText(text, startX + fontSize * 0.1, startY + yPoint);
|
|
2989
2989
|
canvasDraw.fillText(text, startX + fontSize * 0.1, startY + yPoint);
|
|
2990
|
+
if (underline) {
|
|
2991
|
+
var yOffset = yPoint + fontSize * 0.1;
|
|
2992
|
+
this.drawTextDecoration(canvasDraw, text, startX, startY, yOffset, fontSize, 0.1);
|
|
2993
|
+
}
|
|
2994
|
+
if (strikethrough) {
|
|
2995
|
+
var yOffset = yPoint - lineHeight - fontSize * 0.025;
|
|
2996
|
+
this.drawTextDecoration(canvasDraw, text, startX, startY, yOffset, fontSize, 0.1);
|
|
2997
|
+
}
|
|
2990
2998
|
}
|
|
2991
2999
|
canvasDraw.lineWidth = tempWidth;
|
|
2992
3000
|
}
|
|
@@ -2996,6 +3004,19 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
2996
3004
|
this.drawOuterSelection(canvasDraw);
|
|
2997
3005
|
}
|
|
2998
3006
|
};
|
|
3007
|
+
Draw.prototype.drawTextDecoration = function (canvasDraw, text, startX, startY, yOffset, fontSize, horizontalPadding) {
|
|
3008
|
+
if (horizontalPadding === void 0) { horizontalPadding = 0.1; }
|
|
3009
|
+
var tempWidth = canvasDraw.lineWidth;
|
|
3010
|
+
var textWidth = canvasDraw.measureText(text).width;
|
|
3011
|
+
canvasDraw.lineWidth = fontSize * 0.1;
|
|
3012
|
+
canvasDraw.beginPath();
|
|
3013
|
+
canvasDraw.moveTo(startX + fontSize * horizontalPadding, startY + yOffset);
|
|
3014
|
+
canvasDraw.lineTo(startX + textWidth + fontSize * horizontalPadding, startY + yOffset);
|
|
3015
|
+
canvasDraw.strokeStyle = canvasDraw.fillStyle;
|
|
3016
|
+
canvasDraw.stroke();
|
|
3017
|
+
canvasDraw.lineWidth = tempWidth;
|
|
3018
|
+
canvasDraw.strokeStyle = this.parent.activeObj.strokeSettings.outlineColor;
|
|
3019
|
+
};
|
|
2999
3020
|
Draw.prototype.updateActPoint = function (degree, canvasDraw) {
|
|
3000
3021
|
var parent = this.parent;
|
|
3001
3022
|
var actObj = parent.activeObj;
|
|
@@ -3242,6 +3263,14 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
3242
3263
|
yPoint + (i > 0 ? fontSize * 0.25 : -fontSize * 0.35));
|
|
3243
3264
|
canvasDraw.fillText(text, startX + fontSize * 0.15, startY +
|
|
3244
3265
|
yPoint + (i > 0 ? fontSize * 0.25 : -fontSize * 0.35));
|
|
3266
|
+
if (actObj.textSettings.underline) {
|
|
3267
|
+
var yOffset = yPoint + (i > 0 ? fontSize * 0.35 : -fontSize * 0.25);
|
|
3268
|
+
this.drawTextDecoration(canvasDraw, text, startX, startY, yOffset, fontSize, 0.15);
|
|
3269
|
+
}
|
|
3270
|
+
if (actObj.textSettings.strikethrough) {
|
|
3271
|
+
var yOffset = yPoint - lineHeight + (i > 0 ? -fontSize * 0.04 : -fontSize * 0.64);
|
|
3272
|
+
this.drawTextDecoration(canvasDraw, text, startX, startY, yOffset, fontSize, 0.1);
|
|
3273
|
+
}
|
|
3245
3274
|
}
|
|
3246
3275
|
};
|
|
3247
3276
|
Draw.prototype.clearOuterCanvas = function (context) {
|
|
@@ -3291,7 +3320,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
3291
3320
|
}
|
|
3292
3321
|
parent.img.destLeft = (parent.lowerCanvas.clientWidth - maxDimension.width) / 2;
|
|
3293
3322
|
if (degree === 0) {
|
|
3294
|
-
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height
|
|
3323
|
+
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height) / 2;
|
|
3295
3324
|
}
|
|
3296
3325
|
else {
|
|
3297
3326
|
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height) / 2;
|
|
@@ -3477,6 +3506,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
3477
3506
|
var parent = this.parent;
|
|
3478
3507
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
3479
3508
|
var proxy = this;
|
|
3509
|
+
parent.imageLoaded = false;
|
|
3480
3510
|
parent.baseImg.src = src;
|
|
3481
3511
|
parent.baseImg.onload = function () {
|
|
3482
3512
|
parent.imgSrc = src;
|
|
@@ -3521,6 +3551,10 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
3521
3551
|
var action = { action: 'file-open', actionEventArgs: fileOpened };
|
|
3522
3552
|
parent.triggerEditCompleteEvent(action);
|
|
3523
3553
|
}
|
|
3554
|
+
if (_this.fileType === 'Bmp') {
|
|
3555
|
+
_this.fileType = FileType.Png;
|
|
3556
|
+
}
|
|
3557
|
+
parent.imageLoaded = true;
|
|
3524
3558
|
};
|
|
3525
3559
|
parent.baseImg.onerror = function () {
|
|
3526
3560
|
hideSpinner(parent.element);
|
|
@@ -3535,9 +3569,20 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
3535
3569
|
};
|
|
3536
3570
|
Draw.prototype.updateBaseImgCanvas = function () {
|
|
3537
3571
|
var parent = this.parent;
|
|
3538
|
-
parent.
|
|
3539
|
-
|
|
3540
|
-
|
|
3572
|
+
if (!parent.aspectRatioBaseDimension && parent.imageSettings.width && parent.imageSettings.height) {
|
|
3573
|
+
var widthRatio = parent.baseImg.width / parent.imageSettings.width;
|
|
3574
|
+
var heightRatio = parent.baseImg.height / parent.imageSettings.height;
|
|
3575
|
+
var ratio = (widthRatio + heightRatio) / 2;
|
|
3576
|
+
ratio = ratio < 1 ? 1 : ratio;
|
|
3577
|
+
parent.baseImgCanvas.width = parent.imageSettings.width * ratio;
|
|
3578
|
+
parent.baseImgCanvas.height = parent.imageSettings.height * ratio;
|
|
3579
|
+
parent.baseImgCanvas.getContext('2d').drawImage(parent.baseImg, 0, 0, parent.baseImgCanvas.width, parent.baseImgCanvas.height);
|
|
3580
|
+
}
|
|
3581
|
+
else {
|
|
3582
|
+
parent.baseImgCanvas.width = parent.baseImg.width;
|
|
3583
|
+
parent.baseImgCanvas.height = parent.baseImg.height;
|
|
3584
|
+
parent.baseImgCanvas.getContext('2d').drawImage(parent.baseImg, 0, 0);
|
|
3585
|
+
}
|
|
3541
3586
|
};
|
|
3542
3587
|
Draw.prototype.updateCanvas = function (isCropped, isSameDimension) {
|
|
3543
3588
|
var parent = this.parent;
|
|
@@ -3564,7 +3609,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
3564
3609
|
value: { width: parent.img.srcWidth, height: parent.img.srcHeight, obj: obj, isImgShape: null } });
|
|
3565
3610
|
var maxDimension = obj;
|
|
3566
3611
|
parent.img.destLeft = (parent.lowerCanvas.clientWidth - maxDimension.width) / 2;
|
|
3567
|
-
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height
|
|
3612
|
+
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height) / 2;
|
|
3568
3613
|
this.drawImgToCanvas(maxDimension);
|
|
3569
3614
|
this.origDim.width = parent.img.destWidth;
|
|
3570
3615
|
this.origDim.height = parent.img.destHeight;
|
|
@@ -3901,7 +3946,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
3901
3946
|
}
|
|
3902
3947
|
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
3903
3948
|
this.tempTextSettings = { text: 'Enter Text', fontFamily: parent.fontFamily.default, fontSize: null, fontRatio: null, bold: false,
|
|
3904
|
-
italic: false, underline: false };
|
|
3949
|
+
italic: false, underline: false, strikethrough: false };
|
|
3905
3950
|
parent.objColl = extend([], this.tempObjColl, [], true);
|
|
3906
3951
|
parent.pointColl = extend([], this.tempPointColl, [], true);
|
|
3907
3952
|
this.renderImage();
|
|
@@ -4387,7 +4432,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
4387
4432
|
var parent = this.parent;
|
|
4388
4433
|
if (parent.transform.degree % 90 === 0 && parent.transform.degree % 180 !== 0) {
|
|
4389
4434
|
parent.img.destLeft = (parent.lowerCanvas.clientWidth - parent.img.destHeight) / 2;
|
|
4390
|
-
parent.img.destTop = (parent.lowerCanvas.clientHeight - parent.img.destWidth
|
|
4435
|
+
parent.img.destTop = (parent.lowerCanvas.clientHeight - parent.img.destWidth) / 2;
|
|
4391
4436
|
var temp = parent.img.destWidth;
|
|
4392
4437
|
parent.img.destWidth = parent.img.destHeight;
|
|
4393
4438
|
parent.img.destHeight = temp;
|
|
@@ -4395,7 +4440,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
4395
4440
|
else {
|
|
4396
4441
|
if (isNullOrUndefined(isPreventDimension)) {
|
|
4397
4442
|
parent.img.destLeft = (parent.lowerCanvas.clientWidth - parent.img.destWidth) / 2;
|
|
4398
|
-
parent.img.destTop = (parent.lowerCanvas.clientHeight - parent.img.destHeight
|
|
4443
|
+
parent.img.destTop = (parent.lowerCanvas.clientHeight - parent.img.destHeight) / 2;
|
|
4399
4444
|
}
|
|
4400
4445
|
}
|
|
4401
4446
|
};
|
|
@@ -4854,7 +4899,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
4854
4899
|
this.fileType = 'Jpeg';
|
|
4855
4900
|
fileType = 'jpeg';
|
|
4856
4901
|
}
|
|
4857
|
-
if (fileType !== 'jpeg' && fileType !== 'png' && fileType !== 'svg' && fileType !== 'webp') {
|
|
4902
|
+
if (fileType !== 'jpeg' && fileType !== 'png' && fileType !== 'svg' && fileType !== 'webp' && fileType !== 'bmp') {
|
|
4858
4903
|
this.fileType = null;
|
|
4859
4904
|
}
|
|
4860
4905
|
}
|
|
@@ -4885,24 +4930,33 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
4885
4930
|
};
|
|
4886
4931
|
Draw.prototype.getImageSizeFromURL = function (imageUrl, callback) {
|
|
4887
4932
|
return __awaiter(this, void 0, void 0, function () {
|
|
4888
|
-
var response,
|
|
4889
|
-
return __generator(this, function (
|
|
4890
|
-
switch (
|
|
4933
|
+
var response, isBlob, imageSizeMB, _a, ex_1;
|
|
4934
|
+
return __generator(this, function (_b) {
|
|
4935
|
+
switch (_b.label) {
|
|
4891
4936
|
case 0:
|
|
4892
|
-
|
|
4893
|
-
|
|
4937
|
+
_b.trys.push([0, 5, , 6]);
|
|
4938
|
+
isBlob = imageUrl.indexOf('blob:') === 0;
|
|
4939
|
+
return [4 /*yield*/, fetch(imageUrl, { method: isBlob ? 'GET' : 'HEAD' })];
|
|
4894
4940
|
case 1:
|
|
4895
|
-
response =
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
callback(imageSizeMB);
|
|
4899
|
-
return [3 /*break*/, 3];
|
|
4941
|
+
response = _b.sent();
|
|
4942
|
+
if (!isBlob) return [3 /*break*/, 3];
|
|
4943
|
+
return [4 /*yield*/, response.blob()];
|
|
4900
4944
|
case 2:
|
|
4901
|
-
|
|
4945
|
+
_a = (_b.sent()).size;
|
|
4946
|
+
return [3 /*break*/, 4];
|
|
4947
|
+
case 3:
|
|
4948
|
+
_a = parseInt(response.headers.get('content-length') || '0', 10);
|
|
4949
|
+
_b.label = 4;
|
|
4950
|
+
case 4:
|
|
4951
|
+
imageSizeMB = _a;
|
|
4952
|
+
callback(imageSizeMB);
|
|
4953
|
+
return [3 /*break*/, 6];
|
|
4954
|
+
case 5:
|
|
4955
|
+
ex_1 = _b.sent();
|
|
4902
4956
|
// eslint-disable-next-line no-console
|
|
4903
4957
|
console.log(ex_1.message);
|
|
4904
|
-
return [3 /*break*/,
|
|
4905
|
-
case
|
|
4958
|
+
return [3 /*break*/, 6];
|
|
4959
|
+
case 6: return [2 /*return*/];
|
|
4906
4960
|
}
|
|
4907
4961
|
});
|
|
4908
4962
|
});
|
|
@@ -5101,6 +5155,8 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
5101
5155
|
this.errorLoading();
|
|
5102
5156
|
return;
|
|
5103
5157
|
}
|
|
5158
|
+
parent.imageSettings = { width: null, height: null };
|
|
5159
|
+
parent.aspectRatioBaseDimension = null;
|
|
5104
5160
|
showSpinner(parent.element);
|
|
5105
5161
|
parent.element.style.opacity = '0.5';
|
|
5106
5162
|
this.inputElem = inputElement;
|
|
@@ -5233,7 +5289,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
5233
5289
|
}
|
|
5234
5290
|
var panX = (parent.lowerCanvas.clientWidth / 2) - (currObj.activePoint.startX +
|
|
5235
5291
|
(currObj.activePoint.width / 2));
|
|
5236
|
-
var panY = ((parent.lowerCanvas.clientHeight
|
|
5292
|
+
var panY = ((parent.lowerCanvas.clientHeight) / 2) - (currObj.activePoint.startY +
|
|
5237
5293
|
(currObj.activePoint.height / 2));
|
|
5238
5294
|
if (isNullOrUndefined(parent.activeObj.shape)) {
|
|
5239
5295
|
parent.activeObj = extend({}, activeObj, {}, true);
|
|
@@ -6013,8 +6069,20 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
6013
6069
|
var point = [];
|
|
6014
6070
|
var parent = this.parent;
|
|
6015
6071
|
var degree = parent.transform.degree;
|
|
6016
|
-
var width
|
|
6017
|
-
var height
|
|
6072
|
+
var width;
|
|
6073
|
+
var height;
|
|
6074
|
+
if (!parent.aspectRatioBaseDimension && parent.imageSettings.width && parent.imageSettings.height) {
|
|
6075
|
+
var widthRatio = parent.baseImg.width / parent.imageSettings.width;
|
|
6076
|
+
var heightRatio = parent.baseImg.height / parent.imageSettings.height;
|
|
6077
|
+
var ratio = (widthRatio + heightRatio) / 2;
|
|
6078
|
+
ratio = ratio < 1 ? 1 : ratio;
|
|
6079
|
+
width = parent.imageSettings.width * ratio;
|
|
6080
|
+
height = parent.imageSettings.height * ratio;
|
|
6081
|
+
}
|
|
6082
|
+
else {
|
|
6083
|
+
width = parent.baseImg.width;
|
|
6084
|
+
height = parent.baseImg.height;
|
|
6085
|
+
}
|
|
6018
6086
|
var obj = { dim: null, width: height, height: width, angle: parent.transform.straighten };
|
|
6019
6087
|
obj['dim'] = parent.getRotatedCanvasDim(obj['width'], obj['height'], obj['angle']);
|
|
6020
6088
|
var baseImgCanvasWidth = degree % 90 === 0 && degree % 180 !== 0 ? obj['dim']['width'] : parent.baseImgCanvas.width;
|
|
@@ -6286,6 +6354,9 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
6286
6354
|
}
|
|
6287
6355
|
canvasDraw.imageSmoothingEnabled = false;
|
|
6288
6356
|
canvasDraw.drawImage(offscreenCanvas, 0, 0, offscreenCanvas.width, offscreenCanvas.height, startX, startY, width, height);
|
|
6357
|
+
if (this.parent.imageSmoothingEnabled) {
|
|
6358
|
+
canvasDraw.imageSmoothingEnabled = true;
|
|
6359
|
+
}
|
|
6289
6360
|
}
|
|
6290
6361
|
obj.redactImage = this.parent.createElement('canvas');
|
|
6291
6362
|
obj.redactImage.width = offscreenCanvas.width;
|
|
@@ -6340,6 +6411,9 @@ var Export = /** @__PURE__ @class */ (function () {
|
|
|
6340
6411
|
case 'drawAnnotation':
|
|
6341
6412
|
this.drawAnnotation(args.value['context'], args.value['ratio']);
|
|
6342
6413
|
break;
|
|
6414
|
+
case 'downScaleImgCanvas':
|
|
6415
|
+
this.downScaleImgCanvas(args.value['canvas'], args.value['width'], args.value['height']);
|
|
6416
|
+
break;
|
|
6343
6417
|
}
|
|
6344
6418
|
};
|
|
6345
6419
|
Export.prototype.getModuleName = function () {
|
|
@@ -8960,6 +9034,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
8960
9034
|
this.isMouseUp = false;
|
|
8961
9035
|
this.mouseWheel = 0;
|
|
8962
9036
|
this.isTransformedShape = false;
|
|
9037
|
+
this.mouseClickPoint = { x: 0, y: 0 };
|
|
8963
9038
|
this.parent = parent;
|
|
8964
9039
|
this.addEventListener();
|
|
8965
9040
|
}
|
|
@@ -9130,7 +9205,8 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
9130
9205
|
parent.activeObj.textSettings.fontSize = 11;
|
|
9131
9206
|
parent.activeObj.keyHistory = 'Enter Text';
|
|
9132
9207
|
parent.notify('shape', { prop: 'initializeTextShape', onPropertyChange: false,
|
|
9133
|
-
value: { text: null, fontFamily: null, fontSize: null, bold: null, italic: null,
|
|
9208
|
+
value: { text: null, fontFamily: null, fontSize: null, bold: null, italic: null,
|
|
9209
|
+
underline: null, strikethrough: null, strokeColor: null } });
|
|
9134
9210
|
}
|
|
9135
9211
|
else if (args.value['shape'] === 'path') {
|
|
9136
9212
|
parent.activeObj.pointColl = [];
|
|
@@ -9343,6 +9419,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
9343
9419
|
this.isSliderActive = false;
|
|
9344
9420
|
this.arrowShape = [ArrowheadType.None, ArrowheadType.SolidArrow];
|
|
9345
9421
|
this.isMouseDown = this.isMouseUp = this.isTransformedShape = false;
|
|
9422
|
+
this.mouseClickPoint = { x: 0, y: 0 };
|
|
9346
9423
|
};
|
|
9347
9424
|
Selection.prototype.performTabAction = function () {
|
|
9348
9425
|
var parent = this.parent;
|
|
@@ -11377,7 +11454,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
11377
11454
|
var width_2 = this.upperContext.measureText(parent.activeObj.textSettings.text).width +
|
|
11378
11455
|
parent.activeObj.textSettings.fontSize * 0.5;
|
|
11379
11456
|
actPoint.endX = actPoint.startX + width_2;
|
|
11380
|
-
actPoint.endY = actPoint.startY + parent.activeObj.textSettings.fontSize;
|
|
11457
|
+
actPoint.endY = actPoint.startY + (parent.activeObj.textSettings.fontSize * 1.18);
|
|
11381
11458
|
actPoint.width = actPoint.endX - actPoint.startX;
|
|
11382
11459
|
actPoint.height = actPoint.endY - actPoint.startY;
|
|
11383
11460
|
tempActiveObj = extend({}, parent.activeObj, null, true);
|
|
@@ -12181,6 +12258,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
12181
12258
|
var activePoint = parent.activeObj.activePoint;
|
|
12182
12259
|
var x = imageEditorClickEventArgs.point.x;
|
|
12183
12260
|
var y = imageEditorClickEventArgs.point.y;
|
|
12261
|
+
this.mouseClickPoint = { x: x, y: y };
|
|
12184
12262
|
var cursor = parent.activeObj.shape && parent.activeObj.shape === 'text' ?
|
|
12185
12263
|
parent.cursor : 'default';
|
|
12186
12264
|
var tempCursor = parent.upperCanvas.style.cursor;
|
|
@@ -12231,7 +12309,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
12231
12309
|
value: { isTextBox: null } });
|
|
12232
12310
|
var width = this.upperContext.measureText(parent.activeObj.textSettings.text).width + parent.activeObj.textSettings.fontSize * 0.5;
|
|
12233
12311
|
activePoint.endX = activePoint.startX + width;
|
|
12234
|
-
activePoint.endY = activePoint.startY + parent.activeObj.textSettings.fontSize;
|
|
12312
|
+
activePoint.endY = activePoint.startY + (parent.activeObj.textSettings.fontSize * 1.18);
|
|
12235
12313
|
activePoint.width = activePoint.endX - activePoint.startX;
|
|
12236
12314
|
activePoint.height = activePoint.endY - activePoint.startY;
|
|
12237
12315
|
}
|
|
@@ -12660,6 +12738,12 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
12660
12738
|
var bbox = parent.lowerCanvas.getBoundingClientRect();
|
|
12661
12739
|
x -= bbox.left;
|
|
12662
12740
|
y -= bbox.top;
|
|
12741
|
+
if (parent.drawingShape === 'text' && this.mouseDownPoint && this.mouseDownPoint.x === x && this.mouseDownPoint.y === y) {
|
|
12742
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
12743
|
+
if (!parent.activeObj.keyHistory) {
|
|
12744
|
+
parent.activeObj.keyHistory = 'Enter Text';
|
|
12745
|
+
}
|
|
12746
|
+
}
|
|
12663
12747
|
var activeObjShape = void 0;
|
|
12664
12748
|
var currentDrawingShape = this.currentDrawingShape;
|
|
12665
12749
|
var dummyClick = false;
|
|
@@ -12837,6 +12921,12 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
12837
12921
|
}
|
|
12838
12922
|
}
|
|
12839
12923
|
if (!isCropSelection_1) {
|
|
12924
|
+
var isDummyClick = false;
|
|
12925
|
+
if (Math.round(x) === Math.round(this.mouseClickPoint.x) && Math.round(y) ===
|
|
12926
|
+
Math.round(this.mouseClickPoint.y)) {
|
|
12927
|
+
isDummyClick = true;
|
|
12928
|
+
parent.notify('undo-redo', { prop: 'preventApplyEditComplete', value: { bool: true } });
|
|
12929
|
+
}
|
|
12840
12930
|
this.adjustActObjForLineArrow();
|
|
12841
12931
|
if (parent.isShapeDrawing) {
|
|
12842
12932
|
var temp = this.currentDrawingShape;
|
|
@@ -12846,6 +12936,9 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
12846
12936
|
else {
|
|
12847
12937
|
parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
|
|
12848
12938
|
}
|
|
12939
|
+
if (isDummyClick) {
|
|
12940
|
+
parent.notify('undo-redo', { prop: 'preventApplyEditComplete', value: { bool: false } });
|
|
12941
|
+
}
|
|
12849
12942
|
}
|
|
12850
12943
|
}
|
|
12851
12944
|
}
|
|
@@ -12909,6 +13002,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
12909
13002
|
parent.notify('freehand-draw', { prop: 'resetSelPoints', onPropertyChange: false });
|
|
12910
13003
|
}
|
|
12911
13004
|
this.isMouseUp = false;
|
|
13005
|
+
this.mouseClickPoint = { x: 0, y: 0 };
|
|
12912
13006
|
};
|
|
12913
13007
|
Selection.prototype.adjustActObjForLineArrow = function (obj) {
|
|
12914
13008
|
var isAdjusted = false;
|
|
@@ -13190,7 +13284,8 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
13190
13284
|
(obj.textSettings && Math.round(obj.textSettings.fontRatio) !== Math.round(this.tempActiveObj.textSettings.fontRatio)) ||
|
|
13191
13285
|
(obj.textSettings && obj.textSettings.bold !== this.tempActiveObj.textSettings.bold) ||
|
|
13192
13286
|
(obj.textSettings && obj.textSettings.italic !== this.tempActiveObj.textSettings.italic) ||
|
|
13193
|
-
(obj.textSettings && obj.textSettings.underline !== this.tempActiveObj.textSettings.underline)
|
|
13287
|
+
(obj.textSettings && obj.textSettings.underline !== this.tempActiveObj.textSettings.underline) ||
|
|
13288
|
+
(obj.textSettings && obj.textSettings.strikethrough !== this.tempActiveObj.textSettings.strikethrough)) {
|
|
13194
13289
|
isApply = true;
|
|
13195
13290
|
}
|
|
13196
13291
|
if (this.isInitialTextEdited && !isApply) {
|
|
@@ -14234,6 +14329,17 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
14234
14329
|
else {
|
|
14235
14330
|
parent.activeObj.textSettings.italic = false;
|
|
14236
14331
|
}
|
|
14332
|
+
parent.activeObj.textSettings.underline = parent.activeObj.textSettings.strikethrough = false;
|
|
14333
|
+
if (parent.textArea.style.textDecoration === 'underline line-through') {
|
|
14334
|
+
parent.activeObj.textSettings.underline = true;
|
|
14335
|
+
parent.activeObj.textSettings.strikethrough = true;
|
|
14336
|
+
}
|
|
14337
|
+
else if (parent.textArea.style.textDecoration === 'underline') {
|
|
14338
|
+
parent.activeObj.textSettings.underline = true;
|
|
14339
|
+
}
|
|
14340
|
+
else if (parent.textArea.style.textDecoration === 'line-through') {
|
|
14341
|
+
parent.activeObj.textSettings.strikethrough = true;
|
|
14342
|
+
}
|
|
14237
14343
|
parent.activeObj.textSettings.fontSize = (parseFloat(parent.textArea.style.fontSize));
|
|
14238
14344
|
};
|
|
14239
14345
|
Selection.prototype.rgbToHex = function (r, g, b, a) {
|
|
@@ -14385,6 +14491,9 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
14385
14491
|
if (parent.activeObj.textSettings.underline) {
|
|
14386
14492
|
fontStyle.push('underline');
|
|
14387
14493
|
}
|
|
14494
|
+
if (parent.activeObj.textSettings.strikethrough) {
|
|
14495
|
+
fontStyle.push('strikethrough');
|
|
14496
|
+
}
|
|
14388
14497
|
}
|
|
14389
14498
|
var _a = parent.activeObj.activePoint, startX = _a.startX, startY = _a.startY, endX = _a.endX, endY = _a.endY, width = _a.width, height = _a.height;
|
|
14390
14499
|
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;
|
|
@@ -14573,7 +14682,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
14573
14682
|
/* eslint-disable no-constant-condition */
|
|
14574
14683
|
var Shape = /** @__PURE__ @class */ (function () {
|
|
14575
14684
|
function Shape(parent) {
|
|
14576
|
-
this.textSettings = { text: 'Enter Text', fontFamily: '', fontSize: null, fontRatio: null, bold: false, italic: false, underline: false };
|
|
14685
|
+
this.textSettings = { text: 'Enter Text', fontFamily: '', fontSize: null, fontRatio: null, bold: false, italic: false, underline: false, strikethrough: false };
|
|
14577
14686
|
this.strokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null, radius: null, outlineColor: '', outlineWidth: null };
|
|
14578
14687
|
this.keyHistory = ''; // text history
|
|
14579
14688
|
this.preventFrameAnnotation = false;
|
|
@@ -14616,7 +14725,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
14616
14725
|
this.drawRectangle(args.value['x'], args.value['y'], args.value['width'], args.value['height'], args.value['strokeWidth'], args.value['strokeColor'], args.value['fillColor'], args.value['degree'], args.value['isSelected'], args.value['radius']);
|
|
14617
14726
|
break;
|
|
14618
14727
|
case 'drawText':
|
|
14619
|
-
this.drawText(args.value['x'], args.value['y'], args.value['text'], args.value['fontFamily'], args.value['fontSize'], args.value['bold'], args.value['italic'], args.value['color'], args.value['isSelected'], args.value['degree'], args.value['fillColor'], args.value['outlineColor'], args.value['outlineWidth'], args.value['transformCollection']);
|
|
14728
|
+
this.drawText(args.value['x'], args.value['y'], args.value['text'], args.value['fontFamily'], args.value['fontSize'], args.value['bold'], args.value['italic'], args.value['color'], args.value['isSelected'], args.value['degree'], args.value['fillColor'], args.value['outlineColor'], args.value['outlineWidth'], args.value['transformCollection'], args.value['underline'], args.value['strikethrough']);
|
|
14620
14729
|
break;
|
|
14621
14730
|
case 'redrawActObj':
|
|
14622
14731
|
this.redrawActObj(args.value['x'], args.value['y'], args.value['isMouseDown']);
|
|
@@ -14780,7 +14889,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
14780
14889
|
this.alignTextAreaIntoCanvas();
|
|
14781
14890
|
break;
|
|
14782
14891
|
case 'initializeTextShape':
|
|
14783
|
-
this.initializeTextShape(args.value['text'], args.value['fontFamily'], args.value['fontSize'], args.value['bold'], args.value['italic'], args.value['strokeColor'], args.value['fillColor'], args.value['outlineColor'], args.value['outlineWidth']);
|
|
14892
|
+
this.initializeTextShape(args.value['text'], args.value['fontFamily'], args.value['fontSize'], args.value['bold'], args.value['italic'], args.value['underline'], args.value['strikethrough'], args.value['strokeColor'], args.value['fillColor'], args.value['outlineColor'], args.value['outlineWidth']);
|
|
14784
14893
|
break;
|
|
14785
14894
|
case 'stopPathDrawing':
|
|
14786
14895
|
this.stopPathDrawing(args.value['e'], args.value['isApply']);
|
|
@@ -14875,7 +14984,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
14875
14984
|
};
|
|
14876
14985
|
Shape.prototype.reset = function () {
|
|
14877
14986
|
this.textSettings =
|
|
14878
|
-
{ text: 'Enter Text', fontFamily: this.parent.fontFamily.default, fontSize: null, fontRatio: null, bold: false, italic: false, underline: false };
|
|
14987
|
+
{ text: 'Enter Text', fontFamily: this.parent.fontFamily.default, fontSize: null, fontRatio: null, bold: false, italic: false, underline: false, strikethrough: false };
|
|
14879
14988
|
this.strokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null, radius: null, outlineColor: '', outlineWidth: null };
|
|
14880
14989
|
this.preventFrameAnnotation = false;
|
|
14881
14990
|
};
|
|
@@ -14915,8 +15024,8 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
14915
15024
|
var start = x && y ? { x: x, y: y } : null;
|
|
14916
15025
|
this.drawShape('redact', null, null, null, start, width, height, null, null, null, null, null, null, null, type, value);
|
|
14917
15026
|
};
|
|
14918
|
-
Shape.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color, isSelected, degree, fillColor, outlineColor, outlineWidth, transformCollection) {
|
|
14919
|
-
this.drawShapeText(text, fontFamily, fontSize, bold, italic, color, x, y, isSelected, degree, fillColor, outlineColor, outlineWidth, transformCollection);
|
|
15027
|
+
Shape.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color, isSelected, degree, fillColor, outlineColor, outlineWidth, transformCollection, underline, strikethrough) {
|
|
15028
|
+
this.drawShapeText(text, fontFamily, fontSize, bold, italic, color, x, y, isSelected, degree, fillColor, outlineColor, outlineWidth, transformCollection, underline, strikethrough);
|
|
14920
15029
|
};
|
|
14921
15030
|
Shape.prototype.initializeShape = function (type) {
|
|
14922
15031
|
var parent = this.parent;
|
|
@@ -15102,7 +15211,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
15102
15211
|
value: { obj: selPointCollObj } });
|
|
15103
15212
|
this.prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
15104
15213
|
};
|
|
15105
|
-
Shape.prototype.drawShapeText = function (text, fontFamily, fontSize, bold, italic, strokeColor, x, y, isSelected, degree, fillColor, outlineColor, outlineWidth, transformCollection) {
|
|
15214
|
+
Shape.prototype.drawShapeText = function (text, fontFamily, fontSize, bold, italic, strokeColor, x, y, isSelected, degree, fillColor, outlineColor, outlineWidth, transformCollection, underline, strikethrough) {
|
|
15106
15215
|
var parent = this.parent;
|
|
15107
15216
|
if (!parent.disabled && parent.isImageLoaded) {
|
|
15108
15217
|
if (parent.currObjType.shape === 'freehanddraw') {
|
|
@@ -15117,7 +15226,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
15117
15226
|
this.refreshActiveObj();
|
|
15118
15227
|
parent.activeObj.shape = parent.currObjType.shape = 'text';
|
|
15119
15228
|
parent.currObjType.isCustomCrop = false;
|
|
15120
|
-
this.initializeTextShape(text, fontFamily, fontSize, bold, italic, strokeColor, fillColor, outlineColor, outlineWidth);
|
|
15229
|
+
this.initializeTextShape(text, fontFamily, fontSize, bold, italic, underline, strikethrough, strokeColor, fillColor, outlineColor, outlineWidth);
|
|
15121
15230
|
parent.currObjType.isText = parent.currObjType.isInitialText = true;
|
|
15122
15231
|
if (isNullOrUndefined(parent.activeObj.textSettings.fontSize)) {
|
|
15123
15232
|
parent.getFontSizes();
|
|
@@ -15268,7 +15377,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
15268
15377
|
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
15269
15378
|
parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
|
|
15270
15379
|
};
|
|
15271
|
-
Shape.prototype.initializeTextShape = function (text, fontFamily, fontSize, bold, italic, strokeColor, fillColor, outlineColor, outlineWidth) {
|
|
15380
|
+
Shape.prototype.initializeTextShape = function (text, fontFamily, fontSize, bold, italic, underline, strikethrough, strokeColor, fillColor, outlineColor, outlineWidth) {
|
|
15272
15381
|
var parent = this.parent;
|
|
15273
15382
|
this.keyHistory = '';
|
|
15274
15383
|
parent.upperCanvas.style.display = 'block';
|
|
@@ -15279,6 +15388,8 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
15279
15388
|
parent.activeObj.textSettings.fontSize = fontSize || parent.activeObj.textSettings.fontSize;
|
|
15280
15389
|
parent.activeObj.textSettings.bold = bold || parent.activeObj.textSettings.bold;
|
|
15281
15390
|
parent.activeObj.textSettings.italic = italic || parent.activeObj.textSettings.italic;
|
|
15391
|
+
parent.activeObj.textSettings.underline = underline || parent.activeObj.textSettings.underline;
|
|
15392
|
+
parent.activeObj.textSettings.strikethrough = strikethrough || parent.activeObj.textSettings.strikethrough;
|
|
15282
15393
|
parent.activeObj.strokeSettings.outlineColor = outlineColor || parent.activeObj.strokeSettings.outlineColor;
|
|
15283
15394
|
parent.activeObj.strokeSettings.outlineWidth = outlineWidth || parent.activeObj.strokeSettings.outlineWidth;
|
|
15284
15395
|
};
|
|
@@ -15483,6 +15594,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
15483
15594
|
parent.activeObj.textSettings.bold = false;
|
|
15484
15595
|
parent.activeObj.textSettings.italic = false;
|
|
15485
15596
|
parent.activeObj.textSettings.underline = false;
|
|
15597
|
+
parent.activeObj.textSettings.strikethrough = false;
|
|
15486
15598
|
for (var i = 0; i < shapeSettings.fontStyle.length; i++) {
|
|
15487
15599
|
switch (shapeSettings.fontStyle[i]) {
|
|
15488
15600
|
case 'bold':
|
|
@@ -15491,6 +15603,12 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
15491
15603
|
case 'italic':
|
|
15492
15604
|
parent.activeObj.textSettings.italic = true;
|
|
15493
15605
|
break;
|
|
15606
|
+
case 'underline':
|
|
15607
|
+
parent.activeObj.textSettings.underline = true;
|
|
15608
|
+
break;
|
|
15609
|
+
case 'strikethrough':
|
|
15610
|
+
parent.activeObj.textSettings.strikethrough = true;
|
|
15611
|
+
break;
|
|
15494
15612
|
}
|
|
15495
15613
|
}
|
|
15496
15614
|
}
|
|
@@ -15509,7 +15627,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
15509
15627
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
15510
15628
|
this.updateFontStyles();
|
|
15511
15629
|
var width = this.upperContext.measureText(this.keyHistory).width + fontSize * 0.5;
|
|
15512
|
-
var height = fontSize;
|
|
15630
|
+
var height = fontSize * 1.18;
|
|
15513
15631
|
this.upperContext.fillText(this.keyHistory, parent.activeObj.activePoint.startX, parent.activeObj.activePoint.startY + fontSize);
|
|
15514
15632
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
15515
15633
|
parent.currObjType.isText = true;
|
|
@@ -15532,7 +15650,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
15532
15650
|
var text = (parent.textArea.style.display === 'block' || parent.textArea.style.display === 'inline-block') ?
|
|
15533
15651
|
this.getMaxText(true) : this.getMaxText();
|
|
15534
15652
|
var width = this.upperContext.measureText(text).width + fontSize * 0.5;
|
|
15535
|
-
var height = rows.length * fontSize;
|
|
15653
|
+
var height = rows.length * fontSize * 1.18;
|
|
15536
15654
|
if (rows.length > 1) {
|
|
15537
15655
|
height += (fontSize * 0.50);
|
|
15538
15656
|
}
|
|
@@ -15567,7 +15685,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
15567
15685
|
parent.textArea.value = '';
|
|
15568
15686
|
this.updateFontStyles();
|
|
15569
15687
|
var width = this.upperContext.measureText(parent.activeObj.keyHistory).width + fontSize * 0.5;
|
|
15570
|
-
var height = fontSize;
|
|
15688
|
+
var height = fontSize * 1.18;
|
|
15571
15689
|
var rows = parent.activeObj.keyHistory.split('\n');
|
|
15572
15690
|
if (rows.length > 1) {
|
|
15573
15691
|
height *= rows.length;
|
|
@@ -16322,6 +16440,9 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
16322
16440
|
}
|
|
16323
16441
|
parent.textArea.style.fontWeight = actObj.textSettings.bold ? 'bold' : 'normal';
|
|
16324
16442
|
parent.textArea.style.fontStyle = actObj.textSettings.italic ? 'italic' : 'normal';
|
|
16443
|
+
parent.textArea.style.textDecoration = (actObj.textSettings.underline && actObj.textSettings.strikethrough) ? 'underline line-through' :
|
|
16444
|
+
(actObj.textSettings.underline) ? 'underline' :
|
|
16445
|
+
(actObj.textSettings.strikethrough) ? 'line-through' : 'none';
|
|
16325
16446
|
parent.textArea.style.border = '2px solid ' + parent.themeColl[parent.theme]['primaryColor'];
|
|
16326
16447
|
parent.textArea.value = actObj.keyHistory;
|
|
16327
16448
|
parent.textArea.style.overflow = 'hidden';
|
|
@@ -16868,7 +16989,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
16868
16989
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
16869
16990
|
var fileData = filesData;
|
|
16870
16991
|
var fileExtension = fileData.name && fileData.name.split('.').pop().toLowerCase();
|
|
16871
|
-
if (fileExtension && ['jpg', 'jpeg', 'png', 'svg', 'webp'].indexOf(fileExtension) === -1) {
|
|
16992
|
+
if (fileExtension && ['jpg', 'jpeg', 'png', 'svg', 'webp', 'bmp'].indexOf(fileExtension) === -1) {
|
|
16872
16993
|
this.refreshActiveObj();
|
|
16873
16994
|
return;
|
|
16874
16995
|
}
|
|
@@ -17215,9 +17336,16 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
17215
17336
|
var obj = { shapeSettingsObj: {} };
|
|
17216
17337
|
parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
|
|
17217
17338
|
var shapeSettings = obj['shapeSettingsObj'];
|
|
17339
|
+
var isObjPushed = false;
|
|
17340
|
+
var collLength = parent.objColl.length;
|
|
17218
17341
|
this.pushActItemIntoObj();
|
|
17342
|
+
if (collLength !== parent.objColl.length) {
|
|
17343
|
+
isObjPushed = true;
|
|
17344
|
+
}
|
|
17219
17345
|
var objColl = extend([], parent.objColl, [], true);
|
|
17220
|
-
|
|
17346
|
+
if (isObjPushed) {
|
|
17347
|
+
parent.objColl.pop();
|
|
17348
|
+
}
|
|
17221
17349
|
if (parent.textArea.style.display === 'none') {
|
|
17222
17350
|
this.updateFontRatio(parent.activeObj);
|
|
17223
17351
|
}
|
|
@@ -17226,24 +17354,77 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
17226
17354
|
}
|
|
17227
17355
|
switch (item) {
|
|
17228
17356
|
case 'default':
|
|
17229
|
-
this.updateFontStyle(item, objColl, 'normal', 'normal');
|
|
17357
|
+
this.updateFontStyle(item, objColl, 'normal', 'normal', false, false);
|
|
17230
17358
|
break;
|
|
17231
17359
|
case 'bold':
|
|
17232
|
-
this.updateFontStyle(item, objColl, 'bold', 'normal');
|
|
17360
|
+
this.updateFontStyle(item, objColl, 'bold', 'normal', false, false);
|
|
17233
17361
|
break;
|
|
17234
17362
|
case 'italic':
|
|
17235
|
-
this.updateFontStyle(item, objColl, 'normal', 'italic');
|
|
17363
|
+
this.updateFontStyle(item, objColl, 'normal', 'italic', false, false);
|
|
17236
17364
|
break;
|
|
17237
17365
|
case 'bolditalic':
|
|
17238
|
-
this.updateFontStyle(item, objColl, 'bold', 'italic');
|
|
17366
|
+
this.updateFontStyle(item, objColl, 'bold', 'italic', false, false);
|
|
17367
|
+
break;
|
|
17368
|
+
case 'underline':
|
|
17369
|
+
this.updateFontStyle(item, objColl, 'normal', 'normal', true, false);
|
|
17370
|
+
break;
|
|
17371
|
+
case 'boldunderline':
|
|
17372
|
+
this.updateFontStyle(item, objColl, 'bold', 'normal', true, false);
|
|
17373
|
+
break;
|
|
17374
|
+
case 'italicunderline':
|
|
17375
|
+
this.updateFontStyle(item, objColl, 'normal', 'italic', true, false);
|
|
17376
|
+
break;
|
|
17377
|
+
case 'bolditalicunderline':
|
|
17378
|
+
this.updateFontStyle(item, objColl, 'bold', 'italic', true, false);
|
|
17379
|
+
break;
|
|
17380
|
+
case 'strikethrough':
|
|
17381
|
+
this.updateFontStyle(item, objColl, 'normal', 'normal', false, true);
|
|
17382
|
+
break;
|
|
17383
|
+
case 'boldstrikethrough':
|
|
17384
|
+
this.updateFontStyle(item, objColl, 'bold', 'normal', false, true);
|
|
17385
|
+
break;
|
|
17386
|
+
case 'italicstrikethrough':
|
|
17387
|
+
this.updateFontStyle(item, objColl, 'normal', 'italic', false, true);
|
|
17388
|
+
break;
|
|
17389
|
+
case 'underlinestrikethrough':
|
|
17390
|
+
this.updateFontStyle(item, objColl, 'normal', 'normal', true, true);
|
|
17391
|
+
break;
|
|
17392
|
+
case 'bolditalicstrikethrough':
|
|
17393
|
+
this.updateFontStyle(item, objColl, 'bold', 'italic', false, true);
|
|
17394
|
+
break;
|
|
17395
|
+
case 'boldunderlinestrikethrough':
|
|
17396
|
+
this.updateFontStyle(item, objColl, 'bold', 'normal', true, true);
|
|
17397
|
+
break;
|
|
17398
|
+
case 'italicunderlinestrikethrough':
|
|
17399
|
+
this.updateFontStyle(item, objColl, 'normal', 'italic', true, true);
|
|
17400
|
+
break;
|
|
17401
|
+
case 'bolditalicunderlinestrikethrough':
|
|
17402
|
+
this.updateFontStyle(item, objColl, 'bold', 'italic', true, true);
|
|
17239
17403
|
break;
|
|
17240
17404
|
}
|
|
17241
17405
|
var shapeChangedArgs = { action: 'font-style', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
17242
|
-
shapeChangedArgs.currentShapeSettings.fontStyle =
|
|
17406
|
+
shapeChangedArgs.currentShapeSettings.fontStyle = this.getFontStyleArray(item);
|
|
17243
17407
|
parent.trigger('shapeChange', shapeChangedArgs);
|
|
17244
17408
|
parent.editCompleteArgs = shapeChangedArgs;
|
|
17245
17409
|
};
|
|
17246
|
-
Shape.prototype.
|
|
17410
|
+
Shape.prototype.getFontStyleArray = function (item) {
|
|
17411
|
+
var styleArray = [];
|
|
17412
|
+
var lowerItem = item.toLowerCase();
|
|
17413
|
+
if (lowerItem.indexOf('bold') > -1) {
|
|
17414
|
+
styleArray.push('bold');
|
|
17415
|
+
}
|
|
17416
|
+
if (lowerItem.indexOf('italic') > -1) {
|
|
17417
|
+
styleArray.push('italic');
|
|
17418
|
+
}
|
|
17419
|
+
if (lowerItem.indexOf('underline') > -1) {
|
|
17420
|
+
styleArray.push('underline');
|
|
17421
|
+
}
|
|
17422
|
+
if (lowerItem.indexOf('strikethrough') > -1) {
|
|
17423
|
+
styleArray.push('strikethrough');
|
|
17424
|
+
}
|
|
17425
|
+
return styleArray;
|
|
17426
|
+
};
|
|
17427
|
+
Shape.prototype.updateFontStyle = function (item, objColl, fontWeight, fontStyle, underline, strikethrough) {
|
|
17247
17428
|
var parent = this.parent;
|
|
17248
17429
|
var style = parent.textArea.style;
|
|
17249
17430
|
if (style.display === 'block' || style.display === 'inline-block') {
|
|
@@ -17259,9 +17440,43 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
17259
17440
|
else {
|
|
17260
17441
|
style.fontStyle = 'normal';
|
|
17261
17442
|
}
|
|
17262
|
-
|
|
17263
|
-
|
|
17264
|
-
|
|
17443
|
+
if (underline && strikethrough) {
|
|
17444
|
+
style.textDecoration = 'underline line-through';
|
|
17445
|
+
}
|
|
17446
|
+
else if (strikethrough) {
|
|
17447
|
+
style.textDecoration = 'line-through';
|
|
17448
|
+
}
|
|
17449
|
+
else if (underline) {
|
|
17450
|
+
style.textDecoration = 'underline';
|
|
17451
|
+
}
|
|
17452
|
+
else {
|
|
17453
|
+
style.textDecoration = 'none';
|
|
17454
|
+
}
|
|
17455
|
+
var key = [
|
|
17456
|
+
style.fontWeight === 'bold' ? 'bold' : '',
|
|
17457
|
+
style.fontStyle === 'italic' ? 'italic' : '',
|
|
17458
|
+
typeof style.textDecoration === 'string' && style.textDecoration.indexOf('underline') > -1 ? 'underline' : '',
|
|
17459
|
+
typeof style.textDecoration === 'string' && style.textDecoration.indexOf('line-through') > -1 ? 'strikethrough' : ''
|
|
17460
|
+
].filter(Boolean).join('');
|
|
17461
|
+
var valueMap = {
|
|
17462
|
+
'': 'default',
|
|
17463
|
+
bold: 'bold',
|
|
17464
|
+
italic: 'italic',
|
|
17465
|
+
underline: 'underline',
|
|
17466
|
+
strikethrough: 'strikethrough',
|
|
17467
|
+
bolditalic: 'bolditalic',
|
|
17468
|
+
boldunderline: 'boldunderline',
|
|
17469
|
+
boldstrikethrough: 'boldstrikethrough',
|
|
17470
|
+
italicunderline: 'italicunderline',
|
|
17471
|
+
italicstrikethrough: 'italicstrikethrough',
|
|
17472
|
+
underlinestrikethrough: 'underlinestrikethrough',
|
|
17473
|
+
bolditalicunderline: 'bolditalicunderline',
|
|
17474
|
+
bolditalicstrikethrough: 'bolditalicstrikethrough',
|
|
17475
|
+
boldunderlinestrikethrough: 'boldunderlinestrikethrough',
|
|
17476
|
+
italicunderlinestrikethrough: 'italicunderlinestrikethrough',
|
|
17477
|
+
bolditalicunderlinestrikethrough: 'bolditalicunderlinestrikethrough'
|
|
17478
|
+
};
|
|
17479
|
+
var value = key in valueMap ? valueMap[key] : 'default';
|
|
17265
17480
|
var width = this.getTextAreaWidth(value);
|
|
17266
17481
|
style.width = width + 'px';
|
|
17267
17482
|
this.updateObjColl(item, objColl);
|
|
@@ -17269,6 +17484,8 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
17269
17484
|
else {
|
|
17270
17485
|
this.textSettings.bold = parent.activeObj.textSettings.bold = fontWeight === 'normal' ? false : true;
|
|
17271
17486
|
this.textSettings.italic = parent.activeObj.textSettings.italic = fontStyle === 'normal' ? false : true;
|
|
17487
|
+
this.textSettings.underline = parent.activeObj.textSettings.underline = underline ? true : false;
|
|
17488
|
+
this.textSettings.strikethrough = parent.activeObj.textSettings.strikethrough = strikethrough ? true : false;
|
|
17272
17489
|
if (parent.activeObj.activePoint.width !== 0 || parent.activeObj.activePoint.height !== 0) {
|
|
17273
17490
|
this.redrawText();
|
|
17274
17491
|
}
|
|
@@ -17364,24 +17581,107 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
17364
17581
|
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
17365
17582
|
value: { obj: selPointCollObj } });
|
|
17366
17583
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
17367
|
-
var
|
|
17368
|
-
var
|
|
17584
|
+
var textSettings = parent.activeObj.textSettings;
|
|
17585
|
+
var tempBold = textSettings.bold;
|
|
17586
|
+
var tempItalic = textSettings.italic;
|
|
17587
|
+
var tempUnderline = textSettings.underline;
|
|
17588
|
+
var tempStrikethrough = textSettings.strikethrough;
|
|
17369
17589
|
switch (item) {
|
|
17370
17590
|
case 'default':
|
|
17371
|
-
|
|
17372
|
-
|
|
17591
|
+
textSettings.bold = false;
|
|
17592
|
+
textSettings.italic = false;
|
|
17593
|
+
textSettings.underline = false;
|
|
17594
|
+
textSettings.strikethrough = false;
|
|
17373
17595
|
break;
|
|
17374
17596
|
case 'bold':
|
|
17375
|
-
|
|
17376
|
-
|
|
17597
|
+
textSettings.bold = true;
|
|
17598
|
+
textSettings.italic = false;
|
|
17599
|
+
textSettings.underline = false;
|
|
17600
|
+
textSettings.strikethrough = false;
|
|
17377
17601
|
break;
|
|
17378
17602
|
case 'italic':
|
|
17379
|
-
|
|
17380
|
-
|
|
17603
|
+
textSettings.bold = false;
|
|
17604
|
+
textSettings.italic = true;
|
|
17605
|
+
textSettings.underline = false;
|
|
17606
|
+
textSettings.strikethrough = false;
|
|
17381
17607
|
break;
|
|
17382
17608
|
case 'bolditalic':
|
|
17383
|
-
|
|
17384
|
-
|
|
17609
|
+
textSettings.bold = true;
|
|
17610
|
+
textSettings.italic = true;
|
|
17611
|
+
textSettings.underline = false;
|
|
17612
|
+
textSettings.strikethrough = false;
|
|
17613
|
+
break;
|
|
17614
|
+
case 'underline':
|
|
17615
|
+
textSettings.bold = false;
|
|
17616
|
+
textSettings.italic = false;
|
|
17617
|
+
textSettings.underline = true;
|
|
17618
|
+
textSettings.strikethrough = false;
|
|
17619
|
+
break;
|
|
17620
|
+
case 'boldunderline':
|
|
17621
|
+
textSettings.bold = true;
|
|
17622
|
+
textSettings.italic = false;
|
|
17623
|
+
textSettings.underline = true;
|
|
17624
|
+
textSettings.strikethrough = false;
|
|
17625
|
+
break;
|
|
17626
|
+
case 'italicunderline':
|
|
17627
|
+
textSettings.bold = false;
|
|
17628
|
+
textSettings.italic = true;
|
|
17629
|
+
textSettings.underline = true;
|
|
17630
|
+
textSettings.strikethrough = false;
|
|
17631
|
+
break;
|
|
17632
|
+
case 'bolditalicunderline':
|
|
17633
|
+
textSettings.bold = true;
|
|
17634
|
+
textSettings.italic = true;
|
|
17635
|
+
textSettings.underline = true;
|
|
17636
|
+
textSettings.strikethrough = false;
|
|
17637
|
+
break;
|
|
17638
|
+
case 'strikethrough':
|
|
17639
|
+
textSettings.bold = false;
|
|
17640
|
+
textSettings.italic = false;
|
|
17641
|
+
textSettings.underline = false;
|
|
17642
|
+
textSettings.strikethrough = true;
|
|
17643
|
+
break;
|
|
17644
|
+
case 'boldstrikethrough':
|
|
17645
|
+
textSettings.bold = true;
|
|
17646
|
+
textSettings.italic = false;
|
|
17647
|
+
textSettings.underline = false;
|
|
17648
|
+
textSettings.strikethrough = true;
|
|
17649
|
+
break;
|
|
17650
|
+
case 'italicstrikethrough':
|
|
17651
|
+
textSettings.bold = false;
|
|
17652
|
+
textSettings.italic = true;
|
|
17653
|
+
textSettings.underline = false;
|
|
17654
|
+
textSettings.strikethrough = true;
|
|
17655
|
+
break;
|
|
17656
|
+
case 'underlinestrikethrough':
|
|
17657
|
+
textSettings.bold = false;
|
|
17658
|
+
textSettings.italic = false;
|
|
17659
|
+
textSettings.underline = true;
|
|
17660
|
+
textSettings.strikethrough = true;
|
|
17661
|
+
break;
|
|
17662
|
+
case 'bolditalicstrikethrough':
|
|
17663
|
+
textSettings.bold = true;
|
|
17664
|
+
textSettings.italic = true;
|
|
17665
|
+
textSettings.underline = false;
|
|
17666
|
+
textSettings.strikethrough = true;
|
|
17667
|
+
break;
|
|
17668
|
+
case 'boldunderlinestrikethrough':
|
|
17669
|
+
textSettings.bold = true;
|
|
17670
|
+
textSettings.italic = false;
|
|
17671
|
+
textSettings.underline = true;
|
|
17672
|
+
textSettings.strikethrough = true;
|
|
17673
|
+
break;
|
|
17674
|
+
case 'italicunderlinestrikethrough':
|
|
17675
|
+
textSettings.bold = false;
|
|
17676
|
+
textSettings.italic = true;
|
|
17677
|
+
textSettings.underline = true;
|
|
17678
|
+
textSettings.strikethrough = true;
|
|
17679
|
+
break;
|
|
17680
|
+
case 'bolditalicunderlinestrikethrough':
|
|
17681
|
+
textSettings.bold = true;
|
|
17682
|
+
textSettings.italic = true;
|
|
17683
|
+
textSettings.underline = true;
|
|
17684
|
+
textSettings.strikethrough = true;
|
|
17385
17685
|
break;
|
|
17386
17686
|
}
|
|
17387
17687
|
parent.objColl.push(parent.activeObj);
|
|
@@ -17391,8 +17691,10 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
17391
17691
|
previousCropObj: prevCropObj, previousText: null,
|
|
17392
17692
|
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
17393
17693
|
parent.objColl.pop();
|
|
17394
|
-
|
|
17395
|
-
|
|
17694
|
+
textSettings.bold = tempBold;
|
|
17695
|
+
textSettings.italic = tempItalic;
|
|
17696
|
+
textSettings.underline = tempUnderline;
|
|
17697
|
+
textSettings.strikethrough = tempStrikethrough;
|
|
17396
17698
|
};
|
|
17397
17699
|
Shape.prototype.pushActItemIntoObj = function () {
|
|
17398
17700
|
var parent = this.parent;
|
|
@@ -17585,24 +17887,107 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
17585
17887
|
};
|
|
17586
17888
|
Shape.prototype.getTextAreaWidth = function (item) {
|
|
17587
17889
|
var parent = this.parent;
|
|
17588
|
-
var
|
|
17589
|
-
var
|
|
17890
|
+
var textSettings = parent.activeObj.textSettings;
|
|
17891
|
+
var tempBold = textSettings.bold;
|
|
17892
|
+
var tempItalic = textSettings.italic;
|
|
17893
|
+
var tempUnderline = textSettings.underline;
|
|
17894
|
+
var tempStrikethrough = textSettings.strikethrough;
|
|
17590
17895
|
switch (item) {
|
|
17591
17896
|
case 'default':
|
|
17592
|
-
|
|
17593
|
-
|
|
17897
|
+
textSettings.bold = false;
|
|
17898
|
+
textSettings.italic = false;
|
|
17899
|
+
textSettings.underline = false;
|
|
17900
|
+
textSettings.strikethrough = false;
|
|
17594
17901
|
break;
|
|
17595
17902
|
case 'bold':
|
|
17596
|
-
|
|
17597
|
-
|
|
17903
|
+
textSettings.bold = true;
|
|
17904
|
+
textSettings.italic = false;
|
|
17905
|
+
textSettings.underline = false;
|
|
17906
|
+
textSettings.strikethrough = false;
|
|
17598
17907
|
break;
|
|
17599
17908
|
case 'italic':
|
|
17600
|
-
|
|
17601
|
-
|
|
17909
|
+
textSettings.bold = false;
|
|
17910
|
+
textSettings.italic = true;
|
|
17911
|
+
textSettings.underline = false;
|
|
17912
|
+
textSettings.strikethrough = false;
|
|
17602
17913
|
break;
|
|
17603
17914
|
case 'bolditalic':
|
|
17604
|
-
|
|
17605
|
-
|
|
17915
|
+
textSettings.bold = true;
|
|
17916
|
+
textSettings.italic = true;
|
|
17917
|
+
textSettings.underline = false;
|
|
17918
|
+
textSettings.strikethrough = false;
|
|
17919
|
+
break;
|
|
17920
|
+
case 'underline':
|
|
17921
|
+
textSettings.bold = false;
|
|
17922
|
+
textSettings.italic = false;
|
|
17923
|
+
textSettings.underline = true;
|
|
17924
|
+
textSettings.strikethrough = false;
|
|
17925
|
+
break;
|
|
17926
|
+
case 'boldunderline':
|
|
17927
|
+
textSettings.bold = true;
|
|
17928
|
+
textSettings.italic = false;
|
|
17929
|
+
textSettings.underline = true;
|
|
17930
|
+
textSettings.strikethrough = false;
|
|
17931
|
+
break;
|
|
17932
|
+
case 'italicunderline':
|
|
17933
|
+
textSettings.bold = false;
|
|
17934
|
+
textSettings.italic = true;
|
|
17935
|
+
textSettings.underline = true;
|
|
17936
|
+
textSettings.strikethrough = false;
|
|
17937
|
+
break;
|
|
17938
|
+
case 'bolditalicunderline':
|
|
17939
|
+
textSettings.bold = true;
|
|
17940
|
+
textSettings.italic = true;
|
|
17941
|
+
textSettings.underline = true;
|
|
17942
|
+
textSettings.strikethrough = false;
|
|
17943
|
+
break;
|
|
17944
|
+
case 'strikethrough':
|
|
17945
|
+
textSettings.bold = false;
|
|
17946
|
+
textSettings.italic = false;
|
|
17947
|
+
textSettings.underline = false;
|
|
17948
|
+
textSettings.strikethrough = true;
|
|
17949
|
+
break;
|
|
17950
|
+
case 'boldstrikethrough':
|
|
17951
|
+
textSettings.bold = true;
|
|
17952
|
+
textSettings.italic = false;
|
|
17953
|
+
textSettings.underline = false;
|
|
17954
|
+
textSettings.strikethrough = true;
|
|
17955
|
+
break;
|
|
17956
|
+
case 'italicstrikethrough':
|
|
17957
|
+
textSettings.bold = false;
|
|
17958
|
+
textSettings.italic = true;
|
|
17959
|
+
textSettings.underline = false;
|
|
17960
|
+
textSettings.strikethrough = true;
|
|
17961
|
+
break;
|
|
17962
|
+
case 'underlinestrikethrough':
|
|
17963
|
+
textSettings.bold = false;
|
|
17964
|
+
textSettings.italic = false;
|
|
17965
|
+
textSettings.underline = true;
|
|
17966
|
+
textSettings.strikethrough = true;
|
|
17967
|
+
break;
|
|
17968
|
+
case 'bolditalicstrikethrough':
|
|
17969
|
+
textSettings.bold = true;
|
|
17970
|
+
textSettings.italic = true;
|
|
17971
|
+
textSettings.underline = false;
|
|
17972
|
+
textSettings.strikethrough = true;
|
|
17973
|
+
break;
|
|
17974
|
+
case 'boldunderlinestrikethrough':
|
|
17975
|
+
textSettings.bold = true;
|
|
17976
|
+
textSettings.italic = false;
|
|
17977
|
+
textSettings.underline = true;
|
|
17978
|
+
textSettings.strikethrough = true;
|
|
17979
|
+
break;
|
|
17980
|
+
case 'italicunderlinestrikethrough':
|
|
17981
|
+
textSettings.bold = false;
|
|
17982
|
+
textSettings.italic = true;
|
|
17983
|
+
textSettings.underline = true;
|
|
17984
|
+
textSettings.strikethrough = true;
|
|
17985
|
+
break;
|
|
17986
|
+
case 'bolditalicunderlinestrikethrough':
|
|
17987
|
+
textSettings.bold = true;
|
|
17988
|
+
textSettings.italic = true;
|
|
17989
|
+
textSettings.underline = true;
|
|
17990
|
+
textSettings.strikethrough = true;
|
|
17606
17991
|
break;
|
|
17607
17992
|
}
|
|
17608
17993
|
var isTextArea = parent.textArea.style.display === 'none' ? false : true;
|
|
@@ -17610,14 +17995,16 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
17610
17995
|
var width;
|
|
17611
17996
|
if (!isTextArea) {
|
|
17612
17997
|
width = this.upperContext.measureText(parent.activeObj.keyHistory).width +
|
|
17613
|
-
|
|
17998
|
+
textSettings.fontSize * 0.5;
|
|
17614
17999
|
}
|
|
17615
18000
|
else {
|
|
17616
18001
|
width = this.upperContext.measureText(parent.textArea.value).width +
|
|
17617
|
-
|
|
18002
|
+
textSettings.fontSize * 0.5;
|
|
17618
18003
|
}
|
|
17619
|
-
|
|
17620
|
-
|
|
18004
|
+
textSettings.bold = tempBold;
|
|
18005
|
+
textSettings.italic = tempItalic;
|
|
18006
|
+
textSettings.underline = tempUnderline;
|
|
18007
|
+
textSettings.strikethrough = tempStrikethrough;
|
|
17621
18008
|
return width;
|
|
17622
18009
|
};
|
|
17623
18010
|
Shape.prototype.getRedactObjDetails = function (obj) {
|
|
@@ -17696,6 +18083,12 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
17696
18083
|
if (obj.textSettings.italic) {
|
|
17697
18084
|
shapeDetails.fontStyle.push('italic');
|
|
17698
18085
|
}
|
|
18086
|
+
if (obj.textSettings.underline) {
|
|
18087
|
+
shapeDetails.fontStyle.push('underline');
|
|
18088
|
+
}
|
|
18089
|
+
if (obj.textSettings.strikethrough) {
|
|
18090
|
+
shapeDetails.fontStyle.push('strikethrough');
|
|
18091
|
+
}
|
|
17699
18092
|
shapeDetails.degree = obj.rotatedAngle * (180 / Math.PI);
|
|
17700
18093
|
parent.notify('selection', { prop: 'updateTransColl', onPropertyChange: false, value: { obj: transformObj, object: obj } });
|
|
17701
18094
|
shapeDetails.transformCollection = transformObj['coll'];
|
|
@@ -17995,6 +18388,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
17995
18388
|
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
17996
18389
|
parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
|
|
17997
18390
|
parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
|
|
18391
|
+
parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
17998
18392
|
}
|
|
17999
18393
|
};
|
|
18000
18394
|
Shape.prototype.getMaxText = function (isTextBox, text, obj) {
|
|
@@ -19411,40 +19805,40 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
19411
19805
|
destWidth: parent.img.destWidth, destHeight: parent.img.destHeight };
|
|
19412
19806
|
if (parent.activeObj.shape) {
|
|
19413
19807
|
var maxDimension = this.setZoomDimension(-0.1, parent.activeObj);
|
|
19414
|
-
|
|
19415
|
-
|
|
19416
|
-
if (parent.
|
|
19417
|
-
|
|
19418
|
-
|
|
19419
|
-
|
|
19420
|
-
|
|
19421
|
-
zoomOut.classList.add('e-disabled');
|
|
19422
|
-
zoomOut.parentElement.classList.add('e-overlay');
|
|
19423
|
-
isDisabled = true;
|
|
19424
|
-
}
|
|
19425
|
-
else {
|
|
19426
|
-
zoomOut.classList.remove('e-disabled');
|
|
19427
|
-
zoomOut.parentElement.classList.remove('e-overlay');
|
|
19428
|
-
isDisabled = false;
|
|
19429
|
-
}
|
|
19808
|
+
var actPoint = parent.activeObj.activePoint;
|
|
19809
|
+
if (parent.transform.straighten === 0) {
|
|
19810
|
+
if (parent.img.destLeft > actPoint.startX || parent.img.destTop >
|
|
19811
|
+
actPoint.startY || parent.img.destLeft + parent.img.destWidth <
|
|
19812
|
+
actPoint.endX || parent.img.destTop + parent.img.destHeight < actPoint.endY
|
|
19813
|
+
|| zoomFactor === minZoomFactor) {
|
|
19814
|
+
isDisabled = true;
|
|
19430
19815
|
}
|
|
19431
19816
|
else {
|
|
19432
|
-
|
|
19433
|
-
|
|
19434
|
-
|
|
19435
|
-
|
|
19436
|
-
|
|
19437
|
-
|
|
19438
|
-
|
|
19439
|
-
|
|
19440
|
-
|
|
19441
|
-
|
|
19442
|
-
|
|
19443
|
-
|
|
19444
|
-
|
|
19445
|
-
|
|
19446
|
-
|
|
19447
|
-
|
|
19817
|
+
isDisabled = false;
|
|
19818
|
+
}
|
|
19819
|
+
}
|
|
19820
|
+
else {
|
|
19821
|
+
parent.img.destWidth = maxDimension.width;
|
|
19822
|
+
parent.img.destHeight = maxDimension.height;
|
|
19823
|
+
var obj = { isIntersect: null };
|
|
19824
|
+
parent.notify('draw', { prop: 'updateImgCanvasPoints', onPropertyChange: false });
|
|
19825
|
+
parent.notify('draw', { prop: 'isLinesIntersect', onPropertyChange: false, value: { obj: obj } });
|
|
19826
|
+
if (obj['isIntersect'] ||
|
|
19827
|
+
zoomFactor === minZoomFactor) {
|
|
19828
|
+
isDisabled = true;
|
|
19829
|
+
}
|
|
19830
|
+
else {
|
|
19831
|
+
isDisabled = false;
|
|
19832
|
+
}
|
|
19833
|
+
}
|
|
19834
|
+
if (zoomOut) {
|
|
19835
|
+
if (isDisabled) {
|
|
19836
|
+
zoomOut.classList.add('e-disabled');
|
|
19837
|
+
zoomOut.parentElement.classList.add('e-overlay');
|
|
19838
|
+
}
|
|
19839
|
+
else {
|
|
19840
|
+
zoomOut.classList.remove('e-disabled');
|
|
19841
|
+
zoomOut.parentElement.classList.remove('e-overlay');
|
|
19448
19842
|
}
|
|
19449
19843
|
}
|
|
19450
19844
|
}
|
|
@@ -19480,7 +19874,7 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
19480
19874
|
maxDimension.width += (maxDimension.width * parent.transform.zoomFactor);
|
|
19481
19875
|
maxDimension.height += (maxDimension.height * parent.transform.zoomFactor);
|
|
19482
19876
|
parent.img.destLeft = (parent.lowerCanvas.clientWidth - maxDimension.width) / 2;
|
|
19483
|
-
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height
|
|
19877
|
+
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height) / 2;
|
|
19484
19878
|
}
|
|
19485
19879
|
parent.notify('draw', { prop: 'draw-image-to-canvas', value: { dimension: maxDimension } });
|
|
19486
19880
|
maxDimension.width = this.cropDimension.width;
|
|
@@ -20204,7 +20598,7 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
20204
20598
|
maxDimension.height += (maxDimension.height * parent.transform.defaultZoomFactor);
|
|
20205
20599
|
}
|
|
20206
20600
|
parent.img.destLeft = (parent.lowerCanvas.clientWidth - maxDimension.width) / 2;
|
|
20207
|
-
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height
|
|
20601
|
+
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height) / 2;
|
|
20208
20602
|
if (parent.transform.degree === 0 && parent.transform.currFlipState === '') {
|
|
20209
20603
|
if (parent.transform.defaultZoomFactor > 0) {
|
|
20210
20604
|
parent.img.destLeft += parent.panPoint.totalPannedPoint.x;
|
|
@@ -20313,11 +20707,11 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
20313
20707
|
var object = { toolbarHeight: 0 };
|
|
20314
20708
|
var parent = this.parent;
|
|
20315
20709
|
parent.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: object } });
|
|
20316
|
-
var
|
|
20317
|
-
|
|
20318
|
-
var
|
|
20319
|
-
|
|
20320
|
-
canvasMaxHeight = Browser.isDevice ? canvasMaxHeight - (object['toolbarHeight']) : canvasMaxHeight;
|
|
20710
|
+
var newWidth = parent.imageSettings.width ? parent.imageSettings.width : parent.element.clientWidth;
|
|
20711
|
+
var newHeight = parent.imageSettings.height ? parent.imageSettings.height : parent.element.clientHeight - (object['toolbarHeight']);
|
|
20712
|
+
var canvasMaxWidth = isImgShape ? parent.element.clientWidth / 3 : newWidth;
|
|
20713
|
+
var canvasMaxHeight = isImgShape ? (parent.element.clientHeight - object['toolbarHeight']) / 3 : newHeight;
|
|
20714
|
+
canvasMaxHeight = Browser.isDevice ? canvasMaxHeight - (object['toolbarHeight']) : canvasMaxHeight;
|
|
20321
20715
|
if (Browser.isDevice && parent.isStraightening) {
|
|
20322
20716
|
var cxtTbar = parent.element.querySelector('#' + parent.element.id + '_contextualToolbarArea');
|
|
20323
20717
|
canvasMaxHeight -= cxtTbar ? cxtTbar.clientHeight : 0;
|
|
@@ -20325,7 +20719,8 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
20325
20719
|
if (!isImgShape && parent.element.clientHeight === 0) {
|
|
20326
20720
|
canvasMaxHeight = 0;
|
|
20327
20721
|
}
|
|
20328
|
-
|
|
20722
|
+
var isImageSettings = parent.imageSettings.width && parent.imageSettings.height ? true : false;
|
|
20723
|
+
if (isNullOrUndefined(isImgShape) && !(isImageSettings)) {
|
|
20329
20724
|
if (canvasMaxWidth > 30) {
|
|
20330
20725
|
canvasMaxWidth -= 30;
|
|
20331
20726
|
}
|
|
@@ -20551,6 +20946,9 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
20551
20946
|
this.zoomAction(.0125, null, true, true);
|
|
20552
20947
|
}
|
|
20553
20948
|
}
|
|
20949
|
+
if (parent.isPublicMethod && parent.aspectWidth === width && parent.aspectHeight === height) {
|
|
20950
|
+
return;
|
|
20951
|
+
}
|
|
20554
20952
|
this.resizeImg(activeObj, width, height);
|
|
20555
20953
|
width = tempwidth;
|
|
20556
20954
|
height = tempheight;
|
|
@@ -20596,9 +20994,12 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
20596
20994
|
value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
|
|
20597
20995
|
}
|
|
20598
20996
|
if (isNullOrUndefined(parent.currSelectionPoint)) {
|
|
20599
|
-
|
|
20600
|
-
|
|
20601
|
-
|
|
20997
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20998
|
+
if (!parent.shapeColl.some(function (item) { return item.rotatedAngle && item.rotatedAngle !== 0; })) {
|
|
20999
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
21000
|
+
value: { type: 'custom', startX: parent.img.destLeft, startY: parent.img.destTop,
|
|
21001
|
+
width: parent.img.destWidth, height: parent.img.destHeight } });
|
|
21002
|
+
}
|
|
20602
21003
|
}
|
|
20603
21004
|
else {
|
|
20604
21005
|
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
@@ -20780,6 +21181,8 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
|
|
|
20780
21181
|
this.tempUndoRedoColl = [];
|
|
20781
21182
|
this.tempUndoRedoStep = 0;
|
|
20782
21183
|
this.isPreventing = false;
|
|
21184
|
+
this.preventEditComplete = false;
|
|
21185
|
+
this.preventApplyEditComplete = false;
|
|
20783
21186
|
this.parent = parent;
|
|
20784
21187
|
this.addEventListener();
|
|
20785
21188
|
}
|
|
@@ -20861,6 +21264,12 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
|
|
|
20861
21264
|
case 'reset':
|
|
20862
21265
|
this.reset();
|
|
20863
21266
|
break;
|
|
21267
|
+
case 'preventEditComplete':
|
|
21268
|
+
args.value['obj']['bool'] = this.preventEditComplete;
|
|
21269
|
+
break;
|
|
21270
|
+
case 'preventApplyEditComplete':
|
|
21271
|
+
this.preventApplyEditComplete = args.value['bool'];
|
|
21272
|
+
break;
|
|
20864
21273
|
}
|
|
20865
21274
|
};
|
|
20866
21275
|
UndoRedo.prototype.getModuleName = function () {
|
|
@@ -20875,6 +21284,7 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
|
|
|
20875
21284
|
this.tempUndoRedoColl = [];
|
|
20876
21285
|
this.tempUndoRedoStep = 0;
|
|
20877
21286
|
this.isPreventing = false;
|
|
21287
|
+
this.preventEditComplete = this.preventApplyEditComplete = false;
|
|
20878
21288
|
};
|
|
20879
21289
|
UndoRedo.prototype.refreshUrc = function (refreshToolbar) {
|
|
20880
21290
|
var parent = this.parent;
|
|
@@ -21586,6 +21996,10 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
|
|
|
21586
21996
|
textArea.style.color = obj.strokeSettings.strokeColor;
|
|
21587
21997
|
textArea.style.fontWeight = obj.textSettings.bold ? 'bold' : 'normal';
|
|
21588
21998
|
textArea.style.fontStyle = obj.textSettings.italic ? 'italic' : 'normal';
|
|
21999
|
+
textArea.style.textDecoration = (obj.textSettings.underline && obj.textSettings.strikethrough) ? 'underline line-through' :
|
|
22000
|
+
(obj.textSettings.underline) ? 'underline' :
|
|
22001
|
+
(obj.textSettings.strikethrough) ? 'line-through' :
|
|
22002
|
+
'none';
|
|
21589
22003
|
textArea.style.border = '2px solid ' + parent.themeColl[parent.theme]['primaryColor'];
|
|
21590
22004
|
textArea.value = obj.keyHistory;
|
|
21591
22005
|
parent.activeObj = extend({}, obj, {}, true);
|
|
@@ -21919,6 +22333,7 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
|
|
|
21919
22333
|
var temp = parent.noPushUndo;
|
|
21920
22334
|
parent.noPushUndo = false;
|
|
21921
22335
|
parent.isUndoRedoStack = true;
|
|
22336
|
+
this.preventEditComplete = true;
|
|
21922
22337
|
if (isPenDraw) {
|
|
21923
22338
|
var tempTogglePen = parent.togglePen;
|
|
21924
22339
|
var obj = { freehandDrawSelectedId: null };
|
|
@@ -21947,7 +22362,14 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
|
|
|
21947
22362
|
parent.enableTextEditing();
|
|
21948
22363
|
}
|
|
21949
22364
|
}
|
|
21950
|
-
|
|
22365
|
+
if (this.preventEditComplete) {
|
|
22366
|
+
parent.isUndoRedoStack = this.preventEditComplete = false;
|
|
22367
|
+
if (!this.preventApplyEditComplete) {
|
|
22368
|
+
this.triggerActionCompletedEvent('shape-customize');
|
|
22369
|
+
}
|
|
22370
|
+
this.triggerActionCompletedEvent('shape-select');
|
|
22371
|
+
}
|
|
22372
|
+
parent.isUndoRedoStack = this.preventEditComplete = false;
|
|
21951
22373
|
}
|
|
21952
22374
|
};
|
|
21953
22375
|
return UndoRedo;
|
|
@@ -22243,6 +22665,12 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22243
22665
|
_this.tempRedactBlur = 50;
|
|
22244
22666
|
/** @hidden */
|
|
22245
22667
|
_this.tempRedactPixel = 40;
|
|
22668
|
+
/** @hidden */
|
|
22669
|
+
_this.imageSettings = { width: null, height: null };
|
|
22670
|
+
/** @hidden */
|
|
22671
|
+
_this.aspectRatioBaseDimension = false;
|
|
22672
|
+
/** @hidden */
|
|
22673
|
+
_this.imageLoaded = false;
|
|
22246
22674
|
_this.tempToolbarHeight = 0;
|
|
22247
22675
|
_this.tempToolbar = [];
|
|
22248
22676
|
ImageEditor_1.Inject(Crop, Draw, Selection, Transform, Export, ToolbarModule);
|
|
@@ -22347,11 +22775,13 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22347
22775
|
break;
|
|
22348
22776
|
case 'disabled':
|
|
22349
22777
|
if (newProperties.disabled) {
|
|
22350
|
-
this.element.classList.add('e-disabled');
|
|
22778
|
+
this.element.classList.add('e-disabled', 'e-overlay');
|
|
22779
|
+
this.element.style.opacity = '0.5';
|
|
22351
22780
|
this.unwireEvent();
|
|
22352
22781
|
}
|
|
22353
22782
|
else {
|
|
22354
|
-
this.element.classList.remove('e-disabled');
|
|
22783
|
+
this.element.classList.remove('e-disabled', 'e-overlay');
|
|
22784
|
+
this.element.style.opacity = '1';
|
|
22355
22785
|
this.wireEvent();
|
|
22356
22786
|
}
|
|
22357
22787
|
break;
|
|
@@ -22469,7 +22899,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22469
22899
|
if (newProperties.uploadSettings) {
|
|
22470
22900
|
this.uploadSettings = newProperties.uploadSettings;
|
|
22471
22901
|
if (!this.uploadSettings.allowedExtensions) {
|
|
22472
|
-
this.uploadSettings.allowedExtensions = '.jpg, .jpeg, .png, .svg, .webp';
|
|
22902
|
+
this.uploadSettings.allowedExtensions = '.jpg, .jpeg, .png, .svg, .webp, .bmp';
|
|
22473
22903
|
this.notify('draw', { prop: 'setNullExtension', value: { extension: true } });
|
|
22474
22904
|
}
|
|
22475
22905
|
else {
|
|
@@ -22518,6 +22948,10 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22518
22948
|
this.element.innerHTML = '';
|
|
22519
22949
|
};
|
|
22520
22950
|
ImageEditor.prototype.initialize = function () {
|
|
22951
|
+
if (this.disabled) {
|
|
22952
|
+
this.element.classList.add('e-disabled', 'e-overlay');
|
|
22953
|
+
this.element.style.opacity = '0.5';
|
|
22954
|
+
}
|
|
22521
22955
|
if (this.toolbarTemplate) {
|
|
22522
22956
|
this.element.appendChild(this.createElement('div', {
|
|
22523
22957
|
id: this.element.id + '_toolbarArea', className: 'e-toolbar-area'
|
|
@@ -22529,7 +22963,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22529
22963
|
this.notify('toolbar', { prop: 'create-contextual-toolbar', onPropertyChange: false });
|
|
22530
22964
|
}
|
|
22531
22965
|
if (!this.uploadSettings.allowedExtensions) {
|
|
22532
|
-
this.setProperties({ uploadSettings: { allowedExtensions: '.jpg, .jpeg, .png, .svg, .webp' } }, true);
|
|
22966
|
+
this.setProperties({ uploadSettings: { allowedExtensions: '.jpg, .jpeg, .png, .svg, .webp, .bmp' } }, true);
|
|
22533
22967
|
}
|
|
22534
22968
|
else {
|
|
22535
22969
|
this.notify('draw', { prop: 'setNullExtension', value: { extension: false } });
|
|
@@ -22730,7 +23164,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22730
23164
|
* @returns {string[]}.
|
|
22731
23165
|
*/
|
|
22732
23166
|
ImageEditor.prototype.getExtensionArray = function () {
|
|
22733
|
-
var validExtensions = ['jpeg', 'jpg', 'png', 'svg', 'webp'];
|
|
23167
|
+
var validExtensions = ['jpeg', 'jpg', 'png', 'svg', 'webp', 'bmp'];
|
|
22734
23168
|
var split = this.uploadSettings.allowedExtensions.split(',');
|
|
22735
23169
|
var extension = [];
|
|
22736
23170
|
for (var _i = 0, split_1 = split; _i < split_1.length; _i++) {
|
|
@@ -22782,6 +23216,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22782
23216
|
case 'webp':
|
|
22783
23217
|
words += ' WebP,';
|
|
22784
23218
|
break;
|
|
23219
|
+
case 'bmp':
|
|
23220
|
+
words += ' BMP,';
|
|
23221
|
+
break;
|
|
22785
23222
|
}
|
|
22786
23223
|
if (i === extension.length - 1) {
|
|
22787
23224
|
words = words.slice(0, -1);
|
|
@@ -23070,10 +23507,16 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23070
23507
|
*/
|
|
23071
23508
|
ImageEditor.prototype.flip = function (direction) {
|
|
23072
23509
|
this.applyShapes();
|
|
23073
|
-
this.
|
|
23074
|
-
|
|
23075
|
-
|
|
23076
|
-
|
|
23510
|
+
if (this.activeObj.shape && this.activeObj.shape.indexOf('crop') > -1) {
|
|
23511
|
+
this.transformSelect(direction.toLowerCase() + 'flip');
|
|
23512
|
+
}
|
|
23513
|
+
else {
|
|
23514
|
+
this.updateImageTransformColl(direction.toLowerCase() + 'flip');
|
|
23515
|
+
this.setRotateZoom();
|
|
23516
|
+
this.notify('transform', { prop: 'flip', value: { direction: direction } });
|
|
23517
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
23518
|
+
this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
23519
|
+
}
|
|
23077
23520
|
var actionArgs = { action: 'flip', actionEventArgs: this.editCompleteArgs };
|
|
23078
23521
|
this.triggerEditCompleteEvent(actionArgs);
|
|
23079
23522
|
};
|
|
@@ -23112,7 +23555,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23112
23555
|
*
|
|
23113
23556
|
* @param {string | ImageData } data - Specifies url of the image or image data.
|
|
23114
23557
|
* @param {boolean} [resetChanges=true] - Optional. Determines whether to reset existing changes when opening the image. The default value is true, which resets all existing changes.
|
|
23115
|
-
* @param {ImageSettings} imageSettings - Optional. Specifies
|
|
23558
|
+
* @param {ImageSettings} imageSettings - Optional. Specifies image settings to apply when loading an image.
|
|
23116
23559
|
*
|
|
23117
23560
|
* @remarks
|
|
23118
23561
|
* The supported file types are JPG, JPEG, PNG, and SVG.
|
|
@@ -23120,16 +23563,88 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23120
23563
|
* @returns {void}.
|
|
23121
23564
|
*/
|
|
23122
23565
|
ImageEditor.prototype.open = function (data, resetChanges, imageSettings) {
|
|
23566
|
+
var _this = this;
|
|
23123
23567
|
resetChanges = isNullOrUndefined(resetChanges) ? true : resetChanges;
|
|
23124
23568
|
if (resetChanges) {
|
|
23125
|
-
if (isNullOrUndefined(data)) {
|
|
23569
|
+
if (isNullOrUndefined(data) || this.disabled) {
|
|
23126
23570
|
return;
|
|
23127
23571
|
}
|
|
23128
23572
|
var dropArea = document.getElementById(this.element.id + '_dropArea');
|
|
23129
23573
|
if (dropArea) {
|
|
23130
23574
|
dropArea.style.display = 'none';
|
|
23131
23575
|
}
|
|
23132
|
-
this.
|
|
23576
|
+
this.imageSettings = { width: null, height: null };
|
|
23577
|
+
this.aspectRatioBaseDimension = null;
|
|
23578
|
+
if (imageSettings && (imageSettings.width || imageSettings.height)) {
|
|
23579
|
+
var tempImageSettings_1 = extend({}, imageSettings, {}, true);
|
|
23580
|
+
imageSettings = this.scaleToFit(imageSettings);
|
|
23581
|
+
this.aspectRatioBaseDimension = imageSettings.isAspectRatio;
|
|
23582
|
+
if (!imageSettings.isAspectRatio && imageSettings.width && imageSettings.height) {
|
|
23583
|
+
this.imageSettings.width = imageSettings.width;
|
|
23584
|
+
this.imageSettings.height = imageSettings.height;
|
|
23585
|
+
this.notify('draw', { prop: 'open', value: { data: data } });
|
|
23586
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23587
|
+
var intervalId_1 = setInterval(function () {
|
|
23588
|
+
if (_this.imageLoaded && _this.baseImg.width && _this.baseImg.height) {
|
|
23589
|
+
_this.setInitialZoomLevel(tempImageSettings_1);
|
|
23590
|
+
clearInterval(intervalId_1);
|
|
23591
|
+
}
|
|
23592
|
+
}, 1);
|
|
23593
|
+
}
|
|
23594
|
+
else if (imageSettings.width || imageSettings.height) {
|
|
23595
|
+
this.notify('draw', { prop: 'open', value: { data: data } });
|
|
23596
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23597
|
+
var intervalId_2 = setInterval(function () {
|
|
23598
|
+
if (_this.imageLoaded && _this.baseImg.width && _this.baseImg.height) {
|
|
23599
|
+
_this.imageSettings.width = imageSettings.width;
|
|
23600
|
+
_this.imageSettings.height = imageSettings.height;
|
|
23601
|
+
var originalWidth = _this.baseImg.width;
|
|
23602
|
+
var originalHeight = _this.baseImg.height;
|
|
23603
|
+
var maxValue = '';
|
|
23604
|
+
var aspectRatioValue = void 0;
|
|
23605
|
+
var value = void 0;
|
|
23606
|
+
var newValue = void 0;
|
|
23607
|
+
if (imageSettings.width && imageSettings.height) {
|
|
23608
|
+
maxValue = imageSettings.width > imageSettings.height ? 'width' : 'height';
|
|
23609
|
+
}
|
|
23610
|
+
if (maxValue === 'width' || (imageSettings.width && maxValue !== 'height')) {
|
|
23611
|
+
aspectRatioValue = imageSettings.width;
|
|
23612
|
+
value = aspectRatioValue / (originalWidth / originalHeight);
|
|
23613
|
+
newValue = value % 1 >= 0.5 || value % 1 <= -0.5 ? Math.round(value) : (value < 0) ? Math.ceil(value) : Math.floor(value);
|
|
23614
|
+
if (!imageSettings.height || newValue > imageSettings.height) {
|
|
23615
|
+
_this.imageSettings.height = imageSettings.height = newValue;
|
|
23616
|
+
}
|
|
23617
|
+
else {
|
|
23618
|
+
aspectRatioValue = imageSettings.height;
|
|
23619
|
+
value = aspectRatioValue / (originalHeight / originalWidth);
|
|
23620
|
+
newValue = value % 1 >= 0.5 || value % 1 <= -0.5 ? Math.round(value) : (value < 0) ? Math.ceil(value) : Math.floor(value);
|
|
23621
|
+
_this.imageSettings.width = imageSettings.width = newValue;
|
|
23622
|
+
}
|
|
23623
|
+
}
|
|
23624
|
+
else if (maxValue === 'height' || (imageSettings.height && maxValue !== 'width')) {
|
|
23625
|
+
aspectRatioValue = imageSettings.height;
|
|
23626
|
+
value = aspectRatioValue / (originalHeight / originalWidth);
|
|
23627
|
+
newValue = value % 1 >= 0.5 || value % 1 <= -0.5 ? Math.round(value) : (value < 0) ? Math.ceil(value) : Math.floor(value);
|
|
23628
|
+
if (!imageSettings.width || newValue > imageSettings.width) {
|
|
23629
|
+
_this.imageSettings.width = imageSettings.width = newValue;
|
|
23630
|
+
}
|
|
23631
|
+
else {
|
|
23632
|
+
aspectRatioValue = imageSettings.width;
|
|
23633
|
+
value = aspectRatioValue / (originalWidth / originalHeight);
|
|
23634
|
+
newValue = value % 1 >= 0.5 || value % 1 <= -0.5 ? Math.round(value) : (value < 0) ? Math.ceil(value) : Math.floor(value);
|
|
23635
|
+
_this.imageSettings.height = imageSettings.height = newValue;
|
|
23636
|
+
}
|
|
23637
|
+
}
|
|
23638
|
+
_this.notify('draw', { prop: 'open', value: { data: data } });
|
|
23639
|
+
_this.setInitialZoomLevel(tempImageSettings_1);
|
|
23640
|
+
clearInterval(intervalId_2);
|
|
23641
|
+
}
|
|
23642
|
+
}, 1);
|
|
23643
|
+
}
|
|
23644
|
+
}
|
|
23645
|
+
else {
|
|
23646
|
+
this.notify('draw', { prop: 'open', value: { data: data } });
|
|
23647
|
+
}
|
|
23133
23648
|
}
|
|
23134
23649
|
else {
|
|
23135
23650
|
this.updateImage(data, imageSettings ? imageSettings.backgroundColor : null);
|
|
@@ -23283,11 +23798,18 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23283
23798
|
ImageEditor.prototype.rotate = function (degree) {
|
|
23284
23799
|
var obj = { isRotate: false };
|
|
23285
23800
|
this.applyShapes();
|
|
23286
|
-
if (
|
|
23287
|
-
this.
|
|
23801
|
+
if (this.activeObj.shape && this.activeObj.shape.indexOf('crop') > -1) {
|
|
23802
|
+
this.transformSelect(degree === 90 ? 'rotateright' : 'rotateleft');
|
|
23803
|
+
obj['isRotate'] = true;
|
|
23804
|
+
}
|
|
23805
|
+
else {
|
|
23806
|
+
if (degree === 90 || degree === -90) {
|
|
23807
|
+
this.updateImageTransformColl(degree === 90 ? 'rotateright' : 'rotateleft');
|
|
23808
|
+
}
|
|
23809
|
+
this.setRotateZoom();
|
|
23810
|
+
this.notify('transform', { prop: 'rotate', value: { degree: degree, obj: obj } });
|
|
23811
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
23288
23812
|
}
|
|
23289
|
-
this.notify('transform', { prop: 'rotate', value: { degree: degree, obj: obj } });
|
|
23290
|
-
this.notify('draw', { prop: 'redrawDownScale' });
|
|
23291
23813
|
var actionArgs = { action: 'rotate', actionEventArgs: this.editCompleteArgs };
|
|
23292
23814
|
this.triggerEditCompleteEvent(actionArgs);
|
|
23293
23815
|
return obj['isRotate'];
|
|
@@ -23305,7 +23827,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23305
23827
|
* @returns {void}.
|
|
23306
23828
|
*/
|
|
23307
23829
|
ImageEditor.prototype.export = function (type, fileName, imageQuality) {
|
|
23308
|
-
this.
|
|
23830
|
+
this.manageActiveAction();
|
|
23309
23831
|
this.notify('export', { prop: 'export', onPropertyChange: false, value: { type: type, fileName: fileName, imgQuality: imageQuality } });
|
|
23310
23832
|
};
|
|
23311
23833
|
/**
|
|
@@ -23413,6 +23935,17 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23413
23935
|
*/
|
|
23414
23936
|
ImageEditor.prototype.zoom = function (zoomFactor, zoomPoint) {
|
|
23415
23937
|
this.isZoomBtnClick = true;
|
|
23938
|
+
var prevZoom = this.transform.zoomFactor;
|
|
23939
|
+
if (prevZoom !== 0) {
|
|
23940
|
+
var zoomObj = { previousZoomValue: null };
|
|
23941
|
+
this.notify('transform', { prop: 'getPreviousZoomValue', value: { obj: zoomObj } });
|
|
23942
|
+
prevZoom = zoomObj.previousZoomValue;
|
|
23943
|
+
}
|
|
23944
|
+
if (zoomFactor !== 1 && prevZoom !== 0 && ((prevZoom < 1 && zoomFactor > 1) || (prevZoom > 1 && zoomFactor < 1))) {
|
|
23945
|
+
this.notify('transform', { prop: 'zoom', onPropertyChange: false,
|
|
23946
|
+
value: { zoomFactor: 1, zoomPoint: zoomPoint }
|
|
23947
|
+
});
|
|
23948
|
+
}
|
|
23416
23949
|
this.notify('transform', { prop: 'zoom', onPropertyChange: false,
|
|
23417
23950
|
value: { zoomFactor: zoomFactor, zoomPoint: zoomPoint } });
|
|
23418
23951
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
@@ -23575,10 +24108,12 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23575
24108
|
* @param {string} strokeColor - Specifies the outline color of the text annotation.
|
|
23576
24109
|
* @param {number} strokeWidth - Specifies the outline stroke width of the text annotation.
|
|
23577
24110
|
* @param {TransformationCollection[]} transformCollection - Specifies the transform collection of the text annotation.
|
|
24111
|
+
* @param {boolean} underline - Specifies whether the text should be underlined.
|
|
24112
|
+
* @param {boolean} strikethrough - Specifies whether the text should have a strikethrough.
|
|
23578
24113
|
* @returns {boolean}.
|
|
23579
24114
|
*
|
|
23580
24115
|
*/
|
|
23581
|
-
ImageEditor.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color, isSelected, degree, fillColor, strokeColor, strokeWidth, transformCollection) {
|
|
24116
|
+
ImageEditor.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color, isSelected, degree, fillColor, strokeColor, strokeWidth, transformCollection, underline, strikethrough) {
|
|
23582
24117
|
var isText = false;
|
|
23583
24118
|
var isPointsInRange = this.allowShape(x, y);
|
|
23584
24119
|
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
@@ -23586,7 +24121,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23586
24121
|
this.manageActiveAction();
|
|
23587
24122
|
this.notify('shape', { prop: 'drawText', onPropertyChange: false, value: { x: x, y: y, text: text, fontFamily: fontFamily,
|
|
23588
24123
|
fontSize: fontSize, bold: bold, italic: italic, color: color, isSelected: isSelected, degree: degree, fillColor: fillColor,
|
|
23589
|
-
outlineColor: strokeColor, outlineWidth: strokeWidth, transformCollection: transformCollection } });
|
|
24124
|
+
outlineColor: strokeColor, outlineWidth: strokeWidth, transformCollection: transformCollection, underline: underline, strikethrough: strikethrough } });
|
|
23590
24125
|
this.editCompleted();
|
|
23591
24126
|
}
|
|
23592
24127
|
return isText;
|
|
@@ -23611,14 +24146,27 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23611
24146
|
var isImage = false;
|
|
23612
24147
|
var isPointsInRange = this.allowShape(x, y);
|
|
23613
24148
|
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
24149
|
+
if (typeof data === 'string') {
|
|
24150
|
+
try {
|
|
24151
|
+
var request = new XMLHttpRequest();
|
|
24152
|
+
var isBlob = data.indexOf('blob:') === 0;
|
|
24153
|
+
request.open(isBlob ? 'GET' : 'HEAD', data, false);
|
|
24154
|
+
request.send();
|
|
24155
|
+
isImage = request.status >= 200 && request.status < 300;
|
|
24156
|
+
}
|
|
24157
|
+
catch (error) {
|
|
24158
|
+
isImage = false;
|
|
24159
|
+
}
|
|
24160
|
+
}
|
|
24161
|
+
else if (data instanceof ImageData) {
|
|
24162
|
+
if (data.data instanceof Uint8ClampedArray && data.width > 0 && data.height > 0) {
|
|
24163
|
+
isImage = true;
|
|
24164
|
+
}
|
|
24165
|
+
}
|
|
23614
24166
|
this.manageActiveAction();
|
|
23615
|
-
var length_1 = this.objColl.length;
|
|
23616
24167
|
this.notify('shape', { prop: 'drawImage', onPropertyChange: false, value: { x: x, y: y, width: width, height: height,
|
|
23617
24168
|
src: data, degree: degree, isAspectRatio: isAspectRatio, opacity: opacity, isSelected: isSelected } });
|
|
23618
24169
|
this.editCompleted();
|
|
23619
|
-
if (this.objColl.length > length_1) {
|
|
23620
|
-
isImage = true;
|
|
23621
|
-
}
|
|
23622
24170
|
}
|
|
23623
24171
|
return isImage;
|
|
23624
24172
|
};
|
|
@@ -23743,6 +24291,8 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23743
24291
|
this.applyShapes();
|
|
23744
24292
|
this.notify('shape', { prop: 'deleteShape', onPropertyChange: false, value: { id: id, isShape: true } });
|
|
23745
24293
|
this.editCompleted('shape-delete');
|
|
24294
|
+
this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
24295
|
+
this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
|
|
23746
24296
|
};
|
|
23747
24297
|
/**
|
|
23748
24298
|
* Get particular shapes details based on id of the shape which is drawn on an image editor.
|
|
@@ -23954,6 +24504,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23954
24504
|
var isResized = false;
|
|
23955
24505
|
if (((width.toString()).length <= 4 && (height.toString()).length <= 4) && (!this.isCircleCrop || isAspectRatio)) {
|
|
23956
24506
|
this.manageActiveAction();
|
|
24507
|
+
this.isPublicMethod = true;
|
|
23957
24508
|
this.notify('toolbar', { prop: 'resizeClick', value: { bool: false } });
|
|
23958
24509
|
var destPoints = { startX: this.img.destLeft, startY: this.img.destTop, width: this.img.destWidth,
|
|
23959
24510
|
height: this.img.destHeight };
|
|
@@ -23989,6 +24540,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23989
24540
|
else {
|
|
23990
24541
|
this.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
|
|
23991
24542
|
}
|
|
24543
|
+
this.isPublicMethod = false;
|
|
23992
24544
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
23993
24545
|
}
|
|
23994
24546
|
return isResized;
|
|
@@ -24493,6 +25045,70 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
24493
25045
|
}
|
|
24494
25046
|
};
|
|
24495
25047
|
// Toolbar related codes
|
|
25048
|
+
ImageEditor.prototype.scaleToFit = function (imageSettings) {
|
|
25049
|
+
var tempImageSettings = extend({}, imageSettings, {}, true);
|
|
25050
|
+
var viewPortWidth = this.lowerCanvas.clientWidth;
|
|
25051
|
+
var viewPortHeight = this.lowerCanvas.clientHeight;
|
|
25052
|
+
if (imageSettings.width && imageSettings.height && (imageSettings.width > viewPortWidth ||
|
|
25053
|
+
imageSettings.height > viewPortHeight)) {
|
|
25054
|
+
var widthScale = viewPortWidth / imageSettings.width;
|
|
25055
|
+
var heightScale = viewPortHeight / imageSettings.height;
|
|
25056
|
+
var scale = Math.min(widthScale, heightScale);
|
|
25057
|
+
tempImageSettings.width = Math.round(imageSettings.width * scale);
|
|
25058
|
+
tempImageSettings.height = Math.round(imageSettings.height * scale);
|
|
25059
|
+
}
|
|
25060
|
+
else if (imageSettings.width && imageSettings.width > viewPortWidth) {
|
|
25061
|
+
var scale = viewPortWidth / imageSettings.width;
|
|
25062
|
+
tempImageSettings.width = Math.round(imageSettings.width * scale);
|
|
25063
|
+
}
|
|
25064
|
+
else if (imageSettings.height && imageSettings.height > viewPortHeight) {
|
|
25065
|
+
var scale = viewPortHeight / imageSettings.height;
|
|
25066
|
+
tempImageSettings.height = Math.round(imageSettings.height * scale);
|
|
25067
|
+
}
|
|
25068
|
+
return tempImageSettings;
|
|
25069
|
+
};
|
|
25070
|
+
ImageEditor.prototype.setInitialZoomLevel = function (oldImageSettings) {
|
|
25071
|
+
var _this = this;
|
|
25072
|
+
var zoomLevel = 1;
|
|
25073
|
+
var newWidth = this.img.destWidth;
|
|
25074
|
+
var newHeight = this.img.destHeight;
|
|
25075
|
+
var oldWidth = oldImageSettings.width;
|
|
25076
|
+
var oldHeight = oldImageSettings.height;
|
|
25077
|
+
var dimObj = { width: 0, height: 0 };
|
|
25078
|
+
this.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
|
|
25079
|
+
value: { width: this.img.srcWidth, height: this.img.srcHeight, obj: dimObj, isImgShape: null } });
|
|
25080
|
+
while ((newWidth && oldWidth && oldWidth > newWidth) || (newHeight && oldHeight && oldHeight > newHeight)) {
|
|
25081
|
+
newWidth = dimObj['width'] + (dimObj['width'] * 0.025 * zoomLevel);
|
|
25082
|
+
newHeight = dimObj['height'] + (dimObj['height'] * 0.025 * zoomLevel);
|
|
25083
|
+
if (Math.abs(newWidth) >= Math.abs(oldWidth) && Math.abs(newHeight) >= Math.abs(oldHeight)) {
|
|
25084
|
+
break;
|
|
25085
|
+
}
|
|
25086
|
+
zoomLevel++;
|
|
25087
|
+
}
|
|
25088
|
+
if (zoomLevel > 1) {
|
|
25089
|
+
this.isImageLoaded = true;
|
|
25090
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25091
|
+
var intervalId_3 = setInterval(function () {
|
|
25092
|
+
if (_this.imageLoaded) {
|
|
25093
|
+
for (var i = 1; i < zoomLevel; i++) {
|
|
25094
|
+
if (Math.round(i / 4) < _this.zoomSettings.maxZoomFactor) {
|
|
25095
|
+
_this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
25096
|
+
value: { zoomFactor: 0.025, zoomPoint: null, isResize: true } });
|
|
25097
|
+
}
|
|
25098
|
+
else {
|
|
25099
|
+
zoomLevel = i;
|
|
25100
|
+
break;
|
|
25101
|
+
}
|
|
25102
|
+
}
|
|
25103
|
+
_this.setProperties({ zoomSettings: { zoomFactor: Math.round(zoomLevel / 4) } }, true);
|
|
25104
|
+
_this.notify('transform', { prop: 'setPreviousZoomValue', onPropertyChange: false,
|
|
25105
|
+
value: { previousZoomValue: _this.zoomSettings.zoomFactor } });
|
|
25106
|
+
_this.notify('toolbar', { prop: 'enable-disable-btns' });
|
|
25107
|
+
clearInterval(intervalId_3);
|
|
25108
|
+
}
|
|
25109
|
+
}, 1);
|
|
25110
|
+
}
|
|
25111
|
+
};
|
|
24496
25112
|
ImageEditor.prototype.resetToolbar = function () {
|
|
24497
25113
|
if (this.toolbarHeight !== this.tempToolbarHeight && !((isNullOrUndefined(this.toolbar) ||
|
|
24498
25114
|
(this.toolbar && this.toolbar.length > 0)
|
|
@@ -24507,6 +25123,14 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
24507
25123
|
this.update();
|
|
24508
25124
|
}
|
|
24509
25125
|
};
|
|
25126
|
+
ImageEditor.prototype.setRotateZoom = function () {
|
|
25127
|
+
if (this.transform.zoomFactor > 0) {
|
|
25128
|
+
this.notify('draw', { prop: 'setRotateZoom', onPropertyChange: false, value: { isRotateZoom: true } });
|
|
25129
|
+
}
|
|
25130
|
+
else {
|
|
25131
|
+
this.notify('draw', { prop: 'setRotateZoom', onPropertyChange: false, value: { isRotateZoom: false } });
|
|
25132
|
+
}
|
|
25133
|
+
};
|
|
24510
25134
|
ImageEditor.prototype.getData = function (isMaskImage) {
|
|
24511
25135
|
if (isMaskImage) {
|
|
24512
25136
|
this.resetToolbar();
|
|
@@ -25143,6 +25767,11 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
25143
25767
|
}
|
|
25144
25768
|
};
|
|
25145
25769
|
ImageEditor.prototype.triggerEditCompleteEvent = function (args) {
|
|
25770
|
+
var obj = { bool: false };
|
|
25771
|
+
this.notify('undo-redo', { prop: 'preventEditComplete', value: { obj: obj } });
|
|
25772
|
+
if (obj['bool']) {
|
|
25773
|
+
return;
|
|
25774
|
+
}
|
|
25146
25775
|
if (args.action === 'shape-insert' && args.actionEventArgs &&
|
|
25147
25776
|
args.actionEventArgs.currentShapeSettings &&
|
|
25148
25777
|
args.actionEventArgs.currentShapeSettings.type.toString() === 'Redact') {
|
|
@@ -26431,9 +27060,17 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
26431
27060
|
this.notify('crop', { prop: 'calcRatio', onPropertyChange: false,
|
|
26432
27061
|
value: { obj: obj_7, dimension: { width: ctx.canvas.width, height: ctx.canvas.height } } });
|
|
26433
27062
|
}
|
|
26434
|
-
var
|
|
26435
|
-
|
|
26436
|
-
|
|
27063
|
+
var width = this.baseImg.width;
|
|
27064
|
+
var height = this.baseImg.height;
|
|
27065
|
+
if (!this.aspectRatioBaseDimension && this.imageSettings.width && this.imageSettings.height) {
|
|
27066
|
+
var widthRatio = this.baseImg.width / this.imageSettings.width;
|
|
27067
|
+
var heightRatio = this.baseImg.height / this.imageSettings.height;
|
|
27068
|
+
var ratio = (widthRatio + heightRatio) / 2;
|
|
27069
|
+
ratio = ratio < 1 ? 1 : ratio;
|
|
27070
|
+
width = this.imageSettings.width * ratio;
|
|
27071
|
+
height = this.imageSettings.height * ratio;
|
|
27072
|
+
}
|
|
27073
|
+
var dimension = this.getRotatedCanvasDim(width, height, this.transform.straighten);
|
|
26437
27074
|
this.img.srcWidth = ctx.canvas.width = dimension.width;
|
|
26438
27075
|
this.img.srcHeight = ctx.canvas.height = dimension.height;
|
|
26439
27076
|
var x = ctx.canvas.width / 2;
|
|
@@ -26441,7 +27078,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
26441
27078
|
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
26442
27079
|
ctx.translate(x, y);
|
|
26443
27080
|
ctx.rotate(straighten * Math.PI / 180);
|
|
26444
|
-
ctx.drawImage(this.baseImg, -
|
|
27081
|
+
ctx.drawImage(this.baseImg, -width / 2, -height / 2, width, height);
|
|
26445
27082
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
26446
27083
|
var obj = { width: 0, height: 0 };
|
|
26447
27084
|
this.notify('crop', { prop: 'calcRatio', onPropertyChange: false, value: { obj: obj, dimension: { width: ctx.canvas.width, height: ctx.canvas.height } } });
|
|
@@ -26759,6 +27396,8 @@ var FileType;
|
|
|
26759
27396
|
FileType["Svg"] = "Svg";
|
|
26760
27397
|
/** The WebP file type. */
|
|
26761
27398
|
FileType["WebP"] = "WebP";
|
|
27399
|
+
/** The BMP file type. */
|
|
27400
|
+
FileType["Bmp"] = "Bmp";
|
|
26762
27401
|
})(FileType || (FileType = {}));
|
|
26763
27402
|
/**
|
|
26764
27403
|
* An enumeration representing the direction of an image editor operation.
|
|
@@ -27135,7 +27774,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
27135
27774
|
Path: 'Path',
|
|
27136
27775
|
Bold: 'Bold',
|
|
27137
27776
|
Italic: 'Italic',
|
|
27777
|
+
Underline: 'Underline',
|
|
27138
27778
|
BoldItalic: 'Bold Italic',
|
|
27779
|
+
Strikethrough: 'Strikethrough',
|
|
27139
27780
|
XSmall: 'X-Small',
|
|
27140
27781
|
Small: 'Small',
|
|
27141
27782
|
Medium: 'Medium',
|
|
@@ -29209,12 +29850,16 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
29209
29850
|
if (!Browser.isDevice) {
|
|
29210
29851
|
var obj = { shape: null };
|
|
29211
29852
|
parent.notify('selection', { prop: 'getCurrentDrawingShape', value: { obj: obj } });
|
|
29212
|
-
if (obj['shape']
|
|
29853
|
+
if (obj['shape'] === 'path') {
|
|
29854
|
+
toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
29855
|
+
tooltipText: this.l10n.getConstant('OK'), align: 'Right', tabIndex: 0, disabled: true });
|
|
29856
|
+
}
|
|
29857
|
+
else {
|
|
29213
29858
|
toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
29214
29859
|
tooltipText: this.l10n.getConstant('OK'), align: 'Right', tabIndex: 0 });
|
|
29215
|
-
toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
29216
|
-
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
29217
29860
|
}
|
|
29861
|
+
toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
29862
|
+
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
29218
29863
|
}
|
|
29219
29864
|
return toolbarItems;
|
|
29220
29865
|
};
|
|
@@ -29870,6 +30515,14 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
29870
30515
|
toolbarItems.push({ id: id + '_italic', prefixIcon: 'e-icons e-italic', cssClass: 'top-icon e-italic',
|
|
29871
30516
|
tooltipText: this.l10n.getConstant('Italic'), align: 'Center' });
|
|
29872
30517
|
}
|
|
30518
|
+
if (items.indexOf('underline') > -1) {
|
|
30519
|
+
toolbarItems.push({ id: id + '_underline', prefixIcon: 'e-icons e-underline', cssClass: 'top-icon e-underline',
|
|
30520
|
+
tooltipText: this.l10n.getConstant('Underline'), align: 'Center' });
|
|
30521
|
+
}
|
|
30522
|
+
if (items.indexOf('strikethrough') > -1) {
|
|
30523
|
+
toolbarItems.push({ id: id + '_strikethrough', prefixIcon: 'e-icons e-strikethrough', cssClass: 'top-icon e-strikethrough',
|
|
30524
|
+
tooltipText: this.l10n.getConstant('Strikethrough'), align: 'Center' });
|
|
30525
|
+
}
|
|
29873
30526
|
if (items.indexOf('strokeWidth') > -1) {
|
|
29874
30527
|
toolbarItems.push({ id: id + '_strokeWidth', cssClass: 'top-icon e-size', tooltipText: this.l10n.getConstant('TextOutlineWidth'), align: 'Center',
|
|
29875
30528
|
type: 'Input', template: '<button id="' + id + '_borderWidthBtn"></button>' });
|
|
@@ -30352,6 +31005,12 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
30352
31005
|
}
|
|
30353
31006
|
if (Browser.isDevice) {
|
|
30354
31007
|
this.initMainToolbar(false, true, true);
|
|
31008
|
+
var okBtn = document.getElementById(parent.element.id + '_ok');
|
|
31009
|
+
var drawingObject = { shape: '' };
|
|
31010
|
+
parent.notify('selection', { prop: 'getCurrentDrawingShape', onPropertyChange: false, value: { obj: drawingObject } });
|
|
31011
|
+
if (drawingObject['shape'] === 'path' && okBtn) {
|
|
31012
|
+
okBtn.classList.add('e-overlay');
|
|
31013
|
+
}
|
|
30355
31014
|
}
|
|
30356
31015
|
if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'path') {
|
|
30357
31016
|
args.toolbarItems = ['strokeColor', 'strokeWidth', 'z-order', 'duplicate', 'remove'];
|
|
@@ -30383,7 +31042,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
30383
31042
|
if (Browser.isDevice) {
|
|
30384
31043
|
this.initMainToolbar(false, true, true);
|
|
30385
31044
|
}
|
|
30386
|
-
args.toolbarItems = ['fontFamily', 'fontSize', 'fontColor', 'fillColor', 'strokeColor', 'strokeWidth', 'bold', 'italic', 'z-order', 'duplicate', 'remove', 'text'];
|
|
31045
|
+
args.toolbarItems = ['fontFamily', 'fontSize', 'fontColor', 'fillColor', 'strokeColor', 'strokeWidth', 'bold', 'italic', 'underline', 'strikethrough', 'z-order', 'duplicate', 'remove', 'text'];
|
|
30387
31046
|
this.initTextToolbarItem(args.toolbarItems);
|
|
30388
31047
|
break;
|
|
30389
31048
|
case 'pen':
|
|
@@ -30519,8 +31178,13 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
30519
31178
|
parent.notify('transform', { prop: 'getPanMove', onPropertyChange: false,
|
|
30520
31179
|
value: { obj: panMoveObj } });
|
|
30521
31180
|
if (panMoveObj['panMove']) {
|
|
31181
|
+
var currentPannedPoint = extend({}, parent.panPoint.currentPannedPoint, {}, true);
|
|
31182
|
+
parent.panPoint.currentPannedPoint = { x: parent.panPoint.totalPannedClientPoint.x, y: parent.panPoint.totalPannedClientPoint.y };
|
|
31183
|
+
parent.panPoint.totalPannedClientPoint = { x: 0, y: 0 };
|
|
31184
|
+
parent.panPoint.totalPannedInternalPoint = { x: 0, y: 0 };
|
|
30522
31185
|
parent.notify('transform', { prop: 'drawPannedImage', onPropertyChange: false,
|
|
30523
|
-
value: { xDiff:
|
|
31186
|
+
value: { xDiff: parent.panPoint.currentPannedPoint.x, yDiff: parent.panPoint.currentPannedPoint.y } });
|
|
31187
|
+
parent.panPoint.currentPannedPoint = currentPannedPoint;
|
|
30524
31188
|
}
|
|
30525
31189
|
};
|
|
30526
31190
|
ToolbarModule.prototype.updateKBDNavigation = function (type) {
|
|
@@ -32506,60 +33170,10 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
32506
33170
|
}
|
|
32507
33171
|
break;
|
|
32508
33172
|
case 'bold':
|
|
32509
|
-
parent.notify('selection', { prop: 'setInitialTextEdit', value: { bool: false } });
|
|
32510
|
-
if (parent.activeObj.textSettings.bold && parent.activeObj.textSettings.italic) {
|
|
32511
|
-
parent.notify('shape', { prop: 'applyFontStyle', onPropertyChange: false,
|
|
32512
|
-
value: { item: 'italic' } });
|
|
32513
|
-
}
|
|
32514
|
-
else if (parent.activeObj.textSettings.bold && !parent.activeObj.textSettings.italic) {
|
|
32515
|
-
parent.notify('shape', { prop: 'applyFontStyle', onPropertyChange: false,
|
|
32516
|
-
value: { item: 'default' } });
|
|
32517
|
-
}
|
|
32518
|
-
else if (!parent.activeObj.textSettings.bold && parent.activeObj.textSettings.italic) {
|
|
32519
|
-
parent.notify('shape', { prop: 'applyFontStyle', onPropertyChange: false,
|
|
32520
|
-
value: { item: 'bolditalic' } });
|
|
32521
|
-
}
|
|
32522
|
-
else if (!parent.activeObj.textSettings.bold && !parent.activeObj.textSettings.italic) {
|
|
32523
|
-
parent.notify('shape', { prop: 'applyFontStyle', onPropertyChange: false,
|
|
32524
|
-
value: { item: 'bold' } });
|
|
32525
|
-
}
|
|
32526
|
-
if (parent.element.querySelector('#' + id + '_bold').classList.contains('e-selected-btn')) {
|
|
32527
|
-
parent.element.querySelector('#' + id + '_bold').classList.remove('e-selected-btn');
|
|
32528
|
-
}
|
|
32529
|
-
else {
|
|
32530
|
-
parent.element.querySelector('#' + id + '_bold').classList.add('e-selected-btn');
|
|
32531
|
-
}
|
|
32532
|
-
if (parent.activeObj.activePoint.width !== 0 || parent.activeObj.activePoint.height !== 0) {
|
|
32533
|
-
parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
|
|
32534
|
-
}
|
|
32535
|
-
break;
|
|
32536
33173
|
case 'italic':
|
|
32537
|
-
|
|
32538
|
-
|
|
32539
|
-
|
|
32540
|
-
value: { item: 'bold' } });
|
|
32541
|
-
}
|
|
32542
|
-
else if (parent.activeObj.textSettings.bold && !parent.activeObj.textSettings.italic) {
|
|
32543
|
-
parent.notify('shape', { prop: 'applyFontStyle', onPropertyChange: false,
|
|
32544
|
-
value: { item: 'bolditalic' } });
|
|
32545
|
-
}
|
|
32546
|
-
else if (!parent.activeObj.textSettings.bold && parent.activeObj.textSettings.italic) {
|
|
32547
|
-
parent.notify('shape', { prop: 'applyFontStyle', onPropertyChange: false,
|
|
32548
|
-
value: { item: 'default' } });
|
|
32549
|
-
}
|
|
32550
|
-
else if (!parent.activeObj.textSettings.bold && !parent.activeObj.textSettings.italic) {
|
|
32551
|
-
parent.notify('shape', { prop: 'applyFontStyle', onPropertyChange: false,
|
|
32552
|
-
value: { item: 'italic' } });
|
|
32553
|
-
}
|
|
32554
|
-
if (parent.element.querySelector('#' + id + '_italic').classList.contains('e-selected-btn')) {
|
|
32555
|
-
parent.element.querySelector('#' + id + '_italic').classList.remove('e-selected-btn');
|
|
32556
|
-
}
|
|
32557
|
-
else {
|
|
32558
|
-
parent.element.querySelector('#' + id + '_italic').classList.add('e-selected-btn');
|
|
32559
|
-
}
|
|
32560
|
-
if (parent.activeObj.activePoint.width !== 0 || parent.activeObj.activePoint.height !== 0) {
|
|
32561
|
-
parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
|
|
32562
|
-
}
|
|
33174
|
+
case 'underline':
|
|
33175
|
+
case 'strikethrough':
|
|
33176
|
+
this.toggleStyle(id, type);
|
|
32563
33177
|
break;
|
|
32564
33178
|
case 'croptransform':
|
|
32565
33179
|
this.performCropTransformClick();
|
|
@@ -32740,6 +33354,43 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
32740
33354
|
}
|
|
32741
33355
|
}
|
|
32742
33356
|
};
|
|
33357
|
+
ToolbarModule.prototype.getFontStyle = function (settings) {
|
|
33358
|
+
var parts = [];
|
|
33359
|
+
if (settings.bold) {
|
|
33360
|
+
parts.push('bold');
|
|
33361
|
+
}
|
|
33362
|
+
if (settings.italic) {
|
|
33363
|
+
parts.push('italic');
|
|
33364
|
+
}
|
|
33365
|
+
if (settings.underline) {
|
|
33366
|
+
parts.push('underline');
|
|
33367
|
+
}
|
|
33368
|
+
if (settings.strikethrough) {
|
|
33369
|
+
parts.push('strikethrough');
|
|
33370
|
+
}
|
|
33371
|
+
return parts.length === 0 ? 'default' : parts.join('');
|
|
33372
|
+
};
|
|
33373
|
+
ToolbarModule.prototype.toggleStyle = function (id, style) {
|
|
33374
|
+
var parent = this.parent;
|
|
33375
|
+
parent.notify('selection', { prop: 'setInitialTextEdit', value: { bool: false } });
|
|
33376
|
+
var settings = parent.activeObj.textSettings;
|
|
33377
|
+
settings[style] = !settings[style];
|
|
33378
|
+
var fontStyle = this.getFontStyle(settings);
|
|
33379
|
+
parent.notify('shape', { prop: 'applyFontStyle', onPropertyChange: false, value: { item: fontStyle } });
|
|
33380
|
+
var button = parent.element.querySelector("#" + id + "_" + style);
|
|
33381
|
+
if (button) {
|
|
33382
|
+
if (button.classList.contains('e-selected-btn')) {
|
|
33383
|
+
button.classList.remove('e-selected-btn');
|
|
33384
|
+
}
|
|
33385
|
+
else {
|
|
33386
|
+
button.classList.add('e-selected-btn');
|
|
33387
|
+
}
|
|
33388
|
+
}
|
|
33389
|
+
if (parent.activeObj.activePoint.width !== 0 ||
|
|
33390
|
+
parent.activeObj.activePoint.height !== 0) {
|
|
33391
|
+
parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
|
|
33392
|
+
}
|
|
33393
|
+
};
|
|
32743
33394
|
ToolbarModule.prototype.updateRedactType = function (value) {
|
|
32744
33395
|
var parent = this.parent;
|
|
32745
33396
|
parent.activeObj.redactType = value;
|
|
@@ -32758,7 +33409,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
32758
33409
|
if (parent.currObjType.isFiltered || parent.currObjType.isRedact) {
|
|
32759
33410
|
parent.okBtn();
|
|
32760
33411
|
}
|
|
32761
|
-
if (frame
|
|
33412
|
+
if (!frame || !frame.classList.contains('e-overlay')) {
|
|
32762
33413
|
zoom = parent.transform.zoomFactor;
|
|
32763
33414
|
parent.frameDestPoints = extend({}, parent.img, {}, true);
|
|
32764
33415
|
if (isNullOrUndefined(parent.cxtTbarHeight)) {
|
|
@@ -32767,7 +33418,10 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
32767
33418
|
this.callFrameToolbar();
|
|
32768
33419
|
parent.frameObj.type = 'mat';
|
|
32769
33420
|
this.callFrameToolbar();
|
|
32770
|
-
|
|
33421
|
+
var elem = parent.element.querySelector('#' + id + '_customizeWrapper');
|
|
33422
|
+
if (elem) {
|
|
33423
|
+
parent.cxtTbarHeight = elem.scrollHeight;
|
|
33424
|
+
}
|
|
32771
33425
|
parent.frameObj = frameObj;
|
|
32772
33426
|
parent.tempFrameObj = tempFrameObj;
|
|
32773
33427
|
}
|
|
@@ -33333,6 +33987,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
33333
33987
|
var fontSizeElem = parent.element.querySelector('.e-text-font-size');
|
|
33334
33988
|
var boldBtn = parent.element.querySelector('#' + id + '_bold');
|
|
33335
33989
|
var italicBtn = parent.element.querySelector('#' + id + '_italic');
|
|
33990
|
+
var underlineBtn = parent.element.querySelector('#' + id + '_underline');
|
|
33991
|
+
var strikethroughBtn = parent.element.querySelector('#' + id + '_strikethrough');
|
|
33336
33992
|
if (parent.activeObj.strokeSettings && parent.activeObj.textSettings) {
|
|
33337
33993
|
if (isNullOrUndefined(parent.activeObj.strokeSettings.strokeWidth)) {
|
|
33338
33994
|
parent.activeObj.strokeSettings.strokeWidth = 2;
|
|
@@ -33445,6 +34101,22 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
33445
34101
|
italicBtn.classList.remove('e-selected-btn');
|
|
33446
34102
|
}
|
|
33447
34103
|
}
|
|
34104
|
+
if (underlineBtn) {
|
|
34105
|
+
if (parent.activeObj.textSettings.underline) {
|
|
34106
|
+
underlineBtn.classList.add('e-selected-btn');
|
|
34107
|
+
}
|
|
34108
|
+
else {
|
|
34109
|
+
underlineBtn.classList.remove('e-selected-btn');
|
|
34110
|
+
}
|
|
34111
|
+
}
|
|
34112
|
+
if (strikethroughBtn) {
|
|
34113
|
+
if (parent.activeObj.textSettings.strikethrough) {
|
|
34114
|
+
strikethroughBtn.classList.add('e-selected-btn');
|
|
34115
|
+
}
|
|
34116
|
+
else {
|
|
34117
|
+
strikethroughBtn.classList.remove('e-selected-btn');
|
|
34118
|
+
}
|
|
34119
|
+
}
|
|
33448
34120
|
if (strokeWidthElem) {
|
|
33449
34121
|
var width = parent.activeObj.shape === 'text' ? parent.activeObj.strokeSettings.outlineWidth : parent.activeObj.strokeSettings.strokeWidth;
|
|
33450
34122
|
var strokeWidth = Math.round(width).toString();
|
|
@@ -33460,25 +34132,23 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
33460
34132
|
ToolbarModule.prototype.getStrokeWidth = function (text) {
|
|
33461
34133
|
var strokeWidth;
|
|
33462
34134
|
var currentWidth = parseInt(text, 10) / 2;
|
|
33463
|
-
|
|
33464
|
-
|
|
33465
|
-
|
|
33466
|
-
|
|
33467
|
-
|
|
33468
|
-
|
|
33469
|
-
|
|
33470
|
-
|
|
33471
|
-
|
|
33472
|
-
|
|
33473
|
-
|
|
33474
|
-
|
|
33475
|
-
|
|
33476
|
-
|
|
33477
|
-
|
|
33478
|
-
|
|
33479
|
-
|
|
33480
|
-
strokeWidth = this.l10n.getConstant('XLarge');
|
|
33481
|
-
break;
|
|
34135
|
+
if (currentWidth === 0) {
|
|
34136
|
+
strokeWidth = this.l10n.getConstant('NoOutline');
|
|
34137
|
+
}
|
|
34138
|
+
else if (currentWidth > 0 && currentWidth <= 1) {
|
|
34139
|
+
strokeWidth = this.l10n.getConstant('XSmall');
|
|
34140
|
+
}
|
|
34141
|
+
else if (currentWidth > 1 && currentWidth <= 2) {
|
|
34142
|
+
strokeWidth = this.l10n.getConstant('Small');
|
|
34143
|
+
}
|
|
34144
|
+
else if (currentWidth > 2 && currentWidth <= 3) {
|
|
34145
|
+
strokeWidth = this.l10n.getConstant('Medium');
|
|
34146
|
+
}
|
|
34147
|
+
else if (currentWidth > 3 && currentWidth <= 4) {
|
|
34148
|
+
strokeWidth = this.l10n.getConstant('Large');
|
|
34149
|
+
}
|
|
34150
|
+
else {
|
|
34151
|
+
strokeWidth = this.l10n.getConstant('XLarge');
|
|
33482
34152
|
}
|
|
33483
34153
|
return strokeWidth;
|
|
33484
34154
|
};
|