diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-07-04 18:27:00 +0200 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-07-04 18:27:00 +0200 |
commit | ee25f92f87f2fc5bb6ab65023c4515a285535ff4 (patch) | |
tree | 5dfe354df5753779ba5be0dd74b4feaf507c4a7c /src | |
parent | ac854317c3ef89ca2c25b6293530babf1cd9b28c (diff) | |
download | svg.js-ee25f92f87f2fc5bb6ab65023c4515a285535ff4.tar.gz svg.js-ee25f92f87f2fc5bb6ab65023c4515a285535ff4.zip |
make TransformBag clone the object before altering
Diffstat (limited to 'src')
-rw-r--r-- | src/controller.js | 3 | ||||
-rw-r--r-- | src/morph.js | 19 |
2 files changed, 16 insertions, 6 deletions
diff --git a/src/controller.js b/src/controller.js index c2a9355..46c1771 100644 --- a/src/controller.js +++ b/src/controller.js @@ -124,6 +124,9 @@ SVG.Spring = SVG.invent ({ c.done = dt == Infinity if(dt == Infinity) return target if(dt == 0) return current + + if (dt > 100) dt = 16 + dt /= 1000 // Get the previous velocity diff --git a/src/morph.js b/src/morph.js index ff902ae..18ed6b5 100644 --- a/src/morph.js +++ b/src/morph.js @@ -158,15 +158,22 @@ SVG.Morphable.TransformBag = SVG.invent({ } } - SVG.Matrix.call(this, obj) + var data = {...(obj || {})} - if (obj && obj.origin) { - obj.originX = obj.origin[0] - obj.originY = obj.origin[1] + if (typeof data.origin == 'string') { + delete data.origin } - this.originX = obj && obj.originX || 0 - this.originY = obj && obj.originY || 0 + SVG.Matrix.call(this, data) + + + if (data.origin) { + data.originX = data.origin[0] + data.originY = data.origin[1] + } + + this.originX = data.originX || 0 + this.originY = data.originY || 0 }, extend: { |