Skip to content

Commit

Permalink
fix(axes): Fix vector transformation for content
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes-wolf committed Jul 23, 2024
1 parent 5e568f5 commit 60ec38f
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 60ec38f

Please sign in to comment.