gfwilliams / svgtoeagle

Online SVG to Eagle CAD converter
MIT License
85 stars 26 forks source link

Possible bug in unpackPoly() #20

Closed NPoole closed 4 years ago

NPoole commented 4 years ago

in file svgtoeagle.js line 94:

You pass finalPolys[i] as the first argument for isInside() when I believe it should be finalPolys[i][0]

Currently, no error is thrown 'because javascript'. Isinside() evaluates var x and y as undefined therefor it evaluates var intersect as NaN. NaN always evaluates False, so this call will always return False. I don't believe the code block from line 65-100 ever runs.

So far I've never seen a problem using the tool although it could explain behavior I observed once where the inner polygon of the letter 'A' was missing from a conversion. Unfortunately I no longer have the SVG in question to test against.

TL;DR: line 94 of svgtoeagle.js should be } else if (isInside(finalPolys[i][0], path)) {

gfwilliams commented 4 years ago

Thanks! Yes, that definitely looks like an issue - just fixing it :)