t-oster / VisiCut

A userfriendly tool to prepare, save and send Jobs to Lasercutters
https://visicut.org
Other
228 stars 114 forks source link

bounding box includes invisible objects #13

Closed mgmax closed 12 years ago

mgmax commented 12 years ago

The blue size selection box incorrectly includes invisible objects. Example file: https://gist.github.com/3193226

t-oster commented 12 years ago

The question is in general, if invisibile Object should be ignored or not. E.g. it could be, that a line has no stroke-color, thus is invisible, but still intended to be cut. For the given Test-Image, if you select Cut-Line, you'll see also the inivisible line will be cut. If you select engrave-drawing, I agree, that the bounding box is too big. The same would happen, if there was a big white box, which will be ignored in engrave-mode. I could at least change the implementation of Bounding-Boxes of engraved Elements, that they don't include non-engraved areas.

mgmax commented 12 years ago

This boils down to the following basic question: How should the SVG input, that contains no explicit information about lasercutting, be interpreted? I think: As similar as possible to the way it looks in a SVG compliant renderer, like a webbrowser or VisiCut with "no mapping" selected.

An object with display:none or visibility:hidden should therefore be ignored. Sometimes it is necessary to hide an object without deleting it, e.g. for linked clones (<use> elements, AFAIK currently unsupported in visicut). Inkscape also uses <g style="display:none"> for hidden layers.

Even if I use a "cut red lines" mapping, the hidden rectangle in my example file is cut. Currently I am forced to save to another file and delete the hidden items before I can correctly process my drawing with visicut.

t-oster commented 12 years ago

Ok. I think it is easy to filter out groups/items with those properties. Are there any other hiding mechanisms in SVG or is it sufficient to ignore display:none and visibility:hidden elements? What about elements with stroke: none and fill:none?

t-oster commented 12 years ago

Invisibile and Display:none should be filtered now. The elements seem to work (at least the example from http://www.selfsvg.info/?section=6.5)