Add some helpers to resolve percentages of box sizes

This commit is contained in:
Anthony Ramine 2019-12-04 17:05:04 +01:00
parent 48ceb56339
commit 4ebdc39ecd
2 changed files with 90 additions and 95 deletions

View file

@ -141,6 +141,15 @@ impl flow_relative::Vec2<Length> {
}
}
impl flow_relative::Vec2<LengthOrAuto> {
pub fn auto_is(&self, f: impl Fn() -> Length) -> flow_relative::Vec2<Length> {
flow_relative::Vec2 {
inline: self.inline.auto_is(&f),
block: self.block.auto_is(&f),
}
}
}
impl flow_relative::Rect<Length> {
pub fn zero() -> Self {
Self {