bevy icon indicating copy to clipboard operation
bevy copied to clipboard

`AlignContent::Center` doesn't seem to work

Open Seldom-SE opened this issue 1 year ago • 1 comments

Bevy version

0.14

What you did

Aligned a node

use bevy::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, setup)
        .run();
}

fn setup(mut cmds: Commands) {
    cmds.spawn(Camera2dBundle::default());

    cmds.spawn(NodeBundle {
        style: Style {
            align_content: AlignContent::Center,
            min_width: Val::Percent(100.),
            min_height: Val::Percent(100.),
            ..default()
        },
        ..default()
    })
    .with_children(|root| {
        root.spawn(NodeBundle {
            style: Style {
                width: Val::Px(50.),
                height: Val::Px(50.),
                ..default()
            },
            background_color: Color::WHITE.into(),
            ..default()
        });
    });
}

What went wrong

In 0.13, the node aligns correctly

Screenshot_20240709_102511

but in 0.14, it doesn't

Screenshot_20240709_102545

Additional information

I struggle with CSS sometimes, so perhaps I'm missing something. Maybe this was a fix to unexpected behavior? But I can't see why that would be the case.

Repro: https://github.com/Seldom-SE/testetst/blob/aaac435fe295f101a4c879c94edb796fb7c31b6f/src/main.rs

Seldom-SE avatar Jul 09 '24 17:07 Seldom-SE