summaryrefslogtreecommitdiff
path: root/src/layout/mod.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-10-16 21:58:22 +0200
committerLaurenz <laurmaedje@gmail.com>2019-10-16 21:58:22 +0200
commit58693486f97ddbb34595efa1a81a4e7b1d3204c9 (patch)
tree4e8c066928361df07d238c00c1cea997c4cdabc9 /src/layout/mod.rs
parentf2f05e07b0ff2d98e3c822b2618d02281ed1078c (diff)
Allow center alignment 📐
Diffstat (limited to 'src/layout/mod.rs')
-rw-r--r--src/layout/mod.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index b0fba4f2..a5dfa0ad 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -149,10 +149,7 @@ pub struct LayoutSpace {
impl LayoutSpace {
/// The actually usable area (dimensions minus padding).
pub fn usable(&self) -> Size2D {
- Size2D {
- x: self.dimensions.x - self.padding.left - self.padding.right,
- y: self.dimensions.y - self.padding.top - self.padding.bottom,
- }
+ self.dimensions.unpadded(self.padding)
}
}
@@ -161,6 +158,7 @@ impl LayoutSpace {
pub enum Alignment {
Left,
Right,
+ Center,
}
/// The error type for layouting.