summaryrefslogtreecommitdiff
path: root/src/layout/mod.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-11-18 19:36:50 +0100
committerLaurenz <laurmaedje@gmail.com>2019-11-18 19:36:50 +0100
commitf8233a4cb149c1a69ca3ecc954d45edcd064851b (patch)
treeeb19049cccc76b5bad58a6f0c88d8e9c0a180881 /src/layout/mod.rs
parent1a6fb48bc5e95d0a9ef243ab62517557189c0eea (diff)
Refactor stack layouter to layout eagerly 🛫
Diffstat (limited to 'src/layout/mod.rs')
-rw-r--r--src/layout/mod.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index 426a51ec..13b63568 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -275,6 +275,14 @@ impl Axis {
Axis::RightToLeft | Axis::BottomToTop => false,
}
}
+
+ /// The direction factor for this axis.
+ ///
+ /// - 1 if the axis is positive.
+ /// - -1 if the axis is negative.
+ pub fn factor(&self) -> i32 {
+ if self.is_positive() { 1 } else { -1 }
+ }
}
/// Where to align content.