Closed
Description
Bevy version
0.10.0
What you did
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_startup_system(init)
.run()
}
fn init(mut cmd: Commands) {
cmd.spawn(Camera2dBundle::default());
cmd.spawn(NodeBundle {
style: Style {
size: Size {
width: Val::Percent(50.0),
height: Val::Percent(100.0),
},
max_size: Size {
width: Val::Px(100.0),
height: Val::Percent(100.0),
},
..default()
},
background_color: BackgroundColor(Color::NAVY),
..default()
});
}
What went wrong
I expected the UI node (in navy) to have a maximum width of 100px. This was the result in Bevy 0.9
However, the UI node always has a width of 50% of the window size.
Additional information
I bisected this to the update to Taffy 0.3; however, I was unable to reproduce this with just Taffy:
use taffy::prelude::*;
fn main() {
let mut taffy = Taffy::new();
let body = taffy
.new_leaf(Style {
size: Size {
width: percent(50.0),
height: Dimension::Auto,
},
max_size: Size {
width: points(100.0),
height: Dimension::Auto,
},
..Default::default()
})
.unwrap();
let root = taffy
.new_with_children(
Style {
size: Size {
width: points(1000.0),
height: points(600.0),
},
..Default::default()
},
&[body],
)
.unwrap();
taffy.compute_layout(root, Size::MAX_CONTENT).unwrap();
assert_eq!(100.0, taffy.layout(body).unwrap().size.width);
}