Fix Column and Row fluidity being overridden by push

This commit is contained in:
Héctor Ramón Jiménez 2024-02-27 01:21:02 +01:00
parent 58a7007ac1
commit 01fbd5049d
No known key found for this signature in database
GPG key ID: 0BF4EC06CD8E5686
4 changed files with 19 additions and 25 deletions

View file

@ -48,12 +48,21 @@ impl Length {
/// Specifically:
/// - [`Length::Shrink`] if [`Length::Shrink`] or [`Length::Fixed`].
/// - [`Length::Fill`] otherwise.
pub fn fluid(&self) -> Length {
pub fn fluid(&self) -> Self {
match self {
Length::Fill | Length::FillPortion(_) => Length::Fill,
Length::Shrink | Length::Fixed(_) => Length::Shrink,
}
}
/// Adapts the [`Length`] so it can contain the other [`Length`] and
/// match its fluidity.
pub fn enclose(self, other: Length) -> Self {
match (self, other) {
(Length::Shrink, Length::Fill | Length::FillPortion(_)) => other,
_ => self,
}
}
}
impl From<Pixels> for Length {