summaryrefslogtreecommitdiff
path: root/src/layout
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-11-26 16:32:06 +0100
committerLaurenz <laurmaedje@gmail.com>2021-11-26 16:32:06 +0100
commit3a15922d2ffc041c3523edb479f008a9034fd400 (patch)
tree988fe103c0752696c1fade2123142a8db5361ab7 /src/layout
parent393d74f9bb0d4c71a69108d5be261103c39f47f3 (diff)
X/Y abstractions
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/constraints.rs18
-rw-r--r--src/layout/regions.rs2
2 files changed, 4 insertions, 16 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.
diff --git a/src/layout/regions.rs b/src/layout/regions.rs
index 0ef92543..66e6da17 100644
--- a/src/layout/regions.rs
+++ b/src/layout/regions.rs
@@ -51,7 +51,7 @@ impl Regions {
/// Whether the current region is full and a region break is called for.
pub fn is_full(&self) -> bool {
- Length::zero().fits(self.current.h) && !self.in_last()
+ Length::zero().fits(self.current.y) && !self.in_last()
}
/// Whether `current` is the last usable region.