summaryrefslogtreecommitdiffstats
path: root/src/mask.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2013-01-01 21:39:25 +0100
committerwout <wout@impinc.co.uk>2013-01-01 21:39:25 +0100
commit88987d60c456f1e686edd226f4ccb45e35142cd7 (patch)
tree719bd1c6ea1e18bae81ea9a8083742184eb422e9 /src/mask.js
parent5e7c26e9423f3c543e04bc9a11656125ec7bf8ca (diff)
downloadsvg.js-88987d60c456f1e686edd226f4ccb45e35142cd7.tar.gz
svg.js-88987d60c456f1e686edd226f4ccb45e35142cd7.zip
Replaced clip() in favor of mask()
Some browsers had issues with clipping, masking was a better option.
Diffstat (limited to 'src/mask.js')
-rw-r--r--src/mask.js22
1 files changed, 2 insertions, 20 deletions
diff --git a/src/mask.js b/src/mask.js
index a9b457e..19f5562 100644
--- a/src/mask.js
+++ b/src/mask.js
@@ -16,27 +16,9 @@ SVG.extend(SVG.Mask, SVG.Container);
// add clipping functionality to element
SVG.extend(SVG.Element, {
- // mask element using another element
- mask: function(b) {
- var m = this.parent.defs().mask();
- b(m);
-
- return this.maskTo(m);
- },
-
// distribute mask to svg element
- maskTo: function(m) {
- return this.attr('mask', 'url(#' + m.id + ')');
- }
-
-});
-
-// add def-specific functions
-SVG.extend(SVG.Defs, {
-
- // create clippath
- mask: function() {
- return this.put(new SVG.Mask());
+ maskWith: function(e) {
+ return this.attr('mask', 'url(#' + (e instanceof SVG.Mask ? e : this.parent.mask().add(e)).id + ')');
}
}); \ No newline at end of file