diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-04-06 15:13:26 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-04-06 15:13:26 +0200 |
| commit | a73149767c82509b77ccf6996ab0b1125cc9c249 (patch) | |
| tree | 1e4d0e4671af93ea90b31d94a84c12ad9968d5e9 | |
| parent | 1e5a100d6a1cec71fe173009bd2b754ca0b5bd3f (diff) | |
Fix block child spacing
| -rw-r--r-- | library/src/layout/container.rs | 8 | ||||
| -rw-r--r-- | tests/ref/layout/container.png | bin | 20435 -> 21577 bytes | |||
| -rw-r--r-- | tests/typ/layout/container.typ | 11 |
3 files changed, 18 insertions, 1 deletions
diff --git a/library/src/layout/container.rs b/library/src/layout/container.rs index ef5fbe5d..9bf1bf87 100644 --- a/library/src/layout/container.rs +++ b/library/src/layout/container.rs @@ -362,6 +362,10 @@ impl Layout for BlockElem { pod.size.x = size.x; pod.expand = expand; + if expand.y { + pod.full = size.y; + } + // Generate backlog for fixed height. let mut heights = vec![]; 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.backlog = &heights[1..]; pod.last = None; diff --git a/tests/ref/layout/container.png b/tests/ref/layout/container.png Binary files differindex f016385b..0cd56b2d 100644 --- a/tests/ref/layout/container.png +++ b/tests/ref/layout/container.png diff --git a/tests/typ/layout/container.typ b/tests/typ/layout/container.typ index 8a711b10..8d4ec34b 100644 --- a/tests/typ/layout/container.typ +++ b/tests/typ/layout/container.typ @@ -10,7 +10,16 @@ Spaced \ 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( width: 50pt, height: 50pt, |
