Skip to content

Commit

Permalink
Don’t crash when more than 2 values are given to translate and scale
Browse files Browse the repository at this point in the history
Fix #432.
  • Loading branch information
liZe committed Dec 7, 2024
1 parent 9a1bf51 commit abafa8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cairosvg/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,11 @@ def transform(surface, transform_string, gradient=None, transform_origin=None):
elif transformation_type == 'translate':
if len(values) == 1:
values += (0,)
matrix.translate(*values)
matrix.translate(*values[:2])
elif transformation_type == 'scale':
if len(values) == 1:
values = 2 * values
matrix.scale(*values)
matrix.scale(*values[:2])

if transform_origin:
matrix.translate(-float(origin_x), -float(origin_y))
Expand Down

0 comments on commit abafa8a

Please sign in to comment.