Code Monkey home page Code Monkey logo

Comments (3)

jwesthues avatar jwesthues commented on June 29, 2024

I think I found that certain SVG viewers would clip geometry entirely if the stroked line was outside the viewBox and/or width/height, hence the comment:

    (ptMax.x - ptMin.x) + 1, (ptMax.y - ptMin.y) + 1,
    (ptMax.x - ptMin.x) + 1, (ptMax.y - ptMin.y) + 1);
// A little bit of extra space for the stroke width.

It was a long time ago, though, and I don't remember details. Vector export could presumably be changed to determine the exact bounds allowing for stroke width, but that would be more work.

And I can't immediately reproduce your 50.799999, but it doesn't surprise me; floating point math is inexact. Is the difference causing a problem for you?

from solvespace.

blinkenlight avatar blinkenlight commented on June 29, 2024

The 50.799999 is just of cosmetic interest, in the SVG file it actually reappears as 51.800 (round again). I don't know how much of an issue the "plus one" thing is in general, for me it matters because I'm importing the SVG into GCAM for milling (therefore I do actually need accurate origins and sizes and so can only use the manual export option to hope to preserve them) and, well, the big problem is that the SVG canvas is upside-down, with (0,0) in the top left corner, so my imported workpiece obviously jumps up a unit, "sticking" to the invisible top of the larger-than-expected box. It clearly is possible to work around this by adjusting the offset value appropriately before exporting, but IMHO it's needlessly confusing and easy to forget (and one would probably not notice a 1mm displacement until it's too late).

So, considering that manual canvas sizing can already easily screw up the canvas / viewbox size in the SVG file anyway (resulting in coordinates outside the declared box) - would it be perhaps possible to disable the "unit-adding" mechanism at least in manual canvas mode...?

from solvespace.

jwesthues avatar jwesthues commented on June 29, 2024

Seems not unreasonable, just pushed the change. Let me know if you see any trouble.

from solvespace.

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.