diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-11-12 12:00:03 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-11-12 13:01:01 +0100 |
commit | 6ea72cae2c761848b7db2c9457fd41c62d0336d6 (patch) | |
tree | 4d62e3f49a8e4922ed520739e4ab9b42b67e9e97 /src/modules | |
parent | c108c060152add00cac72a4911f6e998ffb4eb83 (diff) | |
download | svg.js-6ea72cae2c761848b7db2c9457fd41c62d0336d6.tar.gz svg.js-6ea72cae2c761848b7db2c9457fd41c62d0336d6.zip |
make List return new lists on method calls, add map to array polyfill so that this works, fix runner
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/optional/sugar.js | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/modules/optional/sugar.js b/src/modules/optional/sugar.js index f4c20fc..6001631 100644 --- a/src/modules/optional/sugar.js +++ b/src/modules/optional/sugar.js @@ -4,7 +4,6 @@ import Color from '../../types/Color.js' import Element from '../../elements/Element.js' import Matrix from '../../types/Matrix.js' import Point from '../../types/Point.js' -import Runner from '../../animation/Runner.js' import SVGNumber from '../../types/SVGNumber.js' // Define list of available attributes for stroke and fill @@ -105,19 +104,21 @@ registerMethods(['Element', 'Runner'], { return this.attr('opacity', value) }, + // Relative move over x and y axes + dmove: function (x, y) { + return this.dx(x).dy(y) + } +}) + +registerMethods('Element', { // Relative move over x axis dx: function (x) { - return this.x(new SVGNumber(x).plus(this instanceof Runner ? 0 : this.x()), true) + return this.x(new SVGNumber(x).plus(this.x())) }, // Relative move over y axis dy: function (y) { - return this.y(new SVGNumber(y).plus(this instanceof Runner ? 0 : this.y()), true) - }, - - // Relative move over x and y axes - dmove: function (x, y) { - return this.dx(x).dy(y) + return this.y(new SVGNumber(y).plus(this.y())) } }) |