We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ad54f17 commit 6651455Copy full SHA for 6651455
apps/tileclk/app.js
@@ -812,10 +812,14 @@
812
const maxTextWidth = options.w - imgSize - padding * 3;
813
814
if (g.stringWidth(text) > maxTextWidth) {
815
- while (g.stringWidth(text + "...") > maxTextWidth && text.length > 0) {
816
- text = text.substr(0, text.length - 1);
+ if (text.indexOf(' ') === -1) {
+ g.setFont("6x8:2");
817
+ if (g.stringWidth(text) > maxTextWidth) g.setFont("6x8:1");
818
+ } else {
819
820
+ const lines = g.wrapString(text, maxTextWidth);
821
+ text = lines.slice(0, 2).join("\n") + (lines.length > 2 ? "..." : "");
822
}
- text = text + "...";
823
824
825
const textWidth = g.stringWidth(text);
0 commit comments