From 88987d60c456f1e686edd226f4ccb45e35142cd7 Mon Sep 17 00:00:00 2001 From: wout Date: Tue, 1 Jan 2013 21:39:25 +0100 Subject: Replaced clip() in favor of mask() Some browsers had issues with clipping, masking was a better option. --- src/mask.js | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'src/mask.js') 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 -- cgit v1.2.3