fix Arc.sweep when transform scale flips it around (#112)

Fixes #111.
pull/114/head
Sebastian Kuzminsky 2020-06-19 19:29:36 -06:00 committed by GitHub
parent fd7348a1df
commit 8457dc01ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -275,8 +275,12 @@ def transform(curve, tf):
new_start = to_complex(tf.dot(to_point(curve.start)))
new_end = to_complex(tf.dot(to_point(curve.end)))
new_radius = to_complex(tf.dot(to_vector(curve.radius)))
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,
large_arc=curve.large_arc, sweep=curve.sweep, end=new_end)
large_arc=curve.large_arc, sweep=new_sweep, end=new_end)
else:
raise TypeError("Input `curve` should be a Path, Line, "
"QuadraticBezier, CubicBezier, or Arc object.")