-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
style.min_size doesn't override max_size on the cross axis #6737
Copy link
Copy link
Closed
Labels
A-UIGraphical user interfaces, styles, layouts, and widgetsGraphical user interfaces, styles, layouts, and widgetsC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorS-BlockedThis cannot move forward until something else changesThis cannot move forward until something else changes
Description
Bevy version
0.9
What you did
use bevy::prelude::*;
pub fn setup(
mut commands: Commands,
) {
commands.spawn(Camera2dBundle::default());
commands.spawn(NodeBundle {
style: Style {
min_size: Size::new(Val::Px(100.0), Val::Px(100.0)),
size: Size::new(Val::Px(50.0), Val::Px(50.0)),
max_size: Size::new(Val::Px(10.0), Val::Px(10.0)),
..Default::default()
},
background_color: BackgroundColor(Color::RED),
..Default::default()
});
}
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_startup_system(setup)
.run();
}What went wrong
It should draw a 100 x 100 square.
Instead, a 100 wide x 10 tall rectangle is drawn.
Additional information
According to the Flexbox spec, min_size is supposed to override max_size if max_size < min_size.
The problem is with the calculation of the length of the cross-axis, if the Flex direction is set to FlexDirection::Column you get a 10 wide x 100 tall box instead.
related issue: #5502
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-UIGraphical user interfaces, styles, layouts, and widgetsGraphical user interfaces, styles, layouts, and widgetsC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorS-BlockedThis cannot move forward until something else changesThis cannot move forward until something else changes