diff options
| author | Emmanuel Lesueur <48604057+Emm54321@users.noreply.github.com> | 2025-02-26 19:07:29 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-26 18:07:29 +0000 |
| commit | 52f1f53973414be72bf22c3253ab365f8db067df (patch) | |
| tree | bd2c3f2d5871466101797fd9cc3977caaf13d5c3 | |
| parent | d6b0d68ffa4963459f52f7d774080f1f128841d4 (diff) | |
Fix curve with multiple non-closed components. (#5963)
| -rw-r--r-- | crates/typst-layout/src/shapes.rs | 1 | ||||
| -rw-r--r-- | tests/ref/curve-multiple-non-closed.png | bin | 0 -> 85 bytes | |||
| -rw-r--r-- | tests/suite/visualize/curve.typ | 10 |
3 files changed, 11 insertions, 0 deletions
diff --git a/crates/typst-layout/src/shapes.rs b/crates/typst-layout/src/shapes.rs index 21d0a518..7ab41e9d 100644 --- a/crates/typst-layout/src/shapes.rs +++ b/crates/typst-layout/src/shapes.rs @@ -284,6 +284,7 @@ impl<'a> CurveBuilder<'a> { self.last_point = point; self.last_control_from = point; self.is_started = true; + self.is_empty = true; } /// Add a line segment. diff --git a/tests/ref/curve-multiple-non-closed.png b/tests/ref/curve-multiple-non-closed.png Binary files differnew file mode 100644 index 00000000..f4332e36 --- /dev/null +++ b/tests/ref/curve-multiple-non-closed.png diff --git a/tests/suite/visualize/curve.typ b/tests/suite/visualize/curve.typ index f98f634a..14a1c0cc 100644 --- a/tests/suite/visualize/curve.typ +++ b/tests/suite/visualize/curve.typ @@ -38,6 +38,16 @@ curve.close(mode: "smooth"), ) +--- curve-multiple-non-closed --- +#curve( + stroke: 2pt, + curve.line((20pt, 0pt)), + curve.move((0pt, 10pt)), + curve.line((20pt, 10pt)), + curve.move((0pt, 20pt)), + curve.line((20pt, 20pt)), +) + --- curve-line --- #curve( fill: purple, |
