summaryrefslogtreecommitdiffstats
path: root/src/sugar.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2014-07-26 21:58:56 +0200
committerwout <wout@impinc.co.uk>2014-07-26 21:58:56 +0200
commit80521a95f894c37d6db2e0480454c1afc3d8f6a5 (patch)
tree762ec2c50953bc7871fbe03770bc985abaeaa351 /src/sugar.js
parent9842187d84e71e736ada6a2e9444bab592945600 (diff)
downloadsvg.js-80521a95f894c37d6db2e0480454c1afc3d8f6a5.tar.gz
svg.js-80521a95f894c37d6db2e0480454c1afc3d8f6a5.zip
Installed Jasmin 2.0.1
Diffstat (limited to 'src/sugar.js')
-rwxr-xr-xsrc/sugar.js18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/sugar.js b/src/sugar.js
index cf19112..52f5697 100755
--- a/src/sugar.js
+++ b/src/sugar.js
@@ -29,25 +29,25 @@ var sugar = {
})
SVG.extend(SVG.Element, SVG.FX, {
- // Rotation
+ // Map rotation to transform
rotate: function(d, cx, cy) {
return this.transform({ rotation: d, cx: cx, cy: cy })
}
- // Skew
+ // Map skew to transform
, skew: function(x, y) {
return this.transform({ skewX: x, skewY: y })
}
- // Scale
+ // Map scale to transform
, scale: function(x, y, cx, cy) {
return arguments.length == 1 || arguments.length == 3 ?
- this.transform({ scale: x, cx: y, cy: cx }) :
+ this.transform({ scale: x, cx: y, cy: cx }) :
this.transform({ scaleX: x, scaleY: y, cx: cx, cy: cy })
}
- // Translate
+ // Map translate to transform
, translate: function(x, y) {
return this.transform({ x: x, y: y })
}
- // Matrix
+ // Map matrix to transform
, matrix: function(m) {
return this.attr('transform', new SVG.Matrix(m))
}
@@ -57,10 +57,12 @@ SVG.extend(SVG.Element, SVG.FX, {
}
})
-SVG.extend(SVG.Rect, SVG.Ellipse, SVG.Circle, SVG.FX, {
+SVG.extend(SVG.Rect, SVG.Ellipse, SVG.Circle, SVG.Gradient, SVG.FX, {
// Add x and y radius
radius: function(x, y) {
- return this.rx(x).ry(y == null ? x : y)
+ return (this.target || this).type == 'radial' ?
+ this.attr({ r: new SVG.Number(x) }) :
+ this.rx(x).ry(y == null ? x : y)
}
})