diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-06-13 00:19:28 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-06-13 00:22:39 +0200 |
| commit | a61ee46ed2d39d7b7b0c14e6c36d224e03532bac (patch) | |
| tree | 20d55a4c9765954c1734681b3e9add8b9bc96f51 /src/geom | |
| parent | 4c37ebb936ae49278a5f299c815a37b2ae32cdc3 (diff) | |
Refactor column resolving
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 { |
