Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

max_size not working on NodeBundle #8072

Closed
tecbeast42 opened this issue Mar 13, 2023 · 3 comments
Closed

max_size not working on NodeBundle #8072

tecbeast42 opened this issue Mar 13, 2023 · 3 comments
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior

Comments

@tecbeast42
Copy link

Bevy version

v0.10

What you did

I added 2 NodeBundles. The parent is blue, the child is red. The child should have a max size of 600 px.

use bevy::prelude::*;

fn main() {
    let mut app = App::new();
    app.add_plugins(
        DefaultPlugins
    );
    app.add_startup_system(setup);
    app.run();
}

fn setup(
    mut commands: Commands,
) {
    commands.spawn(Camera2dBundle::default());
    commands.spawn(NodeBundle {
        style: Style {
            size: Size::new(Val::Auto, Val::Percent(100.0)),
            ..default()
        },
        background_color: Color::BLUE.into(),
        ..default()
    }).with_children(|damage_report| {
            damage_report.spawn((
                NodeBundle {
                    style: Style {
                        margin: UiRect::all(Val::Px(5.0)),
                        padding: UiRect::all(Val::Px(5.0)),
                        size: Size::new(Val::Px(450.0), Val::Undefined),
                        max_size: Size::new(Val::Undefined, Val::Px(600.0)),
                        flex_direction: FlexDirection::Column,
                        justify_content: JustifyContent::SpaceEvenly,
                        align_items: AlignItems::FlexStart,
                        ..default()
                    },
                    background_color: Color::RED.into(),
                    ..default()
                },
            ));
        });
}

What went wrong

The red child node fills the full parent node, even though the max_size is limited to 600 px.

Additional information

image

image

@tecbeast42 tecbeast42 added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Mar 13, 2023
@tecbeast42
Copy link
Author

I forgot, it was working fine with bevy 0.9.

@rparrett
Copy link
Contributor

I believe this would be fixed by #7948. Would you mind checking?

@rparrett rparrett added A-UI Graphical user interfaces, styles, layouts, and widgets and removed S-Needs-Triage This issue needs to be labelled labels Mar 13, 2023
@rparrett
Copy link
Contributor

I can confirm that #7948 fixes the example above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

No branches or pull requests

2 participants