nadavrot / layout

Layout is a rust library and a tool that renders Graphviz dot files.
MIT License
656 stars 39 forks source link

Custom properties #26

Closed ekinimo closed 6 months ago

ekinimo commented 6 months ago

Hello! I added <g> tag around vertices and edges in svg backend. Here is the documentation for the tag . As far as i understood this should not interfere with the rendering of the child elements. Elements and Arrows have now additional constructors with properties:Optional<String> argument to dictate the properties of the <g> tag.

nadavrot commented 6 months ago

Thanks @ekinimo. This looks pretty good. I have a few comments. First, run 'cargo fmt', to make sure that the formatting is okay. Second, with_properties could be implemented using 'new', or the other way around, to eliminate duplication. Same with simple_with_properties.

Everything else looks good. Just make these tiny fixes and I'll land the change.

ekinimo commented 6 months ago

Hey @nadavrot I made the changes, i hope you like them.

I have a preliminary version of ForeignElement feature that suffices my needs. You can check the branch here Im working on a version that hides behing Text and ForeignObjects behind a trait so that it would be more general but that ll take a bit more time and it is not as trivial as i hoped it would be, i had to add lot of genericsto a lot of structs. Ill present that branch after im happy with it as well

nadavrot commented 6 months ago

Thanks for doing the work!