-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
A flex column nested inside a flex row results in unexpected layout calculation #4237
Comments
Do you reproduce that issue with |
I added an example using use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_startup_system(setup_ui)
.run();
}
fn setup_ui(mut c: Commands, assets: Res<AssetServer>) {
c.spawn_bundle(UiCameraBundle::default());
let image = |s: &'static str| ImageBundle {
image: assets.load(s).into(),
node: Node {
size: Vec2::new(10.0, 10.0),
..Default::default()
},
..Default::default()
};
fn row() -> NodeBundle {
NodeBundle {
style: Style {
flex_direction: FlexDirection::Row,
..Default::default()
},
color: Color::NONE.into(),
..Default::default()
}
}
fn column() -> NodeBundle {
NodeBundle {
style: Style {
flex_direction: FlexDirection::Column,
..Default::default()
},
color: Color::NONE.into(),
..Default::default()
}
}
c.spawn_bundle(row()).with_children(|c| {
c.spawn_bundle(image("icons/outline_north_east_black_24dp.png"));
c.spawn_bundle(column()).with_children(|c| {
c.spawn_bundle(image("icons/outline_north_west_black_24dp.png"));
c.spawn_bundle(image("icons/outline_south_east_black_24dp.png"));
});
c.spawn_bundle(image("icons/outline_south_west_black_24dp.png"));
});
} This does result in a different behavior though, it appears the row is now invisible. I tried this with all of the children directly under the row, c.spawn_bundle(row()).with_children(|c| {
c.spawn_bundle(image("icons/outline_north_east_black_24dp.png"));
c.spawn_bundle(image("icons/outline_north_west_black_24dp.png"));
c.spawn_bundle(image("icons/outline_south_east_black_24dp.png"));
c.spawn_bundle(image("icons/outline_south_west_black_24dp.png"));
c.spawn_bundle(column()).with_children(|c| {});
}); and this result was squished, but did render all 4. EDIT: The icons I used were the diagonal arrow icons from https://fonts.google.com/icons |
It appears this happens specifically when the inner text element has a height of Auto or Unknown. |
I suspect the answer is yes, but are you able to reproduce the issue using current |
Bevy version
0.6.1
Operating system & version
Windows 11
What you did
I compiled and ran this code (when a valid font)
What you expected to happen
I expected a vertically reversed version of this html
which looks like this
What actually happened
This is what bevy renders
The row flex was ignored, and the column goes off the screen. Elements after the column are also missing.
Additional information
If I remove the children of the column, but keep the column itself there the row works fine. It looks like the column having content seems to break the row calculation.
The text was updated successfully, but these errors were encountered: