summaryrefslogtreecommitdiffstats
path: root/src/sugar.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/sugar.js')
-rw-r--r--src/sugar.js48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/sugar.js b/src/sugar.js
index c8b71fb..e076491 100644
--- a/src/sugar.js
+++ b/src/sugar.js
@@ -1,65 +1,65 @@
// Define list of available attributes for stroke and fill
-SVG._stroke = ['color', 'width', 'opacity', 'linecap', 'linejoin', 'miterlimit', 'dasharray', 'dashoffset'];
-SVG._fill = ['color', 'opacity', 'rule'];
+SVG._stroke = ['color', 'width', 'opacity', 'linecap', 'linejoin', 'miterlimit', 'dasharray', 'dashoffset']
+SVG._fill = ['color', 'opacity', 'rule']
// Prepend correct color prefix
var _colorPrefix = function(type, attr) {
- return attr == 'color' ? type : type + '-' + attr;
-};
+ return attr == 'color' ? type : type + '-' + attr
+}
/* Add sugar for fill and stroke */
-['fill', 'stroke'].forEach(function(method) {
+;['fill', 'stroke'].forEach(function(method) {
// Set fill color and opacity
SVG.Shape.prototype[method] = function(o) {
- var index;
+ var indexOf
if (typeof o == 'string')
- this.attr(method, o);
+ this.attr(method, o)
else
/* set all attributes from _fillAttr and _strokeAttr list */
for (index = SVG['_' + method].length - 1; index >= 0; index--)
if (o[SVG['_' + method][index]] != null)
- this.attr(_colorPrefix(method, SVG['_' + method][index]), o[SVG['_' + method][index]]);
+ this.attr(_colorPrefix(method, SVG['_' + method][index]), o[SVG['_' + method][index]])
- return this;
- };
+ return this
+ }
-});
+})
-[SVG.Element, SVG.FX].forEach(function(module) {
+;[SVG.Element, SVG.FX].forEach(function(module) {
if (module) {
SVG.extend(module, {
// Rotation
rotate: function(angle) {
return this.transform({
rotation: angle || 0
- });
+ })
},
// Skew
skew: function(x, y) {
return this.transform({
skewX: x || 0,
skewY: y || 0
- });
+ })
},
// Scale
scale: function(x, y) {
return this.transform({
scaleX: x,
scaleY: y == null ? x : y
- });
+ })
},
// Opacity
opacity: function(value) {
- return this.attr('opacity', value);
+ return this.attr('opacity', value)
}
- });
+ })
}
-});
+})
if (SVG.G) {
SVG.extend(SVG.G, {
@@ -68,17 +68,17 @@ if (SVG.G) {
return this.transform({
x: x,
y: y
- });
+ })
}
- });
+ })
}
if (SVG.Text) {
SVG.extend(SVG.Text, {
// Set font
font: function(o) {
- var key, attr = {};
+ var key, attr = {}
for (key in o)
key == 'leading' ?
@@ -87,11 +87,11 @@ if (SVG.Text) {
attr['text-anchor'] = o[key] :
_styleAttr.indexOf(key) > -1 ?
attr['font-'+ key] = o[key] :
- void 0;
+ void 0
- return this.attr(attr).text(this.content);
+ return this.attr(attr).text(this.content)
}
- });
+ })
}