diff options
Diffstat (limited to 'dist/svg.js')
-rw-r--r-- | dist/svg.js | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/dist/svg.js b/dist/svg.js index a7ad178..2a2b22f 100644 --- a/dist/svg.js +++ b/dist/svg.js @@ -1,4 +1,4 @@ -/* svg.js v0.35 - svg regex default color array number viewbox bbox rbox element parent container fx event defs group arrange mask clip gradient doc shape use rect ellipse line poly path image text textpath nested hyperlink sugar set memory loader - svgjs.com/license */ +/* svg.js v0.36 - svg regex default color array number viewbox bbox rbox element parent container fx event defs group arrange mask clip gradient doc shape use rect ellipse line poly path image text textpath nested hyperlink sugar set memory loader - svgjs.com/license */ ;(function() { this.SVG = function(element) { @@ -833,6 +833,14 @@ return element } + // Add element to given container and return self + , addTo: function(parent) { + return parent.put(this) + } + // Add element to given container and return container + , putIn: function(parent) { + return parent.add(this) + } // Get parent document , doc: function(type) { return this._parent(type || SVG.Doc) @@ -2857,6 +2865,22 @@ } }) + + // + SVG.extend(SVG.Element, { + // Create a hyperlink element + linkTo: function(url) { + var link = new SVG.A + + if (typeof url == 'function') + url.call(link, link) + else + link.to(url) + + return this.parent.put(link).put(this) + } + + }) SVG._stroke = ['color', 'width', 'opacity', 'linecap', 'linejoin', 'miterlimit', 'dasharray', 'dashoffset'] SVG._fill = ['color', 'opacity', 'rule'] |