Add Length::FillPortion variant

It allows to specify the amount of available space an element should
take relative to other elements.
This commit is contained in:
Héctor Ramón Jiménez 2019-12-30 18:37:13 +01:00
parent 4b86c2ff98
commit aecc3ad195
4 changed files with 14 additions and 4 deletions

View file

@ -52,7 +52,7 @@ impl Limits {
Length::Shrink => {
self.fill.width = self.min.width;
}
Length::Fill => {
Length::Fill | Length::FillPortion(_) => {
self.fill.width = self.fill.width.min(self.max.width);
}
Length::Units(units) => {
@ -76,7 +76,7 @@ impl Limits {
Length::Shrink => {
self.fill.height = self.min.height;
}
Length::Fill => {
Length::Fill | Length::FillPortion(_) => {
self.fill.height = self.fill.height.min(self.max.height);
}
Length::Units(units) => {