diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-10-16 11:39:26 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-10-23 20:22:47 +0200 |
| commit | 6690bc23545bfe7275ad92de9e6bd11b7345caf4 (patch) | |
| tree | e116a23f2f04b3053160aae09088830fdb21460f /src/library | |
| parent | 1e74f7c407e42174b631cb7477f3c88252da7e25 (diff) | |
Revise block node contract
Frames produced by block nodes are now always treated as exactly one per
given region and a frame must not be larger than its respective region.
Any overflow must be handled internally. This means that stack and grid
don't need to search for fitting regions anymore, since the child has
already does that for them. This commit further moves stack spacing into
a new `SpacingNode`.
Diffstat (limited to 'src/library')
| -rw-r--r-- | src/library/layout.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/library/layout.rs b/src/library/layout.rs index b98b08f1..ffe8bc69 100644 --- a/src/library/layout.rs +++ b/src/library/layout.rs @@ -209,7 +209,7 @@ pub fn stack(_: &mut EvalContext, args: &mut Args) -> TypResult<Value> { } let dir = args.named("dir")?.unwrap_or(Dir::TTB); - let spacing = args.named("spacing")?; + let spacing = args.named::<Linear>("spacing")?; let list: Vec<Child> = args.all().collect(); Ok(Value::Template(Template::from_block(move |style| { @@ -220,16 +220,16 @@ pub fn stack(_: &mut EvalContext, args: &mut Args) -> TypResult<Value> { for child in &list { match child { Child::Spacing(v) => { - children.push(StackChild::Spacing(*v)); + children.push(StackChild::spacing(*v, dir.axis())); delayed = None; } Child::Any(template) => { if let Some(v) = delayed { - children.push(StackChild::Spacing(v)); + children.push(StackChild::spacing(v, dir.axis())); } - let node = template.to_stack(style).into(); - children.push(StackChild::Any(node, style.aligns.block)); + let node = template.to_stack(style); + children.push(StackChild::new(node, style.aligns.block)); delayed = spacing; } } |
