aboutsummaryrefslogtreecommitdiffstats
path: root/src/container.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/container.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/container.js')
-rw-r--r--src/container.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/container.js b/src/container.js
index 3656892..86c2827 100644
--- a/src/container.js
+++ b/src/container.js
@@ -36,7 +36,7 @@ SVG.Container = {
c = this.children();
// iteralte all shapes
- for (i = 1, l = c.length; i < l; i++)
+ for (i = 0, l = c.length; i < l; i++)
if (c[i] instanceof SVG.Shape)
b.apply(c[i], [i, c]);
@@ -92,17 +92,17 @@ SVG.Container = {
// create a polyline element
polyline: function(p) {
- return this.put(new SVG.Polyline().plot(p));
+ return this.put(new Wrap(new SVG.Polyline())).plot(p);
},
// create a polygon element
polygon: function(p) {
- return this.put(new SVG.Polygon().plot(p));
+ return this.put(new Wrap(new SVG.Polygon())).plot(p);
},
- // create a path element
+ // create a wrapped path element
path: function(d) {
- return this.put(new SVG.Path().plot(d));
+ return this.put(new Wrap(new SVG.Path())).plot(d);
},
// create image element, load image and set its size
@@ -121,6 +121,11 @@ SVG.Container = {
return this.defs().gradient(t, b);
},
+ // create masking element
+ mask: function() {
+ return this.defs().put(new SVG.Mask());
+ },
+
// get first child, skipping the defs node
first: function() {
return this.children()[1];