diff options
Diffstat (limited to 'src/sugar.js')
-rw-r--r-- | src/sugar.js | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/src/sugar.js b/src/sugar.js index 654be67..fef1363 100644 --- a/src/sugar.js +++ b/src/sugar.js @@ -46,35 +46,39 @@ SVG.extend(SVG.Element, { }); -SVG.extend(SVG.G, { - // Move using translate - move: function(x, y) { - return this.transform({ - x: x, - y: y - }); - } - -}); +if (SVG.G) { + SVG.extend(SVG.G, { + // Move using translate + move: function(x, y) { + return this.transform({ + x: x, + y: y + }); + } -SVG.extend(SVG.Text, { - // Set font - font: function(o) { - var key, attr = {}; - - for (key in o) - key == 'leading' ? - attr[key] = o[key] : - key == 'anchor' ? - attr['text-anchor'] = o[key] : - _styleAttr.indexOf(key) > -1 ? - attr['font-'+ key] = o[key] : - void 0; - - return this.attr(attr).text(this.content); - } - -}); + }); +} + +if (SVG.Text) { + SVG.extend(SVG.Text, { + // Set font + font: function(o) { + var key, attr = {}; + + for (key in o) + key == 'leading' ? + attr[key] = o[key] : + key == 'anchor' ? + attr['text-anchor'] = o[key] : + _styleAttr.indexOf(key) > -1 ? + attr['font-'+ key] = o[key] : + void 0; + + return this.attr(attr).text(this.content); + } + + }); +} if (SVG.FX) { @@ -98,4 +102,3 @@ if (SVG.FX) { } - |