diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2015-09-15 23:47:21 +0200 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2015-09-15 23:47:21 +0200 |
commit | 07c5387602dea1d2ac9eef52bbc8e98d0f937fe9 (patch) | |
tree | bb88e66b49d4e873b792a3770f4654d2f4176592 /src | |
parent | 30b433264fd4ed51d7a2db56c6f291652b9ca01a (diff) | |
download | svg.js-07c5387602dea1d2ac9eef52bbc8e98d0f937fe9.tar.gz svg.js-07c5387602dea1d2ac9eef52bbc8e98d0f937fe9.zip |
clone method for text to mark all firstlevel tspans as newlines (fixes #369)
Diffstat (limited to 'src')
-rw-r--r-- | src/text.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/text.js b/src/text.js index 14f2137..cfe797f 100644 --- a/src/text.js +++ b/src/text.js @@ -16,8 +16,22 @@ SVG.Text = SVG.invent({ // Add class methods , extend: { + clone: function(){ + // clone element and assign new id + var clone = assignNewId(this.node.cloneNode(true)) + + // mark first level tspans as newlines + clone.lines().each(function(){ + this.newLined = true + }) + + // insert the clone after myself + this.after(clone) + + return clone + } // Move over x-axis - x: function(x) { + , x: function(x) { // act as getter if (x == null) return this.attr('x') |