|
|
@ -23,11 +23,11 @@ impl SVGMeasure {
|
|
|
|
Self { measure, unit }
|
|
|
|
Self { measure, unit }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn to_user_units(&self) -> f64 {
|
|
|
|
fn to_user_units(self) -> f64 {
|
|
|
|
self.measure * self.unit.to_user_units()
|
|
|
|
self.measure * self.unit.to_user_units()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn to_unit(&self, unit: SVGUnit) -> Self {
|
|
|
|
fn to_unit(self, unit: SVGUnit) -> Self {
|
|
|
|
SVGMeasure {
|
|
|
|
SVGMeasure {
|
|
|
|
measure: self.to_user_units() / unit.to_user_units(),
|
|
|
|
measure: self.to_user_units() / unit.to_user_units(),
|
|
|
|
unit,
|
|
|
|
unit,
|
|
|
@ -67,10 +67,6 @@ impl PartialEq for SVGMeasure {
|
|
|
|
fn eq(&self, other: &Self) -> bool {
|
|
|
|
fn eq(&self, other: &Self) -> bool {
|
|
|
|
(self.to_user_units() - other.to_user_units()).abs() < EQ_TOLERANCE
|
|
|
|
(self.to_user_units() - other.to_user_units()).abs() < EQ_TOLERANCE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn ne(&self, other: &Self) -> bool {
|
|
|
|
|
|
|
|
(self.to_user_units() - other.to_user_units()).abs() > EQ_TOLERANCE
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl PartialOrd for SVGMeasure {
|
|
|
|
impl PartialOrd for SVGMeasure {
|
|
|
|