fix(painter): implement SVG export for bezier curves#5568
fix(painter): implement SVG export for bezier curves#5568kartikktripathi wants to merge 2 commits intosugarlabs:masterfrom
Conversation
|
✅ All Jest tests passed! This PR is ready to merge. |
|
Hey @walterbender, I’ve opened a small fix that implements the missing SVG export in Painter.doBezier() (note the FIXME). It keeps behaviour unchanged and only makes exported SVG match the canvas output. Would appreciate a quick look whenever you have time. |
|
Thanks, I see the issue. The SVG curve is being generated using turtle-space angles, while the canvas Bézier uses screen-space coordinates, which causes a geometry mismatch in vector renderers like Inkscape. I’ll adjust the control-point/heading calculations to use consistent coordinate space so the exported SVG matches the canvas exactly. |
|
✅ All Jest tests passed! This PR is ready to merge. |
|
The previous SVG continued the Bézier from the prior path segment, which changed the starting tangent. |
|
The exported SVG seemed to assume an X,Y starting position of 0,0 in both cases. |




Summary
Painter.doBezier()rendered curves correctly on the canvas but did not generate SVG output, leaving exported artwork incomplete and inconsistent with on-screen drawings. This patch implements SVG path generation for Bézier curves and extends hollow stroke handling to match the behaviour already used by line and arc rendering. The change ensures that exported SVG faithfully reproduces canvas output.Changes
Generate SVG
Ccommands using scaled turtle coordinates:Replicates the same outline logic used in
_move()and_arc():This preserves stroke thickness in SVG instead of exporting a centerline.
// FIXME: Add SVG outputTesting
Verified that canvas output matches exported SVG:
Thanks!