From 7aa3a9f848d3393997c92d29f209f6f00a3e19de Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Wed, 11 Jun 2025 21:03:22 +0300 Subject: [PATCH] fix(demo): ui clipping --- crates/bevy_dice_demo/src/ui.rs | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/crates/bevy_dice_demo/src/ui.rs b/crates/bevy_dice_demo/src/ui.rs index 02bf8e0..0c13fb0 100644 --- a/crates/bevy_dice_demo/src/ui.rs +++ b/crates/bevy_dice_demo/src/ui.rs @@ -229,8 +229,14 @@ fn set_selected_variant_text( } fn setup(mut commands: Commands) { - let buttons = commands - .spawn(( + commands.spawn(( + Node { + width: Val::Percent(100.0), + height: Val::Percent(100.0), + padding: UiRect::all(Val::Px(8.0)), + ..Default::default() + }, + children![( Node { width: Val::Percent(100.0), flex_direction: FlexDirection::Row, @@ -243,14 +249,16 @@ fn setup(mut commands: Commands) { button(ButtonFunction::Throw, "Throw", THROW_COLOR), button(ButtonFunction::Despawn, "Despawn Dice", DESPAWN_COLOR), ], - )) - .id(); + )], + )); let dropdown = commands .spawn(( Node { width: Val::Percent(100.0), + height: Val::Percent(100.0), flex_direction: FlexDirection::Column, + padding: UiRect::all(Val::Px(8.0)), overflow: Overflow::scroll_y(), ..Default::default() }, @@ -297,17 +305,4 @@ fn setup(mut commands: Commands) { format!("{:?}", variant), )); } - - let layout = commands - .spawn((Node { - width: Val::Percent(100.0), - height: Val::Percent(100.0), - flex_direction: FlexDirection::Column, - align_items: AlignItems::FlexEnd, - justify_content: JustifyContent::SpaceBetween, - padding: UiRect::all(Val::Px(8.0)), - ..Default::default() - },)) - .id(); - commands.entity(layout).add_children(&[dropdown, buttons]); } -- 2.44.1