summaryrefslogtreecommitdiff
path: root/src/layout
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-10-22 21:40:37 +0200
committerLaurenz <laurmaedje@gmail.com>2019-10-22 21:40:37 +0200
commitcff325b520727ac0eec46a3757831afaa0916cc1 (patch)
tree18cef7a7880fef41050678ab479818e0abb91f14 /src/layout
parent991e879e1d2ed53125dbff4edba80804ff28f2a9 (diff)
Add spacing functions 🔛
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/mod.rs9
-rw-r--r--src/layout/tree.rs2
2 files changed, 11 insertions, 0 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index 470ac3ba..34c9b35a 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -40,6 +40,15 @@ pub struct Layout {
}
impl Layout {
+ /// Create an empty layout with the specified dimensions.
+ pub fn empty(width: Size, height: Size) -> Layout {
+ Layout {
+ dimensions: Size2D::new(width, height),
+ actions: vec![],
+ debug_render: true,
+ }
+ }
+
/// Serialize this layout into an output buffer.
pub fn serialize<W: Write>(&self, f: &mut W) -> io::Result<()> {
writeln!(
diff --git a/src/layout/tree.rs b/src/layout/tree.rs
index 3a58115f..a0cb1434 100644
--- a/src/layout/tree.rs
+++ b/src/layout/tree.rs
@@ -124,6 +124,8 @@ impl<'a, 'p> TreeLayouter<'a, 'p> {
self.start_new_flex();
}
+ Command::AddFlex(layout) => self.flex.add(layout),
+
Command::SetAlignment(alignment) => {
self.finish_flex()?;
self.alignment = alignment;