From 099b6adfcba671e5c859f4875e765dcfd420a2ed Mon Sep 17 00:00:00 2001 From: Sam Thomson Date: Thu, 30 Jul 2015 16:18:24 +0100 Subject: [PATCH] Fixes #366 --- src/sugar.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/sugar.js b/src/sugar.js index 4b7b232..669b809 100644 --- a/src/sugar.js +++ b/src/sugar.js @@ -10,7 +10,7 @@ var sugar = { /* Add sugar for fill and stroke */ ;['fill', 'stroke'].forEach(function(m) { var i, extension = {} - + extension[m] = function(o) { if (typeof o == 'string' || SVG.Color.isRgb(o) || (o && typeof o.fill === 'function')) this.attr(m, o) @@ -20,12 +20,12 @@ var sugar = { for (i = sugar[m].length - 1; i >= 0; i--) if (o[sugar[m][i]] != null) this.attr(sugar.prefix(m, sugar[m][i]), o[sugar[m][i]]) - + return this } - + SVG.extend(SVG.Element, SVG.FX, extension) - + }) SVG.extend(SVG.Element, SVG.FX, { @@ -76,8 +76,9 @@ SVG.extend(SVG.Element, SVG.FX, { SVG.extend(SVG.Rect, SVG.Ellipse, SVG.Circle, SVG.Gradient, SVG.FX, { // Add x and y radius radius: function(x, y) { - return (this.target || this).type == 'radial' ? - this.attr({ r: new SVG.Number(x) }) : + var type = (this.target || this).type; + return type == 'radial' || type == 'circle' ? + this.attr({ 'r': new SVG.Number(x) }) : this.rx(x).ry(y == null ? x : y) } }) @@ -94,7 +95,7 @@ SVG.extend(SVG.Path, { }) SVG.extend(SVG.Parent, SVG.Text, SVG.FX, { - // Set font + // Set font font: function(o) { for (var k in o) k == 'leading' ? @@ -104,7 +105,7 @@ SVG.extend(SVG.Parent, SVG.Text, SVG.FX, { k == 'size' || k == 'family' || k == 'weight' || k == 'stretch' || k == 'variant' || k == 'style' ? this.attr('font-'+ k, o[k]) : this.attr(k, o[k]) - + return this } }) -- 2.39.5