Commit 8d301de9 authored by Tebjan Halm's avatar Tebjan Halm
Browse files

Merge pull request #22 from joye-ramone/master

Fixed issue with translate(x,y) transformation parsing in SvgTransformConverter
parents 6a17e694 dcafe786
......@@ -60,14 +60,21 @@ namespace Svg.Transforms
case "translate":
string[] coords = contents.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
if (coords.Length != 2)
if (coords.Length == 0 || coords.Length > 2)
{
throw new FormatException("Translate transforms must be in the format 'translate(x, y)'");
throw new FormatException("Translate transforms must be in the format 'translate(x [,y])'");
}
float x = float.Parse(coords[0].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture);
float y = float.Parse(coords[1].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture);
transformList.Add(new SvgTranslate(x, y));
if (coords.Length > 1)
{
float y = float.Parse(coords[1].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture);
transformList.Add(new SvgTranslate(x, y));
}
else
{
transformList.Add(new SvgTranslate(x));
}
break;
case "rotate":
string[] args = contents.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
......@@ -201,4 +208,4 @@ namespace Svg.Transforms
return base.ConvertTo(context, culture, value, destinationType);
}
}
}
\ No newline at end of file
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment