Skip to content

Commit

Permalink
Merge pull request #20 from cetz-package/transform-vector-fix
Browse files Browse the repository at this point in the history
fix(axes): Fix vector transformation for content
  • Loading branch information
johannes-wolf authored Jul 26, 2024
2 parents 5e568f5 + 60ec38f commit 8a5f065
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/axes.typ
Original file line number Diff line number Diff line change
Expand Up @@ -496,10 +496,6 @@

let (x, y, ..) = vec

if x < x-low or x > x-high or y < y-low or x > x-high {
return none
}

return (
(x - x-axis.min) * fx + ox,
(y - y-axis.min) * fy + oy,
Expand All @@ -523,11 +519,16 @@
ctx.transform = transform

drawables = drawables.map(d => {
d.segments = d.segments.map(((kind, ..pts)) => {
(kind, ..pts.map(pt => {
transform-vec(size, x, y, none, pt)
}))
})
if "segments" in d {
d.segments = d.segments.map(((kind, ..pts)) => {
(kind, ..pts.map(pt => {
transform-vec(size, x, y, none, pt)
}))
})
}
if "pos" in d {
d.pos = transform-vec(size, x, y, none, d.pos)
}
return d
})

Expand Down

0 comments on commit 8a5f065

Please sign in to comment.