path.transform: Arc sweep is reversed by negative scale

When transforming an Arc, negative scale reverses the sweep.
pull/201/head
Sebastian Kuzminsky 2023-05-05 00:35:22 -06:00
parent 6abda09d1c
commit e94483510e
1 changed files with 6 additions and 2 deletions

View File

@ -338,9 +338,13 @@ def transform(curve, tf):
if new_radius.real == 0 or new_radius.imag == 0 : if new_radius.real == 0 or new_radius.imag == 0 :
return Line(new_start, new_end) return Line(new_start, new_end)
else : else:
if tf[0][0] * tf[1][1] >= 0.0:
new_sweep = curve.sweep
else:
new_sweep = not curve.sweep
return Arc(new_start, radius=new_radius, rotation=curve.rotation + rot, return Arc(new_start, radius=new_radius, rotation=curve.rotation + rot,
large_arc=curve.large_arc, sweep=curve.sweep, end=new_end, large_arc=curve.large_arc, sweep=new_sweep, end=new_end,
autoscale_radius=True) autoscale_radius=True)
else: else: