rafaeltonholo / svg-to-compose

A command-line tool for convert SVG to Android Jetpack Compose Icons.
MIT License
61 stars 2 forks source link

Relative coordinates with negative initial bounds #63

Closed andreydang closed 1 month ago

andreydang commented 1 month ago

Hi, I'm using your great library and I've encountered a rendering problem. I tried to convert this image as an example:

https://upload.wikimedia.org/wikipedia/commons/d/d7/Android_robot.svg

With initial negative borders, no shift occurs

viewBox="-147 -70 294 345"

                moveToRelative(dx = -95.0f, dy = 44.5f)
                lineToRelative(dx = 190.0f, dy = 0.0f)

pic

                moveToRelative(52.0f, 114.5f)
                lineToRelative(190.0f,0f)

pic2

It looks like when the element is positioned relative, it does not add the initial border offset.

 -95.0+147 = 52
  44.5+70 = 114.5

I believe that somewhere the shift is not taken into account, but 0 is set. In editors and in the browser, the SVG is displayed correctly.

rafaeltonholo commented 1 month ago

Hi @andreydang,

Thank you for reporting the bug! I have identified the issue, and a fix will be in place soon. Additionally, I have identified another issue related to round rectangles not considering floating point values, which has also been addressed. You should see your icon correctly rendered in the new release.

Thank you for using this CLI :)

andreydang commented 1 month ago

Hi @rafaeltonholo Thank you very much! Awesome)