diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-02-12 16:38:14 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-02-12 16:38:18 +0100 |
| commit | ebbee6274cafa6865a0d9123b78cae305c3c12aa (patch) | |
| tree | b3c982a5a46a3dcfc8cce642eacf252a0901f183 | |
| parent | 6260878245bdf81d7b928777e4fc1018c6651878 (diff) | |
Fix square base
| -rw-r--r-- | library/src/layout/grid.rs | 2 | ||||
| -rw-r--r-- | library/src/visualize/shape.rs | 6 | ||||
| -rw-r--r-- | tests/ref/bugs/square-base.png | bin | 0 -> 150 bytes | |||
| -rw-r--r-- | tests/ref/visualize/shape-square.png | bin | 18061 -> 18059 bytes | |||
| -rw-r--r-- | tests/typ/bugs/square-base.typ | 5 |
5 files changed, 9 insertions, 4 deletions
diff --git a/library/src/layout/grid.rs b/library/src/layout/grid.rs index d488430f..da8c4fca 100644 --- a/library/src/layout/grid.rs +++ b/library/src/layout/grid.rs @@ -321,7 +321,7 @@ impl<'a, 'v> GridLayouter<'a, 'v> { let rcols = vec![Abs::zero(); cols.len()]; let lrows = vec![]; - // We use the regions for auto row measurement. Since at that moment, + // We use these regions for auto row measurement. Since at that moment, // columns are already sized, we can enable horizontal expansion. let mut regions = regions.clone(); regions.expand = Axes::new(true, false); diff --git a/library/src/visualize/shape.rs b/library/src/visualize/shape.rs index e6cb55f5..c0c81bf5 100644 --- a/library/src/visualize/shape.rs +++ b/library/src/visualize/shape.rs @@ -556,7 +556,7 @@ fn layout( // Pad the child. let child = child.clone().padded(inset.map(|side| side.map(Length::from))); - let mut pod = Regions::one(regions.first, regions.base, regions.expand); + let pod = Regions::one(regions.first, regions.base, regions.expand); frame = child.layout(vt, styles, pod)?.into_frame(); // Relayout with full expansion into square region to make sure @@ -571,8 +571,8 @@ fn layout( desired.min(regions.first.x).min(regions.first.y) }; - pod.first = Size::splat(length); - pod.expand = Axes::splat(true); + let size = Size::splat(length); + let pod = Regions::one(size, size, Axes::splat(true)); frame = child.layout(vt, styles, pod)?.into_frame(); } } else { diff --git a/tests/ref/bugs/square-base.png b/tests/ref/bugs/square-base.png Binary files differnew file mode 100644 index 00000000..290ee54e --- /dev/null +++ b/tests/ref/bugs/square-base.png diff --git a/tests/ref/visualize/shape-square.png b/tests/ref/visualize/shape-square.png Binary files differindex 3d81f2ed..e8433a56 100644 --- a/tests/ref/visualize/shape-square.png +++ b/tests/ref/visualize/shape-square.png diff --git a/tests/typ/bugs/square-base.typ b/tests/typ/bugs/square-base.typ new file mode 100644 index 00000000..d8339c1a --- /dev/null +++ b/tests/typ/bugs/square-base.typ @@ -0,0 +1,5 @@ +// Test that square sets correct base for its content. + +--- +#set page(height: 80pt) +#square(width: 40%, rect(width: 60%, height: 80%)) |
