summaryrefslogtreecommitdiff
path: root/src/geom
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-10-13 13:24:33 +0200
committerLaurenz <laurmaedje@gmail.com>2020-10-13 13:24:33 +0200
commit8680fcd4903b451909a5932e8b948a68c9aacb16 (patch)
tree37a195fc77ecee3ec7f17639079f4c7652cde7a4 /src/geom
parent22697f0c0c858bc013ec5c7d8b3ea50f000246dd (diff)
Rename geometric eval and apply to resolve ✏
Diffstat (limited to 'src/geom')
-rw-r--r--src/geom/align.rs2
-rw-r--r--src/geom/linear.rs7
-rw-r--r--src/geom/relative.rs6
-rw-r--r--src/geom/sides.rs12
4 files changed, 13 insertions, 14 deletions
diff --git a/src/geom/align.rs b/src/geom/align.rs
index 1030a133..422624d8 100644
--- a/src/geom/align.rs
+++ b/src/geom/align.rs
@@ -13,7 +13,7 @@ pub enum Align {
impl Align {
/// Returns the position of this alignment in the given range.
- pub fn apply(self, range: Range<Length>) -> Length {
+ pub fn resolve(self, range: Range<Length>) -> Length {
match self {
Self::Start => range.start,
Self::Center => (range.start + range.end) / 2.0,
diff --git a/src/geom/linear.rs b/src/geom/linear.rs
index d9860d43..5638517b 100644
--- a/src/geom/linear.rs
+++ b/src/geom/linear.rs
@@ -21,10 +21,9 @@ impl Linear {
Self { rel, abs }
}
- /// Evaluate the linear length with `one` being `100%` for the relative
- /// part.
- pub fn eval(self, one: Length) -> Length {
- self.rel.eval(one) + self.abs
+ /// Resolve this relative to the given `length`.
+ pub fn resolve(self, length: Length) -> Length {
+ self.rel.resolve(length) + self.abs
}
/// Whether this linear's relative part is zero.
diff --git a/src/geom/relative.rs b/src/geom/relative.rs
index 037c83dc..d87cfac7 100644
--- a/src/geom/relative.rs
+++ b/src/geom/relative.rs
@@ -26,9 +26,9 @@ impl Relative {
self.0
}
- /// Evaluate the relative length with `one` being `100%`.
- pub fn eval(self, one: Length) -> Length {
- self.get() * one
+ /// Resolve this relative to the given `length`.
+ pub fn resolve(self, length: Length) -> Length {
+ self.get() * length
}
}
diff --git a/src/geom/sides.rs b/src/geom/sides.rs
index 770fad58..39487ff7 100644
--- a/src/geom/sides.rs
+++ b/src/geom/sides.rs
@@ -34,13 +34,13 @@ impl<T> Sides<T> {
}
impl Sides<Linear> {
- /// Evaluate the linear values in this container.
- pub fn eval(self, size: Size) -> Sides<Length> {
+ /// Resolve the linear margins relative to the given `size`.
+ pub fn resolve(self, size: Size) -> Sides<Length> {
Sides {
- left: self.left.eval(size.width),
- top: self.top.eval(size.height),
- right: self.right.eval(size.width),
- bottom: self.bottom.eval(size.height),
+ left: self.left.resolve(size.width),
+ top: self.top.resolve(size.height),
+ right: self.right.resolve(size.width),
+ bottom: self.bottom.resolve(size.height),
}
}
}