Fix block child spacing

This commit is contained in:
Laurenz 2023-04-06 15:13:26 +02:00
parent 1e5a100d6a
commit a73149767c
3 changed files with 18 additions and 1 deletions

View File

@ -362,6 +362,10 @@ impl Layout for BlockElem {
pod.size.x = size.x; pod.size.x = size.x;
pod.expand = expand; pod.expand = expand;
if expand.y {
pod.full = size.y;
}
// Generate backlog for fixed height. // Generate backlog for fixed height.
let mut heights = vec![]; let mut heights = vec![];
if sizing.y.is_custom() { if sizing.y.is_custom() {
@ -375,6 +379,10 @@ impl Layout for BlockElem {
} }
} }
if let Some(last) = heights.last_mut() {
*last += remaining;
}
pod.size.y = heights[0]; pod.size.y = heights[0];
pod.backlog = &heights[1..]; pod.backlog = &heights[1..];
pod.last = None; pod.last = None;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -10,7 +10,16 @@ Spaced \
Apart Apart
--- ---
// Test box sizing. // Test block sizing.
#set page(height: 120pt)
#set block(spacing: 0pt)
#block(width: 90pt, height: 80pt, fill: red)[
#block(width: 60%, height: 60%, fill: green)
#block(width: 50%, height: 60%, fill: blue)
]
---
// Test box sizing with layoutable child.
#box( #box(
width: 50pt, width: 50pt,
height: 50pt, height: 50pt,