From 11bd858fa8347e6d31c9b1f2edd2c296534676d2 Mon Sep 17 00:00:00 2001 From: demenik Date: Tue, 9 Dec 2025 13:46:56 +0100 Subject: [PATCH] refactor: Use `Node::from_padding` helper --- src/features/hud/mod.rs | 15 +++------------ src/features/pom/ui/context_menu.rs | 10 ++-------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/src/features/hud/mod.rs b/src/features/hud/mod.rs index 4661850..a753243 100644 --- a/src/features/hud/mod.rs +++ b/src/features/hud/mod.rs @@ -44,28 +44,19 @@ fn setup(mut commands: Commands) { button( shop::components::ButtonType::ShopOpen, ButtonVariant::Secondary, - Node { - padding: UiRect::all(px(10)), - ..default() - }, + Node::from_padding(UiRect::all(px(10))), |color| text("Shop [P]", 16.0, color) ), button( inventory::components::ButtonType::InventoryOpen, ButtonVariant::Secondary, - Node { - padding: UiRect::all(px(10)), - ..default() - }, + Node::from_padding(UiRect::all(px(10))), |color| text("Inventar", 16.0, color) ), button( ButtonType::SettingsOpen, ButtonVariant::Secondary, - Node { - padding: UiRect::all(px(10)), - ..default() - }, + Node::from_padding(UiRect::all(px(10))), |color| text("Einstellungen", 16.0, color) ) ], diff --git a/src/features/pom/ui/context_menu.rs b/src/features/pom/ui/context_menu.rs index b8b5b84..5b3165d 100644 --- a/src/features/pom/ui/context_menu.rs +++ b/src/features/pom/ui/context_menu.rs @@ -70,10 +70,7 @@ pub fn open_context_menu( action: option.clone(), }, ButtonVariant::Primary, - Node { - padding: UiRect::all(px(5)), - ..default() - }, + Node::from_padding(UiRect::all(px(5))), |c| text(option.clone().get_name(&game_config), 20.0, c), // TODO: add sprite )); } @@ -81,10 +78,7 @@ pub fn open_context_menu( parent.spawn(button( ButtonType::Cancel, ButtonVariant::Destructive, - Node { - padding: UiRect::all(px(5)), - ..default() - }, + Node::from_padding(UiRect::all(px(5))), |c| text("Abbrechen", 20.0, c), )); },