diff options
| author | Laurenz <laurmaedje@gmail.com> | 2019-11-18 19:36:50 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2019-11-18 19:36:50 +0100 |
| commit | f8233a4cb149c1a69ca3ecc954d45edcd064851b (patch) | |
| tree | eb19049cccc76b5bad58a6f0c88d8e9c0a180881 /src/layout/mod.rs | |
| parent | 1a6fb48bc5e95d0a9ef243ab62517557189c0eea (diff) | |
Refactor stack layouter to layout eagerly 🛫
Diffstat (limited to 'src/layout/mod.rs')
| -rw-r--r-- | src/layout/mod.rs | 8 |
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. |
