summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2020-01-10 05:19:25 +0100
committerLibravatar GitHub <noreply@github.com>2020-01-10 05:19:25 +0100
commit84f1a936db93c16255a07f079c47e351635586f4 (patch)
treee67aa5b9b5b18a6028f8f4ba8d76193c86b20a0a
parent992ca76afc40bd3f57fbd2bc6e673e1fb334b0af (diff)
parentd1bf3f02c7161e35e40f89fd0a6b3da9834a1616 (diff)
downloadiced-84f1a936db93c16255a07f079c47e351635586f4.tar.gz
iced-84f1a936db93c16255a07f079c47e351635586f4.tar.bz2
iced-84f1a936db93c16255a07f079c47e351635586f4.zip
Merge pull request #152 from hecrj/fix/flex-layout-alignment
Fix flex layout cross-alignment when not filled
-rw-r--r--native/src/layout/flex.rs2
-rw-r--r--native/src/layout/limits.rs8
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