aboutsummaryrefslogtreecommitdiffstats
path: root/dist/svg.js
diff options
context:
space:
mode:
Diffstat (limited to 'dist/svg.js')
-rw-r--r--dist/svg.js47
1 files changed, 42 insertions, 5 deletions
diff --git a/dist/svg.js b/dist/svg.js
index 77ab5cd..ca68e1d 100644
--- a/dist/svg.js
+++ b/dist/svg.js
@@ -1,4 +1,4 @@
-/* svg.js v0.22 - svg regex default color number viewbox bbox rbox element container fx event defs group arrange mask clip pattern gradient doc shape rect ellipse line poly path plotable image text nested sugar - svgjs.com/license */
+/* svg.js v0.23 - svg regex default color number viewbox bbox rbox element container fx event defs group arrange mask clip pattern gradient use doc shape rect ellipse line poly path plotable image text nested sugar - svgjs.com/license */
;(function() {
this.SVG = function(element) {
@@ -627,10 +627,6 @@
return this.style(v)
} else {
- /* process gradient or pattern fill */
- if (typeof v.fill === 'function')
- v = v.fill()
-
/* treat x differently on text elements */
if (a == 'x' && Array.isArray(this.lines))
for (n = this.lines.length - 1; n >= 0; n--)
@@ -844,6 +840,10 @@
, visible: function() {
return this.style('display') != 'none'
}
+ // Return id on string conversion
+ , toString: function() {
+ return this.attr('id')
+ }
// Private: find svg parent by instance
, _parent: function(parent) {
var element = this
@@ -1643,6 +1643,10 @@
fill: function() {
return 'url(#' + this.attr('id') + ')'
}
+ // Alias string convertion to fill
+ , toString: function() {
+ return this.fill()
+ }
})
@@ -1723,6 +1727,10 @@
, fill: function() {
return 'url(#' + this.attr('id') + ')'
}
+ // Alias string convertion to fill
+ , toString: function() {
+ return this.fill()
+ }
})
@@ -1776,6 +1784,35 @@
+ SVG.Use = function() {
+ this.constructor.call(this, SVG.create('use'))
+ }
+
+ // Inherit from SVG.Shape
+ SVG.Use.prototype = new SVG.Element
+
+ //
+ SVG.extend(SVG.Use, {
+ // Use element as a reference
+ element: function(element) {
+ /* store target element */
+ this.target = element
+
+ /* set lined element */
+ return this.attr('xlink:href', '#' + element, SVG.xlink)
+ }
+
+ })
+
+ //
+ SVG.extend(SVG.Container, {
+ // Create a use element
+ use: function(element) {
+ return this.put(new SVG.Use).element(element)
+ }
+
+ })
+
SVG.Doc = function(element) {
/* ensure the presence of a html element */
this.parent = typeof element == 'string' ?