Skip to content

Commit d2a8cbb

Browse files
committed
Fix #455 incorrect width when using width and contain
1 parent ff7e0e2 commit d2a8cbb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/core/text-rendering/renderers/LightningTextTextureRenderer.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,16 @@ export class LightningTextTextureRenderer {
399399
innerWidth = maxLineWidth;
400400
}
401401

402+
// If word wrap is enabled the width needs to be the width of the text.
403+
if (
404+
this._settings.wordWrap &&
405+
w > maxLineWidth &&
406+
this._settings.textAlign === 'left' &&
407+
lines.length === 1
408+
) {
409+
width = maxLineWidth + paddingLeft + paddingRight;
410+
}
411+
402412
let height;
403413
if (h) {
404414
height = h;

0 commit comments

Comments
 (0)