Open mm3509 opened 6 years ago
Following the conversation on StackOverflow I realized that this happens because of using Safari.
ah I see. I'm aware of the issues with Safari, will look into it when I get some time
Thanks. SVGnest works well in Chrome and Firefox. I discovered it last week and I got an improvement around 50% in a project for the laser cutter. Thank you very much for this, and please keep up the good work!
@Jack000 Maybe I can give you a pointer. I just had an issue, where Safari would drop some paths.
Look at https://github.com/Jack000/SVGnest/blob/285ae61afc33f4826bce9a356408c82d7c515bef/svgparser.js#L494
In Chrome SVGPointList
works like an array, but in Safari you have to use getItem
to access it. Documentation is very sparse on this, though, so I don't even know, which one is right. The spec looks like Chrome adopted the new requirement, that lists should behave more like arrays, but apparently Safari doesn't implement it that way, yet.
Using length to iterate over the list, would result in an empty array of points.
I created an SVG with Inkscape and Illustrator. This screenshot shows the SVG in Illustrator to the right and in SVGnest to the left:
SVGnest does this for about half my paths, which are all letters expanded from the fonts Arial MT Rounded, Chalkboard SE, and Cursivestandard. I chose the "g" letter above because it is striking and I can copy-paste the SVG content: