Skip to content
This repository was archived by the owner on Jul 24, 2022. It is now read-only.

Commit 4a47f00

Browse files
authored
fix(svg transforms): fixes weird new issue with undefined vs null transforms (#46)
* fix(transforms): added safeguard against null AND undefined * test(panda): added baby panda tests from main repo to be sure our own examples work...
1 parent e754a2e commit 4a47f00

File tree

2 files changed

+313
-6
lines changed

2 files changed

+313
-6
lines changed

packages/svg-deserializer/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,17 @@ const codify = function (group) {
150150
if ('scale' in t) { ts = t }
151151
if ('translate' in t) { tt = t }
152152
}
153-
if (ts !== null) {
153+
if (ts !== null && ts !== undefined) {
154154
const x = ts.scale[0]
155155
const y = ts.scale[1]
156156
code += indent + on + ' = ' + on + '.scale([' + x + ',' + y + ']);\n'
157157
}
158-
if (tr !== null) {
158+
if (tr !== null && tr !== undefined) {
159+
console.log('tr', tr)
159160
const z = 0 - tr.rotate
160161
code += indent + on + ' = ' + on + '.rotateZ(' + z + ');\n'
161162
}
162-
if (tt !== null) {
163+
if (tt !== null && tt !== undefined) {
163164
const x = cagLengthX(tt.translate[0], svgUnitsPmm, svgUnitsX)
164165
const y = (0 - cagLengthY(tt.translate[1], svgUnitsPmm, svgUnitsY))
165166
code += indent + on + ' = ' + on + '.translate([' + x + ',' + y + ']);\n'

0 commit comments

Comments
 (0)