diff options
author | wout <wout@impinc.co.uk> | 2012-12-21 17:28:17 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2012-12-21 17:28:17 +0100 |
commit | 5e4f748abffe48305e3d112e683d71cbec5155b3 (patch) | |
tree | 3c283536ea906a9260946168f6ad7b3891aa4f58 /src/clip.js | |
parent | b1516b2580dbdffd5ee68c75d4eb769b52faa100 (diff) | |
download | svg.js-5e4f748abffe48305e3d112e683d71cbec5155b3.tar.gz svg.js-5e4f748abffe48305e3d112e683d71cbec5155b3.zip |
Streamlined code
Diffstat (limited to 'src/clip.js')
-rw-r--r-- | src/clip.js | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/clip.js b/src/clip.js index 2266adb..ddc2588 100644 --- a/src/clip.js +++ b/src/clip.js @@ -18,9 +18,9 @@ SVG.extend(SVG.Clip, SVG.Container); SVG.extend(SVG.Element, { // clip element using another element - clip: function(block) { + clip: function(b) { var p = this.mother().defs().clipPath(); - block(p); + b(p); return this.clipTo(p); }, @@ -31,3 +31,16 @@ SVG.extend(SVG.Element, { } }); + +// add def-specific functions +SVG.extend(SVG.Defs, { + + // define clippath + clipPath: function() { + var e = new SVG.Clip(); + this.add(e); + + return e; + } + +});
\ No newline at end of file |