From c538a231c181971522e3b3b4ef9875d1ef20e287 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Wed, 24 Jul 2024 18:39:13 +0800 Subject: [PATCH] Fix Label text_align. --- crates/ui/src/label.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/crates/ui/src/label.rs b/crates/ui/src/label.rs index 42d5f867..c93fb0f0 100644 --- a/crates/ui/src/label.rs +++ b/crates/ui/src/label.rs @@ -71,13 +71,14 @@ impl RenderOnce for Label { text.to_string() }; - div() - .map(|this| match self.align { - TextAlign::Left => this.justify_start(), - TextAlign::Center => this.justify_center(), - TextAlign::Right => this.justify_end(), - }) - .text_color(cx.theme().foreground) - .child(self.base.child(text_display)) + div().text_color(cx.theme().foreground).child( + self.base + .map(|this| match self.align { + TextAlign::Left => this.justify_start(), + TextAlign::Center => this.justify_center(), + TextAlign::Right => this.justify_end(), + }) + .child(text_display), + ) } }