diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-03-11 10:48:29 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-03-11 10:48:29 +0100 |
| commit | c1b1dbcc0925ba1730fabbfbca3c8b99831c5561 (patch) | |
| tree | 6e4cb30753729c699bd899a7f2ec352e276beee8 /src/library/shapes.rs | |
| parent | 4e5f85aa4ac0d6b51323bb2a6e1fbd3f4f46babb (diff) | |
Better expansion behaviour 🐪
This makes expansion behaviour inheritable by placing it into the area and passing it down during layouting instead of computing some approximation of what we want during execution.
Diffstat (limited to 'src/library/shapes.rs')
| -rw-r--r-- | src/library/shapes.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/library/shapes.rs b/src/library/shapes.rs index 5e638c01..9c466318 100644 --- a/src/library/shapes.rs +++ b/src/library/shapes.rs @@ -26,17 +26,13 @@ pub fn box_(ctx: &mut EvalContext, args: &mut ValueArgs) -> Value { let color = args.get(ctx, "color"); let body = args.find::<ValueTemplate>(ctx).unwrap_or_default(); - let fill_if = |c| if c { Expansion::Fill } else { Expansion::Fit }; - let expand = Spec::new(fill_if(width.is_some()), fill_if(height.is_some())); - Value::template("box", move |ctx| { let snapshot = ctx.state.clone(); ctx.set_dirs(Gen::new(main, cross)); - let child = ctx.exec_body(&body, expand); + let child = ctx.exec(&body); let fixed = NodeFixed { width, height, child }; - if let Some(color) = color { ctx.push(NodeBackground { fill: Fill::Color(color), |
