Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make filter property animatable. #17288

Merged
merged 5 commits into from Jun 19, 2017
Next

Preserve the unit when interpolating/adding angles with matching units.

If the units of two angles being interpolated/added matches, we should preserve
the original unit; otherwise, we fall back to radians. This matches the behavior
of Gecko.
  • Loading branch information
mantaroh committed Jun 19, 2017
commit ccf08bceadc30a4eda812fa5ecfb567d654cd4e6
@@ -936,9 +936,20 @@ impl Animatable for i32 {
impl Animatable for Angle {
#[inline]
fn add_weighted(&self, other: &Angle, self_portion: f64, other_portion: f64) -> Result<Self, ()> {
self.radians()
.add_weighted(&other.radians(), self_portion, other_portion)
.map(Angle::from_radians)
match (*self, *other) {
% for angle_type in [ 'Degree', 'Gradian', 'Turn' ]:
(Angle::${angle_type}(val1), Angle::${angle_type}(val2)) => {
Ok(Angle::${angle_type}(
try!(val1.add_weighted(&val2, self_portion, other_portion))
))
}
% endfor
_ => {
self.radians()
.add_weighted(&other.radians(), self_portion, other_portion)
.map(Angle::from_radians)
}
}
}
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.