@syncfusion/ej2-image-editor 29.2.4 → 30.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +2 -0
- package/dist/ej2-image-editor.umd.min.js +2 -2
- package/dist/ej2-image-editor.umd.min.js.map +1 -1
- package/dist/es6/ej2-image-editor.es2015.js +884 -225
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +906 -235
- package/dist/es6/ej2-image-editor.es5.js.map +1 -1
- package/dist/global/ej2-image-editor.min.js +2 -2
- package/dist/global/ej2-image-editor.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +15 -47
- package/src/image-editor/action/crop.js +1 -1
- package/src/image-editor/action/draw.d.ts +1 -0
- package/src/image-editor/action/draw.js +103 -31
- package/src/image-editor/action/export.js +3 -0
- package/src/image-editor/action/selection.d.ts +1 -0
- package/src/image-editor/action/selection.js +39 -4
- package/src/image-editor/action/shape.d.ts +1 -0
- package/src/image-editor/action/shape.js +334 -49
- package/src/image-editor/action/transform.js +51 -43
- package/src/image-editor/action/undo-redo.d.ts +2 -0
- package/src/image-editor/action/undo-redo.js +22 -1
- package/src/image-editor/base/enum.d.ts +3 -1
- package/src/image-editor/base/enum.js +2 -0
- package/src/image-editor/base/image-editor.d.ts +13 -2
- package/src/image-editor/base/image-editor.js +242 -27
- package/src/image-editor/base/interface.d.ts +17 -1
- package/src/image-editor/renderer/toolbar.d.ts +2 -0
- package/src/image-editor/renderer/toolbar.js +110 -79
- package/styles/bds-lite.css +4 -0
- package/styles/bds.css +8 -0
- package/styles/bootstrap-dark-lite.css +4 -0
- package/styles/bootstrap-dark.css +4 -0
- package/styles/bootstrap-lite.css +4 -0
- package/styles/bootstrap.css +4 -0
- package/styles/bootstrap4-lite.css +4 -0
- package/styles/bootstrap4.css +4 -0
- package/styles/bootstrap5-dark-lite.css +4 -0
- package/styles/bootstrap5-dark.css +4 -0
- package/styles/bootstrap5-lite.css +4 -0
- package/styles/bootstrap5.3-lite.css +4 -0
- package/styles/bootstrap5.3.css +4 -0
- package/styles/bootstrap5.css +4 -0
- package/styles/fabric-dark-lite.css +4 -0
- package/styles/fabric-dark.css +19 -0
- package/styles/fabric-lite.css +4 -0
- package/styles/fabric.css +19 -0
- package/styles/fluent-dark-lite.css +4 -0
- package/styles/fluent-dark.css +13 -0
- package/styles/fluent-lite.css +4 -0
- package/styles/fluent.css +13 -0
- package/styles/fluent2-lite.css +8 -0
- package/styles/fluent2.css +12 -0
- package/styles/highcontrast-light-lite.css +4 -0
- package/styles/highcontrast-light.css +4 -0
- package/styles/highcontrast-lite.css +9 -1
- package/styles/highcontrast.css +14 -1
- package/styles/image-editor/_bigger.scss +56 -0
- package/styles/image-editor/_highcontrast-definition.scss +1 -1
- package/styles/image-editor/_layout.scss +36 -0
- package/styles/image-editor/bds.css +8 -0
- package/styles/image-editor/bootstrap-dark.css +4 -0
- package/styles/image-editor/bootstrap.css +4 -0
- package/styles/image-editor/bootstrap4.css +4 -0
- package/styles/image-editor/bootstrap5-dark.css +4 -0
- package/styles/image-editor/bootstrap5.3.css +4 -0
- package/styles/image-editor/bootstrap5.css +4 -0
- package/styles/image-editor/fabric-dark.css +19 -0
- package/styles/image-editor/fabric.css +19 -0
- package/styles/image-editor/fluent-dark.css +13 -0
- package/styles/image-editor/fluent.css +13 -0
- package/styles/image-editor/fluent2.css +12 -0
- package/styles/image-editor/highcontrast-light.css +4 -0
- package/styles/image-editor/highcontrast.css +14 -1
- package/styles/image-editor/material-dark.css +4 -0
- package/styles/image-editor/material.css +8 -0
- package/styles/image-editor/material3-dark.css +21 -1
- package/styles/image-editor/material3.css +21 -1
- package/styles/image-editor/tailwind-dark.css +8 -0
- package/styles/image-editor/tailwind.css +8 -0
- package/styles/image-editor/tailwind3.css +4 -0
- package/styles/material-dark-lite.css +4 -0
- package/styles/material-dark.css +4 -0
- package/styles/material-lite.css +4 -0
- package/styles/material.css +8 -0
- package/styles/material3-dark-lite.css +12 -0
- package/styles/material3-dark.css +21 -1
- package/styles/material3-lite.css +12 -0
- package/styles/material3.css +21 -1
- package/styles/tailwind-dark-lite.css +4 -0
- package/styles/tailwind-dark.css +8 -0
- package/styles/tailwind-lite.css +4 -0
- package/styles/tailwind.css +8 -0
- package/styles/tailwind3-lite.css +4 -0
- package/styles/tailwind3.css +4 -0
|
@@ -3,7 +3,7 @@ import { EventHandler, extend, isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
|
3
3
|
import { ShapeType, RedactType } from '../index';
|
|
4
4
|
var Shape = /** @class */ (function () {
|
|
5
5
|
function Shape(parent) {
|
|
6
|
-
this.textSettings = { text: 'Enter Text', fontFamily: '', fontSize: null, fontRatio: null, bold: false, italic: false, underline: false };
|
|
6
|
+
this.textSettings = { text: 'Enter Text', fontFamily: '', fontSize: null, fontRatio: null, bold: false, italic: false, underline: false, strikethrough: false };
|
|
7
7
|
this.strokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null, radius: null, outlineColor: '', outlineWidth: null };
|
|
8
8
|
this.keyHistory = ''; // text history
|
|
9
9
|
this.preventFrameAnnotation = false;
|
|
@@ -46,7 +46,7 @@ var Shape = /** @class */ (function () {
|
|
|
46
46
|
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']);
|
|
47
47
|
break;
|
|
48
48
|
case 'drawText':
|
|
49
|
-
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']);
|
|
49
|
+
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']);
|
|
50
50
|
break;
|
|
51
51
|
case 'redrawActObj':
|
|
52
52
|
this.redrawActObj(args.value['x'], args.value['y'], args.value['isMouseDown']);
|
|
@@ -210,7 +210,7 @@ var Shape = /** @class */ (function () {
|
|
|
210
210
|
this.alignTextAreaIntoCanvas();
|
|
211
211
|
break;
|
|
212
212
|
case 'initializeTextShape':
|
|
213
|
-
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']);
|
|
213
|
+
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']);
|
|
214
214
|
break;
|
|
215
215
|
case 'stopPathDrawing':
|
|
216
216
|
this.stopPathDrawing(args.value['e'], args.value['isApply']);
|
|
@@ -305,7 +305,7 @@ var Shape = /** @class */ (function () {
|
|
|
305
305
|
};
|
|
306
306
|
Shape.prototype.reset = function () {
|
|
307
307
|
this.textSettings =
|
|
308
|
-
{ text: 'Enter Text', fontFamily: this.parent.fontFamily.default, fontSize: null, fontRatio: null, bold: false, italic: false, underline: false };
|
|
308
|
+
{ text: 'Enter Text', fontFamily: this.parent.fontFamily.default, fontSize: null, fontRatio: null, bold: false, italic: false, underline: false, strikethrough: false };
|
|
309
309
|
this.strokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null, radius: null, outlineColor: '', outlineWidth: null };
|
|
310
310
|
this.preventFrameAnnotation = false;
|
|
311
311
|
};
|
|
@@ -345,8 +345,8 @@ var Shape = /** @class */ (function () {
|
|
|
345
345
|
var start = x && y ? { x: x, y: y } : null;
|
|
346
346
|
this.drawShape('redact', null, null, null, start, width, height, null, null, null, null, null, null, null, type, value);
|
|
347
347
|
};
|
|
348
|
-
Shape.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color, isSelected, degree, fillColor, outlineColor, outlineWidth, transformCollection) {
|
|
349
|
-
this.drawShapeText(text, fontFamily, fontSize, bold, italic, color, x, y, isSelected, degree, fillColor, outlineColor, outlineWidth, transformCollection);
|
|
348
|
+
Shape.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color, isSelected, degree, fillColor, outlineColor, outlineWidth, transformCollection, underline, strikethrough) {
|
|
349
|
+
this.drawShapeText(text, fontFamily, fontSize, bold, italic, color, x, y, isSelected, degree, fillColor, outlineColor, outlineWidth, transformCollection, underline, strikethrough);
|
|
350
350
|
};
|
|
351
351
|
Shape.prototype.initializeShape = function (type) {
|
|
352
352
|
var parent = this.parent;
|
|
@@ -532,7 +532,7 @@ var Shape = /** @class */ (function () {
|
|
|
532
532
|
value: { obj: selPointCollObj } });
|
|
533
533
|
this.prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
534
534
|
};
|
|
535
|
-
Shape.prototype.drawShapeText = function (text, fontFamily, fontSize, bold, italic, strokeColor, x, y, isSelected, degree, fillColor, outlineColor, outlineWidth, transformCollection) {
|
|
535
|
+
Shape.prototype.drawShapeText = function (text, fontFamily, fontSize, bold, italic, strokeColor, x, y, isSelected, degree, fillColor, outlineColor, outlineWidth, transformCollection, underline, strikethrough) {
|
|
536
536
|
var parent = this.parent;
|
|
537
537
|
if (!parent.disabled && parent.isImageLoaded) {
|
|
538
538
|
if (parent.currObjType.shape === 'freehanddraw') {
|
|
@@ -547,7 +547,7 @@ var Shape = /** @class */ (function () {
|
|
|
547
547
|
this.refreshActiveObj();
|
|
548
548
|
parent.activeObj.shape = parent.currObjType.shape = 'text';
|
|
549
549
|
parent.currObjType.isCustomCrop = false;
|
|
550
|
-
this.initializeTextShape(text, fontFamily, fontSize, bold, italic, strokeColor, fillColor, outlineColor, outlineWidth);
|
|
550
|
+
this.initializeTextShape(text, fontFamily, fontSize, bold, italic, underline, strikethrough, strokeColor, fillColor, outlineColor, outlineWidth);
|
|
551
551
|
parent.currObjType.isText = parent.currObjType.isInitialText = true;
|
|
552
552
|
if (isNullOrUndefined(parent.activeObj.textSettings.fontSize)) {
|
|
553
553
|
parent.getFontSizes();
|
|
@@ -698,7 +698,7 @@ var Shape = /** @class */ (function () {
|
|
|
698
698
|
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
699
699
|
parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
|
|
700
700
|
};
|
|
701
|
-
Shape.prototype.initializeTextShape = function (text, fontFamily, fontSize, bold, italic, strokeColor, fillColor, outlineColor, outlineWidth) {
|
|
701
|
+
Shape.prototype.initializeTextShape = function (text, fontFamily, fontSize, bold, italic, underline, strikethrough, strokeColor, fillColor, outlineColor, outlineWidth) {
|
|
702
702
|
var parent = this.parent;
|
|
703
703
|
this.keyHistory = '';
|
|
704
704
|
parent.upperCanvas.style.display = 'block';
|
|
@@ -709,6 +709,8 @@ var Shape = /** @class */ (function () {
|
|
|
709
709
|
parent.activeObj.textSettings.fontSize = fontSize || parent.activeObj.textSettings.fontSize;
|
|
710
710
|
parent.activeObj.textSettings.bold = bold || parent.activeObj.textSettings.bold;
|
|
711
711
|
parent.activeObj.textSettings.italic = italic || parent.activeObj.textSettings.italic;
|
|
712
|
+
parent.activeObj.textSettings.underline = underline || parent.activeObj.textSettings.underline;
|
|
713
|
+
parent.activeObj.textSettings.strikethrough = strikethrough || parent.activeObj.textSettings.strikethrough;
|
|
712
714
|
parent.activeObj.strokeSettings.outlineColor = outlineColor || parent.activeObj.strokeSettings.outlineColor;
|
|
713
715
|
parent.activeObj.strokeSettings.outlineWidth = outlineWidth || parent.activeObj.strokeSettings.outlineWidth;
|
|
714
716
|
};
|
|
@@ -913,6 +915,7 @@ var Shape = /** @class */ (function () {
|
|
|
913
915
|
parent.activeObj.textSettings.bold = false;
|
|
914
916
|
parent.activeObj.textSettings.italic = false;
|
|
915
917
|
parent.activeObj.textSettings.underline = false;
|
|
918
|
+
parent.activeObj.textSettings.strikethrough = false;
|
|
916
919
|
for (var i = 0; i < shapeSettings.fontStyle.length; i++) {
|
|
917
920
|
switch (shapeSettings.fontStyle[i]) {
|
|
918
921
|
case 'bold':
|
|
@@ -921,6 +924,12 @@ var Shape = /** @class */ (function () {
|
|
|
921
924
|
case 'italic':
|
|
922
925
|
parent.activeObj.textSettings.italic = true;
|
|
923
926
|
break;
|
|
927
|
+
case 'underline':
|
|
928
|
+
parent.activeObj.textSettings.underline = true;
|
|
929
|
+
break;
|
|
930
|
+
case 'strikethrough':
|
|
931
|
+
parent.activeObj.textSettings.strikethrough = true;
|
|
932
|
+
break;
|
|
924
933
|
}
|
|
925
934
|
}
|
|
926
935
|
}
|
|
@@ -939,7 +948,7 @@ var Shape = /** @class */ (function () {
|
|
|
939
948
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
940
949
|
this.updateFontStyles();
|
|
941
950
|
var width = this.upperContext.measureText(this.keyHistory).width + fontSize * 0.5;
|
|
942
|
-
var height = fontSize;
|
|
951
|
+
var height = fontSize * 1.18;
|
|
943
952
|
this.upperContext.fillText(this.keyHistory, parent.activeObj.activePoint.startX, parent.activeObj.activePoint.startY + fontSize);
|
|
944
953
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
945
954
|
parent.currObjType.isText = true;
|
|
@@ -962,7 +971,7 @@ var Shape = /** @class */ (function () {
|
|
|
962
971
|
var text = (parent.textArea.style.display === 'block' || parent.textArea.style.display === 'inline-block') ?
|
|
963
972
|
this.getMaxText(true) : this.getMaxText();
|
|
964
973
|
var width = this.upperContext.measureText(text).width + fontSize * 0.5;
|
|
965
|
-
var height = rows.length * fontSize;
|
|
974
|
+
var height = rows.length * fontSize * 1.18;
|
|
966
975
|
if (rows.length > 1) {
|
|
967
976
|
height += (fontSize * 0.50);
|
|
968
977
|
}
|
|
@@ -997,7 +1006,7 @@ var Shape = /** @class */ (function () {
|
|
|
997
1006
|
parent.textArea.value = '';
|
|
998
1007
|
this.updateFontStyles();
|
|
999
1008
|
var width = this.upperContext.measureText(parent.activeObj.keyHistory).width + fontSize * 0.5;
|
|
1000
|
-
var height = fontSize;
|
|
1009
|
+
var height = fontSize * 1.18;
|
|
1001
1010
|
var rows = parent.activeObj.keyHistory.split('\n');
|
|
1002
1011
|
if (rows.length > 1) {
|
|
1003
1012
|
height *= rows.length;
|
|
@@ -1752,6 +1761,9 @@ var Shape = /** @class */ (function () {
|
|
|
1752
1761
|
}
|
|
1753
1762
|
parent.textArea.style.fontWeight = actObj.textSettings.bold ? 'bold' : 'normal';
|
|
1754
1763
|
parent.textArea.style.fontStyle = actObj.textSettings.italic ? 'italic' : 'normal';
|
|
1764
|
+
parent.textArea.style.textDecoration = (actObj.textSettings.underline && actObj.textSettings.strikethrough) ? 'underline line-through' :
|
|
1765
|
+
(actObj.textSettings.underline) ? 'underline' :
|
|
1766
|
+
(actObj.textSettings.strikethrough) ? 'line-through' : 'none';
|
|
1755
1767
|
parent.textArea.style.border = '2px solid ' + parent.themeColl[parent.theme]['primaryColor'];
|
|
1756
1768
|
parent.textArea.value = actObj.keyHistory;
|
|
1757
1769
|
parent.textArea.style.overflow = 'hidden';
|
|
@@ -2298,7 +2310,7 @@ var Shape = /** @class */ (function () {
|
|
|
2298
2310
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2299
2311
|
var fileData = filesData;
|
|
2300
2312
|
var fileExtension = fileData.name && fileData.name.split('.').pop().toLowerCase();
|
|
2301
|
-
if (fileExtension && ['jpg', 'jpeg', 'png', 'svg', 'webp'].indexOf(fileExtension) === -1) {
|
|
2313
|
+
if (fileExtension && ['jpg', 'jpeg', 'png', 'svg', 'webp', 'bmp'].indexOf(fileExtension) === -1) {
|
|
2302
2314
|
this.refreshActiveObj();
|
|
2303
2315
|
return;
|
|
2304
2316
|
}
|
|
@@ -2645,9 +2657,16 @@ var Shape = /** @class */ (function () {
|
|
|
2645
2657
|
var obj = { shapeSettingsObj: {} };
|
|
2646
2658
|
parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
|
|
2647
2659
|
var shapeSettings = obj['shapeSettingsObj'];
|
|
2660
|
+
var isObjPushed = false;
|
|
2661
|
+
var collLength = parent.objColl.length;
|
|
2648
2662
|
this.pushActItemIntoObj();
|
|
2663
|
+
if (collLength !== parent.objColl.length) {
|
|
2664
|
+
isObjPushed = true;
|
|
2665
|
+
}
|
|
2649
2666
|
var objColl = extend([], parent.objColl, [], true);
|
|
2650
|
-
|
|
2667
|
+
if (isObjPushed) {
|
|
2668
|
+
parent.objColl.pop();
|
|
2669
|
+
}
|
|
2651
2670
|
if (parent.textArea.style.display === 'none') {
|
|
2652
2671
|
this.updateFontRatio(parent.activeObj);
|
|
2653
2672
|
}
|
|
@@ -2656,24 +2675,77 @@ var Shape = /** @class */ (function () {
|
|
|
2656
2675
|
}
|
|
2657
2676
|
switch (item) {
|
|
2658
2677
|
case 'default':
|
|
2659
|
-
this.updateFontStyle(item, objColl, 'normal', 'normal');
|
|
2678
|
+
this.updateFontStyle(item, objColl, 'normal', 'normal', false, false);
|
|
2660
2679
|
break;
|
|
2661
2680
|
case 'bold':
|
|
2662
|
-
this.updateFontStyle(item, objColl, 'bold', 'normal');
|
|
2681
|
+
this.updateFontStyle(item, objColl, 'bold', 'normal', false, false);
|
|
2663
2682
|
break;
|
|
2664
2683
|
case 'italic':
|
|
2665
|
-
this.updateFontStyle(item, objColl, 'normal', 'italic');
|
|
2684
|
+
this.updateFontStyle(item, objColl, 'normal', 'italic', false, false);
|
|
2666
2685
|
break;
|
|
2667
2686
|
case 'bolditalic':
|
|
2668
|
-
this.updateFontStyle(item, objColl, 'bold', 'italic');
|
|
2687
|
+
this.updateFontStyle(item, objColl, 'bold', 'italic', false, false);
|
|
2688
|
+
break;
|
|
2689
|
+
case 'underline':
|
|
2690
|
+
this.updateFontStyle(item, objColl, 'normal', 'normal', true, false);
|
|
2691
|
+
break;
|
|
2692
|
+
case 'boldunderline':
|
|
2693
|
+
this.updateFontStyle(item, objColl, 'bold', 'normal', true, false);
|
|
2694
|
+
break;
|
|
2695
|
+
case 'italicunderline':
|
|
2696
|
+
this.updateFontStyle(item, objColl, 'normal', 'italic', true, false);
|
|
2697
|
+
break;
|
|
2698
|
+
case 'bolditalicunderline':
|
|
2699
|
+
this.updateFontStyle(item, objColl, 'bold', 'italic', true, false);
|
|
2700
|
+
break;
|
|
2701
|
+
case 'strikethrough':
|
|
2702
|
+
this.updateFontStyle(item, objColl, 'normal', 'normal', false, true);
|
|
2703
|
+
break;
|
|
2704
|
+
case 'boldstrikethrough':
|
|
2705
|
+
this.updateFontStyle(item, objColl, 'bold', 'normal', false, true);
|
|
2706
|
+
break;
|
|
2707
|
+
case 'italicstrikethrough':
|
|
2708
|
+
this.updateFontStyle(item, objColl, 'normal', 'italic', false, true);
|
|
2709
|
+
break;
|
|
2710
|
+
case 'underlinestrikethrough':
|
|
2711
|
+
this.updateFontStyle(item, objColl, 'normal', 'normal', true, true);
|
|
2712
|
+
break;
|
|
2713
|
+
case 'bolditalicstrikethrough':
|
|
2714
|
+
this.updateFontStyle(item, objColl, 'bold', 'italic', false, true);
|
|
2715
|
+
break;
|
|
2716
|
+
case 'boldunderlinestrikethrough':
|
|
2717
|
+
this.updateFontStyle(item, objColl, 'bold', 'normal', true, true);
|
|
2718
|
+
break;
|
|
2719
|
+
case 'italicunderlinestrikethrough':
|
|
2720
|
+
this.updateFontStyle(item, objColl, 'normal', 'italic', true, true);
|
|
2721
|
+
break;
|
|
2722
|
+
case 'bolditalicunderlinestrikethrough':
|
|
2723
|
+
this.updateFontStyle(item, objColl, 'bold', 'italic', true, true);
|
|
2669
2724
|
break;
|
|
2670
2725
|
}
|
|
2671
2726
|
var shapeChangedArgs = { action: 'font-style', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2672
|
-
shapeChangedArgs.currentShapeSettings.fontStyle =
|
|
2727
|
+
shapeChangedArgs.currentShapeSettings.fontStyle = this.getFontStyleArray(item);
|
|
2673
2728
|
parent.trigger('shapeChange', shapeChangedArgs);
|
|
2674
2729
|
parent.editCompleteArgs = shapeChangedArgs;
|
|
2675
2730
|
};
|
|
2676
|
-
Shape.prototype.
|
|
2731
|
+
Shape.prototype.getFontStyleArray = function (item) {
|
|
2732
|
+
var styleArray = [];
|
|
2733
|
+
var lowerItem = item.toLowerCase();
|
|
2734
|
+
if (lowerItem.indexOf('bold') > -1) {
|
|
2735
|
+
styleArray.push('bold');
|
|
2736
|
+
}
|
|
2737
|
+
if (lowerItem.indexOf('italic') > -1) {
|
|
2738
|
+
styleArray.push('italic');
|
|
2739
|
+
}
|
|
2740
|
+
if (lowerItem.indexOf('underline') > -1) {
|
|
2741
|
+
styleArray.push('underline');
|
|
2742
|
+
}
|
|
2743
|
+
if (lowerItem.indexOf('strikethrough') > -1) {
|
|
2744
|
+
styleArray.push('strikethrough');
|
|
2745
|
+
}
|
|
2746
|
+
return styleArray;
|
|
2747
|
+
};
|
|
2748
|
+
Shape.prototype.updateFontStyle = function (item, objColl, fontWeight, fontStyle, underline, strikethrough) {
|
|
2677
2749
|
var parent = this.parent;
|
|
2678
2750
|
var style = parent.textArea.style;
|
|
2679
2751
|
if (style.display === 'block' || style.display === 'inline-block') {
|
|
@@ -2689,9 +2761,43 @@ var Shape = /** @class */ (function () {
|
|
|
2689
2761
|
else {
|
|
2690
2762
|
style.fontStyle = 'normal';
|
|
2691
2763
|
}
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2764
|
+
if (underline && strikethrough) {
|
|
2765
|
+
style.textDecoration = 'underline line-through';
|
|
2766
|
+
}
|
|
2767
|
+
else if (strikethrough) {
|
|
2768
|
+
style.textDecoration = 'line-through';
|
|
2769
|
+
}
|
|
2770
|
+
else if (underline) {
|
|
2771
|
+
style.textDecoration = 'underline';
|
|
2772
|
+
}
|
|
2773
|
+
else {
|
|
2774
|
+
style.textDecoration = 'none';
|
|
2775
|
+
}
|
|
2776
|
+
var key = [
|
|
2777
|
+
style.fontWeight === 'bold' ? 'bold' : '',
|
|
2778
|
+
style.fontStyle === 'italic' ? 'italic' : '',
|
|
2779
|
+
typeof style.textDecoration === 'string' && style.textDecoration.indexOf('underline') > -1 ? 'underline' : '',
|
|
2780
|
+
typeof style.textDecoration === 'string' && style.textDecoration.indexOf('line-through') > -1 ? 'strikethrough' : ''
|
|
2781
|
+
].filter(Boolean).join('');
|
|
2782
|
+
var valueMap = {
|
|
2783
|
+
'': 'default',
|
|
2784
|
+
bold: 'bold',
|
|
2785
|
+
italic: 'italic',
|
|
2786
|
+
underline: 'underline',
|
|
2787
|
+
strikethrough: 'strikethrough',
|
|
2788
|
+
bolditalic: 'bolditalic',
|
|
2789
|
+
boldunderline: 'boldunderline',
|
|
2790
|
+
boldstrikethrough: 'boldstrikethrough',
|
|
2791
|
+
italicunderline: 'italicunderline',
|
|
2792
|
+
italicstrikethrough: 'italicstrikethrough',
|
|
2793
|
+
underlinestrikethrough: 'underlinestrikethrough',
|
|
2794
|
+
bolditalicunderline: 'bolditalicunderline',
|
|
2795
|
+
bolditalicstrikethrough: 'bolditalicstrikethrough',
|
|
2796
|
+
boldunderlinestrikethrough: 'boldunderlinestrikethrough',
|
|
2797
|
+
italicunderlinestrikethrough: 'italicunderlinestrikethrough',
|
|
2798
|
+
bolditalicunderlinestrikethrough: 'bolditalicunderlinestrikethrough'
|
|
2799
|
+
};
|
|
2800
|
+
var value = key in valueMap ? valueMap[key] : 'default';
|
|
2695
2801
|
var width = this.getTextAreaWidth(value);
|
|
2696
2802
|
style.width = width + 'px';
|
|
2697
2803
|
this.updateObjColl(item, objColl);
|
|
@@ -2699,6 +2805,8 @@ var Shape = /** @class */ (function () {
|
|
|
2699
2805
|
else {
|
|
2700
2806
|
this.textSettings.bold = parent.activeObj.textSettings.bold = fontWeight === 'normal' ? false : true;
|
|
2701
2807
|
this.textSettings.italic = parent.activeObj.textSettings.italic = fontStyle === 'normal' ? false : true;
|
|
2808
|
+
this.textSettings.underline = parent.activeObj.textSettings.underline = underline ? true : false;
|
|
2809
|
+
this.textSettings.strikethrough = parent.activeObj.textSettings.strikethrough = strikethrough ? true : false;
|
|
2702
2810
|
if (parent.activeObj.activePoint.width !== 0 || parent.activeObj.activePoint.height !== 0) {
|
|
2703
2811
|
this.redrawText();
|
|
2704
2812
|
}
|
|
@@ -2794,24 +2902,107 @@ var Shape = /** @class */ (function () {
|
|
|
2794
2902
|
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
2795
2903
|
value: { obj: selPointCollObj } });
|
|
2796
2904
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
2797
|
-
var
|
|
2798
|
-
var
|
|
2905
|
+
var textSettings = parent.activeObj.textSettings;
|
|
2906
|
+
var tempBold = textSettings.bold;
|
|
2907
|
+
var tempItalic = textSettings.italic;
|
|
2908
|
+
var tempUnderline = textSettings.underline;
|
|
2909
|
+
var tempStrikethrough = textSettings.strikethrough;
|
|
2799
2910
|
switch (item) {
|
|
2800
2911
|
case 'default':
|
|
2801
|
-
|
|
2802
|
-
|
|
2912
|
+
textSettings.bold = false;
|
|
2913
|
+
textSettings.italic = false;
|
|
2914
|
+
textSettings.underline = false;
|
|
2915
|
+
textSettings.strikethrough = false;
|
|
2803
2916
|
break;
|
|
2804
2917
|
case 'bold':
|
|
2805
|
-
|
|
2806
|
-
|
|
2918
|
+
textSettings.bold = true;
|
|
2919
|
+
textSettings.italic = false;
|
|
2920
|
+
textSettings.underline = false;
|
|
2921
|
+
textSettings.strikethrough = false;
|
|
2807
2922
|
break;
|
|
2808
2923
|
case 'italic':
|
|
2809
|
-
|
|
2810
|
-
|
|
2924
|
+
textSettings.bold = false;
|
|
2925
|
+
textSettings.italic = true;
|
|
2926
|
+
textSettings.underline = false;
|
|
2927
|
+
textSettings.strikethrough = false;
|
|
2811
2928
|
break;
|
|
2812
2929
|
case 'bolditalic':
|
|
2813
|
-
|
|
2814
|
-
|
|
2930
|
+
textSettings.bold = true;
|
|
2931
|
+
textSettings.italic = true;
|
|
2932
|
+
textSettings.underline = false;
|
|
2933
|
+
textSettings.strikethrough = false;
|
|
2934
|
+
break;
|
|
2935
|
+
case 'underline':
|
|
2936
|
+
textSettings.bold = false;
|
|
2937
|
+
textSettings.italic = false;
|
|
2938
|
+
textSettings.underline = true;
|
|
2939
|
+
textSettings.strikethrough = false;
|
|
2940
|
+
break;
|
|
2941
|
+
case 'boldunderline':
|
|
2942
|
+
textSettings.bold = true;
|
|
2943
|
+
textSettings.italic = false;
|
|
2944
|
+
textSettings.underline = true;
|
|
2945
|
+
textSettings.strikethrough = false;
|
|
2946
|
+
break;
|
|
2947
|
+
case 'italicunderline':
|
|
2948
|
+
textSettings.bold = false;
|
|
2949
|
+
textSettings.italic = true;
|
|
2950
|
+
textSettings.underline = true;
|
|
2951
|
+
textSettings.strikethrough = false;
|
|
2952
|
+
break;
|
|
2953
|
+
case 'bolditalicunderline':
|
|
2954
|
+
textSettings.bold = true;
|
|
2955
|
+
textSettings.italic = true;
|
|
2956
|
+
textSettings.underline = true;
|
|
2957
|
+
textSettings.strikethrough = false;
|
|
2958
|
+
break;
|
|
2959
|
+
case 'strikethrough':
|
|
2960
|
+
textSettings.bold = false;
|
|
2961
|
+
textSettings.italic = false;
|
|
2962
|
+
textSettings.underline = false;
|
|
2963
|
+
textSettings.strikethrough = true;
|
|
2964
|
+
break;
|
|
2965
|
+
case 'boldstrikethrough':
|
|
2966
|
+
textSettings.bold = true;
|
|
2967
|
+
textSettings.italic = false;
|
|
2968
|
+
textSettings.underline = false;
|
|
2969
|
+
textSettings.strikethrough = true;
|
|
2970
|
+
break;
|
|
2971
|
+
case 'italicstrikethrough':
|
|
2972
|
+
textSettings.bold = false;
|
|
2973
|
+
textSettings.italic = true;
|
|
2974
|
+
textSettings.underline = false;
|
|
2975
|
+
textSettings.strikethrough = true;
|
|
2976
|
+
break;
|
|
2977
|
+
case 'underlinestrikethrough':
|
|
2978
|
+
textSettings.bold = false;
|
|
2979
|
+
textSettings.italic = false;
|
|
2980
|
+
textSettings.underline = true;
|
|
2981
|
+
textSettings.strikethrough = true;
|
|
2982
|
+
break;
|
|
2983
|
+
case 'bolditalicstrikethrough':
|
|
2984
|
+
textSettings.bold = true;
|
|
2985
|
+
textSettings.italic = true;
|
|
2986
|
+
textSettings.underline = false;
|
|
2987
|
+
textSettings.strikethrough = true;
|
|
2988
|
+
break;
|
|
2989
|
+
case 'boldunderlinestrikethrough':
|
|
2990
|
+
textSettings.bold = true;
|
|
2991
|
+
textSettings.italic = false;
|
|
2992
|
+
textSettings.underline = true;
|
|
2993
|
+
textSettings.strikethrough = true;
|
|
2994
|
+
break;
|
|
2995
|
+
case 'italicunderlinestrikethrough':
|
|
2996
|
+
textSettings.bold = false;
|
|
2997
|
+
textSettings.italic = true;
|
|
2998
|
+
textSettings.underline = true;
|
|
2999
|
+
textSettings.strikethrough = true;
|
|
3000
|
+
break;
|
|
3001
|
+
case 'bolditalicunderlinestrikethrough':
|
|
3002
|
+
textSettings.bold = true;
|
|
3003
|
+
textSettings.italic = true;
|
|
3004
|
+
textSettings.underline = true;
|
|
3005
|
+
textSettings.strikethrough = true;
|
|
2815
3006
|
break;
|
|
2816
3007
|
}
|
|
2817
3008
|
parent.objColl.push(parent.activeObj);
|
|
@@ -2821,8 +3012,10 @@ var Shape = /** @class */ (function () {
|
|
|
2821
3012
|
previousCropObj: prevCropObj, previousText: null,
|
|
2822
3013
|
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
2823
3014
|
parent.objColl.pop();
|
|
2824
|
-
|
|
2825
|
-
|
|
3015
|
+
textSettings.bold = tempBold;
|
|
3016
|
+
textSettings.italic = tempItalic;
|
|
3017
|
+
textSettings.underline = tempUnderline;
|
|
3018
|
+
textSettings.strikethrough = tempStrikethrough;
|
|
2826
3019
|
};
|
|
2827
3020
|
Shape.prototype.pushActItemIntoObj = function () {
|
|
2828
3021
|
var parent = this.parent;
|
|
@@ -3015,24 +3208,107 @@ var Shape = /** @class */ (function () {
|
|
|
3015
3208
|
};
|
|
3016
3209
|
Shape.prototype.getTextAreaWidth = function (item) {
|
|
3017
3210
|
var parent = this.parent;
|
|
3018
|
-
var
|
|
3019
|
-
var
|
|
3211
|
+
var textSettings = parent.activeObj.textSettings;
|
|
3212
|
+
var tempBold = textSettings.bold;
|
|
3213
|
+
var tempItalic = textSettings.italic;
|
|
3214
|
+
var tempUnderline = textSettings.underline;
|
|
3215
|
+
var tempStrikethrough = textSettings.strikethrough;
|
|
3020
3216
|
switch (item) {
|
|
3021
3217
|
case 'default':
|
|
3022
|
-
|
|
3023
|
-
|
|
3218
|
+
textSettings.bold = false;
|
|
3219
|
+
textSettings.italic = false;
|
|
3220
|
+
textSettings.underline = false;
|
|
3221
|
+
textSettings.strikethrough = false;
|
|
3024
3222
|
break;
|
|
3025
3223
|
case 'bold':
|
|
3026
|
-
|
|
3027
|
-
|
|
3224
|
+
textSettings.bold = true;
|
|
3225
|
+
textSettings.italic = false;
|
|
3226
|
+
textSettings.underline = false;
|
|
3227
|
+
textSettings.strikethrough = false;
|
|
3028
3228
|
break;
|
|
3029
3229
|
case 'italic':
|
|
3030
|
-
|
|
3031
|
-
|
|
3230
|
+
textSettings.bold = false;
|
|
3231
|
+
textSettings.italic = true;
|
|
3232
|
+
textSettings.underline = false;
|
|
3233
|
+
textSettings.strikethrough = false;
|
|
3032
3234
|
break;
|
|
3033
3235
|
case 'bolditalic':
|
|
3034
|
-
|
|
3035
|
-
|
|
3236
|
+
textSettings.bold = true;
|
|
3237
|
+
textSettings.italic = true;
|
|
3238
|
+
textSettings.underline = false;
|
|
3239
|
+
textSettings.strikethrough = false;
|
|
3240
|
+
break;
|
|
3241
|
+
case 'underline':
|
|
3242
|
+
textSettings.bold = false;
|
|
3243
|
+
textSettings.italic = false;
|
|
3244
|
+
textSettings.underline = true;
|
|
3245
|
+
textSettings.strikethrough = false;
|
|
3246
|
+
break;
|
|
3247
|
+
case 'boldunderline':
|
|
3248
|
+
textSettings.bold = true;
|
|
3249
|
+
textSettings.italic = false;
|
|
3250
|
+
textSettings.underline = true;
|
|
3251
|
+
textSettings.strikethrough = false;
|
|
3252
|
+
break;
|
|
3253
|
+
case 'italicunderline':
|
|
3254
|
+
textSettings.bold = false;
|
|
3255
|
+
textSettings.italic = true;
|
|
3256
|
+
textSettings.underline = true;
|
|
3257
|
+
textSettings.strikethrough = false;
|
|
3258
|
+
break;
|
|
3259
|
+
case 'bolditalicunderline':
|
|
3260
|
+
textSettings.bold = true;
|
|
3261
|
+
textSettings.italic = true;
|
|
3262
|
+
textSettings.underline = true;
|
|
3263
|
+
textSettings.strikethrough = false;
|
|
3264
|
+
break;
|
|
3265
|
+
case 'strikethrough':
|
|
3266
|
+
textSettings.bold = false;
|
|
3267
|
+
textSettings.italic = false;
|
|
3268
|
+
textSettings.underline = false;
|
|
3269
|
+
textSettings.strikethrough = true;
|
|
3270
|
+
break;
|
|
3271
|
+
case 'boldstrikethrough':
|
|
3272
|
+
textSettings.bold = true;
|
|
3273
|
+
textSettings.italic = false;
|
|
3274
|
+
textSettings.underline = false;
|
|
3275
|
+
textSettings.strikethrough = true;
|
|
3276
|
+
break;
|
|
3277
|
+
case 'italicstrikethrough':
|
|
3278
|
+
textSettings.bold = false;
|
|
3279
|
+
textSettings.italic = true;
|
|
3280
|
+
textSettings.underline = false;
|
|
3281
|
+
textSettings.strikethrough = true;
|
|
3282
|
+
break;
|
|
3283
|
+
case 'underlinestrikethrough':
|
|
3284
|
+
textSettings.bold = false;
|
|
3285
|
+
textSettings.italic = false;
|
|
3286
|
+
textSettings.underline = true;
|
|
3287
|
+
textSettings.strikethrough = true;
|
|
3288
|
+
break;
|
|
3289
|
+
case 'bolditalicstrikethrough':
|
|
3290
|
+
textSettings.bold = true;
|
|
3291
|
+
textSettings.italic = true;
|
|
3292
|
+
textSettings.underline = false;
|
|
3293
|
+
textSettings.strikethrough = true;
|
|
3294
|
+
break;
|
|
3295
|
+
case 'boldunderlinestrikethrough':
|
|
3296
|
+
textSettings.bold = true;
|
|
3297
|
+
textSettings.italic = false;
|
|
3298
|
+
textSettings.underline = true;
|
|
3299
|
+
textSettings.strikethrough = true;
|
|
3300
|
+
break;
|
|
3301
|
+
case 'italicunderlinestrikethrough':
|
|
3302
|
+
textSettings.bold = false;
|
|
3303
|
+
textSettings.italic = true;
|
|
3304
|
+
textSettings.underline = true;
|
|
3305
|
+
textSettings.strikethrough = true;
|
|
3306
|
+
break;
|
|
3307
|
+
case 'bolditalicunderlinestrikethrough':
|
|
3308
|
+
textSettings.bold = true;
|
|
3309
|
+
textSettings.italic = true;
|
|
3310
|
+
textSettings.underline = true;
|
|
3311
|
+
textSettings.strikethrough = true;
|
|
3036
3312
|
break;
|
|
3037
3313
|
}
|
|
3038
3314
|
var isTextArea = parent.textArea.style.display === 'none' ? false : true;
|
|
@@ -3040,14 +3316,16 @@ var Shape = /** @class */ (function () {
|
|
|
3040
3316
|
var width;
|
|
3041
3317
|
if (!isTextArea) {
|
|
3042
3318
|
width = this.upperContext.measureText(parent.activeObj.keyHistory).width +
|
|
3043
|
-
|
|
3319
|
+
textSettings.fontSize * 0.5;
|
|
3044
3320
|
}
|
|
3045
3321
|
else {
|
|
3046
3322
|
width = this.upperContext.measureText(parent.textArea.value).width +
|
|
3047
|
-
|
|
3323
|
+
textSettings.fontSize * 0.5;
|
|
3048
3324
|
}
|
|
3049
|
-
|
|
3050
|
-
|
|
3325
|
+
textSettings.bold = tempBold;
|
|
3326
|
+
textSettings.italic = tempItalic;
|
|
3327
|
+
textSettings.underline = tempUnderline;
|
|
3328
|
+
textSettings.strikethrough = tempStrikethrough;
|
|
3051
3329
|
return width;
|
|
3052
3330
|
};
|
|
3053
3331
|
Shape.prototype.getRedactObjDetails = function (obj) {
|
|
@@ -3126,6 +3404,12 @@ var Shape = /** @class */ (function () {
|
|
|
3126
3404
|
if (obj.textSettings.italic) {
|
|
3127
3405
|
shapeDetails.fontStyle.push('italic');
|
|
3128
3406
|
}
|
|
3407
|
+
if (obj.textSettings.underline) {
|
|
3408
|
+
shapeDetails.fontStyle.push('underline');
|
|
3409
|
+
}
|
|
3410
|
+
if (obj.textSettings.strikethrough) {
|
|
3411
|
+
shapeDetails.fontStyle.push('strikethrough');
|
|
3412
|
+
}
|
|
3129
3413
|
shapeDetails.degree = obj.rotatedAngle * (180 / Math.PI);
|
|
3130
3414
|
parent.notify('selection', { prop: 'updateTransColl', onPropertyChange: false, value: { obj: transformObj, object: obj } });
|
|
3131
3415
|
shapeDetails.transformCollection = transformObj['coll'];
|
|
@@ -3425,6 +3709,7 @@ var Shape = /** @class */ (function () {
|
|
|
3425
3709
|
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
3426
3710
|
parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
|
|
3427
3711
|
parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
|
|
3712
|
+
parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
3428
3713
|
}
|
|
3429
3714
|
};
|
|
3430
3715
|
Shape.prototype.getMaxText = function (isTextBox, text, obj) {
|