diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-03-19 17:57:31 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-03-19 17:57:31 +0100 |
| commit | 264a7dedd42e27cd9e604037640cf0594b2ec46b (patch) | |
| tree | d26feea399d54bb86bd44878f40293983bf5251d /src/library/shapes.rs | |
| parent | ca3df70e2a5069832d7d2135967674c34a155442 (diff) | |
Scheduled maintenance 🔨
- New naming scheme
- TextNode instead of NodeText
- CallExpr instead of ExprCall
- ...
- Less glob imports
- Removes Value::Args variant
- Removes prelude
- Renames Layouted to Fragment
- Moves font into env
- Moves shaping into layout
- Moves frame into separate module
Diffstat (limited to 'src/library/shapes.rs')
| -rw-r--r-- | src/library/shapes.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/library/shapes.rs b/src/library/shapes.rs index 48bc7ebd..211a4f2e 100644 --- a/src/library/shapes.rs +++ b/src/library/shapes.rs @@ -1,4 +1,5 @@ use super::*; +use crate::layout::{BackgroundNode, Fill, FixedNode}; /// `rect`: Create a rectangular box. /// @@ -21,13 +22,13 @@ use super::*; /// - `rtl` (right to left) /// - `ttb` (top to bottom) /// - `btt` (bottom to top) -pub fn rect(ctx: &mut EvalContext, args: &mut ValueArgs) -> Value { +pub fn rect(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { let width = args.get(ctx, "width"); let height = args.get(ctx, "height"); let main = args.get(ctx, "main-dir"); let cross = args.get(ctx, "cross-dir"); let fill = args.get(ctx, "fill"); - let body = args.find::<ValueTemplate>(ctx).unwrap_or_default(); + let body = args.find::<TemplateValue>(ctx).unwrap_or_default(); Value::template("box", move |ctx| { let snapshot = ctx.state.clone(); @@ -35,9 +36,9 @@ pub fn rect(ctx: &mut EvalContext, args: &mut ValueArgs) -> Value { ctx.set_dirs(Gen::new(main, cross)); let child = ctx.exec(&body).into(); - let fixed = NodeFixed { width, height, child }; + let fixed = FixedNode { width, height, child }; if let Some(color) = fill { - ctx.push(NodeBackground { + ctx.push(BackgroundNode { fill: Fill::Color(color), child: fixed.into(), }); |
