fix: Center UI button content

This commit is contained in:
demenik
2025-11-28 13:04:56 +01:00
parent 3ab3c8c2d9
commit 885bd2aeb0
3 changed files with 8 additions and 12 deletions

View File

@@ -51,8 +51,6 @@ pub fn spawn_load_popup(commands: &mut Commands) {
Node {
width: px(40),
height: px(40),
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
..default()
},
"X",
@@ -127,8 +125,6 @@ pub fn spawn_load_popup(commands: &mut Commands) {
Node {
width: px(40),
height: px(40),
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
..default()
},
"X",

View File

@@ -37,8 +37,6 @@ fn setup(mut commands: Commands) {
ButtonVariant::Primary,
Node {
width: px(280),
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
padding: UiRect::all(px(10)),
..default()
},
@@ -50,8 +48,6 @@ fn setup(mut commands: Commands) {
ButtonVariant::Primary,
Node {
width: px(280),
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
padding: UiRect::all(px(10)),
..default()
},
@@ -63,8 +59,6 @@ fn setup(mut commands: Commands) {
ButtonVariant::Secondary,
Node {
width: px(280),
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
padding: UiRect::all(px(10)),
..default()
},

View File

@@ -3,10 +3,13 @@ use crate::prelude::*;
pub fn button(
button_type: impl Component,
variant: ButtonVariant,
node: Node,
mut node: Node,
title: impl Into<String>,
font_size: f32,
) -> impl Bundle {
node.justify_content = JustifyContent::Center;
node.align_items = AlignItems::Center;
(
Button,
button_type,
@@ -25,10 +28,13 @@ pub fn button(
pub fn pill_button(
button_type: impl Component,
variant: ButtonVariant,
node: Node,
mut node: Node,
title: impl Into<String>,
font_size: f32,
) -> impl Bundle {
node.justify_content = JustifyContent::Center;
node.align_items = AlignItems::Center;
(
Button,
button_type,