summaryrefslogtreecommitdiffstats
path: root/src/matrix.js
diff options
context:
space:
mode:
authorRémi Tétreault <tetreault.remi@gmail.com>2017-05-01 20:39:24 -0400
committerRémi Tétreault <tetreault.remi@gmail.com>2017-05-01 20:41:23 -0400
commitf9a7d3878267b274d095233f34bffc2e43c28c20 (patch)
tree196c7689fc798e97c7704e0c68f2e01c5b270340 /src/matrix.js
parentbd04216e0b13114e985ad144d5ca006c5a6a0087 (diff)
downloadsvg.js-f9a7d3878267b274d095233f34bffc2e43c28c20.tar.gz
svg.js-f9a7d3878267b274d095233f34bffc2e43c28c20.zip
allow SVG.Matrix to be passed SVG.Number
Diffstat (limited to 'src/matrix.js')
-rw-r--r--src/matrix.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/matrix.js b/src/matrix.js
index 7b8ced9..298833e 100644
--- a/src/matrix.js
+++ b/src/matrix.js
@@ -1,7 +1,7 @@
SVG.Matrix = SVG.invent({
// Initialize
create: function(source) {
- var i, base = arrayToMatrix([1, 0, 0, 1, 0, 0])
+ var i, base = arrayToMatrix([1, 0, 0, 1, 0, 0]), n
// ensure source as object
source = source instanceof SVG.Element ?
@@ -16,9 +16,12 @@ SVG.Matrix = SVG.invent({
source : base
// merge source
- for (i = abcdef.length - 1; i >= 0; --i)
- this[abcdef[i]] = source && typeof source[abcdef[i]] === 'number' ?
- source[abcdef[i]] : base[abcdef[i]]
+ for (i = abcdef.length - 1; i >= 0; --i) {
+ n = source[abcdef[i]]
+ if(n != null) n = n.valueOf()
+
+ this[abcdef[i]] = typeof n === 'number' ? n : base[abcdef[i]]
+ }
}
// Add methods