Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

group: Transform bounding box #490

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/draw/grouping.typ
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#import "/src/styles.typ"
#import "/src/drawable.typ"
#import "/src/vector.typ"
#import "/src/matrix.typ"
#import "/src/util.typ"
#import "/src/coordinate.typ"
#import "/src/aabb.typ"
Expand Down Expand Up @@ -206,6 +207,7 @@
let drawables = ()
let group-ctx = ctx
group-ctx.groups.push((anchors: (:)))
group-ctx.transform = matrix.ident()
(ctx: group-ctx, drawables, bounds) = process.many(group-ctx, if type(body) == function {body(ctx)} else {body})

// Apply bounds padding
Expand All @@ -221,7 +223,6 @@
// Calculate a bounding box path used for border
// anchor calculation.
let (center, width, height, path) = if bounds != none {
(bounds.low.at(1), bounds.high.at(1)) = (bounds.high.at(1), bounds.low.at(1))
let center = aabb.mid(bounds)
let (width, height, _) = aabb.size(bounds)
let path = drawable.path(
Expand All @@ -246,6 +247,7 @@
border-anchors: bounds != none,
radii: (width, height),
path: path,
transform: ctx.transform,
)
return (
ctx: ctx,
Expand Down
Loading