Git Product home page Git Product logo

lw.svg-parser's Issues

Units question

The parser transforms this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<!-- Creator: CorelDRAW X7 -->
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="457.285mm" height="135.043mm" version="1.0" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" clip-rule="evenodd"
viewBox="0 0 38014 11224"
 xmlns:xlink="http://www.w3.org/1999/xlink">
 <g id="Layer1">
  <metadata id="CorelCorpID_0Corel-Layer"/>
  <polygon fill="none" stroke="yellow" stroke-width="6.33459" points="3,3 38011,3 38011,11221 3,11221 "/>
 </g>
</svg>

To this:

{x: 0.12789526521816735, y: 0.12789526521816735}
{x: 1620.475642069253, y: 0.12789526521816735}
{x: 1620.475642069253, y: 478.37092367101855}
{x: 0.12789526521816735, y: 478.37092367101855}
{x: 0.12789526521816735, y: 0.12789526521816735}

What units are these? They don't match mm, inches, or the original PX units (83.1 px/mm).

It's called with default options:

let parser = new Parser({});
parser.parse(reader.result).then(...).catch(...);

viewBox calculation mixed up

Hi!
I get users complaining that the SVGs I generate with Boxes.py (https://github.com/florianfesti/boxes) cannot be rendered with Laserweb. A quick look into the code raised the suspicion that the viewBox calculation may be off. Especially those two lines in tagparser.js seem to be in the wrong order. Swapping them out at least shows something:

this.tag.scale(scaleX, scaleY)
this.tag.translate(-translateX, -translateY)

Test with any SVG with has a viewBox not starting at 0 0 - like all Boxes.py artifacts.

Sorry, for not submitting a proper PR.

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.