diff --git a/src/draw/shapes.typ b/src/draw/shapes.typ index b4d369b1..22a46bc0 100644 --- a/src/draw/shapes.typ +++ b/src/draw/shapes.typ @@ -711,15 +711,15 @@ len in (1, 2), message: "Bezier curve expects 1 or 2 control points. Got " + str(len), ) - let coordinates = (start, end, ..ctrl) + let coordinates = (start, ..ctrl, end) // Coordinates check let t = coordinates.map(coordinate.resolve-system) return ( ctx => { - let (ctx, start, end, ..ctrl) = coordinate.resolve(ctx, ..coordinates) - + let (ctx, start, ..ctrl, end) = coordinate.resolve(ctx, ..coordinates) + if ctrl.len() == 1 { (start, end, ..ctrl) = bezier_.quadratic-to-cubic(start, end, ..ctrl) } diff --git a/tests/bezier/ref.png b/tests/bezier/ref.png new file mode 100644 index 00000000..4f42c9d6 Binary files /dev/null and b/tests/bezier/ref.png differ diff --git a/tests/bezier/test.typ b/tests/bezier/test.typ new file mode 100644 index 00000000..643636b1 --- /dev/null +++ b/tests/bezier/test.typ @@ -0,0 +1,12 @@ +#set page(width: auto, height: auto) +#import "/src/lib.typ": * + +/* Make sure the current position is set to the curves end point [236] */ +#block(stroke: 2pt + red, canvas(length: .5cm, { + import draw: * + + set-style(radius: .1) + circle((), fill: green) + bezier((0,0), (3, 0), (1,1), (2,-1)) + circle((), fill: red) +}))