summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-02-07 13:14:28 +0100
committerLaurenz <laurmaedje@gmail.com>2021-02-07 13:14:28 +0100
commitc80e13579f3e6ca8fb1aac5a6d423d902747368d (patch)
treeee62a7b7517acd16e9b2b5133c7ad1bdceff0d3c /src/library
parentbfc2f5aefc6c407de0b699b31dafd835fc2c9be3 (diff)
Dry-clean visitor with a macro 🏜
Diffstat (limited to 'src/library')
-rw-r--r--src/library/layout.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/library/layout.rs b/src/library/layout.rs
index 2812a48f..e4839953 100644
--- a/src/library/layout.rs
+++ b/src/library/layout.rs
@@ -175,7 +175,16 @@ impl Display for Alignment {
/// # Named arguments
/// - Width of the box: `width`, of type `linear` relative to parent width.
/// - Height of the box: `height`, of type `linear` relative to parent height.
+/// - Main layouting direction: `main-dir`, of type `direction`.
+/// - Cross layouting direction: `cross-dir`, of type `direction`.
/// - Background color of the box: `color`, of type `color`.
+///
+/// # Relevant types and constants
+/// - Type `direction`
+/// - `ltr` (left to right)
+/// - `rtl` (right to left)
+/// - `ttb` (top to bottom)
+/// - `btt` (bottom to top)
pub fn box_(ctx: &mut EvalContext, args: &mut Args) -> Value {
let snapshot = ctx.state.clone();
@@ -210,13 +219,12 @@ pub fn box_(ctx: &mut EvalContext, args: &mut Args) -> Value {
if let Some(color) = color {
ctx.push(NodeBackground {
fill: Fill::Color(color),
- child: Node::Any(fixed_node.into()),
+ child: fixed_node.into(),
})
} else {
ctx.push(fixed_node);
}
-
ctx.state = snapshot;
Value::None
}