-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Merged by Bors] - change the default width
and height
of Size
to Val::Auto
#7475
[Merged by Bors] - change the default width
and height
of Size
to Val::Auto
#7475
Conversation
Size
default width and height to Val::Auto
Size
default width and height to Val::Auto
Size
default width and height to Val::Auto
width
and height
of Size
to Val::Auto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change seems unproblematic to me. However, I believe it will have no effect as IIRC Taffy versions that have both Undefined
and Auto
treat them both as Auto
anyway.
Undefined and Auto definitely aren't the same. Ultra minimal example, red window: use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_startup_system(|mut commands: Commands| {
commands.spawn(Camera2dBundle::default());
commands.spawn(NodeBundle {
style: Style {
size: Size::new(Val::Percent(100.), Val::Auto),
..Default::default()
},
background_color: BackgroundColor(Color::RED),
..Default::default()
});
})
.run();
} Grey window: use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_startup_system(|mut commands: Commands| {
commands.spawn(Camera2dBundle::default());
commands.spawn(NodeBundle {
style: Style {
size: Size::new(Val::Percent(100.), Val::Undefined),
..Default::default()
},
background_color: BackgroundColor(Color::RED),
..Default::default()
});
})
.run(); The Taffy 2.x compute source is full of predicates like |
bors r+ |
# Objective In CSS Flexbox width and height are auto by default, whereas in Bevy their default is `Size::Undefined`. This means that, unlike in CSS, if you elide a height or width value for a node it will be given zero length (unless it has an explicitly sized child node). This has misled users into falsely assuming that they have to explicitly set a value for both height and width all the time. relevant issue: #7120 ## Solution Change the `Size` `width` and `height` default values to `Val::Auto` ## Changelog * Changed the `Size` `width` and `height` default values to `Val::Auto` ## Migration Guide The default values for `Size` `width` and `height` have been changed from `Val::Undefined` to `Val::Auto`. It's unlikely to cause any issues with existing code.
Build failed (retrying...): |
# Objective In CSS Flexbox width and height are auto by default, whereas in Bevy their default is `Size::Undefined`. This means that, unlike in CSS, if you elide a height or width value for a node it will be given zero length (unless it has an explicitly sized child node). This has misled users into falsely assuming that they have to explicitly set a value for both height and width all the time. relevant issue: #7120 ## Solution Change the `Size` `width` and `height` default values to `Val::Auto` ## Changelog * Changed the `Size` `width` and `height` default values to `Val::Auto` ## Migration Guide The default values for `Size` `width` and `height` have been changed from `Val::Undefined` to `Val::Auto`. It's unlikely to cause any issues with existing code.
Pull request successfully merged into main. Build succeeded:
|
width
and height
of Size
to Val::Auto
width
and height
of Size
to Val::Auto
Objective
In CSS Flexbox width and height are auto by default, whereas in Bevy their default is
Size::Undefined
.This means that, unlike in CSS, if you elide a height or width value for a node it will be given zero length (unless it has an explicitly sized child node). This has misled users into falsely assuming that they have to explicitly set a value for both height and width all the time.
relevant issue: #7120
Solution
Change the
Size
width
andheight
default values toVal::Auto
Changelog
Size
width
andheight
default values toVal::Auto
Migration Guide
The default values for
Size
width
andheight
have been changed fromVal::Undefined
toVal::Auto
.It's unlikely to cause any issues with existing code.