diff options
author | wout <wout@impinc.co.uk> | 2012-12-31 16:16:05 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2012-12-31 16:16:05 +0100 |
commit | 5e7c26e9423f3c543e04bc9a11656125ec7bf8ca (patch) | |
tree | 5e568b9a8083aa23b1bf830b7f4a42a3c8c1a1c0 /src/arrange.js | |
parent | 8dbe3599dd9b80738c4124f7e71bc12e763c50dc (diff) | |
download | svg.js-5e7c26e9423f3c543e04bc9a11656125ec7bf8ca.tar.gz svg.js-5e7c26e9423f3c543e04bc9a11656125ec7bf8ca.zip |
Added each(), next(), previous() and more
Diffstat (limited to 'src/arrange.js')
-rw-r--r-- | src/arrange.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/arrange.js b/src/arrange.js index ff255be..ec06591 100644 --- a/src/arrange.js +++ b/src/arrange.js @@ -12,11 +12,19 @@ SVG.extend(SVG.Element, { return this.siblings().indexOf(this); }, + // get the next element + next: function() { + return this.siblings()[this.position() + 1]; + }, + + // get the next element + previous: function() { + return this.siblings()[this.position() - 1]; + }, + // send given element one step forwards forward: function() { - var i = this.siblings().indexOf(this); - - return this.parent.remove(this).put(this, i + 1); + return this.parent.remove(this).put(this, this.position() + 1); }, // send given element one step backwards |