Let Repr for Relative<T> print both abs + ratio (#3721)

This commit is contained in:
Leedehai 2024-03-23 07:51:43 -04:00 committed by GitHub
parent 0dba0e2658
commit d1568a5583
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 5 additions and 5 deletions

View File

@ -100,11 +100,7 @@ impl<T: Numeric + Debug> Debug for Rel<T> {
impl<T: Numeric + Repr> Repr for Rel<T> { impl<T: Numeric + Repr> Repr for Rel<T> {
fn repr(&self) -> EcoString { fn repr(&self) -> EcoString {
match (self.rel.is_zero(), self.abs.is_zero()) { eco_format!("{} + {}", self.rel.repr(), self.abs.repr())
(false, false) => eco_format!("{} + {}", self.rel.repr(), self.abs.repr()),
(false, true) => self.rel.repr(),
(true, _) => self.abs.repr(),
}
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

@ -22,6 +22,10 @@
#1.7em \ #1.7em \
#(1cm + 0em) \ #(1cm + 0em) \
#(2em + 10pt) \ #(2em + 10pt) \
#(100% + (2em + 2pt)) \
#(100% + 0pt) \
#(100% - 2em + 2pt) \
#(100% - 2pt) \
#2.3fr #2.3fr
--- ---