Giter Site home page Giter Site logo

Comments (3)

mchoe avatar mchoe commented on July 23, 2024

Hi @naan, thanks for filing the issue and the commit to fix this. Seeing this is an issue of the SVG generator not properly dealing with floating point rounding, and not one from the library, I'm not entirely convinced that the change should get merged in yet.

Can you tell me what program you're using to generate your SVGs?

from swiftsvg.

naan avatar naan commented on July 23, 2024

Yeah, I realized that after I made a change, so I dug into this issue.

The application I'm generating SVG is Sketch, and here's original code:


<svg width="381px" height="520px" viewBox="-4 -7 381 520" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <!-- Generator: Sketch 3.7.2 (28276) - http://www.bohemiancoding.com/sketch -->
    <desc>Created with Sketch.</desc>
    <defs></defs>
    <polygon id="Path-12" stroke="none" fill-opacity="0.300000012" fill="#FFC64D" fill-rule="evenodd" style="mix-blend-mode: multiply;" points="187.136435 512.08631 0 302.480469 0 166.554688"></polygon>
    <polygon id="Path-12-Copy" stroke="none" fill-opacity="0.300000012" fill="#FFC64D" fill-rule="evenodd" style="mix-blend-mode: multiply;" transform="translate(281.499999, 343.701358) scale(-1, 1) translate(-281.499999, -343.701358) " points="374.999998 512.08631 188 304.378906 188 175.316406"></polygon>
    <polygon id="Path-13" stroke="none" fill-opacity="0.300000012" fill="#FFC64D" fill-rule="evenodd" style="mix-blend-mode: multiply;" points="187.93703 511.744987 1.42108547e-14 107.175781 1.42108547e-14 2.84217094e-14 35.8710953 2.84217094e-14"></polygon>
    <polygon id="Path-13-Copy" stroke="none" fill-opacity="0.300000012" fill="#FFC64D" fill-rule="evenodd" style="mix-blend-mode: multiply;" transform="translate(281.500000, 255.872494) scale(-1, 1) translate(-281.500000, -255.872494) " points="374.999999 511.744987 188 71.234375 188 0 223.292965 0"></polygon>
    <polygon id="Path-16" stroke="none" fill-opacity="0.300000012" fill="#FFC64D" fill-rule="evenodd" style="mix-blend-mode: multiply;" points="190.454104 511.745614 77.3398438 1.90734863e-06 169.488281 -2.84217094e-14"></polygon>
    <polygon id="Path-16-Copy" stroke="none" fill-opacity="0.300000012" fill="#FFC64D" fill-rule="evenodd" style="mix-blend-mode: multiply;" transform="translate(239.681641, 255.685072) scale(-1, 1) translate(-239.681641, -255.685072) " points="291.363282 511.370144 188 5.26313499e-06 257.167973 0"></polygon>
    <polygon id="Path-18" stroke="none" fill-opacity="0.300000012" fill="#FFC64D" fill-rule="evenodd" style="mix-blend-mode: multiply;" points="191.637218 510.559211 374.999996 346.773437 374.999996 440.890623"></polygon>
    <polygon id="Path-19" stroke="none" fill-opacity="0.300000012" fill="#FFC64D" fill-rule="evenodd" style="mix-blend-mode: multiply;" points="191.186873 509.039787 3.82425696e-07 350.667969 1.03732987e-06 429.853874"></polygon>
    <polygon id="Path-20" stroke="none" fill-opacity="0.300000012" fill="#FFC64D" fill-rule="evenodd" style="mix-blend-mode: multiply;" points="190.078634 508.659931 -5.25835276e-07 463.644531 -7.17046191e-08 508.659931"></polygon>
    <polygon id="Path-20-Copy" stroke="none" fill-opacity="0.300000012" fill="#FFC64D" fill-rule="evenodd" style="mix-blend-mode: multiply;" transform="translate(288.000000, 489.083731) scale(-1, 1) translate(-288.000000, -489.083731) " points="375 509.108866 201.000001 469.058594 201 509.108868"></polygon>
</svg>

As you pointed out, there're floating point value that is not properly rounded, and probably Sketch's error. (I assume they're using their own SVG code.) However, if I import this SVG code into say Adobe Illustrator, they handle values properly.

from swiftsvg.

mchoe avatar mchoe commented on July 23, 2024

Alright, I may still incorporate the change, but I want to do some benchmarking first. Thanks for sending the full SVG along and the help @naan.

from swiftsvg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.