Skip to content

Commit

Permalink
Fix #455 incorrect width when using width and contain (#494)
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterlucas authored Jan 23, 2025
2 parents 5af9cca + d2a8cbb commit a74b092
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/core/text-rendering/renderers/LightningTextTextureRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,16 @@ export class LightningTextTextureRenderer {
innerWidth = maxLineWidth;
}

// If word wrap is enabled the width needs to be the width of the text.
if (
this._settings.wordWrap &&
w > maxLineWidth &&
this._settings.textAlign === 'left' &&
lines.length === 1
) {
width = maxLineWidth + paddingLeft + paddingRight;
}

let height;
if (h) {
height = h;
Expand Down

0 comments on commit a74b092

Please sign in to comment.