summaryrefslogtreecommitdiffstats
path: root/src/arrange.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2012-12-31 16:16:05 +0100
committerwout <wout@impinc.co.uk>2012-12-31 16:16:05 +0100
commit5e7c26e9423f3c543e04bc9a11656125ec7bf8ca (patch)
tree5e568b9a8083aa23b1bf830b7f4a42a3c8c1a1c0 /src/arrange.js
parent8dbe3599dd9b80738c4124f7e71bc12e763c50dc (diff)
downloadsvg.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.js14
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