From 11c7e5807a5fe6f41cda712e185460259cae7cce Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Wed, 15 Feb 2023 13:58:01 +0000 Subject: [PATCH] Improve the documentation for `flex-basis` (#7685) # Objective The current doc comment for `flex-basis` states that it is "The initial size of the item", which is a bit confusing since size in Bevy is mostly used to refer to two-dimensional extents but `flex-basis` is a one-dimensional value. It also needs to explain that: * `flex-basis` sets the initial length of the main axis. * Overrides `size` on the main axis. * Obeys the `min_size` and `max_size` constraints. --- crates/bevy_ui/src/ui_node.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/bevy_ui/src/ui_node.rs b/crates/bevy_ui/src/ui_node.rs index d7e5a02fe2..588cb141d3 100644 --- a/crates/bevy_ui/src/ui_node.rs +++ b/crates/bevy_ui/src/ui_node.rs @@ -247,7 +247,9 @@ pub struct Style { pub flex_grow: f32, /// How to shrink if there's not enough space available pub flex_shrink: f32, - /// The initial size of the item + /// The initial length of the main axis, before other properties are applied. + /// + /// If both are set, `flex_basis` overrides `size` on the main axis but it obeys the bounds defined by `min_size` and `max_size`. pub flex_basis: Val, /// The ideal size of the flexbox ///