From 1aab3a10064c40b2fab190f59dedbf17fa939f7a Mon Sep 17 00:00:00 2001 From: Chetan Sahney Date: Sun, 12 Apr 2026 18:45:02 +0530 Subject: [PATCH] FIX: Made text alignment work when max width is disabled --- node-graph/nodes/text/src/text_context.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/node-graph/nodes/text/src/text_context.rs b/node-graph/nodes/text/src/text_context.rs index 7934feb885..56d5750e6c 100644 --- a/node-graph/nodes/text/src/text_context.rs +++ b/node-graph/nodes/text/src/text_context.rs @@ -81,7 +81,10 @@ impl TextContext { let mut layout: Layout<()> = builder.build(text); layout.break_all_lines(typesetting.max_width.map(|mw| mw as f32)); - layout.align(typesetting.max_width.map(|max_w| max_w as f32), typesetting.align.into(), AlignmentOptions::default()); + + //To make text alignment work when the max width is disabled + let alignment_width = typesetting.max_width.map(|max_w| max_w as f32).or(Some(layout.full_width())); + layout.align(alignment_width, typesetting.align.into(), AlignmentOptions::default()); Some(layout) }