summaryrefslogtreecommitdiffstats
path: root/core/src/length.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-11-10 06:05:20 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-11-11 03:08:00 +0100
commit0240c3981b716c82ecb3364945815335b420a63e (patch)
tree441eebaa9441649a4e878bde71cdec20d4a67391 /core/src/length.rs
parent2303111e09d806ef2a652bddc2b73be6dccf6ae2 (diff)
downloadiced-0240c3981b716c82ecb3364945815335b420a63e.tar.gz
iced-0240c3981b716c82ecb3364945815335b420a63e.tar.bz2
iced-0240c3981b716c82ecb3364945815335b420a63e.zip
Draft custom layout engine based on `druid`
Diffstat (limited to 'core/src/length.rs')
-rw-r--r--core/src/length.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/core/src/length.rs b/core/src/length.rs
index 0e670038..73c227d8 100644
--- a/core/src/length.rs
+++ b/core/src/length.rs
@@ -1,7 +1,17 @@
/// The strategy used to fill space in a specific dimension.
-#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
+#[derive(Debug, Clone, Copy, PartialEq, Hash)]
pub enum Length {
Fill,
Shrink,
Units(u16),
}
+
+impl Length {
+ pub fn fill_factor(&self) -> u16 {
+ match self {
+ Length::Fill => 1,
+ Length::Shrink => 0,
+ Length::Units(_) => 0,
+ }
+ }
+}