diff options
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. |
