diff options
-rw-r--r-- | src/container.js | 36 | ||||
-rw-r--r-- | src/element.js | 7 |
2 files changed, 30 insertions, 13 deletions
diff --git a/src/container.js b/src/container.js index 339e554..b45f184 100644 --- a/src/container.js +++ b/src/container.js @@ -90,21 +90,33 @@ SVG.Container = { }, circle: function(v) { - return this.place(new SVG.Circle(), { - x: v != null ? v.x : void 0, - y: v != null ? v.y : void 0, - width: (v != null ? (v.width || v.r || v.radius) : void 0), - height: null - }); + var g; + + if (v != null) { + g = { x: v.x, y: v.y }; + + if (v.r || v.radius) + g.width = g.height = (v.r || v.radius) * 2; + else + g.width = g.height = v.width || v.height; + } + + return this.place(new SVG.Circle(), g); }, ellipse: function(v) { - return this.place(new SVG.Ellipse(), { - x: v != null ? v.x : void 0, - y: v != null ? v.y : void 0, - width: (v != null ? (v.width || v.rx || v.radiusX) : void 0), - height: (v != null ? (v.height || v.ry || v.radiusY) : void 0) - }); + var g; + + if (v != null) { + g = { x: v.x, y: v.y }; + + if (v.width) g.width = v.width; + if (v.height) g.height = v.height; + if (v.rx) g.width = v.rx * 2; + if (v.ry) g.height = v.ry * 2; + } + + return this.place(new SVG.Ellipse(), g); }, path: function(v) { diff --git a/src/element.js b/src/element.js index d38e323..bf729cd 100644 --- a/src/element.js +++ b/src/element.js @@ -84,4 +84,9 @@ SVG.Element.prototype._findParent = function(pt) { }; // include the dispatcher object -SVG.Element.include(SVG.Dispatcher);
\ No newline at end of file +SVG.Element.include(SVG.Dispatcher); + + + + + |