summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2019-12-31 10:35:51 +0100
committerLibravatar GitHub <noreply@github.com>2019-12-31 10:35:51 +0100
commiteb8866007456c7ea9efb5449096b0aa15b66ba9b (patch)
tree68004fd1f6ad89b4fdf2b37888a59ba3933db6dd /core
parent74d01a69577065ce4152fc80b297e8816ab3deff (diff)
parentaecc3ad1955b8433d1634ab1b975d2af20e772a1 (diff)
downloadiced-eb8866007456c7ea9efb5449096b0aa15b66ba9b.tar.gz
iced-eb8866007456c7ea9efb5449096b0aa15b66ba9b.tar.bz2
iced-eb8866007456c7ea9efb5449096b0aa15b66ba9b.zip
Merge pull request #137 from hecrj/feature/fill-portion
Add `Length::FillPortion` variant
Diffstat (limited to '')
-rw-r--r--core/src/length.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/core/src/length.rs b/core/src/length.rs
index 10873e89..06d8cf0a 100644
--- a/core/src/length.rs
+++ b/core/src/length.rs
@@ -4,6 +4,15 @@ pub enum Length {
/// Fill all the remaining space
Fill,
+ /// Fill a portion of the remaining space relative to other elements.
+ ///
+ /// Let's say we have two elements: one with `FillPortion(2)` and one with
+ /// `FillPortion(3)`. The first will get 2 portions of the available space,
+ /// while the second one would get 3.
+ ///
+ /// `Length::Fill` is equivalent to `Length::FillPortion(1)`.
+ FillPortion(u16),
+
/// Fill the least amount of space
Shrink,
@@ -22,6 +31,7 @@ impl Length {
pub fn fill_factor(&self) -> u16 {
match self {
Length::Fill => 1,
+ Length::FillPortion(factor) => *factor,
Length::Shrink => 0,
Length::Units(_) => 0,
}