Skip to content

Commit

Permalink
i think i've perfected it
Browse files Browse the repository at this point in the history
  • Loading branch information
skuqre committed Dec 12, 2023
1 parent dc759f2 commit 6ae739e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/scripts/blabla.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ function generateBlabla() {
ctx.letterSpacing = '-0.8px'; // ?

let width = ctx.measureText(item.message).width;
let actualWidth = width + 22 * 2 > 418 ? 418 - 22 * 2 : width + 22 * 2;
let textWidth = actualWidth;
let actualWidth = width + 22 * 2 > 418 ? 418 : width + 22 * 2;
let textWidth = actualWidth - 22 * 2;
let lines = getLinesForParagraphs(ctx, item.message, textWidth);
let height = lines.length > 1 ? 19 + ((31) * (lines.length + 1)) : 81;

Expand Down Expand Up @@ -410,7 +410,7 @@ function getLines(ctx, text, maxWidth) {
for (var i = 1; i < words.length; i++) {
var word = words[i];
var width = ctx.measureText(currentLine + " " + word).width;
if (width < maxWidth) {
if (width <= maxWidth) {
currentLine += " " + word;
} else {
lines.push(currentLine);
Expand Down

0 comments on commit 6ae739e

Please sign in to comment.