summaryrefslogtreecommitdiff
path: root/src/geom/linear.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-10-10 22:35:24 +0200
committerLaurenz <laurmaedje@gmail.com>2020-10-10 22:35:24 +0200
commit51bf3268ddf5db1bdd61e59bfb4a30f0463a4bfb (patch)
tree9da15f6e77e714f5f983e60159cecd6d37cd7cf2 /src/geom/linear.rs
parent92c01da36016e94ff20163806ddcbcf7e33d4031 (diff)
Refactor text state 🆎
Diffstat (limited to 'src/geom/linear.rs')
-rw-r--r--src/geom/linear.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/geom/linear.rs b/src/geom/linear.rs
index 2567d264..d9860d43 100644
--- a/src/geom/linear.rs
+++ b/src/geom/linear.rs
@@ -11,7 +11,10 @@ pub struct Linear {
impl Linear {
/// The zero linear.
- pub const ZERO: Linear = Linear { rel: Relative::ZERO, abs: Length::ZERO };
+ pub const ZERO: Self = Self { rel: Relative::ZERO, abs: Length::ZERO };
+
+ /// The linear with a relative part of `100%` and no absolute part.
+ pub const ONE: Self = Self { rel: Relative::ONE, abs: Length::ZERO };
/// Create a new linear.
pub fn new(rel: Relative, abs: Length) -> Self {
@@ -24,7 +27,7 @@ impl Linear {
self.rel.eval(one) + self.abs
}
- /// Whether this linear's relative component is zero.
+ /// Whether this linear's relative part is zero.
pub fn is_absolute(self) -> bool {
self.rel == Relative::ZERO
}