Svg import incorrectly had conditional inside fabs() instead of checking the result of fabs()
SVG import plug-in was checking the size of the viewbox, but incorrectly placed the conditional inside of the fabs() function.
e.g. (simplified) if (fabs( (xs/ys - 1.0) < 0.1 ))
this will often equate to the opposite when the scale smaller than ±0.9. In other words the scale could be fabs() > 0.1
but equate to true because ((xs/ys) - 1.0) < 0.1
inside the fabs() function (e.g. (1/10 - 1.0) would equate to -0.9 which is less than 0.1). So fabs(-0.9 < 0.1)
is fabs(true)
is true
.
(simplified corrected) if ( fabs( xs/ys - 1.0) < 0.1 )
this will appropriately only be true when the scale is small. I believe this is what was intended. e.g. fabs(-0.9) < 0.1
is false.
I also added a test to avoid divide by zero surrounding the original code and simplified the number of calls to fabs() by moving it up to were the xs
and ys
variables are instantiated.