mirror of
https://github.com/typst/typst
synced 2025-05-13 12:36:23 +08:00
Fix square base
This commit is contained in:
parent
6260878245
commit
ebbee6274c
@ -321,7 +321,7 @@ impl<'a, 'v> GridLayouter<'a, 'v> {
|
|||||||
let rcols = vec![Abs::zero(); cols.len()];
|
let rcols = vec![Abs::zero(); cols.len()];
|
||||||
let lrows = vec![];
|
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.
|
// columns are already sized, we can enable horizontal expansion.
|
||||||
let mut regions = regions.clone();
|
let mut regions = regions.clone();
|
||||||
regions.expand = Axes::new(true, false);
|
regions.expand = Axes::new(true, false);
|
||||||
|
@ -556,7 +556,7 @@ fn layout(
|
|||||||
// Pad the child.
|
// Pad the child.
|
||||||
let child = child.clone().padded(inset.map(|side| side.map(Length::from)));
|
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();
|
frame = child.layout(vt, styles, pod)?.into_frame();
|
||||||
|
|
||||||
// Relayout with full expansion into square region to make sure
|
// 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)
|
desired.min(regions.first.x).min(regions.first.y)
|
||||||
};
|
};
|
||||||
|
|
||||||
pod.first = Size::splat(length);
|
let size = Size::splat(length);
|
||||||
pod.expand = Axes::splat(true);
|
let pod = Regions::one(size, size, Axes::splat(true));
|
||||||
frame = child.layout(vt, styles, pod)?.into_frame();
|
frame = child.layout(vt, styles, pod)?.into_frame();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
BIN
tests/ref/bugs/square-base.png
Normal file
BIN
tests/ref/bugs/square-base.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 150 B |
Binary file not shown.
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
5
tests/typ/bugs/square-base.typ
Normal file
5
tests/typ/bugs/square-base.typ
Normal file
@ -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%))
|
Loading…
x
Reference in New Issue
Block a user