Skip to content

Commit 0fc4ed2

Browse files
committed
SVG: allow more whitespace in SVG tranforms (references #76)
Between transform name (rotation, scale, translate, etc) and opening paren After opening paren and before closing paren The SVG spec specifies that this is allowed, and I confirmed that browsers allow it too Did not do the same for CSS url() and rgb() because those seem to work differently, even if the syntax looks similar
1 parent 5d72f34 commit 0fc4ed2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

format/svg/SVGData.hx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ class SVGData extends Group {
3030
private static inline var TAN22:Float = 0.4142135623730950488016887242097;
3131
private static var mStyleSplit = ~/;/g;
3232
private static var mStyleValue = ~/\s*(.*)\s*:\s*(.*)\s*/;
33-
private static var mTranslateMatch = ~/translate\((.*)[, ](.*)\)/;
34-
private static var mScaleMatch = ~/scale\((.*)\)/;
35-
private static var mMatrixMatch = ~/matrix\((.*?)[, ]+(.*?)[, ]+(.*?)[, ]+(.*?)[, ]+(.*?)[, ]+(.*?)\)/;
36-
private static var mRotationMatch = ~/rotate\((-?[0-9\.]+)(?:\s*,)?\s*(-?[0-9\.]+)?(?:\s*,)?\s*(-?[0-9\.]+)?\)/;
33+
private static var mTranslateMatch = ~/translate\s*\((.*)[, ](.*)\)/;
34+
private static var mScaleMatch = ~/scale\s*\((.*)\)/;
35+
private static var mMatrixMatch = ~/matrix\s*\((.*?)[, ]+(.*?)[, ]+(.*?)[, ]+(.*?)[, ]+(.*?)[, ]+(.*?)\)/;
36+
private static var mRotationMatch = ~/rotate\s*\(\s*(-?[0-9\.]+)(?:\s*,)?\s*(-?[0-9\.]+)?(?:\s*,)?\s*(-?[0-9\.]+)?\s*\)/;
3737
private static var mURLMatch = ~/url\(('|"?)#(.*)\1\)/;
3838
private static var mRGBMatch = ~/rgb\s*\(\s*(\d+)\s*(%)?\s*,\s*(\d+)\s*(%)?\s*,\s*(\d+)\s*(%)?\s*\)/;
3939
private static var defaultFill = FillSolid(0x000000);

0 commit comments

Comments
 (0)