diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-11-26 16:32:06 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-11-26 16:32:06 +0100 |
| commit | 3a15922d2ffc041c3523edb479f008a9034fd400 (patch) | |
| tree | 988fe103c0752696c1fade2123142a8db5361ab7 /src/layout/constraints.rs | |
| parent | 393d74f9bb0d4c71a69108d5be261103c39f47f3 (diff) | |
X/Y abstractions
Diffstat (limited to 'src/layout/constraints.rs')
| -rw-r--r-- | src/layout/constraints.rs | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/layout/constraints.rs b/src/layout/constraints.rs index b72254d7..0d772cea 100644 --- a/src/layout/constraints.rs +++ b/src/layout/constraints.rs @@ -2,7 +2,7 @@ use std::rc::Rc; use super::Regions; use crate::frame::Frame; -use crate::geom::{Length, Linear, Size, Spec}; +use crate::geom::{Length, Size, Spec}; /// Constrain a frame with constraints. pub trait Constrain { @@ -65,8 +65,8 @@ impl Constraints { Self { min: Spec::default(), max: Spec::default(), - exact: regions.current.to_spec().map(Some), - base: regions.base.to_spec().map(Some), + exact: regions.current.map(Some), + base: regions.base.map(Some), expand: regions.expand, } } @@ -80,18 +80,6 @@ impl Constraints { && verify(self.exact, current, Length::approx_eq) && verify(self.base, base, Length::approx_eq) } - - /// Set the appropriate base constraints for linear width and height sizing. - pub fn set_base_if_linear(&mut self, base: Size, sizing: Spec<Option<Linear>>) { - // The full sizes need to be equal if there is a relative component in - // the sizes. - if sizing.x.map_or(false, |l| l.is_relative()) { - self.base.x = Some(base.w); - } - if sizing.y.map_or(false, |l| l.is_relative()) { - self.base.y = Some(base.h); - } - } } /// Verify a single constraint. |
