diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-10-13 18:33:10 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-10-23 20:22:47 +0200 |
| commit | 1e74f7c407e42174b631cb7477f3c88252da7e25 (patch) | |
| tree | 53c0510b6503c434c9ba470b188d9e737ce1c3cf /src/library/layout.rs | |
| parent | 5f4dde0a6b32c7620b29af30f69591cf3995af9b (diff) | |
New `ShapeNode`
Replaces `BackgroundNode` and `FixedNode`
Diffstat (limited to 'src/library/layout.rs')
| -rw-r--r-- | src/library/layout.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/library/layout.rs b/src/library/layout.rs index efa012b9..b98b08f1 100644 --- a/src/library/layout.rs +++ b/src/library/layout.rs @@ -1,5 +1,7 @@ use super::*; -use crate::layout::{FixedNode, GridNode, PadNode, StackChild, StackNode, TrackSizing}; +use crate::layout::{ + GridNode, PadNode, ShapeKind, ShapeNode, StackChild, StackNode, TrackSizing, +}; use crate::style::{Paper, PaperClass}; /// `page`: Configure pages. @@ -146,13 +148,15 @@ pub fn v(_: &mut EvalContext, args: &mut Args) -> TypResult<Value> { pub fn boxed(_: &mut EvalContext, args: &mut Args) -> TypResult<Value> { let width = args.named("width")?; let height = args.named("height")?; + let fill = args.named("fill")?; let body: Template = args.eat().unwrap_or_default(); Ok(Value::Template(Template::from_inline(move |style| { - FixedNode { + ShapeNode { + shape: ShapeKind::Rect, width, height, - aspect: None, - child: body.to_stack(style).into(), + fill: fill.map(Paint::Color), + child: Some(body.to_stack(style).into()), } }))) } |
