diff options
author | wout <wout@impinc.co.uk> | 2012-12-19 13:22:07 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2012-12-19 13:22:07 +0100 |
commit | dab421143cf719370cb3739d07e3e411d555cf3c (patch) | |
tree | 2ca44dc3130c2bd9da15465a5e46b01adf2f7061 /dist/svg.js | |
parent | 877c953761e9118753a593ec1ebeb1d523aecb5b (diff) | |
download | svg.js-dab421143cf719370cb3739d07e3e411d555cf3c.tar.gz svg.js-dab421143cf719370cb3739d07e3e411d555cf3c.zip |
Updated Readme
Diffstat (limited to 'dist/svg.js')
-rw-r--r-- | dist/svg.js | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/dist/svg.js b/dist/svg.js index 9358be1..62dc9d5 100644 --- a/dist/svg.js +++ b/dist/svg.js @@ -1,4 +1,4 @@ -/* svg.js 0.1a - svg container element arrange clip doc defs shape rect circle ellipse path image group sugar - svgjs.com/license */ +/* svg.js 0.1a - svg container element group arrange clip doc defs shape rect circle ellipse path image sugar - svgjs.com/license */ (function() { this.SVG = { @@ -33,7 +33,7 @@ }, has: function(e) { - return Array.prototype.indexOf.call(this.children(), e) >= 0; + return this.children().indexOf(e) >= 0; }, children: function() { @@ -253,6 +253,16 @@ }); + SVG.G = function G() { + this.constructor.call(this, SVG.create('g')); + }; + + // inherit from SVG.Element + SVG.G.prototype = new SVG.Element(); + + // include the container object + SVG.extend(SVG.G, SVG.Container); + SVG.extend(SVG.Element, { // get all siblings, including me @@ -509,16 +519,6 @@ }); - SVG.G = function G() { - this.constructor.call(this, SVG.create('g')); - }; - - // inherit from SVG.Element - SVG.G.prototype = new SVG.Element(); - - // include the container object - SVG.extend(SVG.G, SVG.Container); - SVG.extend(SVG.Shape, { // set fill color and opacity @@ -557,6 +557,7 @@ // rotation rotate: function(o) { var b = this.bbox(); + if (o.x == null) o.x = b.cx; if (o.y == null) o.y = b.cy; @@ -566,6 +567,22 @@ } }); + + // Add group-specific functions + SVG.extend(SVG.G, { + + // move using translate + move: function(x, y) { + this.transform('translate(' + x + ' ' + y + ')', true); + + return this; + } + + }); + + + + }).call(this); |