mathandy / svgpathtools

A collection of tools for manipulating and analyzing SVG Path objects and Bezier curves.
MIT License
557 stars 142 forks source link

negative scale breaks arc sweep #200

Closed SebKuzminsky closed 1 year ago

SebKuzminsky commented 1 year ago

Here's an SVG that demonstrates the problem:

<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100mm" height="100mm" viewBox="-100 -200 500 500" xmlns="http://www.w3.org/2000/svg" version="
1.1">
    <g id="Sketch" transform="scale(1,-1)">
        <path id="slot" d="
            M 0 10
            L 0 80
            A 30 30 0 1 0 0 140
            A 10 10 0 0 1 0 100
            L 100 100
            A 10 10 0 1 1 100 140
            A 30 30 0 0 0 100 80
            L 100 10
            A 10 10 0 0 0 90 0
            L 10 0
            A 10 10 0 0 0 0 10
        " stroke="#ff0000" stroke-width="0.35 px"/>
    </g>
</svg>

Note the group transform, with a negative Y scale.

The SVG renders like this: Screenshot from 2023-05-05 00-39-28

When loaded into svgpathtools, the arcs are all inside out (wrong sweep): Screenshot from 2023-05-05 00-41-47

This is the same bug as #111, which was fixed in #112 and then broken again in baba1d18b2c804e48a35dadb8147178498f71aec back in 1.4.2.