aboutsummaryrefslogtreecommitdiffstats
path: root/src/clip.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/clip.js')
-rw-r--r--src/clip.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/clip.js b/src/clip.js
index c1e82cb..7341c8f 100644
--- a/src/clip.js
+++ b/src/clip.js
@@ -5,6 +5,7 @@ SVG.Clip = function() {
// Inherit from SVG.Container
SVG.Clip.prototype = new SVG.Container
+//
SVG.extend(SVG.Element, {
// Distribute clipPath to svg element
clipWith: function(element) {
@@ -14,4 +15,13 @@ SVG.extend(SVG.Element, {
return this.attr('clip-path', 'url(#' + this.clip.attr('id') + ')')
}
+})
+
+//
+SVG.extend(SVG.Container, {
+ // Create clipping element
+ clip: function() {
+ return this.defs().put(new SVG.Clip)
+ }
+
}) \ No newline at end of file