Skip to content

Outer non-scaling-stroke group makes it challenging to treat svg groups as plot layers #21

@R4chel

Description

@R4chel

For a while I was making separate layers by writing each layer to a separate file but I was really excited to see the beginSvgGroup and endSvgGroup functionality. My understanding is these can be used to help communicate different layers to the plotter.

However just using those functions didn't seem to let me make a multilayered plot. This is because every plot is wrapped in one outermost <g vector-effect="non-scaling-stroke"> tag so the whole plot is treated as having 1 layer by at least vpype and nextdraw

p5.plotSvg/lib/p5.plotSvg.js

Lines 1143 to 1145 in 8ae96fb

// The SVG file wraps everything in a group with a non-scaling stroke effect:
svgContent += `<g vector-effect="non-scaling-stroke">\n`;
_svgGroupLevel++;

I tested locally removing that group from my plot and then the software saw the layers I had intended.

For testing this locally I am using vpype read <plot> proplist --layer all. I tried this with both a saved svg from examples/plotSvg_post_grouping and examples/plotSvg_generative/README.md

Additionally after this is addressed it would be awesome to explicitly add an example that has multiple layers to the examples.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdocumentationImprovements or additions to documentation

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions