customized-fabric 1.8.6 → 1.8.7
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.
@@ -69,22 +69,24 @@ const TextInputClass = fabric_1.fabric.util.createClass(fabric_1.fabric.Group, {
|
|
69
69
|
this.fire("scaling");
|
70
70
|
},
|
71
71
|
autoChangeFontSize: function (changeSpeed) {
|
72
|
-
|
73
|
-
|
74
|
-
while (this.width <=
|
72
|
+
let maxLineWidth = Math.max(...this.textObject.__lineWidths);
|
73
|
+
if (this.width <= maxLineWidth || this.height <= this.textObject.height) {
|
74
|
+
while (this.width <= maxLineWidth ||
|
75
75
|
this.height <= this.textObject.height) {
|
76
76
|
this.textObject.set({
|
77
77
|
fontSize: this.textObject.fontSize - changeSpeed,
|
78
78
|
});
|
79
|
+
maxLineWidth = Math.max(...this.textObject.__lineWidths);
|
79
80
|
}
|
80
81
|
}
|
81
82
|
else {
|
82
83
|
while (this.textObject.maxFontSize > this.textObject.fontSize &&
|
83
|
-
this.width >
|
84
|
+
this.width > maxLineWidth &&
|
84
85
|
this.height > this.textObject.height) {
|
85
86
|
this.textObject.set({
|
86
87
|
fontSize: this.textObject.fontSize + changeSpeed,
|
87
88
|
});
|
89
|
+
maxLineWidth = Math.max(...this.textObject.__lineWidths);
|
88
90
|
}
|
89
91
|
}
|
90
92
|
},
|
@@ -126,8 +128,8 @@ const TextInputClass = fabric_1.fabric.util.createClass(fabric_1.fabric.Group, {
|
|
126
128
|
this.textObject.set({
|
127
129
|
fontSize,
|
128
130
|
});
|
129
|
-
|
130
|
-
|
131
|
+
const maxLineWidth = Math.max(...this.textObject.__lineWidths);
|
132
|
+
if (maxLineWidth < this.width && this.textObject.height < this.height) {
|
131
133
|
}
|
132
134
|
else {
|
133
135
|
this.autoChangeFontSize(1);
|
@@ -209,6 +211,8 @@ const toTextInputObject = (object) => {
|
|
209
211
|
infix: textObject?.infix,
|
210
212
|
suffix: textObject?.suffix,
|
211
213
|
isAllCapital: textObject?.isAllCapital,
|
214
|
+
lineHeight: textObject?.lineHeight,
|
215
|
+
charSpacing: textObject?.charSpacing,
|
212
216
|
},
|
213
217
|
};
|
214
218
|
};
|