diff --git a/src/canvas.typ b/src/canvas.typ index bb4ca973..9fd07cc2 100644 --- a/src/canvas.typ +++ b/src/canvas.typ @@ -32,6 +32,8 @@ } assert(length / 1cm != 0, message: "Canvas length must be != 0!") + assert(not float.is-infinite(length / 1cm), + message: "Length must not be infinite!") let ctx = ( version: version.version, diff --git a/src/path-util.typ b/src/path-util.typ index 02af4b81..5a07c00f 100644 --- a/src/path-util.typ +++ b/src/path-util.typ @@ -260,7 +260,7 @@ } } - let segment = segment-at-t(segments, t, samples: samples, rev: rev) + let segment = segment-at-t(segments, t, samples: samples, rev: rev, clamp: true) return if segment != none { let (distance, segment, length, ..) = segment _point-on-segment(segment, if rev { length - distance } else { distance }, samples: samples, extrapolate: extrapolate) diff --git a/tests/decorations/path/test.typ b/tests/decorations/path/test.typ index 9090fdc1..431cf38e 100644 --- a/tests/decorations/path/test.typ +++ b/tests/decorations/path/test.typ @@ -90,3 +90,11 @@ wave(line((0,0), (4,0)), segments: 1) }) + +// Bug #757: Coil only works with specific order +#block(width: 10cm, canvas(length:10cm,{ + import draw: * + let a = (1, 0) + let b = (0.12, 0.3) + coil(hobby(b,a),amplitude:0.051,segment-length:0.05112,align:"MID") +}))