diff --git a/src/svg/SvgImport.js b/src/svg/SvgImport.js index e4ab3fc7d1..ed4f86aeee 100644 --- a/src/svg/SvgImport.js +++ b/src/svg/SvgImport.js @@ -281,10 +281,18 @@ new function() { // https://www.w3.org/TR/SVG/shapes.html#RectElement rect: function(node) { + var rx = getValue(node, 'rx', false, true, true); + var ry = getValue(node, 'ry', false, true, true); + if (rx === null && ry !== null) { + rx = ry; + } else if (ry === null && rx !== null) { + ry = rx; + } + var radius = rx !== null && ry !== null ? new Size(rx, ry) : null; return new Shape.Rectangle(new Rectangle( getPoint(node), getSize(node) - ), getSize(node, 'rx', 'ry')); + ), radius); }, // https://www.w3.org/TR/SVG/shapes.html#LineElement diff --git a/test/assets/rectangles.svg b/test/assets/rectangles.svg new file mode 100644 index 0000000000..a74bb62f63 --- /dev/null +++ b/test/assets/rectangles.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/test/tests/SvgImport.js b/test/tests/SvgImport.js index 3f8409a706..5443c55cd2 100644 --- a/test/tests/SvgImport.js +++ b/test/tests/SvgImport.js @@ -205,7 +205,8 @@ if (!isNodeContext) { 'gradients-1': {}, 'gradients-2': !isPhantomContext && {}, 'gradients-3': {}, - 'gradients-4': {} + 'gradients-4': {}, + 'rectangles': {} }; Base.each(svgFiles, function(options, name) { if (options) {