From 4edd782f0b8b351a28215341ba9b1986d8d1f91f Mon Sep 17 00:00:00 2001 From: Rob Parrett Date: Tue, 26 Mar 2024 13:17:26 -0700 Subject: [PATCH] Add padding to new text in `ui` example (#12567) # Objective #11237 added some new text to the UI example. Unlike the other text sharing the same container just above, this new text has no padding and straddles the edge of the screen. ## Solution Move the padding to the container, and add `row_gap` so nodes placed in the container get some vertical separation as well. Before / After 12567-before (1) 12567-after --- examples/ui/ui.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/examples/ui/ui.rs b/examples/ui/ui.rs index 96d8333e4b677..89bbec98ca9e2 100644 --- a/examples/ui/ui.rs +++ b/examples/ui/ui.rs @@ -62,6 +62,8 @@ fn setup(mut commands: Commands, asset_server: Res) { style: Style { width: Val::Percent(100.), flex_direction: FlexDirection::Column, + padding: UiRect::all(Val::Px(5.)), + row_gap: Val::Px(5.), ..default() }, background_color: Color::srgb(0.15, 0.15, 0.15).into(), @@ -77,11 +79,7 @@ fn setup(mut commands: Commands, asset_server: Res) { font_size: 30.0, ..default() }, - ) - .with_style(Style { - margin: UiRect::all(Val::Px(5.)), - ..default() - }), + ), // Because this is a distinct label widget and // not button/list item text, this is necessary // for accessibility to treat the text accordingly.