@syncfusion/ej2-image-editor 29.2.5 → 30.1.38
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 +898 -227
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +920 -237
- 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 +43 -5
- 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 +121 -80
- 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 +39 -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 +24 -1
- package/styles/image-editor/material3.css +24 -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 +15 -0
- package/styles/material3-dark.css +24 -1
- package/styles/material3-lite.css +15 -0
- package/styles/material3.css +24 -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;
|
|
@@ -10519,6 +10596,9 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
10519
10596
|
endY = destTop + destHeight;
|
|
10520
10597
|
}
|
|
10521
10598
|
}
|
|
10599
|
+
if (actPoint.width < 0 && actPoint.height < 0 && this.isCropSelection) {
|
|
10600
|
+
isLimiting = true;
|
|
10601
|
+
}
|
|
10522
10602
|
if (parent.transform.straighten !== 0) {
|
|
10523
10603
|
var obj = { isIntersect: null, arr: null };
|
|
10524
10604
|
parent.notify('draw', { prop: 'updateImgCanvasPoints', onPropertyChange: false });
|
|
@@ -11262,7 +11342,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
11262
11342
|
scale = Math.max(width, height);
|
|
11263
11343
|
var newScale = this.getScaleRatio(scale);
|
|
11264
11344
|
actPoint.endX += newScale.x;
|
|
11265
|
-
actPoint.endY += newScale.
|
|
11345
|
+
actPoint.endY += newScale.y;
|
|
11266
11346
|
if (actPoint.endX > (destLeft + destWidth) ||
|
|
11267
11347
|
actPoint.endY > (destTop + destHeight)) {
|
|
11268
11348
|
actPoint.endX -= newScale.x;
|
|
@@ -11377,7 +11457,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
11377
11457
|
var width_2 = this.upperContext.measureText(parent.activeObj.textSettings.text).width +
|
|
11378
11458
|
parent.activeObj.textSettings.fontSize * 0.5;
|
|
11379
11459
|
actPoint.endX = actPoint.startX + width_2;
|
|
11380
|
-
actPoint.endY = actPoint.startY + parent.activeObj.textSettings.fontSize;
|
|
11460
|
+
actPoint.endY = actPoint.startY + (parent.activeObj.textSettings.fontSize * 1.18);
|
|
11381
11461
|
actPoint.width = actPoint.endX - actPoint.startX;
|
|
11382
11462
|
actPoint.height = actPoint.endY - actPoint.startY;
|
|
11383
11463
|
tempActiveObj = extend({}, parent.activeObj, null, true);
|
|
@@ -12181,6 +12261,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
12181
12261
|
var activePoint = parent.activeObj.activePoint;
|
|
12182
12262
|
var x = imageEditorClickEventArgs.point.x;
|
|
12183
12263
|
var y = imageEditorClickEventArgs.point.y;
|
|
12264
|
+
this.mouseClickPoint = { x: x, y: y };
|
|
12184
12265
|
var cursor = parent.activeObj.shape && parent.activeObj.shape === 'text' ?
|
|
12185
12266
|
parent.cursor : 'default';
|
|
12186
12267
|
var tempCursor = parent.upperCanvas.style.cursor;
|
|
@@ -12231,7 +12312,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
12231
12312
|
value: { isTextBox: null } });
|
|
12232
12313
|
var width = this.upperContext.measureText(parent.activeObj.textSettings.text).width + parent.activeObj.textSettings.fontSize * 0.5;
|
|
12233
12314
|
activePoint.endX = activePoint.startX + width;
|
|
12234
|
-
activePoint.endY = activePoint.startY + parent.activeObj.textSettings.fontSize;
|
|
12315
|
+
activePoint.endY = activePoint.startY + (parent.activeObj.textSettings.fontSize * 1.18);
|
|
12235
12316
|
activePoint.width = activePoint.endX - activePoint.startX;
|
|
12236
12317
|
activePoint.height = activePoint.endY - activePoint.startY;
|
|
12237
12318
|
}
|
|
@@ -12660,6 +12741,12 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
12660
12741
|
var bbox = parent.lowerCanvas.getBoundingClientRect();
|
|
12661
12742
|
x -= bbox.left;
|
|
12662
12743
|
y -= bbox.top;
|
|
12744
|
+
if (parent.drawingShape === 'text' && this.mouseDownPoint && this.mouseDownPoint.x === x && this.mouseDownPoint.y === y) {
|
|
12745
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
12746
|
+
if (!parent.activeObj.keyHistory) {
|
|
12747
|
+
parent.activeObj.keyHistory = 'Enter Text';
|
|
12748
|
+
}
|
|
12749
|
+
}
|
|
12663
12750
|
var activeObjShape = void 0;
|
|
12664
12751
|
var currentDrawingShape = this.currentDrawingShape;
|
|
12665
12752
|
var dummyClick = false;
|
|
@@ -12837,6 +12924,12 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
12837
12924
|
}
|
|
12838
12925
|
}
|
|
12839
12926
|
if (!isCropSelection_1) {
|
|
12927
|
+
var isDummyClick = false;
|
|
12928
|
+
if (Math.round(x) === Math.round(this.mouseClickPoint.x) && Math.round(y) ===
|
|
12929
|
+
Math.round(this.mouseClickPoint.y)) {
|
|
12930
|
+
isDummyClick = true;
|
|
12931
|
+
parent.notify('undo-redo', { prop: 'preventApplyEditComplete', value: { bool: true } });
|
|
12932
|
+
}
|
|
12840
12933
|
this.adjustActObjForLineArrow();
|
|
12841
12934
|
if (parent.isShapeDrawing) {
|
|
12842
12935
|
var temp = this.currentDrawingShape;
|
|
@@ -12846,6 +12939,9 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
12846
12939
|
else {
|
|
12847
12940
|
parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
|
|
12848
12941
|
}
|
|
12942
|
+
if (isDummyClick) {
|
|
12943
|
+
parent.notify('undo-redo', { prop: 'preventApplyEditComplete', value: { bool: false } });
|
|
12944
|
+
}
|
|
12849
12945
|
}
|
|
12850
12946
|
}
|
|
12851
12947
|
}
|
|
@@ -12909,6 +13005,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
12909
13005
|
parent.notify('freehand-draw', { prop: 'resetSelPoints', onPropertyChange: false });
|
|
12910
13006
|
}
|
|
12911
13007
|
this.isMouseUp = false;
|
|
13008
|
+
this.mouseClickPoint = { x: 0, y: 0 };
|
|
12912
13009
|
};
|
|
12913
13010
|
Selection.prototype.adjustActObjForLineArrow = function (obj) {
|
|
12914
13011
|
var isAdjusted = false;
|
|
@@ -13190,7 +13287,8 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
13190
13287
|
(obj.textSettings && Math.round(obj.textSettings.fontRatio) !== Math.round(this.tempActiveObj.textSettings.fontRatio)) ||
|
|
13191
13288
|
(obj.textSettings && obj.textSettings.bold !== this.tempActiveObj.textSettings.bold) ||
|
|
13192
13289
|
(obj.textSettings && obj.textSettings.italic !== this.tempActiveObj.textSettings.italic) ||
|
|
13193
|
-
(obj.textSettings && obj.textSettings.underline !== this.tempActiveObj.textSettings.underline)
|
|
13290
|
+
(obj.textSettings && obj.textSettings.underline !== this.tempActiveObj.textSettings.underline) ||
|
|
13291
|
+
(obj.textSettings && obj.textSettings.strikethrough !== this.tempActiveObj.textSettings.strikethrough)) {
|
|
13194
13292
|
isApply = true;
|
|
13195
13293
|
}
|
|
13196
13294
|
if (this.isInitialTextEdited && !isApply) {
|
|
@@ -14234,6 +14332,17 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
14234
14332
|
else {
|
|
14235
14333
|
parent.activeObj.textSettings.italic = false;
|
|
14236
14334
|
}
|
|
14335
|
+
parent.activeObj.textSettings.underline = parent.activeObj.textSettings.strikethrough = false;
|
|
14336
|
+
if (parent.textArea.style.textDecoration === 'underline line-through') {
|
|
14337
|
+
parent.activeObj.textSettings.underline = true;
|
|
14338
|
+
parent.activeObj.textSettings.strikethrough = true;
|
|
14339
|
+
}
|
|
14340
|
+
else if (parent.textArea.style.textDecoration === 'underline') {
|
|
14341
|
+
parent.activeObj.textSettings.underline = true;
|
|
14342
|
+
}
|
|
14343
|
+
else if (parent.textArea.style.textDecoration === 'line-through') {
|
|
14344
|
+
parent.activeObj.textSettings.strikethrough = true;
|
|
14345
|
+
}
|
|
14237
14346
|
parent.activeObj.textSettings.fontSize = (parseFloat(parent.textArea.style.fontSize));
|
|
14238
14347
|
};
|
|
14239
14348
|
Selection.prototype.rgbToHex = function (r, g, b, a) {
|
|
@@ -14385,6 +14494,9 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
14385
14494
|
if (parent.activeObj.textSettings.underline) {
|
|
14386
14495
|
fontStyle.push('underline');
|
|
14387
14496
|
}
|
|
14497
|
+
if (parent.activeObj.textSettings.strikethrough) {
|
|
14498
|
+
fontStyle.push('strikethrough');
|
|
14499
|
+
}
|
|
14388
14500
|
}
|
|
14389
14501
|
var _a = parent.activeObj.activePoint, startX = _a.startX, startY = _a.startY, endX = _a.endX, endY = _a.endY, width = _a.width, height = _a.height;
|
|
14390
14502
|
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 +14685,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
14573
14685
|
/* eslint-disable no-constant-condition */
|
|
14574
14686
|
var Shape = /** @__PURE__ @class */ (function () {
|
|
14575
14687
|
function Shape(parent) {
|
|
14576
|
-
this.textSettings = { text: 'Enter Text', fontFamily: '', fontSize: null, fontRatio: null, bold: false, italic: false, underline: false };
|
|
14688
|
+
this.textSettings = { text: 'Enter Text', fontFamily: '', fontSize: null, fontRatio: null, bold: false, italic: false, underline: false, strikethrough: false };
|
|
14577
14689
|
this.strokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null, radius: null, outlineColor: '', outlineWidth: null };
|
|
14578
14690
|
this.keyHistory = ''; // text history
|
|
14579
14691
|
this.preventFrameAnnotation = false;
|
|
@@ -14616,7 +14728,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
14616
14728
|
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
14729
|
break;
|
|
14618
14730
|
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']);
|
|
14731
|
+
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
14732
|
break;
|
|
14621
14733
|
case 'redrawActObj':
|
|
14622
14734
|
this.redrawActObj(args.value['x'], args.value['y'], args.value['isMouseDown']);
|
|
@@ -14780,7 +14892,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
14780
14892
|
this.alignTextAreaIntoCanvas();
|
|
14781
14893
|
break;
|
|
14782
14894
|
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']);
|
|
14895
|
+
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
14896
|
break;
|
|
14785
14897
|
case 'stopPathDrawing':
|
|
14786
14898
|
this.stopPathDrawing(args.value['e'], args.value['isApply']);
|
|
@@ -14875,7 +14987,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
14875
14987
|
};
|
|
14876
14988
|
Shape.prototype.reset = function () {
|
|
14877
14989
|
this.textSettings =
|
|
14878
|
-
{ text: 'Enter Text', fontFamily: this.parent.fontFamily.default, fontSize: null, fontRatio: null, bold: false, italic: false, underline: false };
|
|
14990
|
+
{ text: 'Enter Text', fontFamily: this.parent.fontFamily.default, fontSize: null, fontRatio: null, bold: false, italic: false, underline: false, strikethrough: false };
|
|
14879
14991
|
this.strokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null, radius: null, outlineColor: '', outlineWidth: null };
|
|
14880
14992
|
this.preventFrameAnnotation = false;
|
|
14881
14993
|
};
|
|
@@ -14915,8 +15027,8 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
14915
15027
|
var start = x && y ? { x: x, y: y } : null;
|
|
14916
15028
|
this.drawShape('redact', null, null, null, start, width, height, null, null, null, null, null, null, null, type, value);
|
|
14917
15029
|
};
|
|
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);
|
|
15030
|
+
Shape.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color, isSelected, degree, fillColor, outlineColor, outlineWidth, transformCollection, underline, strikethrough) {
|
|
15031
|
+
this.drawShapeText(text, fontFamily, fontSize, bold, italic, color, x, y, isSelected, degree, fillColor, outlineColor, outlineWidth, transformCollection, underline, strikethrough);
|
|
14920
15032
|
};
|
|
14921
15033
|
Shape.prototype.initializeShape = function (type) {
|
|
14922
15034
|
var parent = this.parent;
|
|
@@ -15102,7 +15214,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
15102
15214
|
value: { obj: selPointCollObj } });
|
|
15103
15215
|
this.prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
15104
15216
|
};
|
|
15105
|
-
Shape.prototype.drawShapeText = function (text, fontFamily, fontSize, bold, italic, strokeColor, x, y, isSelected, degree, fillColor, outlineColor, outlineWidth, transformCollection) {
|
|
15217
|
+
Shape.prototype.drawShapeText = function (text, fontFamily, fontSize, bold, italic, strokeColor, x, y, isSelected, degree, fillColor, outlineColor, outlineWidth, transformCollection, underline, strikethrough) {
|
|
15106
15218
|
var parent = this.parent;
|
|
15107
15219
|
if (!parent.disabled && parent.isImageLoaded) {
|
|
15108
15220
|
if (parent.currObjType.shape === 'freehanddraw') {
|
|
@@ -15117,7 +15229,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
15117
15229
|
this.refreshActiveObj();
|
|
15118
15230
|
parent.activeObj.shape = parent.currObjType.shape = 'text';
|
|
15119
15231
|
parent.currObjType.isCustomCrop = false;
|
|
15120
|
-
this.initializeTextShape(text, fontFamily, fontSize, bold, italic, strokeColor, fillColor, outlineColor, outlineWidth);
|
|
15232
|
+
this.initializeTextShape(text, fontFamily, fontSize, bold, italic, underline, strikethrough, strokeColor, fillColor, outlineColor, outlineWidth);
|
|
15121
15233
|
parent.currObjType.isText = parent.currObjType.isInitialText = true;
|
|
15122
15234
|
if (isNullOrUndefined(parent.activeObj.textSettings.fontSize)) {
|
|
15123
15235
|
parent.getFontSizes();
|
|
@@ -15268,7 +15380,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
15268
15380
|
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
15269
15381
|
parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
|
|
15270
15382
|
};
|
|
15271
|
-
Shape.prototype.initializeTextShape = function (text, fontFamily, fontSize, bold, italic, strokeColor, fillColor, outlineColor, outlineWidth) {
|
|
15383
|
+
Shape.prototype.initializeTextShape = function (text, fontFamily, fontSize, bold, italic, underline, strikethrough, strokeColor, fillColor, outlineColor, outlineWidth) {
|
|
15272
15384
|
var parent = this.parent;
|
|
15273
15385
|
this.keyHistory = '';
|
|
15274
15386
|
parent.upperCanvas.style.display = 'block';
|
|
@@ -15279,6 +15391,8 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
15279
15391
|
parent.activeObj.textSettings.fontSize = fontSize || parent.activeObj.textSettings.fontSize;
|
|
15280
15392
|
parent.activeObj.textSettings.bold = bold || parent.activeObj.textSettings.bold;
|
|
15281
15393
|
parent.activeObj.textSettings.italic = italic || parent.activeObj.textSettings.italic;
|
|
15394
|
+
parent.activeObj.textSettings.underline = underline || parent.activeObj.textSettings.underline;
|
|
15395
|
+
parent.activeObj.textSettings.strikethrough = strikethrough || parent.activeObj.textSettings.strikethrough;
|
|
15282
15396
|
parent.activeObj.strokeSettings.outlineColor = outlineColor || parent.activeObj.strokeSettings.outlineColor;
|
|
15283
15397
|
parent.activeObj.strokeSettings.outlineWidth = outlineWidth || parent.activeObj.strokeSettings.outlineWidth;
|
|
15284
15398
|
};
|
|
@@ -15483,6 +15597,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
15483
15597
|
parent.activeObj.textSettings.bold = false;
|
|
15484
15598
|
parent.activeObj.textSettings.italic = false;
|
|
15485
15599
|
parent.activeObj.textSettings.underline = false;
|
|
15600
|
+
parent.activeObj.textSettings.strikethrough = false;
|
|
15486
15601
|
for (var i = 0; i < shapeSettings.fontStyle.length; i++) {
|
|
15487
15602
|
switch (shapeSettings.fontStyle[i]) {
|
|
15488
15603
|
case 'bold':
|
|
@@ -15491,6 +15606,12 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
15491
15606
|
case 'italic':
|
|
15492
15607
|
parent.activeObj.textSettings.italic = true;
|
|
15493
15608
|
break;
|
|
15609
|
+
case 'underline':
|
|
15610
|
+
parent.activeObj.textSettings.underline = true;
|
|
15611
|
+
break;
|
|
15612
|
+
case 'strikethrough':
|
|
15613
|
+
parent.activeObj.textSettings.strikethrough = true;
|
|
15614
|
+
break;
|
|
15494
15615
|
}
|
|
15495
15616
|
}
|
|
15496
15617
|
}
|
|
@@ -15509,7 +15630,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
15509
15630
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
15510
15631
|
this.updateFontStyles();
|
|
15511
15632
|
var width = this.upperContext.measureText(this.keyHistory).width + fontSize * 0.5;
|
|
15512
|
-
var height = fontSize;
|
|
15633
|
+
var height = fontSize * 1.18;
|
|
15513
15634
|
this.upperContext.fillText(this.keyHistory, parent.activeObj.activePoint.startX, parent.activeObj.activePoint.startY + fontSize);
|
|
15514
15635
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
15515
15636
|
parent.currObjType.isText = true;
|
|
@@ -15532,7 +15653,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
15532
15653
|
var text = (parent.textArea.style.display === 'block' || parent.textArea.style.display === 'inline-block') ?
|
|
15533
15654
|
this.getMaxText(true) : this.getMaxText();
|
|
15534
15655
|
var width = this.upperContext.measureText(text).width + fontSize * 0.5;
|
|
15535
|
-
var height = rows.length * fontSize;
|
|
15656
|
+
var height = rows.length * fontSize * 1.18;
|
|
15536
15657
|
if (rows.length > 1) {
|
|
15537
15658
|
height += (fontSize * 0.50);
|
|
15538
15659
|
}
|
|
@@ -15567,7 +15688,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
15567
15688
|
parent.textArea.value = '';
|
|
15568
15689
|
this.updateFontStyles();
|
|
15569
15690
|
var width = this.upperContext.measureText(parent.activeObj.keyHistory).width + fontSize * 0.5;
|
|
15570
|
-
var height = fontSize;
|
|
15691
|
+
var height = fontSize * 1.18;
|
|
15571
15692
|
var rows = parent.activeObj.keyHistory.split('\n');
|
|
15572
15693
|
if (rows.length > 1) {
|
|
15573
15694
|
height *= rows.length;
|
|
@@ -16322,6 +16443,9 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
16322
16443
|
}
|
|
16323
16444
|
parent.textArea.style.fontWeight = actObj.textSettings.bold ? 'bold' : 'normal';
|
|
16324
16445
|
parent.textArea.style.fontStyle = actObj.textSettings.italic ? 'italic' : 'normal';
|
|
16446
|
+
parent.textArea.style.textDecoration = (actObj.textSettings.underline && actObj.textSettings.strikethrough) ? 'underline line-through' :
|
|
16447
|
+
(actObj.textSettings.underline) ? 'underline' :
|
|
16448
|
+
(actObj.textSettings.strikethrough) ? 'line-through' : 'none';
|
|
16325
16449
|
parent.textArea.style.border = '2px solid ' + parent.themeColl[parent.theme]['primaryColor'];
|
|
16326
16450
|
parent.textArea.value = actObj.keyHistory;
|
|
16327
16451
|
parent.textArea.style.overflow = 'hidden';
|
|
@@ -16868,7 +16992,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
16868
16992
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
16869
16993
|
var fileData = filesData;
|
|
16870
16994
|
var fileExtension = fileData.name && fileData.name.split('.').pop().toLowerCase();
|
|
16871
|
-
if (fileExtension && ['jpg', 'jpeg', 'png', 'svg', 'webp'].indexOf(fileExtension) === -1) {
|
|
16995
|
+
if (fileExtension && ['jpg', 'jpeg', 'png', 'svg', 'webp', 'bmp'].indexOf(fileExtension) === -1) {
|
|
16872
16996
|
this.refreshActiveObj();
|
|
16873
16997
|
return;
|
|
16874
16998
|
}
|
|
@@ -17215,9 +17339,16 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
17215
17339
|
var obj = { shapeSettingsObj: {} };
|
|
17216
17340
|
parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
|
|
17217
17341
|
var shapeSettings = obj['shapeSettingsObj'];
|
|
17342
|
+
var isObjPushed = false;
|
|
17343
|
+
var collLength = parent.objColl.length;
|
|
17218
17344
|
this.pushActItemIntoObj();
|
|
17345
|
+
if (collLength !== parent.objColl.length) {
|
|
17346
|
+
isObjPushed = true;
|
|
17347
|
+
}
|
|
17219
17348
|
var objColl = extend([], parent.objColl, [], true);
|
|
17220
|
-
|
|
17349
|
+
if (isObjPushed) {
|
|
17350
|
+
parent.objColl.pop();
|
|
17351
|
+
}
|
|
17221
17352
|
if (parent.textArea.style.display === 'none') {
|
|
17222
17353
|
this.updateFontRatio(parent.activeObj);
|
|
17223
17354
|
}
|
|
@@ -17226,24 +17357,77 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
17226
17357
|
}
|
|
17227
17358
|
switch (item) {
|
|
17228
17359
|
case 'default':
|
|
17229
|
-
this.updateFontStyle(item, objColl, 'normal', 'normal');
|
|
17360
|
+
this.updateFontStyle(item, objColl, 'normal', 'normal', false, false);
|
|
17230
17361
|
break;
|
|
17231
17362
|
case 'bold':
|
|
17232
|
-
this.updateFontStyle(item, objColl, 'bold', 'normal');
|
|
17363
|
+
this.updateFontStyle(item, objColl, 'bold', 'normal', false, false);
|
|
17233
17364
|
break;
|
|
17234
17365
|
case 'italic':
|
|
17235
|
-
this.updateFontStyle(item, objColl, 'normal', 'italic');
|
|
17366
|
+
this.updateFontStyle(item, objColl, 'normal', 'italic', false, false);
|
|
17236
17367
|
break;
|
|
17237
17368
|
case 'bolditalic':
|
|
17238
|
-
this.updateFontStyle(item, objColl, 'bold', 'italic');
|
|
17369
|
+
this.updateFontStyle(item, objColl, 'bold', 'italic', false, false);
|
|
17370
|
+
break;
|
|
17371
|
+
case 'underline':
|
|
17372
|
+
this.updateFontStyle(item, objColl, 'normal', 'normal', true, false);
|
|
17373
|
+
break;
|
|
17374
|
+
case 'boldunderline':
|
|
17375
|
+
this.updateFontStyle(item, objColl, 'bold', 'normal', true, false);
|
|
17376
|
+
break;
|
|
17377
|
+
case 'italicunderline':
|
|
17378
|
+
this.updateFontStyle(item, objColl, 'normal', 'italic', true, false);
|
|
17379
|
+
break;
|
|
17380
|
+
case 'bolditalicunderline':
|
|
17381
|
+
this.updateFontStyle(item, objColl, 'bold', 'italic', true, false);
|
|
17382
|
+
break;
|
|
17383
|
+
case 'strikethrough':
|
|
17384
|
+
this.updateFontStyle(item, objColl, 'normal', 'normal', false, true);
|
|
17385
|
+
break;
|
|
17386
|
+
case 'boldstrikethrough':
|
|
17387
|
+
this.updateFontStyle(item, objColl, 'bold', 'normal', false, true);
|
|
17388
|
+
break;
|
|
17389
|
+
case 'italicstrikethrough':
|
|
17390
|
+
this.updateFontStyle(item, objColl, 'normal', 'italic', false, true);
|
|
17391
|
+
break;
|
|
17392
|
+
case 'underlinestrikethrough':
|
|
17393
|
+
this.updateFontStyle(item, objColl, 'normal', 'normal', true, true);
|
|
17394
|
+
break;
|
|
17395
|
+
case 'bolditalicstrikethrough':
|
|
17396
|
+
this.updateFontStyle(item, objColl, 'bold', 'italic', false, true);
|
|
17397
|
+
break;
|
|
17398
|
+
case 'boldunderlinestrikethrough':
|
|
17399
|
+
this.updateFontStyle(item, objColl, 'bold', 'normal', true, true);
|
|
17400
|
+
break;
|
|
17401
|
+
case 'italicunderlinestrikethrough':
|
|
17402
|
+
this.updateFontStyle(item, objColl, 'normal', 'italic', true, true);
|
|
17403
|
+
break;
|
|
17404
|
+
case 'bolditalicunderlinestrikethrough':
|
|
17405
|
+
this.updateFontStyle(item, objColl, 'bold', 'italic', true, true);
|
|
17239
17406
|
break;
|
|
17240
17407
|
}
|
|
17241
17408
|
var shapeChangedArgs = { action: 'font-style', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
17242
|
-
shapeChangedArgs.currentShapeSettings.fontStyle =
|
|
17409
|
+
shapeChangedArgs.currentShapeSettings.fontStyle = this.getFontStyleArray(item);
|
|
17243
17410
|
parent.trigger('shapeChange', shapeChangedArgs);
|
|
17244
17411
|
parent.editCompleteArgs = shapeChangedArgs;
|
|
17245
17412
|
};
|
|
17246
|
-
Shape.prototype.
|
|
17413
|
+
Shape.prototype.getFontStyleArray = function (item) {
|
|
17414
|
+
var styleArray = [];
|
|
17415
|
+
var lowerItem = item.toLowerCase();
|
|
17416
|
+
if (lowerItem.indexOf('bold') > -1) {
|
|
17417
|
+
styleArray.push('bold');
|
|
17418
|
+
}
|
|
17419
|
+
if (lowerItem.indexOf('italic') > -1) {
|
|
17420
|
+
styleArray.push('italic');
|
|
17421
|
+
}
|
|
17422
|
+
if (lowerItem.indexOf('underline') > -1) {
|
|
17423
|
+
styleArray.push('underline');
|
|
17424
|
+
}
|
|
17425
|
+
if (lowerItem.indexOf('strikethrough') > -1) {
|
|
17426
|
+
styleArray.push('strikethrough');
|
|
17427
|
+
}
|
|
17428
|
+
return styleArray;
|
|
17429
|
+
};
|
|
17430
|
+
Shape.prototype.updateFontStyle = function (item, objColl, fontWeight, fontStyle, underline, strikethrough) {
|
|
17247
17431
|
var parent = this.parent;
|
|
17248
17432
|
var style = parent.textArea.style;
|
|
17249
17433
|
if (style.display === 'block' || style.display === 'inline-block') {
|
|
@@ -17259,9 +17443,43 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
17259
17443
|
else {
|
|
17260
17444
|
style.fontStyle = 'normal';
|
|
17261
17445
|
}
|
|
17262
|
-
|
|
17263
|
-
|
|
17264
|
-
|
|
17446
|
+
if (underline && strikethrough) {
|
|
17447
|
+
style.textDecoration = 'underline line-through';
|
|
17448
|
+
}
|
|
17449
|
+
else if (strikethrough) {
|
|
17450
|
+
style.textDecoration = 'line-through';
|
|
17451
|
+
}
|
|
17452
|
+
else if (underline) {
|
|
17453
|
+
style.textDecoration = 'underline';
|
|
17454
|
+
}
|
|
17455
|
+
else {
|
|
17456
|
+
style.textDecoration = 'none';
|
|
17457
|
+
}
|
|
17458
|
+
var key = [
|
|
17459
|
+
style.fontWeight === 'bold' ? 'bold' : '',
|
|
17460
|
+
style.fontStyle === 'italic' ? 'italic' : '',
|
|
17461
|
+
typeof style.textDecoration === 'string' && style.textDecoration.indexOf('underline') > -1 ? 'underline' : '',
|
|
17462
|
+
typeof style.textDecoration === 'string' && style.textDecoration.indexOf('line-through') > -1 ? 'strikethrough' : ''
|
|
17463
|
+
].filter(Boolean).join('');
|
|
17464
|
+
var valueMap = {
|
|
17465
|
+
'': 'default',
|
|
17466
|
+
bold: 'bold',
|
|
17467
|
+
italic: 'italic',
|
|
17468
|
+
underline: 'underline',
|
|
17469
|
+
strikethrough: 'strikethrough',
|
|
17470
|
+
bolditalic: 'bolditalic',
|
|
17471
|
+
boldunderline: 'boldunderline',
|
|
17472
|
+
boldstrikethrough: 'boldstrikethrough',
|
|
17473
|
+
italicunderline: 'italicunderline',
|
|
17474
|
+
italicstrikethrough: 'italicstrikethrough',
|
|
17475
|
+
underlinestrikethrough: 'underlinestrikethrough',
|
|
17476
|
+
bolditalicunderline: 'bolditalicunderline',
|
|
17477
|
+
bolditalicstrikethrough: 'bolditalicstrikethrough',
|
|
17478
|
+
boldunderlinestrikethrough: 'boldunderlinestrikethrough',
|
|
17479
|
+
italicunderlinestrikethrough: 'italicunderlinestrikethrough',
|
|
17480
|
+
bolditalicunderlinestrikethrough: 'bolditalicunderlinestrikethrough'
|
|
17481
|
+
};
|
|
17482
|
+
var value = key in valueMap ? valueMap[key] : 'default';
|
|
17265
17483
|
var width = this.getTextAreaWidth(value);
|
|
17266
17484
|
style.width = width + 'px';
|
|
17267
17485
|
this.updateObjColl(item, objColl);
|
|
@@ -17269,6 +17487,8 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
17269
17487
|
else {
|
|
17270
17488
|
this.textSettings.bold = parent.activeObj.textSettings.bold = fontWeight === 'normal' ? false : true;
|
|
17271
17489
|
this.textSettings.italic = parent.activeObj.textSettings.italic = fontStyle === 'normal' ? false : true;
|
|
17490
|
+
this.textSettings.underline = parent.activeObj.textSettings.underline = underline ? true : false;
|
|
17491
|
+
this.textSettings.strikethrough = parent.activeObj.textSettings.strikethrough = strikethrough ? true : false;
|
|
17272
17492
|
if (parent.activeObj.activePoint.width !== 0 || parent.activeObj.activePoint.height !== 0) {
|
|
17273
17493
|
this.redrawText();
|
|
17274
17494
|
}
|
|
@@ -17364,24 +17584,107 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
17364
17584
|
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
17365
17585
|
value: { obj: selPointCollObj } });
|
|
17366
17586
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
17367
|
-
var
|
|
17368
|
-
var
|
|
17587
|
+
var textSettings = parent.activeObj.textSettings;
|
|
17588
|
+
var tempBold = textSettings.bold;
|
|
17589
|
+
var tempItalic = textSettings.italic;
|
|
17590
|
+
var tempUnderline = textSettings.underline;
|
|
17591
|
+
var tempStrikethrough = textSettings.strikethrough;
|
|
17369
17592
|
switch (item) {
|
|
17370
17593
|
case 'default':
|
|
17371
|
-
|
|
17372
|
-
|
|
17594
|
+
textSettings.bold = false;
|
|
17595
|
+
textSettings.italic = false;
|
|
17596
|
+
textSettings.underline = false;
|
|
17597
|
+
textSettings.strikethrough = false;
|
|
17373
17598
|
break;
|
|
17374
17599
|
case 'bold':
|
|
17375
|
-
|
|
17376
|
-
|
|
17600
|
+
textSettings.bold = true;
|
|
17601
|
+
textSettings.italic = false;
|
|
17602
|
+
textSettings.underline = false;
|
|
17603
|
+
textSettings.strikethrough = false;
|
|
17377
17604
|
break;
|
|
17378
17605
|
case 'italic':
|
|
17379
|
-
|
|
17380
|
-
|
|
17606
|
+
textSettings.bold = false;
|
|
17607
|
+
textSettings.italic = true;
|
|
17608
|
+
textSettings.underline = false;
|
|
17609
|
+
textSettings.strikethrough = false;
|
|
17381
17610
|
break;
|
|
17382
17611
|
case 'bolditalic':
|
|
17383
|
-
|
|
17384
|
-
|
|
17612
|
+
textSettings.bold = true;
|
|
17613
|
+
textSettings.italic = true;
|
|
17614
|
+
textSettings.underline = false;
|
|
17615
|
+
textSettings.strikethrough = false;
|
|
17616
|
+
break;
|
|
17617
|
+
case 'underline':
|
|
17618
|
+
textSettings.bold = false;
|
|
17619
|
+
textSettings.italic = false;
|
|
17620
|
+
textSettings.underline = true;
|
|
17621
|
+
textSettings.strikethrough = false;
|
|
17622
|
+
break;
|
|
17623
|
+
case 'boldunderline':
|
|
17624
|
+
textSettings.bold = true;
|
|
17625
|
+
textSettings.italic = false;
|
|
17626
|
+
textSettings.underline = true;
|
|
17627
|
+
textSettings.strikethrough = false;
|
|
17628
|
+
break;
|
|
17629
|
+
case 'italicunderline':
|
|
17630
|
+
textSettings.bold = false;
|
|
17631
|
+
textSettings.italic = true;
|
|
17632
|
+
textSettings.underline = true;
|
|
17633
|
+
textSettings.strikethrough = false;
|
|
17634
|
+
break;
|
|
17635
|
+
case 'bolditalicunderline':
|
|
17636
|
+
textSettings.bold = true;
|
|
17637
|
+
textSettings.italic = true;
|
|
17638
|
+
textSettings.underline = true;
|
|
17639
|
+
textSettings.strikethrough = false;
|
|
17640
|
+
break;
|
|
17641
|
+
case 'strikethrough':
|
|
17642
|
+
textSettings.bold = false;
|
|
17643
|
+
textSettings.italic = false;
|
|
17644
|
+
textSettings.underline = false;
|
|
17645
|
+
textSettings.strikethrough = true;
|
|
17646
|
+
break;
|
|
17647
|
+
case 'boldstrikethrough':
|
|
17648
|
+
textSettings.bold = true;
|
|
17649
|
+
textSettings.italic = false;
|
|
17650
|
+
textSettings.underline = false;
|
|
17651
|
+
textSettings.strikethrough = true;
|
|
17652
|
+
break;
|
|
17653
|
+
case 'italicstrikethrough':
|
|
17654
|
+
textSettings.bold = false;
|
|
17655
|
+
textSettings.italic = true;
|
|
17656
|
+
textSettings.underline = false;
|
|
17657
|
+
textSettings.strikethrough = true;
|
|
17658
|
+
break;
|
|
17659
|
+
case 'underlinestrikethrough':
|
|
17660
|
+
textSettings.bold = false;
|
|
17661
|
+
textSettings.italic = false;
|
|
17662
|
+
textSettings.underline = true;
|
|
17663
|
+
textSettings.strikethrough = true;
|
|
17664
|
+
break;
|
|
17665
|
+
case 'bolditalicstrikethrough':
|
|
17666
|
+
textSettings.bold = true;
|
|
17667
|
+
textSettings.italic = true;
|
|
17668
|
+
textSettings.underline = false;
|
|
17669
|
+
textSettings.strikethrough = true;
|
|
17670
|
+
break;
|
|
17671
|
+
case 'boldunderlinestrikethrough':
|
|
17672
|
+
textSettings.bold = true;
|
|
17673
|
+
textSettings.italic = false;
|
|
17674
|
+
textSettings.underline = true;
|
|
17675
|
+
textSettings.strikethrough = true;
|
|
17676
|
+
break;
|
|
17677
|
+
case 'italicunderlinestrikethrough':
|
|
17678
|
+
textSettings.bold = false;
|
|
17679
|
+
textSettings.italic = true;
|
|
17680
|
+
textSettings.underline = true;
|
|
17681
|
+
textSettings.strikethrough = true;
|
|
17682
|
+
break;
|
|
17683
|
+
case 'bolditalicunderlinestrikethrough':
|
|
17684
|
+
textSettings.bold = true;
|
|
17685
|
+
textSettings.italic = true;
|
|
17686
|
+
textSettings.underline = true;
|
|
17687
|
+
textSettings.strikethrough = true;
|
|
17385
17688
|
break;
|
|
17386
17689
|
}
|
|
17387
17690
|
parent.objColl.push(parent.activeObj);
|
|
@@ -17391,8 +17694,10 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
17391
17694
|
previousCropObj: prevCropObj, previousText: null,
|
|
17392
17695
|
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
17393
17696
|
parent.objColl.pop();
|
|
17394
|
-
|
|
17395
|
-
|
|
17697
|
+
textSettings.bold = tempBold;
|
|
17698
|
+
textSettings.italic = tempItalic;
|
|
17699
|
+
textSettings.underline = tempUnderline;
|
|
17700
|
+
textSettings.strikethrough = tempStrikethrough;
|
|
17396
17701
|
};
|
|
17397
17702
|
Shape.prototype.pushActItemIntoObj = function () {
|
|
17398
17703
|
var parent = this.parent;
|
|
@@ -17585,24 +17890,107 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
17585
17890
|
};
|
|
17586
17891
|
Shape.prototype.getTextAreaWidth = function (item) {
|
|
17587
17892
|
var parent = this.parent;
|
|
17588
|
-
var
|
|
17589
|
-
var
|
|
17893
|
+
var textSettings = parent.activeObj.textSettings;
|
|
17894
|
+
var tempBold = textSettings.bold;
|
|
17895
|
+
var tempItalic = textSettings.italic;
|
|
17896
|
+
var tempUnderline = textSettings.underline;
|
|
17897
|
+
var tempStrikethrough = textSettings.strikethrough;
|
|
17590
17898
|
switch (item) {
|
|
17591
17899
|
case 'default':
|
|
17592
|
-
|
|
17593
|
-
|
|
17900
|
+
textSettings.bold = false;
|
|
17901
|
+
textSettings.italic = false;
|
|
17902
|
+
textSettings.underline = false;
|
|
17903
|
+
textSettings.strikethrough = false;
|
|
17594
17904
|
break;
|
|
17595
17905
|
case 'bold':
|
|
17596
|
-
|
|
17597
|
-
|
|
17906
|
+
textSettings.bold = true;
|
|
17907
|
+
textSettings.italic = false;
|
|
17908
|
+
textSettings.underline = false;
|
|
17909
|
+
textSettings.strikethrough = false;
|
|
17598
17910
|
break;
|
|
17599
17911
|
case 'italic':
|
|
17600
|
-
|
|
17601
|
-
|
|
17912
|
+
textSettings.bold = false;
|
|
17913
|
+
textSettings.italic = true;
|
|
17914
|
+
textSettings.underline = false;
|
|
17915
|
+
textSettings.strikethrough = false;
|
|
17602
17916
|
break;
|
|
17603
17917
|
case 'bolditalic':
|
|
17604
|
-
|
|
17605
|
-
|
|
17918
|
+
textSettings.bold = true;
|
|
17919
|
+
textSettings.italic = true;
|
|
17920
|
+
textSettings.underline = false;
|
|
17921
|
+
textSettings.strikethrough = false;
|
|
17922
|
+
break;
|
|
17923
|
+
case 'underline':
|
|
17924
|
+
textSettings.bold = false;
|
|
17925
|
+
textSettings.italic = false;
|
|
17926
|
+
textSettings.underline = true;
|
|
17927
|
+
textSettings.strikethrough = false;
|
|
17928
|
+
break;
|
|
17929
|
+
case 'boldunderline':
|
|
17930
|
+
textSettings.bold = true;
|
|
17931
|
+
textSettings.italic = false;
|
|
17932
|
+
textSettings.underline = true;
|
|
17933
|
+
textSettings.strikethrough = false;
|
|
17934
|
+
break;
|
|
17935
|
+
case 'italicunderline':
|
|
17936
|
+
textSettings.bold = false;
|
|
17937
|
+
textSettings.italic = true;
|
|
17938
|
+
textSettings.underline = true;
|
|
17939
|
+
textSettings.strikethrough = false;
|
|
17940
|
+
break;
|
|
17941
|
+
case 'bolditalicunderline':
|
|
17942
|
+
textSettings.bold = true;
|
|
17943
|
+
textSettings.italic = true;
|
|
17944
|
+
textSettings.underline = true;
|
|
17945
|
+
textSettings.strikethrough = false;
|
|
17946
|
+
break;
|
|
17947
|
+
case 'strikethrough':
|
|
17948
|
+
textSettings.bold = false;
|
|
17949
|
+
textSettings.italic = false;
|
|
17950
|
+
textSettings.underline = false;
|
|
17951
|
+
textSettings.strikethrough = true;
|
|
17952
|
+
break;
|
|
17953
|
+
case 'boldstrikethrough':
|
|
17954
|
+
textSettings.bold = true;
|
|
17955
|
+
textSettings.italic = false;
|
|
17956
|
+
textSettings.underline = false;
|
|
17957
|
+
textSettings.strikethrough = true;
|
|
17958
|
+
break;
|
|
17959
|
+
case 'italicstrikethrough':
|
|
17960
|
+
textSettings.bold = false;
|
|
17961
|
+
textSettings.italic = true;
|
|
17962
|
+
textSettings.underline = false;
|
|
17963
|
+
textSettings.strikethrough = true;
|
|
17964
|
+
break;
|
|
17965
|
+
case 'underlinestrikethrough':
|
|
17966
|
+
textSettings.bold = false;
|
|
17967
|
+
textSettings.italic = false;
|
|
17968
|
+
textSettings.underline = true;
|
|
17969
|
+
textSettings.strikethrough = true;
|
|
17970
|
+
break;
|
|
17971
|
+
case 'bolditalicstrikethrough':
|
|
17972
|
+
textSettings.bold = true;
|
|
17973
|
+
textSettings.italic = true;
|
|
17974
|
+
textSettings.underline = false;
|
|
17975
|
+
textSettings.strikethrough = true;
|
|
17976
|
+
break;
|
|
17977
|
+
case 'boldunderlinestrikethrough':
|
|
17978
|
+
textSettings.bold = true;
|
|
17979
|
+
textSettings.italic = false;
|
|
17980
|
+
textSettings.underline = true;
|
|
17981
|
+
textSettings.strikethrough = true;
|
|
17982
|
+
break;
|
|
17983
|
+
case 'italicunderlinestrikethrough':
|
|
17984
|
+
textSettings.bold = false;
|
|
17985
|
+
textSettings.italic = true;
|
|
17986
|
+
textSettings.underline = true;
|
|
17987
|
+
textSettings.strikethrough = true;
|
|
17988
|
+
break;
|
|
17989
|
+
case 'bolditalicunderlinestrikethrough':
|
|
17990
|
+
textSettings.bold = true;
|
|
17991
|
+
textSettings.italic = true;
|
|
17992
|
+
textSettings.underline = true;
|
|
17993
|
+
textSettings.strikethrough = true;
|
|
17606
17994
|
break;
|
|
17607
17995
|
}
|
|
17608
17996
|
var isTextArea = parent.textArea.style.display === 'none' ? false : true;
|
|
@@ -17610,14 +17998,16 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
17610
17998
|
var width;
|
|
17611
17999
|
if (!isTextArea) {
|
|
17612
18000
|
width = this.upperContext.measureText(parent.activeObj.keyHistory).width +
|
|
17613
|
-
|
|
18001
|
+
textSettings.fontSize * 0.5;
|
|
17614
18002
|
}
|
|
17615
18003
|
else {
|
|
17616
18004
|
width = this.upperContext.measureText(parent.textArea.value).width +
|
|
17617
|
-
|
|
18005
|
+
textSettings.fontSize * 0.5;
|
|
17618
18006
|
}
|
|
17619
|
-
|
|
17620
|
-
|
|
18007
|
+
textSettings.bold = tempBold;
|
|
18008
|
+
textSettings.italic = tempItalic;
|
|
18009
|
+
textSettings.underline = tempUnderline;
|
|
18010
|
+
textSettings.strikethrough = tempStrikethrough;
|
|
17621
18011
|
return width;
|
|
17622
18012
|
};
|
|
17623
18013
|
Shape.prototype.getRedactObjDetails = function (obj) {
|
|
@@ -17696,6 +18086,12 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
17696
18086
|
if (obj.textSettings.italic) {
|
|
17697
18087
|
shapeDetails.fontStyle.push('italic');
|
|
17698
18088
|
}
|
|
18089
|
+
if (obj.textSettings.underline) {
|
|
18090
|
+
shapeDetails.fontStyle.push('underline');
|
|
18091
|
+
}
|
|
18092
|
+
if (obj.textSettings.strikethrough) {
|
|
18093
|
+
shapeDetails.fontStyle.push('strikethrough');
|
|
18094
|
+
}
|
|
17699
18095
|
shapeDetails.degree = obj.rotatedAngle * (180 / Math.PI);
|
|
17700
18096
|
parent.notify('selection', { prop: 'updateTransColl', onPropertyChange: false, value: { obj: transformObj, object: obj } });
|
|
17701
18097
|
shapeDetails.transformCollection = transformObj['coll'];
|
|
@@ -17995,6 +18391,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
17995
18391
|
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
17996
18392
|
parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
|
|
17997
18393
|
parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
|
|
18394
|
+
parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
17998
18395
|
}
|
|
17999
18396
|
};
|
|
18000
18397
|
Shape.prototype.getMaxText = function (isTextBox, text, obj) {
|
|
@@ -19411,40 +19808,40 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
19411
19808
|
destWidth: parent.img.destWidth, destHeight: parent.img.destHeight };
|
|
19412
19809
|
if (parent.activeObj.shape) {
|
|
19413
19810
|
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
|
-
}
|
|
19811
|
+
var actPoint = parent.activeObj.activePoint;
|
|
19812
|
+
if (parent.transform.straighten === 0) {
|
|
19813
|
+
if (parent.img.destLeft > actPoint.startX || parent.img.destTop >
|
|
19814
|
+
actPoint.startY || parent.img.destLeft + parent.img.destWidth <
|
|
19815
|
+
actPoint.endX || parent.img.destTop + parent.img.destHeight < actPoint.endY
|
|
19816
|
+
|| zoomFactor === minZoomFactor) {
|
|
19817
|
+
isDisabled = true;
|
|
19430
19818
|
}
|
|
19431
19819
|
else {
|
|
19432
|
-
|
|
19433
|
-
|
|
19434
|
-
|
|
19435
|
-
|
|
19436
|
-
|
|
19437
|
-
|
|
19438
|
-
|
|
19439
|
-
|
|
19440
|
-
|
|
19441
|
-
|
|
19442
|
-
|
|
19443
|
-
|
|
19444
|
-
|
|
19445
|
-
|
|
19446
|
-
|
|
19447
|
-
|
|
19820
|
+
isDisabled = false;
|
|
19821
|
+
}
|
|
19822
|
+
}
|
|
19823
|
+
else {
|
|
19824
|
+
parent.img.destWidth = maxDimension.width;
|
|
19825
|
+
parent.img.destHeight = maxDimension.height;
|
|
19826
|
+
var obj = { isIntersect: null };
|
|
19827
|
+
parent.notify('draw', { prop: 'updateImgCanvasPoints', onPropertyChange: false });
|
|
19828
|
+
parent.notify('draw', { prop: 'isLinesIntersect', onPropertyChange: false, value: { obj: obj } });
|
|
19829
|
+
if (obj['isIntersect'] ||
|
|
19830
|
+
zoomFactor === minZoomFactor) {
|
|
19831
|
+
isDisabled = true;
|
|
19832
|
+
}
|
|
19833
|
+
else {
|
|
19834
|
+
isDisabled = false;
|
|
19835
|
+
}
|
|
19836
|
+
}
|
|
19837
|
+
if (zoomOut) {
|
|
19838
|
+
if (isDisabled) {
|
|
19839
|
+
zoomOut.classList.add('e-disabled');
|
|
19840
|
+
zoomOut.parentElement.classList.add('e-overlay');
|
|
19841
|
+
}
|
|
19842
|
+
else {
|
|
19843
|
+
zoomOut.classList.remove('e-disabled');
|
|
19844
|
+
zoomOut.parentElement.classList.remove('e-overlay');
|
|
19448
19845
|
}
|
|
19449
19846
|
}
|
|
19450
19847
|
}
|
|
@@ -19480,7 +19877,7 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
19480
19877
|
maxDimension.width += (maxDimension.width * parent.transform.zoomFactor);
|
|
19481
19878
|
maxDimension.height += (maxDimension.height * parent.transform.zoomFactor);
|
|
19482
19879
|
parent.img.destLeft = (parent.lowerCanvas.clientWidth - maxDimension.width) / 2;
|
|
19483
|
-
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height
|
|
19880
|
+
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height) / 2;
|
|
19484
19881
|
}
|
|
19485
19882
|
parent.notify('draw', { prop: 'draw-image-to-canvas', value: { dimension: maxDimension } });
|
|
19486
19883
|
maxDimension.width = this.cropDimension.width;
|
|
@@ -20204,7 +20601,7 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
20204
20601
|
maxDimension.height += (maxDimension.height * parent.transform.defaultZoomFactor);
|
|
20205
20602
|
}
|
|
20206
20603
|
parent.img.destLeft = (parent.lowerCanvas.clientWidth - maxDimension.width) / 2;
|
|
20207
|
-
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height
|
|
20604
|
+
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height) / 2;
|
|
20208
20605
|
if (parent.transform.degree === 0 && parent.transform.currFlipState === '') {
|
|
20209
20606
|
if (parent.transform.defaultZoomFactor > 0) {
|
|
20210
20607
|
parent.img.destLeft += parent.panPoint.totalPannedPoint.x;
|
|
@@ -20313,11 +20710,11 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
20313
20710
|
var object = { toolbarHeight: 0 };
|
|
20314
20711
|
var parent = this.parent;
|
|
20315
20712
|
parent.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: object } });
|
|
20316
|
-
var
|
|
20317
|
-
|
|
20318
|
-
var
|
|
20319
|
-
|
|
20320
|
-
canvasMaxHeight = Browser.isDevice ? canvasMaxHeight - (object['toolbarHeight']) : canvasMaxHeight;
|
|
20713
|
+
var newWidth = parent.imageSettings.width ? parent.imageSettings.width : parent.element.clientWidth;
|
|
20714
|
+
var newHeight = parent.imageSettings.height ? parent.imageSettings.height : parent.element.clientHeight - (object['toolbarHeight']);
|
|
20715
|
+
var canvasMaxWidth = isImgShape ? parent.element.clientWidth / 3 : newWidth;
|
|
20716
|
+
var canvasMaxHeight = isImgShape ? (parent.element.clientHeight - object['toolbarHeight']) / 3 : newHeight;
|
|
20717
|
+
canvasMaxHeight = Browser.isDevice ? canvasMaxHeight - (object['toolbarHeight']) : canvasMaxHeight;
|
|
20321
20718
|
if (Browser.isDevice && parent.isStraightening) {
|
|
20322
20719
|
var cxtTbar = parent.element.querySelector('#' + parent.element.id + '_contextualToolbarArea');
|
|
20323
20720
|
canvasMaxHeight -= cxtTbar ? cxtTbar.clientHeight : 0;
|
|
@@ -20325,7 +20722,8 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
20325
20722
|
if (!isImgShape && parent.element.clientHeight === 0) {
|
|
20326
20723
|
canvasMaxHeight = 0;
|
|
20327
20724
|
}
|
|
20328
|
-
|
|
20725
|
+
var isImageSettings = parent.imageSettings.width && parent.imageSettings.height ? true : false;
|
|
20726
|
+
if (isNullOrUndefined(isImgShape) && !(isImageSettings)) {
|
|
20329
20727
|
if (canvasMaxWidth > 30) {
|
|
20330
20728
|
canvasMaxWidth -= 30;
|
|
20331
20729
|
}
|
|
@@ -20551,6 +20949,9 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
20551
20949
|
this.zoomAction(.0125, null, true, true);
|
|
20552
20950
|
}
|
|
20553
20951
|
}
|
|
20952
|
+
if (parent.isPublicMethod && parent.aspectWidth === width && parent.aspectHeight === height) {
|
|
20953
|
+
return;
|
|
20954
|
+
}
|
|
20554
20955
|
this.resizeImg(activeObj, width, height);
|
|
20555
20956
|
width = tempwidth;
|
|
20556
20957
|
height = tempheight;
|
|
@@ -20596,9 +20997,12 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
20596
20997
|
value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
|
|
20597
20998
|
}
|
|
20598
20999
|
if (isNullOrUndefined(parent.currSelectionPoint)) {
|
|
20599
|
-
|
|
20600
|
-
|
|
20601
|
-
|
|
21000
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
21001
|
+
if (!parent.shapeColl.some(function (item) { return item.rotatedAngle && item.rotatedAngle !== 0; })) {
|
|
21002
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
21003
|
+
value: { type: 'custom', startX: parent.img.destLeft, startY: parent.img.destTop,
|
|
21004
|
+
width: parent.img.destWidth, height: parent.img.destHeight } });
|
|
21005
|
+
}
|
|
20602
21006
|
}
|
|
20603
21007
|
else {
|
|
20604
21008
|
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
@@ -20780,6 +21184,8 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
|
|
|
20780
21184
|
this.tempUndoRedoColl = [];
|
|
20781
21185
|
this.tempUndoRedoStep = 0;
|
|
20782
21186
|
this.isPreventing = false;
|
|
21187
|
+
this.preventEditComplete = false;
|
|
21188
|
+
this.preventApplyEditComplete = false;
|
|
20783
21189
|
this.parent = parent;
|
|
20784
21190
|
this.addEventListener();
|
|
20785
21191
|
}
|
|
@@ -20861,6 +21267,12 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
|
|
|
20861
21267
|
case 'reset':
|
|
20862
21268
|
this.reset();
|
|
20863
21269
|
break;
|
|
21270
|
+
case 'preventEditComplete':
|
|
21271
|
+
args.value['obj']['bool'] = this.preventEditComplete;
|
|
21272
|
+
break;
|
|
21273
|
+
case 'preventApplyEditComplete':
|
|
21274
|
+
this.preventApplyEditComplete = args.value['bool'];
|
|
21275
|
+
break;
|
|
20864
21276
|
}
|
|
20865
21277
|
};
|
|
20866
21278
|
UndoRedo.prototype.getModuleName = function () {
|
|
@@ -20875,6 +21287,7 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
|
|
|
20875
21287
|
this.tempUndoRedoColl = [];
|
|
20876
21288
|
this.tempUndoRedoStep = 0;
|
|
20877
21289
|
this.isPreventing = false;
|
|
21290
|
+
this.preventEditComplete = this.preventApplyEditComplete = false;
|
|
20878
21291
|
};
|
|
20879
21292
|
UndoRedo.prototype.refreshUrc = function (refreshToolbar) {
|
|
20880
21293
|
var parent = this.parent;
|
|
@@ -21586,6 +21999,10 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
|
|
|
21586
21999
|
textArea.style.color = obj.strokeSettings.strokeColor;
|
|
21587
22000
|
textArea.style.fontWeight = obj.textSettings.bold ? 'bold' : 'normal';
|
|
21588
22001
|
textArea.style.fontStyle = obj.textSettings.italic ? 'italic' : 'normal';
|
|
22002
|
+
textArea.style.textDecoration = (obj.textSettings.underline && obj.textSettings.strikethrough) ? 'underline line-through' :
|
|
22003
|
+
(obj.textSettings.underline) ? 'underline' :
|
|
22004
|
+
(obj.textSettings.strikethrough) ? 'line-through' :
|
|
22005
|
+
'none';
|
|
21589
22006
|
textArea.style.border = '2px solid ' + parent.themeColl[parent.theme]['primaryColor'];
|
|
21590
22007
|
textArea.value = obj.keyHistory;
|
|
21591
22008
|
parent.activeObj = extend({}, obj, {}, true);
|
|
@@ -21919,6 +22336,7 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
|
|
|
21919
22336
|
var temp = parent.noPushUndo;
|
|
21920
22337
|
parent.noPushUndo = false;
|
|
21921
22338
|
parent.isUndoRedoStack = true;
|
|
22339
|
+
this.preventEditComplete = true;
|
|
21922
22340
|
if (isPenDraw) {
|
|
21923
22341
|
var tempTogglePen = parent.togglePen;
|
|
21924
22342
|
var obj = { freehandDrawSelectedId: null };
|
|
@@ -21947,7 +22365,14 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
|
|
|
21947
22365
|
parent.enableTextEditing();
|
|
21948
22366
|
}
|
|
21949
22367
|
}
|
|
21950
|
-
|
|
22368
|
+
if (this.preventEditComplete) {
|
|
22369
|
+
parent.isUndoRedoStack = this.preventEditComplete = false;
|
|
22370
|
+
if (!this.preventApplyEditComplete) {
|
|
22371
|
+
this.triggerActionCompletedEvent('shape-customize');
|
|
22372
|
+
}
|
|
22373
|
+
this.triggerActionCompletedEvent('shape-select');
|
|
22374
|
+
}
|
|
22375
|
+
parent.isUndoRedoStack = this.preventEditComplete = false;
|
|
21951
22376
|
}
|
|
21952
22377
|
};
|
|
21953
22378
|
return UndoRedo;
|
|
@@ -22243,6 +22668,12 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22243
22668
|
_this.tempRedactBlur = 50;
|
|
22244
22669
|
/** @hidden */
|
|
22245
22670
|
_this.tempRedactPixel = 40;
|
|
22671
|
+
/** @hidden */
|
|
22672
|
+
_this.imageSettings = { width: null, height: null };
|
|
22673
|
+
/** @hidden */
|
|
22674
|
+
_this.aspectRatioBaseDimension = false;
|
|
22675
|
+
/** @hidden */
|
|
22676
|
+
_this.imageLoaded = false;
|
|
22246
22677
|
_this.tempToolbarHeight = 0;
|
|
22247
22678
|
_this.tempToolbar = [];
|
|
22248
22679
|
ImageEditor_1.Inject(Crop, Draw, Selection, Transform, Export, ToolbarModule);
|
|
@@ -22347,11 +22778,13 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22347
22778
|
break;
|
|
22348
22779
|
case 'disabled':
|
|
22349
22780
|
if (newProperties.disabled) {
|
|
22350
|
-
this.element.classList.add('e-disabled');
|
|
22781
|
+
this.element.classList.add('e-disabled', 'e-overlay');
|
|
22782
|
+
this.element.style.opacity = '0.5';
|
|
22351
22783
|
this.unwireEvent();
|
|
22352
22784
|
}
|
|
22353
22785
|
else {
|
|
22354
|
-
this.element.classList.remove('e-disabled');
|
|
22786
|
+
this.element.classList.remove('e-disabled', 'e-overlay');
|
|
22787
|
+
this.element.style.opacity = '1';
|
|
22355
22788
|
this.wireEvent();
|
|
22356
22789
|
}
|
|
22357
22790
|
break;
|
|
@@ -22469,7 +22902,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22469
22902
|
if (newProperties.uploadSettings) {
|
|
22470
22903
|
this.uploadSettings = newProperties.uploadSettings;
|
|
22471
22904
|
if (!this.uploadSettings.allowedExtensions) {
|
|
22472
|
-
this.uploadSettings.allowedExtensions = '.jpg, .jpeg, .png, .svg, .webp';
|
|
22905
|
+
this.uploadSettings.allowedExtensions = '.jpg, .jpeg, .png, .svg, .webp, .bmp';
|
|
22473
22906
|
this.notify('draw', { prop: 'setNullExtension', value: { extension: true } });
|
|
22474
22907
|
}
|
|
22475
22908
|
else {
|
|
@@ -22518,6 +22951,10 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22518
22951
|
this.element.innerHTML = '';
|
|
22519
22952
|
};
|
|
22520
22953
|
ImageEditor.prototype.initialize = function () {
|
|
22954
|
+
if (this.disabled) {
|
|
22955
|
+
this.element.classList.add('e-disabled', 'e-overlay');
|
|
22956
|
+
this.element.style.opacity = '0.5';
|
|
22957
|
+
}
|
|
22521
22958
|
if (this.toolbarTemplate) {
|
|
22522
22959
|
this.element.appendChild(this.createElement('div', {
|
|
22523
22960
|
id: this.element.id + '_toolbarArea', className: 'e-toolbar-area'
|
|
@@ -22529,7 +22966,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22529
22966
|
this.notify('toolbar', { prop: 'create-contextual-toolbar', onPropertyChange: false });
|
|
22530
22967
|
}
|
|
22531
22968
|
if (!this.uploadSettings.allowedExtensions) {
|
|
22532
|
-
this.setProperties({ uploadSettings: { allowedExtensions: '.jpg, .jpeg, .png, .svg, .webp' } }, true);
|
|
22969
|
+
this.setProperties({ uploadSettings: { allowedExtensions: '.jpg, .jpeg, .png, .svg, .webp, .bmp' } }, true);
|
|
22533
22970
|
}
|
|
22534
22971
|
else {
|
|
22535
22972
|
this.notify('draw', { prop: 'setNullExtension', value: { extension: false } });
|
|
@@ -22730,7 +23167,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22730
23167
|
* @returns {string[]}.
|
|
22731
23168
|
*/
|
|
22732
23169
|
ImageEditor.prototype.getExtensionArray = function () {
|
|
22733
|
-
var validExtensions = ['jpeg', 'jpg', 'png', 'svg', 'webp'];
|
|
23170
|
+
var validExtensions = ['jpeg', 'jpg', 'png', 'svg', 'webp', 'bmp'];
|
|
22734
23171
|
var split = this.uploadSettings.allowedExtensions.split(',');
|
|
22735
23172
|
var extension = [];
|
|
22736
23173
|
for (var _i = 0, split_1 = split; _i < split_1.length; _i++) {
|
|
@@ -22782,6 +23219,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22782
23219
|
case 'webp':
|
|
22783
23220
|
words += ' WebP,';
|
|
22784
23221
|
break;
|
|
23222
|
+
case 'bmp':
|
|
23223
|
+
words += ' BMP,';
|
|
23224
|
+
break;
|
|
22785
23225
|
}
|
|
22786
23226
|
if (i === extension.length - 1) {
|
|
22787
23227
|
words = words.slice(0, -1);
|
|
@@ -23070,10 +23510,16 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23070
23510
|
*/
|
|
23071
23511
|
ImageEditor.prototype.flip = function (direction) {
|
|
23072
23512
|
this.applyShapes();
|
|
23073
|
-
this.
|
|
23074
|
-
|
|
23075
|
-
|
|
23076
|
-
|
|
23513
|
+
if (this.activeObj.shape && this.activeObj.shape.indexOf('crop') > -1) {
|
|
23514
|
+
this.transformSelect(direction.toLowerCase() + 'flip');
|
|
23515
|
+
}
|
|
23516
|
+
else {
|
|
23517
|
+
this.updateImageTransformColl(direction.toLowerCase() + 'flip');
|
|
23518
|
+
this.setRotateZoom();
|
|
23519
|
+
this.notify('transform', { prop: 'flip', value: { direction: direction } });
|
|
23520
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
23521
|
+
this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
23522
|
+
}
|
|
23077
23523
|
var actionArgs = { action: 'flip', actionEventArgs: this.editCompleteArgs };
|
|
23078
23524
|
this.triggerEditCompleteEvent(actionArgs);
|
|
23079
23525
|
};
|
|
@@ -23112,7 +23558,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23112
23558
|
*
|
|
23113
23559
|
* @param {string | ImageData } data - Specifies url of the image or image data.
|
|
23114
23560
|
* @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
|
|
23561
|
+
* @param {ImageSettings} imageSettings - Optional. Specifies image settings to apply when loading an image.
|
|
23116
23562
|
*
|
|
23117
23563
|
* @remarks
|
|
23118
23564
|
* The supported file types are JPG, JPEG, PNG, and SVG.
|
|
@@ -23120,16 +23566,88 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23120
23566
|
* @returns {void}.
|
|
23121
23567
|
*/
|
|
23122
23568
|
ImageEditor.prototype.open = function (data, resetChanges, imageSettings) {
|
|
23569
|
+
var _this = this;
|
|
23123
23570
|
resetChanges = isNullOrUndefined(resetChanges) ? true : resetChanges;
|
|
23124
23571
|
if (resetChanges) {
|
|
23125
|
-
if (isNullOrUndefined(data)) {
|
|
23572
|
+
if (isNullOrUndefined(data) || this.disabled) {
|
|
23126
23573
|
return;
|
|
23127
23574
|
}
|
|
23128
23575
|
var dropArea = document.getElementById(this.element.id + '_dropArea');
|
|
23129
23576
|
if (dropArea) {
|
|
23130
23577
|
dropArea.style.display = 'none';
|
|
23131
23578
|
}
|
|
23132
|
-
this.
|
|
23579
|
+
this.imageSettings = { width: null, height: null };
|
|
23580
|
+
this.aspectRatioBaseDimension = null;
|
|
23581
|
+
if (imageSettings && (imageSettings.width || imageSettings.height)) {
|
|
23582
|
+
var tempImageSettings_1 = extend({}, imageSettings, {}, true);
|
|
23583
|
+
imageSettings = this.scaleToFit(imageSettings);
|
|
23584
|
+
this.aspectRatioBaseDimension = imageSettings.isAspectRatio;
|
|
23585
|
+
if (!imageSettings.isAspectRatio && imageSettings.width && imageSettings.height) {
|
|
23586
|
+
this.imageSettings.width = imageSettings.width;
|
|
23587
|
+
this.imageSettings.height = imageSettings.height;
|
|
23588
|
+
this.notify('draw', { prop: 'open', value: { data: data } });
|
|
23589
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23590
|
+
var intervalId_1 = setInterval(function () {
|
|
23591
|
+
if (_this.imageLoaded && _this.baseImg.width && _this.baseImg.height) {
|
|
23592
|
+
_this.setInitialZoomLevel(tempImageSettings_1);
|
|
23593
|
+
clearInterval(intervalId_1);
|
|
23594
|
+
}
|
|
23595
|
+
}, 1);
|
|
23596
|
+
}
|
|
23597
|
+
else if (imageSettings.width || imageSettings.height) {
|
|
23598
|
+
this.notify('draw', { prop: 'open', value: { data: data } });
|
|
23599
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23600
|
+
var intervalId_2 = setInterval(function () {
|
|
23601
|
+
if (_this.imageLoaded && _this.baseImg.width && _this.baseImg.height) {
|
|
23602
|
+
_this.imageSettings.width = imageSettings.width;
|
|
23603
|
+
_this.imageSettings.height = imageSettings.height;
|
|
23604
|
+
var originalWidth = _this.baseImg.width;
|
|
23605
|
+
var originalHeight = _this.baseImg.height;
|
|
23606
|
+
var maxValue = '';
|
|
23607
|
+
var aspectRatioValue = void 0;
|
|
23608
|
+
var value = void 0;
|
|
23609
|
+
var newValue = void 0;
|
|
23610
|
+
if (imageSettings.width && imageSettings.height) {
|
|
23611
|
+
maxValue = imageSettings.width > imageSettings.height ? 'width' : 'height';
|
|
23612
|
+
}
|
|
23613
|
+
if (maxValue === 'width' || (imageSettings.width && maxValue !== 'height')) {
|
|
23614
|
+
aspectRatioValue = imageSettings.width;
|
|
23615
|
+
value = aspectRatioValue / (originalWidth / originalHeight);
|
|
23616
|
+
newValue = value % 1 >= 0.5 || value % 1 <= -0.5 ? Math.round(value) : (value < 0) ? Math.ceil(value) : Math.floor(value);
|
|
23617
|
+
if (!imageSettings.height || newValue > imageSettings.height) {
|
|
23618
|
+
_this.imageSettings.height = imageSettings.height = newValue;
|
|
23619
|
+
}
|
|
23620
|
+
else {
|
|
23621
|
+
aspectRatioValue = imageSettings.height;
|
|
23622
|
+
value = aspectRatioValue / (originalHeight / originalWidth);
|
|
23623
|
+
newValue = value % 1 >= 0.5 || value % 1 <= -0.5 ? Math.round(value) : (value < 0) ? Math.ceil(value) : Math.floor(value);
|
|
23624
|
+
_this.imageSettings.width = imageSettings.width = newValue;
|
|
23625
|
+
}
|
|
23626
|
+
}
|
|
23627
|
+
else if (maxValue === 'height' || (imageSettings.height && maxValue !== 'width')) {
|
|
23628
|
+
aspectRatioValue = imageSettings.height;
|
|
23629
|
+
value = aspectRatioValue / (originalHeight / originalWidth);
|
|
23630
|
+
newValue = value % 1 >= 0.5 || value % 1 <= -0.5 ? Math.round(value) : (value < 0) ? Math.ceil(value) : Math.floor(value);
|
|
23631
|
+
if (!imageSettings.width || newValue > imageSettings.width) {
|
|
23632
|
+
_this.imageSettings.width = imageSettings.width = newValue;
|
|
23633
|
+
}
|
|
23634
|
+
else {
|
|
23635
|
+
aspectRatioValue = imageSettings.width;
|
|
23636
|
+
value = aspectRatioValue / (originalWidth / originalHeight);
|
|
23637
|
+
newValue = value % 1 >= 0.5 || value % 1 <= -0.5 ? Math.round(value) : (value < 0) ? Math.ceil(value) : Math.floor(value);
|
|
23638
|
+
_this.imageSettings.height = imageSettings.height = newValue;
|
|
23639
|
+
}
|
|
23640
|
+
}
|
|
23641
|
+
_this.notify('draw', { prop: 'open', value: { data: data } });
|
|
23642
|
+
_this.setInitialZoomLevel(tempImageSettings_1);
|
|
23643
|
+
clearInterval(intervalId_2);
|
|
23644
|
+
}
|
|
23645
|
+
}, 1);
|
|
23646
|
+
}
|
|
23647
|
+
}
|
|
23648
|
+
else {
|
|
23649
|
+
this.notify('draw', { prop: 'open', value: { data: data } });
|
|
23650
|
+
}
|
|
23133
23651
|
}
|
|
23134
23652
|
else {
|
|
23135
23653
|
this.updateImage(data, imageSettings ? imageSettings.backgroundColor : null);
|
|
@@ -23283,11 +23801,18 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23283
23801
|
ImageEditor.prototype.rotate = function (degree) {
|
|
23284
23802
|
var obj = { isRotate: false };
|
|
23285
23803
|
this.applyShapes();
|
|
23286
|
-
if (
|
|
23287
|
-
this.
|
|
23804
|
+
if (this.activeObj.shape && this.activeObj.shape.indexOf('crop') > -1) {
|
|
23805
|
+
this.transformSelect(degree === 90 ? 'rotateright' : 'rotateleft');
|
|
23806
|
+
obj['isRotate'] = true;
|
|
23807
|
+
}
|
|
23808
|
+
else {
|
|
23809
|
+
if (degree === 90 || degree === -90) {
|
|
23810
|
+
this.updateImageTransformColl(degree === 90 ? 'rotateright' : 'rotateleft');
|
|
23811
|
+
}
|
|
23812
|
+
this.setRotateZoom();
|
|
23813
|
+
this.notify('transform', { prop: 'rotate', value: { degree: degree, obj: obj } });
|
|
23814
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
23288
23815
|
}
|
|
23289
|
-
this.notify('transform', { prop: 'rotate', value: { degree: degree, obj: obj } });
|
|
23290
|
-
this.notify('draw', { prop: 'redrawDownScale' });
|
|
23291
23816
|
var actionArgs = { action: 'rotate', actionEventArgs: this.editCompleteArgs };
|
|
23292
23817
|
this.triggerEditCompleteEvent(actionArgs);
|
|
23293
23818
|
return obj['isRotate'];
|
|
@@ -23305,7 +23830,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23305
23830
|
* @returns {void}.
|
|
23306
23831
|
*/
|
|
23307
23832
|
ImageEditor.prototype.export = function (type, fileName, imageQuality) {
|
|
23308
|
-
this.
|
|
23833
|
+
this.manageActiveAction();
|
|
23309
23834
|
this.notify('export', { prop: 'export', onPropertyChange: false, value: { type: type, fileName: fileName, imgQuality: imageQuality } });
|
|
23310
23835
|
};
|
|
23311
23836
|
/**
|
|
@@ -23413,6 +23938,17 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23413
23938
|
*/
|
|
23414
23939
|
ImageEditor.prototype.zoom = function (zoomFactor, zoomPoint) {
|
|
23415
23940
|
this.isZoomBtnClick = true;
|
|
23941
|
+
var prevZoom = this.transform.zoomFactor;
|
|
23942
|
+
if (prevZoom !== 0) {
|
|
23943
|
+
var zoomObj = { previousZoomValue: null };
|
|
23944
|
+
this.notify('transform', { prop: 'getPreviousZoomValue', value: { obj: zoomObj } });
|
|
23945
|
+
prevZoom = zoomObj.previousZoomValue;
|
|
23946
|
+
}
|
|
23947
|
+
if (zoomFactor !== 1 && prevZoom !== 0 && ((prevZoom < 1 && zoomFactor > 1) || (prevZoom > 1 && zoomFactor < 1))) {
|
|
23948
|
+
this.notify('transform', { prop: 'zoom', onPropertyChange: false,
|
|
23949
|
+
value: { zoomFactor: 1, zoomPoint: zoomPoint }
|
|
23950
|
+
});
|
|
23951
|
+
}
|
|
23416
23952
|
this.notify('transform', { prop: 'zoom', onPropertyChange: false,
|
|
23417
23953
|
value: { zoomFactor: zoomFactor, zoomPoint: zoomPoint } });
|
|
23418
23954
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
@@ -23575,10 +24111,12 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23575
24111
|
* @param {string} strokeColor - Specifies the outline color of the text annotation.
|
|
23576
24112
|
* @param {number} strokeWidth - Specifies the outline stroke width of the text annotation.
|
|
23577
24113
|
* @param {TransformationCollection[]} transformCollection - Specifies the transform collection of the text annotation.
|
|
24114
|
+
* @param {boolean} underline - Specifies whether the text should be underlined.
|
|
24115
|
+
* @param {boolean} strikethrough - Specifies whether the text should have a strikethrough.
|
|
23578
24116
|
* @returns {boolean}.
|
|
23579
24117
|
*
|
|
23580
24118
|
*/
|
|
23581
|
-
ImageEditor.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color, isSelected, degree, fillColor, strokeColor, strokeWidth, transformCollection) {
|
|
24119
|
+
ImageEditor.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color, isSelected, degree, fillColor, strokeColor, strokeWidth, transformCollection, underline, strikethrough) {
|
|
23582
24120
|
var isText = false;
|
|
23583
24121
|
var isPointsInRange = this.allowShape(x, y);
|
|
23584
24122
|
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
@@ -23586,7 +24124,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23586
24124
|
this.manageActiveAction();
|
|
23587
24125
|
this.notify('shape', { prop: 'drawText', onPropertyChange: false, value: { x: x, y: y, text: text, fontFamily: fontFamily,
|
|
23588
24126
|
fontSize: fontSize, bold: bold, italic: italic, color: color, isSelected: isSelected, degree: degree, fillColor: fillColor,
|
|
23589
|
-
outlineColor: strokeColor, outlineWidth: strokeWidth, transformCollection: transformCollection } });
|
|
24127
|
+
outlineColor: strokeColor, outlineWidth: strokeWidth, transformCollection: transformCollection, underline: underline, strikethrough: strikethrough } });
|
|
23590
24128
|
this.editCompleted();
|
|
23591
24129
|
}
|
|
23592
24130
|
return isText;
|
|
@@ -23611,14 +24149,27 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23611
24149
|
var isImage = false;
|
|
23612
24150
|
var isPointsInRange = this.allowShape(x, y);
|
|
23613
24151
|
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
24152
|
+
if (typeof data === 'string') {
|
|
24153
|
+
try {
|
|
24154
|
+
var request = new XMLHttpRequest();
|
|
24155
|
+
var isBlob = data.indexOf('blob:') === 0;
|
|
24156
|
+
request.open(isBlob ? 'GET' : 'HEAD', data, false);
|
|
24157
|
+
request.send();
|
|
24158
|
+
isImage = request.status >= 200 && request.status < 300;
|
|
24159
|
+
}
|
|
24160
|
+
catch (error) {
|
|
24161
|
+
isImage = false;
|
|
24162
|
+
}
|
|
24163
|
+
}
|
|
24164
|
+
else if (data instanceof ImageData) {
|
|
24165
|
+
if (data.data instanceof Uint8ClampedArray && data.width > 0 && data.height > 0) {
|
|
24166
|
+
isImage = true;
|
|
24167
|
+
}
|
|
24168
|
+
}
|
|
23614
24169
|
this.manageActiveAction();
|
|
23615
|
-
var length_1 = this.objColl.length;
|
|
23616
24170
|
this.notify('shape', { prop: 'drawImage', onPropertyChange: false, value: { x: x, y: y, width: width, height: height,
|
|
23617
24171
|
src: data, degree: degree, isAspectRatio: isAspectRatio, opacity: opacity, isSelected: isSelected } });
|
|
23618
24172
|
this.editCompleted();
|
|
23619
|
-
if (this.objColl.length > length_1) {
|
|
23620
|
-
isImage = true;
|
|
23621
|
-
}
|
|
23622
24173
|
}
|
|
23623
24174
|
return isImage;
|
|
23624
24175
|
};
|
|
@@ -23743,6 +24294,8 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23743
24294
|
this.applyShapes();
|
|
23744
24295
|
this.notify('shape', { prop: 'deleteShape', onPropertyChange: false, value: { id: id, isShape: true } });
|
|
23745
24296
|
this.editCompleted('shape-delete');
|
|
24297
|
+
this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
24298
|
+
this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
|
|
23746
24299
|
};
|
|
23747
24300
|
/**
|
|
23748
24301
|
* Get particular shapes details based on id of the shape which is drawn on an image editor.
|
|
@@ -23954,6 +24507,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23954
24507
|
var isResized = false;
|
|
23955
24508
|
if (((width.toString()).length <= 4 && (height.toString()).length <= 4) && (!this.isCircleCrop || isAspectRatio)) {
|
|
23956
24509
|
this.manageActiveAction();
|
|
24510
|
+
this.isPublicMethod = true;
|
|
23957
24511
|
this.notify('toolbar', { prop: 'resizeClick', value: { bool: false } });
|
|
23958
24512
|
var destPoints = { startX: this.img.destLeft, startY: this.img.destTop, width: this.img.destWidth,
|
|
23959
24513
|
height: this.img.destHeight };
|
|
@@ -23989,6 +24543,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
23989
24543
|
else {
|
|
23990
24544
|
this.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
|
|
23991
24545
|
}
|
|
24546
|
+
this.isPublicMethod = false;
|
|
23992
24547
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
23993
24548
|
}
|
|
23994
24549
|
return isResized;
|
|
@@ -24493,6 +25048,70 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
24493
25048
|
}
|
|
24494
25049
|
};
|
|
24495
25050
|
// Toolbar related codes
|
|
25051
|
+
ImageEditor.prototype.scaleToFit = function (imageSettings) {
|
|
25052
|
+
var tempImageSettings = extend({}, imageSettings, {}, true);
|
|
25053
|
+
var viewPortWidth = this.lowerCanvas.clientWidth;
|
|
25054
|
+
var viewPortHeight = this.lowerCanvas.clientHeight;
|
|
25055
|
+
if (imageSettings.width && imageSettings.height && (imageSettings.width > viewPortWidth ||
|
|
25056
|
+
imageSettings.height > viewPortHeight)) {
|
|
25057
|
+
var widthScale = viewPortWidth / imageSettings.width;
|
|
25058
|
+
var heightScale = viewPortHeight / imageSettings.height;
|
|
25059
|
+
var scale = Math.min(widthScale, heightScale);
|
|
25060
|
+
tempImageSettings.width = Math.round(imageSettings.width * scale);
|
|
25061
|
+
tempImageSettings.height = Math.round(imageSettings.height * scale);
|
|
25062
|
+
}
|
|
25063
|
+
else if (imageSettings.width && imageSettings.width > viewPortWidth) {
|
|
25064
|
+
var scale = viewPortWidth / imageSettings.width;
|
|
25065
|
+
tempImageSettings.width = Math.round(imageSettings.width * scale);
|
|
25066
|
+
}
|
|
25067
|
+
else if (imageSettings.height && imageSettings.height > viewPortHeight) {
|
|
25068
|
+
var scale = viewPortHeight / imageSettings.height;
|
|
25069
|
+
tempImageSettings.height = Math.round(imageSettings.height * scale);
|
|
25070
|
+
}
|
|
25071
|
+
return tempImageSettings;
|
|
25072
|
+
};
|
|
25073
|
+
ImageEditor.prototype.setInitialZoomLevel = function (oldImageSettings) {
|
|
25074
|
+
var _this = this;
|
|
25075
|
+
var zoomLevel = 1;
|
|
25076
|
+
var newWidth = this.img.destWidth;
|
|
25077
|
+
var newHeight = this.img.destHeight;
|
|
25078
|
+
var oldWidth = oldImageSettings.width;
|
|
25079
|
+
var oldHeight = oldImageSettings.height;
|
|
25080
|
+
var dimObj = { width: 0, height: 0 };
|
|
25081
|
+
this.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
|
|
25082
|
+
value: { width: this.img.srcWidth, height: this.img.srcHeight, obj: dimObj, isImgShape: null } });
|
|
25083
|
+
while ((newWidth && oldWidth && oldWidth > newWidth) || (newHeight && oldHeight && oldHeight > newHeight)) {
|
|
25084
|
+
newWidth = dimObj['width'] + (dimObj['width'] * 0.025 * zoomLevel);
|
|
25085
|
+
newHeight = dimObj['height'] + (dimObj['height'] * 0.025 * zoomLevel);
|
|
25086
|
+
if (Math.abs(newWidth) >= Math.abs(oldWidth) && Math.abs(newHeight) >= Math.abs(oldHeight)) {
|
|
25087
|
+
break;
|
|
25088
|
+
}
|
|
25089
|
+
zoomLevel++;
|
|
25090
|
+
}
|
|
25091
|
+
if (zoomLevel > 1) {
|
|
25092
|
+
this.isImageLoaded = true;
|
|
25093
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25094
|
+
var intervalId_3 = setInterval(function () {
|
|
25095
|
+
if (_this.imageLoaded) {
|
|
25096
|
+
for (var i = 1; i < zoomLevel; i++) {
|
|
25097
|
+
if (Math.round(i / 4) < _this.zoomSettings.maxZoomFactor) {
|
|
25098
|
+
_this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
25099
|
+
value: { zoomFactor: 0.025, zoomPoint: null, isResize: true } });
|
|
25100
|
+
}
|
|
25101
|
+
else {
|
|
25102
|
+
zoomLevel = i;
|
|
25103
|
+
break;
|
|
25104
|
+
}
|
|
25105
|
+
}
|
|
25106
|
+
_this.setProperties({ zoomSettings: { zoomFactor: Math.round(zoomLevel / 4) } }, true);
|
|
25107
|
+
_this.notify('transform', { prop: 'setPreviousZoomValue', onPropertyChange: false,
|
|
25108
|
+
value: { previousZoomValue: _this.zoomSettings.zoomFactor } });
|
|
25109
|
+
_this.notify('toolbar', { prop: 'enable-disable-btns' });
|
|
25110
|
+
clearInterval(intervalId_3);
|
|
25111
|
+
}
|
|
25112
|
+
}, 1);
|
|
25113
|
+
}
|
|
25114
|
+
};
|
|
24496
25115
|
ImageEditor.prototype.resetToolbar = function () {
|
|
24497
25116
|
if (this.toolbarHeight !== this.tempToolbarHeight && !((isNullOrUndefined(this.toolbar) ||
|
|
24498
25117
|
(this.toolbar && this.toolbar.length > 0)
|
|
@@ -24507,6 +25126,14 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
24507
25126
|
this.update();
|
|
24508
25127
|
}
|
|
24509
25128
|
};
|
|
25129
|
+
ImageEditor.prototype.setRotateZoom = function () {
|
|
25130
|
+
if (this.transform.zoomFactor > 0) {
|
|
25131
|
+
this.notify('draw', { prop: 'setRotateZoom', onPropertyChange: false, value: { isRotateZoom: true } });
|
|
25132
|
+
}
|
|
25133
|
+
else {
|
|
25134
|
+
this.notify('draw', { prop: 'setRotateZoom', onPropertyChange: false, value: { isRotateZoom: false } });
|
|
25135
|
+
}
|
|
25136
|
+
};
|
|
24510
25137
|
ImageEditor.prototype.getData = function (isMaskImage) {
|
|
24511
25138
|
if (isMaskImage) {
|
|
24512
25139
|
this.resetToolbar();
|
|
@@ -25143,6 +25770,11 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
25143
25770
|
}
|
|
25144
25771
|
};
|
|
25145
25772
|
ImageEditor.prototype.triggerEditCompleteEvent = function (args) {
|
|
25773
|
+
var obj = { bool: false };
|
|
25774
|
+
this.notify('undo-redo', { prop: 'preventEditComplete', value: { obj: obj } });
|
|
25775
|
+
if (obj['bool']) {
|
|
25776
|
+
return;
|
|
25777
|
+
}
|
|
25146
25778
|
if (args.action === 'shape-insert' && args.actionEventArgs &&
|
|
25147
25779
|
args.actionEventArgs.currentShapeSettings &&
|
|
25148
25780
|
args.actionEventArgs.currentShapeSettings.type.toString() === 'Redact') {
|
|
@@ -26431,9 +27063,17 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
26431
27063
|
this.notify('crop', { prop: 'calcRatio', onPropertyChange: false,
|
|
26432
27064
|
value: { obj: obj_7, dimension: { width: ctx.canvas.width, height: ctx.canvas.height } } });
|
|
26433
27065
|
}
|
|
26434
|
-
var
|
|
26435
|
-
|
|
26436
|
-
|
|
27066
|
+
var width = this.baseImg.width;
|
|
27067
|
+
var height = this.baseImg.height;
|
|
27068
|
+
if (!this.aspectRatioBaseDimension && this.imageSettings.width && this.imageSettings.height) {
|
|
27069
|
+
var widthRatio = this.baseImg.width / this.imageSettings.width;
|
|
27070
|
+
var heightRatio = this.baseImg.height / this.imageSettings.height;
|
|
27071
|
+
var ratio = (widthRatio + heightRatio) / 2;
|
|
27072
|
+
ratio = ratio < 1 ? 1 : ratio;
|
|
27073
|
+
width = this.imageSettings.width * ratio;
|
|
27074
|
+
height = this.imageSettings.height * ratio;
|
|
27075
|
+
}
|
|
27076
|
+
var dimension = this.getRotatedCanvasDim(width, height, this.transform.straighten);
|
|
26437
27077
|
this.img.srcWidth = ctx.canvas.width = dimension.width;
|
|
26438
27078
|
this.img.srcHeight = ctx.canvas.height = dimension.height;
|
|
26439
27079
|
var x = ctx.canvas.width / 2;
|
|
@@ -26441,7 +27081,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
26441
27081
|
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
26442
27082
|
ctx.translate(x, y);
|
|
26443
27083
|
ctx.rotate(straighten * Math.PI / 180);
|
|
26444
|
-
ctx.drawImage(this.baseImg, -
|
|
27084
|
+
ctx.drawImage(this.baseImg, -width / 2, -height / 2, width, height);
|
|
26445
27085
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
26446
27086
|
var obj = { width: 0, height: 0 };
|
|
26447
27087
|
this.notify('crop', { prop: 'calcRatio', onPropertyChange: false, value: { obj: obj, dimension: { width: ctx.canvas.width, height: ctx.canvas.height } } });
|
|
@@ -26759,6 +27399,8 @@ var FileType;
|
|
|
26759
27399
|
FileType["Svg"] = "Svg";
|
|
26760
27400
|
/** The WebP file type. */
|
|
26761
27401
|
FileType["WebP"] = "WebP";
|
|
27402
|
+
/** The BMP file type. */
|
|
27403
|
+
FileType["Bmp"] = "Bmp";
|
|
26762
27404
|
})(FileType || (FileType = {}));
|
|
26763
27405
|
/**
|
|
26764
27406
|
* An enumeration representing the direction of an image editor operation.
|
|
@@ -27135,7 +27777,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
27135
27777
|
Path: 'Path',
|
|
27136
27778
|
Bold: 'Bold',
|
|
27137
27779
|
Italic: 'Italic',
|
|
27780
|
+
Underline: 'Underline',
|
|
27138
27781
|
BoldItalic: 'Bold Italic',
|
|
27782
|
+
Strikethrough: 'Strikethrough',
|
|
27139
27783
|
XSmall: 'X-Small',
|
|
27140
27784
|
Small: 'Small',
|
|
27141
27785
|
Medium: 'Medium',
|
|
@@ -27447,7 +28091,17 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
27447
28091
|
};
|
|
27448
28092
|
ToolbarModule.prototype.reset = function () {
|
|
27449
28093
|
var parent = this.parent;
|
|
27450
|
-
|
|
28094
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0) || parent.toolbarTemplate) {
|
|
28095
|
+
if (parent.toolbarTemplate) {
|
|
28096
|
+
this.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
|
|
28097
|
+
}
|
|
28098
|
+
else {
|
|
28099
|
+
this.toolbarHeight = 46;
|
|
28100
|
+
}
|
|
28101
|
+
}
|
|
28102
|
+
else {
|
|
28103
|
+
this.toolbarHeight = 0;
|
|
28104
|
+
}
|
|
27451
28105
|
parent.prevCurrSelectionPoint = null;
|
|
27452
28106
|
this.zoomBtnHold = null;
|
|
27453
28107
|
this.currToolbar = '';
|
|
@@ -29209,12 +29863,16 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
29209
29863
|
if (!Browser.isDevice) {
|
|
29210
29864
|
var obj = { shape: null };
|
|
29211
29865
|
parent.notify('selection', { prop: 'getCurrentDrawingShape', value: { obj: obj } });
|
|
29212
|
-
if (obj['shape']
|
|
29866
|
+
if (obj['shape'] === 'path') {
|
|
29867
|
+
toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
29868
|
+
tooltipText: this.l10n.getConstant('OK'), align: 'Right', tabIndex: 0, disabled: true });
|
|
29869
|
+
}
|
|
29870
|
+
else {
|
|
29213
29871
|
toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
29214
29872
|
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
29873
|
}
|
|
29874
|
+
toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
29875
|
+
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
29218
29876
|
}
|
|
29219
29877
|
return toolbarItems;
|
|
29220
29878
|
};
|
|
@@ -29870,6 +30528,14 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
29870
30528
|
toolbarItems.push({ id: id + '_italic', prefixIcon: 'e-icons e-italic', cssClass: 'top-icon e-italic',
|
|
29871
30529
|
tooltipText: this.l10n.getConstant('Italic'), align: 'Center' });
|
|
29872
30530
|
}
|
|
30531
|
+
if (items.indexOf('underline') > -1) {
|
|
30532
|
+
toolbarItems.push({ id: id + '_underline', prefixIcon: 'e-icons e-underline', cssClass: 'top-icon e-underline',
|
|
30533
|
+
tooltipText: this.l10n.getConstant('Underline'), align: 'Center' });
|
|
30534
|
+
}
|
|
30535
|
+
if (items.indexOf('strikethrough') > -1) {
|
|
30536
|
+
toolbarItems.push({ id: id + '_strikethrough', prefixIcon: 'e-icons e-strikethrough', cssClass: 'top-icon e-strikethrough',
|
|
30537
|
+
tooltipText: this.l10n.getConstant('Strikethrough'), align: 'Center' });
|
|
30538
|
+
}
|
|
29873
30539
|
if (items.indexOf('strokeWidth') > -1) {
|
|
29874
30540
|
toolbarItems.push({ id: id + '_strokeWidth', cssClass: 'top-icon e-size', tooltipText: this.l10n.getConstant('TextOutlineWidth'), align: 'Center',
|
|
29875
30541
|
type: 'Input', template: '<button id="' + id + '_borderWidthBtn"></button>' });
|
|
@@ -30352,6 +31018,12 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
30352
31018
|
}
|
|
30353
31019
|
if (Browser.isDevice) {
|
|
30354
31020
|
this.initMainToolbar(false, true, true);
|
|
31021
|
+
var okBtn = document.getElementById(parent.element.id + '_ok');
|
|
31022
|
+
var drawingObject = { shape: '' };
|
|
31023
|
+
parent.notify('selection', { prop: 'getCurrentDrawingShape', onPropertyChange: false, value: { obj: drawingObject } });
|
|
31024
|
+
if (drawingObject['shape'] === 'path' && okBtn) {
|
|
31025
|
+
okBtn.classList.add('e-overlay');
|
|
31026
|
+
}
|
|
30355
31027
|
}
|
|
30356
31028
|
if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'path') {
|
|
30357
31029
|
args.toolbarItems = ['strokeColor', 'strokeWidth', 'z-order', 'duplicate', 'remove'];
|
|
@@ -30383,7 +31055,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
30383
31055
|
if (Browser.isDevice) {
|
|
30384
31056
|
this.initMainToolbar(false, true, true);
|
|
30385
31057
|
}
|
|
30386
|
-
args.toolbarItems = ['fontFamily', 'fontSize', 'fontColor', 'fillColor', 'strokeColor', 'strokeWidth', 'bold', 'italic', 'z-order', 'duplicate', 'remove', 'text'];
|
|
31058
|
+
args.toolbarItems = ['fontFamily', 'fontSize', 'fontColor', 'fillColor', 'strokeColor', 'strokeWidth', 'bold', 'italic', 'underline', 'strikethrough', 'z-order', 'duplicate', 'remove', 'text'];
|
|
30387
31059
|
this.initTextToolbarItem(args.toolbarItems);
|
|
30388
31060
|
break;
|
|
30389
31061
|
case 'pen':
|
|
@@ -30519,8 +31191,13 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
30519
31191
|
parent.notify('transform', { prop: 'getPanMove', onPropertyChange: false,
|
|
30520
31192
|
value: { obj: panMoveObj } });
|
|
30521
31193
|
if (panMoveObj['panMove']) {
|
|
31194
|
+
var currentPannedPoint = extend({}, parent.panPoint.currentPannedPoint, {}, true);
|
|
31195
|
+
parent.panPoint.currentPannedPoint = { x: parent.panPoint.totalPannedClientPoint.x, y: parent.panPoint.totalPannedClientPoint.y };
|
|
31196
|
+
parent.panPoint.totalPannedClientPoint = { x: 0, y: 0 };
|
|
31197
|
+
parent.panPoint.totalPannedInternalPoint = { x: 0, y: 0 };
|
|
30522
31198
|
parent.notify('transform', { prop: 'drawPannedImage', onPropertyChange: false,
|
|
30523
|
-
value: { xDiff:
|
|
31199
|
+
value: { xDiff: parent.panPoint.currentPannedPoint.x, yDiff: parent.panPoint.currentPannedPoint.y } });
|
|
31200
|
+
parent.panPoint.currentPannedPoint = currentPannedPoint;
|
|
30524
31201
|
}
|
|
30525
31202
|
};
|
|
30526
31203
|
ToolbarModule.prototype.updateKBDNavigation = function (type) {
|
|
@@ -32506,60 +33183,10 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
32506
33183
|
}
|
|
32507
33184
|
break;
|
|
32508
33185
|
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
33186
|
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
|
-
}
|
|
33187
|
+
case 'underline':
|
|
33188
|
+
case 'strikethrough':
|
|
33189
|
+
this.toggleStyle(id, type);
|
|
32563
33190
|
break;
|
|
32564
33191
|
case 'croptransform':
|
|
32565
33192
|
this.performCropTransformClick();
|
|
@@ -32740,6 +33367,43 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
32740
33367
|
}
|
|
32741
33368
|
}
|
|
32742
33369
|
};
|
|
33370
|
+
ToolbarModule.prototype.getFontStyle = function (settings) {
|
|
33371
|
+
var parts = [];
|
|
33372
|
+
if (settings.bold) {
|
|
33373
|
+
parts.push('bold');
|
|
33374
|
+
}
|
|
33375
|
+
if (settings.italic) {
|
|
33376
|
+
parts.push('italic');
|
|
33377
|
+
}
|
|
33378
|
+
if (settings.underline) {
|
|
33379
|
+
parts.push('underline');
|
|
33380
|
+
}
|
|
33381
|
+
if (settings.strikethrough) {
|
|
33382
|
+
parts.push('strikethrough');
|
|
33383
|
+
}
|
|
33384
|
+
return parts.length === 0 ? 'default' : parts.join('');
|
|
33385
|
+
};
|
|
33386
|
+
ToolbarModule.prototype.toggleStyle = function (id, style) {
|
|
33387
|
+
var parent = this.parent;
|
|
33388
|
+
parent.notify('selection', { prop: 'setInitialTextEdit', value: { bool: false } });
|
|
33389
|
+
var settings = parent.activeObj.textSettings;
|
|
33390
|
+
settings[style] = !settings[style];
|
|
33391
|
+
var fontStyle = this.getFontStyle(settings);
|
|
33392
|
+
parent.notify('shape', { prop: 'applyFontStyle', onPropertyChange: false, value: { item: fontStyle } });
|
|
33393
|
+
var button = parent.element.querySelector("#" + id + "_" + style);
|
|
33394
|
+
if (button) {
|
|
33395
|
+
if (button.classList.contains('e-selected-btn')) {
|
|
33396
|
+
button.classList.remove('e-selected-btn');
|
|
33397
|
+
}
|
|
33398
|
+
else {
|
|
33399
|
+
button.classList.add('e-selected-btn');
|
|
33400
|
+
}
|
|
33401
|
+
}
|
|
33402
|
+
if (parent.activeObj.activePoint.width !== 0 ||
|
|
33403
|
+
parent.activeObj.activePoint.height !== 0) {
|
|
33404
|
+
parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
|
|
33405
|
+
}
|
|
33406
|
+
};
|
|
32743
33407
|
ToolbarModule.prototype.updateRedactType = function (value) {
|
|
32744
33408
|
var parent = this.parent;
|
|
32745
33409
|
parent.activeObj.redactType = value;
|
|
@@ -32758,7 +33422,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
32758
33422
|
if (parent.currObjType.isFiltered || parent.currObjType.isRedact) {
|
|
32759
33423
|
parent.okBtn();
|
|
32760
33424
|
}
|
|
32761
|
-
if (frame
|
|
33425
|
+
if (!frame || !frame.classList.contains('e-overlay')) {
|
|
32762
33426
|
zoom = parent.transform.zoomFactor;
|
|
32763
33427
|
parent.frameDestPoints = extend({}, parent.img, {}, true);
|
|
32764
33428
|
if (isNullOrUndefined(parent.cxtTbarHeight)) {
|
|
@@ -32767,7 +33431,10 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
32767
33431
|
this.callFrameToolbar();
|
|
32768
33432
|
parent.frameObj.type = 'mat';
|
|
32769
33433
|
this.callFrameToolbar();
|
|
32770
|
-
|
|
33434
|
+
var elem = parent.element.querySelector('#' + id + '_customizeWrapper');
|
|
33435
|
+
if (elem) {
|
|
33436
|
+
parent.cxtTbarHeight = elem.scrollHeight;
|
|
33437
|
+
}
|
|
32771
33438
|
parent.frameObj = frameObj;
|
|
32772
33439
|
parent.tempFrameObj = tempFrameObj;
|
|
32773
33440
|
}
|
|
@@ -33333,6 +34000,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
33333
34000
|
var fontSizeElem = parent.element.querySelector('.e-text-font-size');
|
|
33334
34001
|
var boldBtn = parent.element.querySelector('#' + id + '_bold');
|
|
33335
34002
|
var italicBtn = parent.element.querySelector('#' + id + '_italic');
|
|
34003
|
+
var underlineBtn = parent.element.querySelector('#' + id + '_underline');
|
|
34004
|
+
var strikethroughBtn = parent.element.querySelector('#' + id + '_strikethrough');
|
|
33336
34005
|
if (parent.activeObj.strokeSettings && parent.activeObj.textSettings) {
|
|
33337
34006
|
if (isNullOrUndefined(parent.activeObj.strokeSettings.strokeWidth)) {
|
|
33338
34007
|
parent.activeObj.strokeSettings.strokeWidth = 2;
|
|
@@ -33445,6 +34114,22 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
33445
34114
|
italicBtn.classList.remove('e-selected-btn');
|
|
33446
34115
|
}
|
|
33447
34116
|
}
|
|
34117
|
+
if (underlineBtn) {
|
|
34118
|
+
if (parent.activeObj.textSettings.underline) {
|
|
34119
|
+
underlineBtn.classList.add('e-selected-btn');
|
|
34120
|
+
}
|
|
34121
|
+
else {
|
|
34122
|
+
underlineBtn.classList.remove('e-selected-btn');
|
|
34123
|
+
}
|
|
34124
|
+
}
|
|
34125
|
+
if (strikethroughBtn) {
|
|
34126
|
+
if (parent.activeObj.textSettings.strikethrough) {
|
|
34127
|
+
strikethroughBtn.classList.add('e-selected-btn');
|
|
34128
|
+
}
|
|
34129
|
+
else {
|
|
34130
|
+
strikethroughBtn.classList.remove('e-selected-btn');
|
|
34131
|
+
}
|
|
34132
|
+
}
|
|
33448
34133
|
if (strokeWidthElem) {
|
|
33449
34134
|
var width = parent.activeObj.shape === 'text' ? parent.activeObj.strokeSettings.outlineWidth : parent.activeObj.strokeSettings.strokeWidth;
|
|
33450
34135
|
var strokeWidth = Math.round(width).toString();
|
|
@@ -33460,25 +34145,23 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
33460
34145
|
ToolbarModule.prototype.getStrokeWidth = function (text) {
|
|
33461
34146
|
var strokeWidth;
|
|
33462
34147
|
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;
|
|
34148
|
+
if (currentWidth === 0) {
|
|
34149
|
+
strokeWidth = this.l10n.getConstant('NoOutline');
|
|
34150
|
+
}
|
|
34151
|
+
else if (currentWidth > 0 && currentWidth <= 1) {
|
|
34152
|
+
strokeWidth = this.l10n.getConstant('XSmall');
|
|
34153
|
+
}
|
|
34154
|
+
else if (currentWidth > 1 && currentWidth <= 2) {
|
|
34155
|
+
strokeWidth = this.l10n.getConstant('Small');
|
|
34156
|
+
}
|
|
34157
|
+
else if (currentWidth > 2 && currentWidth <= 3) {
|
|
34158
|
+
strokeWidth = this.l10n.getConstant('Medium');
|
|
34159
|
+
}
|
|
34160
|
+
else if (currentWidth > 3 && currentWidth <= 4) {
|
|
34161
|
+
strokeWidth = this.l10n.getConstant('Large');
|
|
34162
|
+
}
|
|
34163
|
+
else {
|
|
34164
|
+
strokeWidth = this.l10n.getConstant('XLarge');
|
|
33482
34165
|
}
|
|
33483
34166
|
return strokeWidth;
|
|
33484
34167
|
};
|