diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/container.js | 2 | ||||
-rw-r--r-- | src/sugar.js | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/container.js b/src/container.js index 46e8200..d24fe17 100644 --- a/src/container.js +++ b/src/container.js @@ -13,7 +13,7 @@ SVG.Container = { }, has: function(e) { - return Array.prototype.indexOf.call(this.children(), e) >= 0; + return this.children().indexOf(e) >= 0; }, children: function() { diff --git a/src/sugar.js b/src/sugar.js index 9b5b482..a9e1458 100644 --- a/src/sugar.js +++ b/src/sugar.js @@ -38,6 +38,7 @@ SVG.extend(SVG.Element, { // rotation rotate: function(o) { var b = this.bbox(); + if (o.x == null) o.x = b.cx; if (o.y == null) o.y = b.cy; @@ -47,3 +48,19 @@ SVG.extend(SVG.Element, { } }); + +// Add group-specific functions +SVG.extend(SVG.G, { + + // move using translate + move: function(x, y) { + this.transform('translate(' + x + ' ' + y + ')', true); + + return this; + } + +}); + + + + |