aboutsummaryrefslogtreecommitdiffstats
path: root/src/textpath.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/textpath.js')
-rw-r--r--src/textpath.js42
1 files changed, 12 insertions, 30 deletions
diff --git a/src/textpath.js b/src/textpath.js
index dfe0152..04d7bde 100644
--- a/src/textpath.js
+++ b/src/textpath.js
@@ -3,21 +3,7 @@ SVG.TextPath = function() {
}
// Inherit from SVG.Element
-SVG.TextPath.prototype = new SVG.Path
-
-//
-SVG.extend(SVG.TextPath, {
- text: function(text) {
- /* remove children */
- while (this.node.firstChild)
- this.node.removeChild(this.node.firstChild)
-
- /* add text */
- this.node.appendChild(document.createTextNode(text))
-
- return this.parent
- }
-})
+SVG.TextPath.prototype = new SVG.Element
//
SVG.extend(SVG.Text, {
@@ -26,9 +12,9 @@ SVG.extend(SVG.Text, {
/* create textPath element */
this.textPath = new SVG.TextPath
- /* remove all child nodes */
- while (this.node.firstChild)
- this.node.removeChild(this.node.firstChild)
+ /* move lines to textpath */
+ while(this.node.hasChildNodes())
+ this.textPath.node.appendChild(this.node.firstChild)
/* add textPath element as child node */
this.node.appendChild(this.textPath.node)
@@ -39,19 +25,15 @@ SVG.extend(SVG.Text, {
/* create circular reference */
this.textPath.parent = this
- /* alias local text() method to textPath's text() method */
- this.text = function(text) {
- return this.textPath.text(text)
- }
-
- /* alias plot() method on track */
- this.plot = function(d) {
- this.track.plot(d)
- return this
- }
-
/* link textPath to path and add content */
- return this.textPath.attr('href', '#' + this.track, SVG.xlink).text(this.content)
+ this.textPath.attr('href', '#' + this.track, SVG.xlink)
+
+ return this
+ }
+ // Plot path if any
+, plot: function(d) {
+ if (this.track) this.track.plot(d)
+ return this
}
}) \ No newline at end of file