-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Remove the Val::try_* arithmetic functions #9571
Copy link
Copy link
Closed
Labels
A-UIGraphical user interfaces, styles, layouts, and widgetsGraphical user interfaces, styles, layouts, and widgetsC-Code-QualityA section of code that is hard to understand or changeA section of code that is hard to understand or changeD-TrivialNice and easy! A great choice to get started with BevyNice and easy! A great choice to get started with Bevy
Description
What problem does this solve or what need does it fill?
Wondering if these are useful at all, or even make sense.
They aren't used internally or in any of the examples.
let mut r = UiRect::new(Val::Px(10.), Val::Percent(5.), Val::Auto, Val::VMin(50.));
// Just feels like nonsense; they don't compose or handle failure well
r.left.try_sub_assign(Val::Px(10.).unwrap();
r.right = r.right.try_add(Val::Px(10.)).unwrap_or(r.right.try_add(Val::Percent(10.)));
The try_*_assign_with_size functions seem problematic too:
r.bottom.try_add_assign_with_context(Val::Px(50.), 100., vec2(800., 600.));
r.bottom equals Val::VMin(50.) and is resolved to 600. * 50. / 100. = 300..
So r.bottom is assigned the value: Val::Px(350.).
This might seem like it's okay. But now r.bottom is no longer responsive to changes in the viewport size.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-UIGraphical user interfaces, styles, layouts, and widgetsGraphical user interfaces, styles, layouts, and widgetsC-Code-QualityA section of code that is hard to understand or changeA section of code that is hard to understand or changeD-TrivialNice and easy! A great choice to get started with BevyNice and easy! A great choice to get started with Bevy