summaryrefslogtreecommitdiff
path: root/library/src/layout/stack.rs
diff options
context:
space:
mode:
Diffstat (limited to 'library/src/layout/stack.rs')
-rw-r--r--library/src/layout/stack.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/library/src/layout/stack.rs b/library/src/layout/stack.rs
index f83f4e41..c423b1a3 100644
--- a/library/src/layout/stack.rs
+++ b/library/src/layout/stack.rs
@@ -40,6 +40,26 @@ impl StackNode {
}
.pack())
}
+
+ fn field(&self, name: &str) -> Option<Value> {
+ match name {
+ "dir" => Some(Value::dynamic(self.dir)),
+ "spacing" => Some(match self.spacing {
+ Some(spacing) => spacing.encode(),
+ None => Value::None,
+ }),
+ "items" => Some(Value::Array(
+ self.children
+ .iter()
+ .map(|child| match child {
+ StackChild::Spacing(spacing) => spacing.encode(),
+ StackChild::Block(content) => Value::Content(content.clone()),
+ })
+ .collect(),
+ )),
+ _ => None,
+ }
+ }
}
impl Layout for StackNode {