summaryrefslogtreecommitdiffstats
path: root/src/container.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2012-12-16 18:48:35 +0100
committerwout <wout@impinc.co.uk>2012-12-16 18:48:35 +0100
commit0237a8cae8d545a8b8182dad29863b4426a4f6d2 (patch)
tree429bb9501ba095273bb316c380e4497202f6989f /src/container.js
parentc6ac1246c271c66733366086f467e381c3fd65a8 (diff)
downloadsvg.js-0237a8cae8d545a8b8182dad29863b4426a4f6d2.tar.gz
svg.js-0237a8cae8d545a8b8182dad29863b4426a4f6d2.zip
Fix in circle and ellipse generater
Diffstat (limited to 'src/container.js')
-rw-r--r--src/container.js36
1 files changed, 24 insertions, 12 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) {