Fix the computation of the interpolation of FontWeight.

This commit is contained in:
Boris Chiou 2017-08-08 13:34:53 +08:00
parent 689dadc751
commit f91bcfd92e

View file

@ -1421,7 +1421,7 @@ impl Animatable for FontWeight {
let b = other.0 as f64;
const NORMAL: f64 = 400.;
let weight = (a - NORMAL) * self_portion + (b - NORMAL) * other_portion + NORMAL;
let weight = (weight.min(100.).max(900.) / 100.).round() * 100.;
let weight = (weight.max(100.).min(900.) / 100.).round() * 100.;
Ok(FontWeight(weight as u16))
}