Juce9 svg group naming bug

I stumbled upon a svg bug with new lunasvg parser in juce 9 .

Any svg group node with opacity (or other render-like attributes), will not set the name of it’s corresponding juce::DrawableComposite

    <g id="ThisIdWillNotPropagateToDrawableName" opacity="0.96">
      ...
    </g>
    <g id="ThisIdWillWorkOk">
      ...
    </g>

I feel its a straight forward bug to fix in SVGParser.cpp, but it may have been explicitly ignored because of some edge cases I can not think of right now.

My one line fix would be :
DrawableCanvas::blendCanvas() should also set the name to getElementIdBeingRendered() as other functions are doing in this same class (i.e drawImage()…)

    void blendCanvas (const Canvas& canvas, lunasvg::BlendMode blendMode, float opacity) override
    {
      {...}
        std::unique_ptr<DrawableComposite> other { static_cast<DrawableComposite*> (drawableCanvas->composite->createCopy().release()) };
        other->setName (document.getElementIdBeingRendered()); // added this line!!!
       {...}
    }

I posted here following github guildelines, but I could happily do a gluten-free/AI-free PR or issue if simpler…
let me know, cheers!

I think the details are important here. Can you post a concrete SVG example where you think the name assignment is incorrect?

I experimented with reproing it myself, but adding opacity to an element just turned it into a blended group represented by a DrawableComposite, and inside that composite the name was still assigned.

In other words the id I was looking for was just moved one level down in the Drawable hierarchy, which is intended behaviour.

Hey thanks for such prompt answer, sorry my previous example was quite misleading because my counter example <g id="ThisIdWillWorkOk"> would indeed be flattened out and lose it’s name by design.

here is a simpler example.

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 379 299">
    <g id="MyGroup" opacity="0.1">
      <rect id="MyRect" fill="red" width="10" height="10" />
    </g>
</svg>

for this svg , the top level group with id=“MyGroup” will effectively be turned into a DrawableComposite, but it’ll have an empty name. everything else is fine.