diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-11-08 13:58:52 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-11-08 13:58:52 +0100 |
commit | d3baefd3d4fac81ba27459197f289bff1a846046 (patch) | |
tree | b6f27cf6bc073f81782cf1105cfb7ef987c22b47 /src | |
parent | 15fd93ef07c1860fba7d7b285fe94dcb97c6f334 (diff) | |
download | svg.js-d3baefd3d4fac81ba27459197f289bff1a846046.tar.gz svg.js-d3baefd3d4fac81ba27459197f289bff1a846046.zip |
added `ax(), ay(), amove()` to change texts x and y values directly (#787)
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/optional/sugar.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/modules/optional/sugar.js b/src/modules/optional/sugar.js index 9cdc662..69f723e 100644 --- a/src/modules/optional/sugar.js +++ b/src/modules/optional/sugar.js @@ -159,6 +159,18 @@ registerMethods(['Element', 'Runner'], { } }) +registerMethods('Text', { + ax (x) { + return this.attr('x', x) + }, + ay (y) { + return this.attr('y', y) + }, + amove (x, y) { + return this.ax(x).ay(y) + } +}) + // Add events to elements const methods = [ 'click', 'dblclick', |