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 from the flexbox layout not working ? #8221

Closed
gwafotapa opened this issue Mar 26, 2023 · 1 comment
Closed

max_size from the flexbox layout not working ? #8221

gwafotapa opened this issue Mar 26, 2023 · 1 comment
Labels
C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled

Comments

@gwafotapa
Copy link

Bevy version

0.10.0

What you did

I'm using Bevy ui but cannot get it to render how I want it to. More specifically, the fields flex_basis, flex_grow and max_size don't seem to matter. Here's a minimal working example of part of the problem :

use bevy::prelude::*;

pub fn spawn_camera(mut commands: Commands) {
    commands.spawn(Camera2dBundle::default());
}

pub fn spawn_ui(mut commands: Commands, asset_server: Res<AssetServer>) {
    let texture = asset_server.load("bevy_logo.png");
    commands.spawn(ImageBundle {
        style: Style {
            max_size: Size::width(Val::Px(200.0)),
            ..default()
        },
        image: UiImage::new(texture.into()),
        ..default()
    });
}

fn main() {
    App::new()
        .insert_resource(ClearColor(Color::rgb(0., 0., 0.)))
        .add_plugins(DefaultPlugins)
        .add_startup_system(spawn_camera)
        .add_startup_system(spawn_ui)
        .run();
}

What went wrong

Setting max_size has no impact on rendering whereas if I replace it with size, the image is shrinked accordingly.
I thought size was not supposed to exceed max_size which the doc specifies. Or maybe I am missing something about the way flexbox operates ?

@gwafotapa gwafotapa added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Mar 26, 2023
@rparrett
Copy link
Contributor

Thanks for the report.

This is #7946. A fix should be included in an upcoming minor release in the next week or so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled
Projects
None yet
Development

No branches or pull requests

2 participants