diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-11-23 14:25:50 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-11-23 14:25:50 +0100 |
| commit | c77c5a0f0ae6560a03a85e847006c29de9c7ae62 (patch) | |
| tree | 18054ddb95e495cf2e198ca7bac0a5daac7b8240 /src/geom | |
| parent | 4f9e5819bbab1f93ad4f4b789038c60487a76368 (diff) | |
Simpler alignment resolving
Diffstat (limited to 'src/geom')
| -rw-r--r-- | src/geom/align.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/geom/align.rs b/src/geom/align.rs index 4be696e6..f068b821 100644 --- a/src/geom/align.rs +++ b/src/geom/align.rs @@ -38,12 +38,12 @@ impl Align { } } - /// Returns the position of this alignment in the given range. - pub fn resolve(self, range: Range<Length>) -> Length { + /// Returns the position of this alignment in the given length. + pub fn resolve(self, length: Length) -> Length { match self { - Self::Left | Self::Top => range.start, - Self::Center | Self::Horizon => (range.start + range.end) / 2.0, - Self::Right | Self::Bottom => range.end, + Self::Left | Self::Top => Length::zero(), + Self::Center | Self::Horizon => length / 2.0, + Self::Right | Self::Bottom => length, } } } |
