summaryrefslogtreecommitdiffstats
path: root/src/text.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2014-03-04 22:19:01 +0100
committerwout <wout@impinc.co.uk>2014-03-04 22:19:01 +0100
commit1286e3de26baa3d75ec6a6eafbb2eaa11305c2e1 (patch)
treeb39257a6256836b9e645f5e5faf37adcbe8d4c4d /src/text.js
parentf3b9e808601e8aa250b9373447527ca67ba75ec4 (diff)
downloadsvg.js-1286e3de26baa3d75ec6a6eafbb2eaa11305c2e1.tar.gz
svg.js-1286e3de26baa3d75ec6a6eafbb2eaa11305c2e1.zip
Bumped to 1.0.0-rc.6
Diffstat (limited to 'src/text.js')
-rwxr-xr-xsrc/text.js20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/text.js b/src/text.js
index 9d95b55..170b9de 100755
--- a/src/text.js
+++ b/src/text.js
@@ -4,9 +4,9 @@ SVG.Text = SVG.invent({
create: function() {
this.constructor.call(this, SVG.create('text'))
- this._leading = new SVG.Number(1.3) /* store leading value for rebuilding */
- this._rebuild = true /* enable automatic updating of dy values */
- this._build = false /* disable build mode for adding multiple lines */
+ this._leading = new SVG.Number(1.3) /* store leading value for rebuilding */
+ this._rebuild = true /* enable automatic updating of dy values */
+ this._build = false /* disable build mode for adding multiple lines */
/* set default font */
this.attr('font-family', SVG.defaults.attrs['font-family'])
@@ -31,11 +31,13 @@ SVG.Text = SVG.invent({
}
// Move over y-axis
, y: function(y) {
+ var o = this.attr('y') - this.bbox().y
+
/* act as getter */
if (y == null)
- return this.attr('y')
+ return this.attr('y') - o
- return this.attr('y', y + this.attr('y') - this.bbox().y)
+ return this.attr('y', y + o)
}
// Move center over x-axis
, cx: function(x) {
@@ -45,14 +47,6 @@ SVG.Text = SVG.invent({
, cy: function(y) {
return y == null ? this.bbox().cy : this.y(y - this.bbox().height / 2)
}
- // Move element to given x and y values
- , move: function(x, y) {
- return this.x(x).y(y)
- }
- // Move element by its center
- , center: function(x, y) {
- return this.cx(x).cy(y)
- }
// Set the text content
, text: function(text) {
/* act as getter */