diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-06-11 14:42:20 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-06-11 14:42:20 +0200 |
| commit | 4017b5a9f67e06145129d75de452c8a42e2d2f5a (patch) | |
| tree | 8ce9c6f80faa75ed62d4f7fbe31d3ceee6e8d4ba /src/library | |
| parent | 4dbd9285c91d59d527f4324df4aaf239ecb007ca (diff) | |
Push some nodes directly into the stack
Diffstat (limited to 'src/library')
| -rw-r--r-- | src/library/grid.rs | 2 | ||||
| -rw-r--r-- | src/library/image.rs | 2 | ||||
| -rw-r--r-- | src/library/pad.rs | 2 | ||||
| -rw-r--r-- | src/library/shapes.rs | 8 | ||||
| -rw-r--r-- | src/library/stack.rs | 2 |
5 files changed, 8 insertions, 8 deletions
diff --git a/src/library/grid.rs b/src/library/grid.rs index cfe46bf4..79070e79 100644 --- a/src/library/grid.rs +++ b/src/library/grid.rs @@ -47,7 +47,7 @@ pub fn grid(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { .map(|child| ctx.exec_template_stack(child).into()) .collect(); - ctx.push(GridNode { + ctx.push_into_stack(GridNode { column_dir: column_dir.unwrap_or(ctx.state.lang.dir), children, tracks: Gen::new(columns.clone(), rows.clone()), diff --git a/src/library/image.rs b/src/library/image.rs index 7fabfe35..e926b955 100644 --- a/src/library/image.rs +++ b/src/library/image.rs @@ -33,7 +33,7 @@ pub fn image(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { Value::template("image", move |ctx| { if let Some(node) = node { - ctx.push(node); + ctx.push_into_par(node); } }) } diff --git a/src/library/pad.rs b/src/library/pad.rs index 6b944c9c..5fa56567 100644 --- a/src/library/pad.rs +++ b/src/library/pad.rs @@ -32,6 +32,6 @@ pub fn pad(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { Value::template("pad", move |ctx| { let child = ctx.exec_template_stack(&body).into(); - ctx.push(PadNode { padding, child }); + ctx.push_into_stack(PadNode { padding, child }); }) } diff --git a/src/library/shapes.rs b/src/library/shapes.rs index 287b1c10..3c6f801d 100644 --- a/src/library/shapes.rs +++ b/src/library/shapes.rs @@ -67,13 +67,13 @@ fn rect_impl( let fixed = FixedNode { width, height, child: stack.into() }; if let Some(color) = fill { - ctx.push(BackgroundNode { + ctx.push_into_par(BackgroundNode { shape: BackgroundShape::Rect, fill: Fill::Color(color), child: fixed.into(), }); } else { - ctx.push(fixed); + ctx.push_into_par(fixed); } }) } @@ -151,13 +151,13 @@ fn ellipse_impl( }; if let Some(color) = fill { - ctx.push(BackgroundNode { + ctx.push_into_par(BackgroundNode { shape: BackgroundShape::Ellipse, fill: Fill::Color(color), child: fixed.into(), }); } else { - ctx.push(fixed); + ctx.push_into_par(fixed); } }) } diff --git a/src/library/stack.rs b/src/library/stack.rs index 03bdc6a1..672cfbef 100644 --- a/src/library/stack.rs +++ b/src/library/stack.rs @@ -31,7 +31,7 @@ pub fn stack(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { }) .collect(); - ctx.push(StackNode { + ctx.push_into_stack(StackNode { dirs: Gen::new(ctx.state.lang.dir, dir), aspect: None, children, |
