Merge pull request #152 from hecrj/fix/flex-layout-alignment

Fix flex layout cross-alignment when not filled
This commit is contained in:
Héctor Ramón 2020-01-10 05:19:25 +01:00 committed by GitHub
commit 84f1a936db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

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

View File

@ -44,6 +44,14 @@ impl Limits {
self.max 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`]. /// Applies a width constraint to the current [`Limits`].
/// ///
/// [`Limits`]: struct.Limits.html /// [`Limits`]: struct.Limits.html