diff options
Diffstat (limited to 'src/geom')
| -rw-r--r-- | src/geom/spec.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/geom/spec.rs b/src/geom/spec.rs index 782cf0f6..d0da3bca 100644 --- a/src/geom/spec.rs +++ b/src/geom/spec.rs @@ -89,6 +89,16 @@ pub enum SpecAxis { } impl SpecAxis { + /// The direction with the given positivity for this axis. + pub fn dir(self, positive: bool) -> Dir { + match (self, positive) { + (Self::Vertical, true) => Dir::TTB, + (Self::Vertical, false) => Dir::BTT, + (Self::Horizontal, true) => Dir::LTR, + (Self::Horizontal, false) => Dir::RTL, + } + } + /// The other axis. pub fn other(self) -> Self { match self { |
