summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-07-04 18:27:00 +0200
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-07-04 18:27:00 +0200
commitee25f92f87f2fc5bb6ab65023c4515a285535ff4 (patch)
tree5dfe354df5753779ba5be0dd74b4feaf507c4a7c /src
parentac854317c3ef89ca2c25b6293530babf1cd9b28c (diff)
downloadsvg.js-ee25f92f87f2fc5bb6ab65023c4515a285535ff4.tar.gz
svg.js-ee25f92f87f2fc5bb6ab65023c4515a285535ff4.zip
make TransformBag clone the object before altering
Diffstat (limited to 'src')
-rw-r--r--src/controller.js3
-rw-r--r--src/morph.js19
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: {