andymchugh / andrewbmchugh-flow-panel

Apache License 2.0
34 stars 2 forks source link

SVG-YAML Mapping issue #43

Closed GabriPoz closed 4 months ago

GabriPoz commented 4 months ago

Dear Andrew, I'm trying to setup my first svg from drawio, but looking at the Mapping log, it seems the svg items cannot be mapped correctly by the yaml file.

In a test, I took the default SVG example that pops up creating a new Flow panel and I edited it with drawio to change the svg cells IDs. I uploaded the new file and also updated the yaml mapping accordingly and everything works fine. Modified Ok

If, however, I change the position of a cell in the SVG, the mapping is completely lost, even though the cell IDs have remained the same. Modified not OK

For the same reason, I cannot successfully create a new svg and map it to test data Could you please help me understand what am I missing?

Thank you so much Regards

andymchugh commented 4 months ago

All I can think is you are somehow removing the first cell and creating a new one. Or somehow hiding the one you are driving behind a second.

The Debugging.mappings button will show you what cells are mapped and what aren't. The debugging.svg will print the svg after all annotation is applied.

Copy the original and updated and post annotation svgs into a prettier (just Google svg prettier or formatter) and you should be able to see what's going wrong.

If you still can't see it take the working svg and reduce it down to a single cell. Check it still works, then apply your breaking change and see whats happening in your svg

Hopefully those steps will get you going

GabriPoz commented 4 months ago

Update: it seems like when saving the SVG in draw.io, the cell IDs get messed up, draw io saves the IDs in another format than that indicated in the guide, so it cannot correctly match the IDs thorugh the YAML. Please not that it does this with both the desktop version with the svgdata plugin installed and also with the web version as well.

andymchugh commented 4 months ago

What desktop version of draw.io and computer os are you using? And if you create a cell id of 'abc' how does it appear in the svg?

andymchugh commented 4 months ago

If after trying the above you are still having problems, you'll need to post the svg source xml from before the transformation and after (you get the after in the console via Debugging->svg). With those I can at least see what's happening and maybe able to help. Your posts above appear to just be images which don't allow me to look deeper. If there's a way for me to convert the above images to the svg xml, do just say and I'll have a look.

GabriPoz commented 4 months ago

After some debugging I found the issue, it's in draw.io not in the plugin :) Draw.io, both in the latest desktop or web version, saves the cell IDs in a format slightly different than that expected, so the yaml file cannot map the cells correctly. We can close the issue since the problem is in draw.io saving method and not in in the plugin. Thank you very much for the prompt support