From f8233a4cb149c1a69ca3ecc954d45edcd064851b Mon Sep 17 00:00:00 2001 From: Laurenz Date: Mon, 18 Nov 2019 19:36:50 +0100 Subject: =?UTF-8?q?Refactor=20stack=20layouter=20to=20layout=20eagerly=20?= =?UTF-8?q?=F0=9F=9B=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/layout/mod.rs') 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. -- cgit v1.2.3