Skip to content

Commit

Permalink
Don't add center or default anchors to groups with no bounds (#503)
Browse files Browse the repository at this point in the history
  • Loading branch information
fenjalien authored Feb 13, 2024
1 parent 15961fa commit c02d976
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/draw/grouping.typ
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,14 @@
let anchors = group-ctx.groups.last().anchors

let (transform, anchors) = anchor_.setup(
anchor => ((center: center, default: center) + anchors).at(anchor),
(anchors.keys() + ("center",)).dedup(),
anchor => (
if bounds != none {
(center: center, default: center)
} + anchors
).at(anchor),
(anchors.keys() + if bounds != none { ("center",) }).dedup(),
name: name,
default: if bounds != none { "default" },
default: if bounds != none or "default" in anchors { "default" },
offset-anchor: anchor,
path-anchors: bounds != none,
border-anchors: bounds != none,
Expand Down
14 changes: 14 additions & 0 deletions tests/group/empty/test.typ
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,17 @@
group(none)
group(ctx => none)
})

#test-case({
import draw: *
group({
group(name: "group-1", none)
copy-anchors("group-1")
})
group({
group(name: "group-2", {
anchor("default", (0,1))
})
copy-anchors("group-2")
})
})

0 comments on commit c02d976

Please sign in to comment.