Skip to content

Commit 4edd782

Browse files
authored
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 <img width="320" alt="12567-before (1)" src="https://github.com/bevyengine/bevy/assets/200550/de0aa142-c715-4c57-b607-d1bdc5d20a01"> <img width="320" alt="12567-after" src="https://github.com/bevyengine/bevy/assets/200550/70b5c9db-9cb2-4f92-88b0-83590ea838b0">
1 parent 0265436 commit 4edd782

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

examples/ui/ui.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
6262
style: Style {
6363
width: Val::Percent(100.),
6464
flex_direction: FlexDirection::Column,
65+
padding: UiRect::all(Val::Px(5.)),
66+
row_gap: Val::Px(5.),
6567
..default()
6668
},
6769
background_color: Color::srgb(0.15, 0.15, 0.15).into(),
@@ -77,11 +79,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
7779
font_size: 30.0,
7880
..default()
7981
},
80-
)
81-
.with_style(Style {
82-
margin: UiRect::all(Val::Px(5.)),
83-
..default()
84-
}),
82+
),
8583
// Because this is a distinct label widget and
8684
// not button/list item text, this is necessary
8785
// for accessibility to treat the text accordingly.

0 commit comments

Comments
 (0)