blob: c1e82cbeb6eac8bdf09f301ea4fe97b9591088e9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
SVG.Clip = function() {
this.constructor.call(this, SVG.create('clipPath'))
}
// Inherit from SVG.Container
SVG.Clip.prototype = new SVG.Container
SVG.extend(SVG.Element, {
// Distribute clipPath to svg element
clipWith: function(element) {
/* use given clip or create a new one */
this.clip = element instanceof SVG.Clip ? element : this.parent.clip().add(element)
return this.attr('clip-path', 'url(#' + this.clip.attr('id') + ')')
}
})
|