diff options
author | 2020-01-10 04:58:13 +0100 | |
---|---|---|
committer | 2020-01-10 04:58:13 +0100 | |
commit | d1bf3f02c7161e35e40f89fd0a6b3da9834a1616 (patch) | |
tree | 3e8959e536b7cab736d12236fa37d79b5238dc55 /native/src/layout | |
parent | 0a8302450557877cb667b51fc84383aaf0a11b02 (diff) | |
download | iced-d1bf3f02c7161e35e40f89fd0a6b3da9834a1616.tar.gz iced-d1bf3f02c7161e35e40f89fd0a6b3da9834a1616.tar.bz2 iced-d1bf3f02c7161e35e40f89fd0a6b3da9834a1616.zip |
Fix flex layout cross-alignment when not filled
Diffstat (limited to 'native/src/layout')
-rw-r--r-- | native/src/layout/flex.rs | 2 | ||||
-rw-r--r-- | native/src/layout/limits.rs | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/native/src/layout/flex.rs b/native/src/layout/flex.rs index 03b13e38..bd37b75a 100644 --- a/native/src/layout/flex.rs +++ b/native/src/layout/flex.rs @@ -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()); diff --git a/native/src/layout/limits.rs b/native/src/layout/limits.rs index a35f7ff7..b674b58a 100644 --- a/native/src/layout/limits.rs +++ b/native/src/layout/limits.rs @@ -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 |