diff options
author | wout <wout@impinc.co.uk> | 2014-02-01 20:13:05 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2014-02-01 20:13:05 +0100 |
commit | 11376f6ec53092bd3893a168f25a08983d7aff6c (patch) | |
tree | de6a4725bb791549a3e177ec06b0364e913f5659 /src/group.js | |
parent | a19bbab549b2d65b83751c3ef85295ee02065f42 (diff) | |
download | svg.js-11376f6ec53092bd3893a168f25a08983d7aff6c.tar.gz svg.js-11376f6ec53092bd3893a168f25a08983d7aff6c.zip |
added `morph()` and `at()` methods to `SVG.Number` for unit morphing
Diffstat (limited to 'src/group.js')
-rwxr-xr-x | src/group.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/group.js b/src/group.js index 84eed54..6f2d502 100755 --- a/src/group.js +++ b/src/group.js @@ -15,6 +15,15 @@ SVG.extend(SVG.G, { , y: function(y) { return y == null ? this.trans.y : this.transform('y', y) } + // Move by center over x-axis +, cx: function(x) { + return x == null ? this.bbox().cx : this.x(x - this.bbox().width / 2) + } + // Move by center over y-axis +, cy: function(y) { + return y == null ? this.bbox().cy : this.y(y - this.bbox().height / 2) + } + }) // |