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

Undefined and Auto should not have equivalent behavior #347

Closed
alice-i-cecile opened this issue Feb 3, 2023 · 1 comment
Closed

Undefined and Auto should not have equivalent behavior #347

alice-i-cecile opened this issue Feb 3, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@alice-i-cecile
Copy link
Collaborator

taffy version

0.3

Context

          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 child_style.cross_size(constants.dir) == Dimension::Auto etc.

Originally posted by @ickshonpe in bevyengine/bevy#7475 (comment)

@alice-i-cecile alice-i-cecile added the bug Something isn't working label Feb 3, 2023
@nicoburns
Copy link
Collaborator

I believe that Undefined and Auto should have equivalent behaviour (see https://developer.mozilla.org/en-US/docs/Web/CSS/width#formal_definition which says that the "initial" (i.e. default) value if width is auto). As I understand it, the problem is that in Taffy 0.2, Undefined and Auto do not have equivalent behaviour (although it's quite close). I believe this is already fixed in Taffy 0.3 by #269 which removed Dimension::Undefined entirely. Although I may have caused some confusion on the bevy issues because I thought that PR was already included in Taffy 0.2 and it turns out it isn't.

@alice-i-cecile alice-i-cecile closed this as not planned Won't fix, can't repro, duplicate, stale Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants