Fix place base

This commit is contained in:
Laurenz 2023-02-12 13:23:40 +01:00
parent fea238921f
commit 8cbc2ac483
3 changed files with 8 additions and 1 deletions

View File

@ -78,7 +78,7 @@ impl Layout for MoveNode {
let mut fragment = self.body.layout(vt, styles, regions)?;
for frame in &mut fragment {
let delta = self.delta.resolve(styles);
let delta = delta.zip(frame.size()).map(|(d, s)| d.relative_to(s));
let delta = delta.zip(regions.base).map(|(d, s)| d.relative_to(s));
frame.translate(delta.to_point());
}
Ok(fragment)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,7 @@
// Test that placement is relative to container and not itself.
---
#set page(height: 80pt, margin: 0pt)
#place(right, dx: -70%, dy: 20%, [First])
#place(left, dx: 20%, dy: 60%, [Second])
#place(center + horizon, dx: 25%, dy: 25%, [Third])