Fix flex layout cross-alignment when not filled

This commit is contained in:
Héctor Ramón Jiménez 2020-01-10 04:58:13 +01:00
parent 0a83024505
commit d1bf3f02c7
2 changed files with 9 additions and 1 deletions

View File

@ -77,7 +77,7 @@ where
let max_cross = axis.cross(limits.max());
let mut fill_sum = 0;
let mut cross = axis.cross(limits.min());
let mut cross = axis.cross(limits.min()).max(axis.cross(limits.fill()));
let mut available = axis.main(limits.max()) - total_spacing;
let mut nodes: Vec<Node> = Vec::with_capacity(items.len());

View File

@ -44,6 +44,14 @@ impl Limits {
self.max
}
/// Returns the fill [`Size`] of the [`Limits`].
///
/// [`Limits`]: struct.Limits.html
/// [`Size`]: ../struct.Size.html
pub fn fill(&self) -> Size {
self.fill
}
/// Applies a width constraint to the current [`Limits`].
///
/// [`Limits`]: struct.Limits.html