diff options
| author | Laurenz <laurmaedje@gmail.com> | 2019-12-09 13:29:04 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2019-12-09 13:29:04 +0100 |
| commit | 7e980224354880cfda1797136a1ff886d6642662 (patch) | |
| tree | c0137dcca82526faa71fd1d980a90c68dac798c8 /src/layout/mod.rs | |
| parent | 64f938b449b7ff5e53b6a06ed943bf9dedc1014b (diff) | |
Bad stack layouter 🚑
Diffstat (limited to 'src/layout/mod.rs')
| -rw-r--r-- | src/layout/mod.rs | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 7f9b9b95..c34d881e 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -248,6 +248,16 @@ impl Axis { } } + /// The inverse axis. + pub fn inv(&self) -> Axis { + match self { + Axis::LeftToRight => Axis::RightToLeft, + Axis::RightToLeft => Axis::LeftToRight, + Axis::TopToBottom => Axis::BottomToTop, + Axis::BottomToTop => Axis::TopToBottom, + } + } + /// The direction factor for this axis. /// /// - 1 if the axis is positive. @@ -363,7 +373,7 @@ enum LastSpacing { } impl LastSpacing { - #[allow(dead_code)] + /// The size of the soft space if this is a soft space or zero otherwise. fn soft_or_zero(&self) -> Size { match self { LastSpacing::Soft(space, _) => *space, @@ -372,18 +382,6 @@ impl LastSpacing { } } -/// The specialized anchor position for an item with the given alignment in a -/// container with a given size along the given axis. -#[allow(dead_code)] -fn anchor(axis: Axis, size: Size, alignment: Alignment) -> Size { - use Alignment::*; - match (axis.is_positive(), alignment) { - (true, Origin) | (false, End) => Size::zero(), - (_, Center) => size / 2, - (true, End) | (false, Origin) => size, - } -} - /// Layout components that can be serialized. pub trait Serialize { /// Serialize the data structure into an output writable. |
