summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-04-06 15:13:26 +0200
committerLaurenz <laurmaedje@gmail.com>2023-04-06 15:13:26 +0200
commita73149767c82509b77ccf6996ab0b1125cc9c249 (patch)
tree1e4d0e4671af93ea90b31d94a84c12ad9968d5e9
parent1e5a100d6a1cec71fe173009bd2b754ca0b5bd3f (diff)
Fix block child spacing
-rw-r--r--library/src/layout/container.rs8
-rw-r--r--tests/ref/layout/container.pngbin20435 -> 21577 bytes
-rw-r--r--tests/typ/layout/container.typ11
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
index f016385b..0cd56b2d 100644
--- a/tests/ref/layout/container.png
+++ b/tests/ref/layout/container.png
Binary files differ
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,