Skip to content

Commit

Permalink
hotfix: Fix path anchors for circles/ellipses
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes-wolf committed Jan 16, 2024
1 parent 3729d63 commit c415a9d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/draw/shapes.typ
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
border-anchors: true,
path-anchors: true,
center: (cx, cy, cz),
radii: (rx, ry),
radii: (rx*2, ry*2),
path: drawables.first(),
)

Expand Down Expand Up @@ -147,7 +147,7 @@
border-anchors: true,
path-anchors: true,
center: center,
radii: (r, r),
radii: (r*2, r*2),
path: drawables.first(),
)

Expand Down
Binary file modified tests/anchor/path-anchors/ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 14 additions & 5 deletions tests/anchor/path-anchors/test.typ
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#set page(width: auto, height: auto)
#import "/src/lib.typ": *

#let display(body, ..args) = {
#let display(body, ..args, angle: false) = {
import draw: *

// Fixed distance
Expand All @@ -16,6 +16,15 @@
for i in (0%, 25%, 50%, 75%, 100%) {
circle((name: "elem", anchor: i), radius: .1)
}

if angle {
set-origin((3,0))

(body)(..args, name: "elem");
for i in (0deg, 45deg, 90deg, 170deg, 180deg) {
circle((name: "elem", anchor: i), radius: .1)
}
}
}

#box(stroke: 2pt + red, canvas(length: 1cm, {
Expand All @@ -25,12 +34,12 @@

#box(stroke: 2pt + red, canvas(length: 1cm, {
import draw: *
display(circle, (0,0))
display(circle, (0,0), angle: true)
}))

#box(stroke: 2pt + red, canvas(length: 1cm, {
import draw: *
display(circle-through, (-1,0), (0,1), (1,0))
display(circle-through, (-1,0), (0,1), (1,0), angle: true)
}))

#box(stroke: 2pt + red, canvas(length: 1cm, {
Expand Down Expand Up @@ -62,7 +71,7 @@

#box(stroke: 2pt + red, canvas(length: 1cm, {
import draw: *
display(rect, (-1,-1), (1,1))
display(rect, (-1,-1), (1,1), angle: true)
}))

#box(stroke: 2pt + red, canvas(length: 1cm, {
Expand Down Expand Up @@ -95,7 +104,7 @@
display(group, {
circle((0,0), radius: .5)
circle((1,1), radius: .7)
})
}, angle: true)
}))

#box(stroke: 2pt + red, canvas(length: 1cm, {
Expand Down

0 comments on commit c415a9d

Please sign in to comment.