bobthekingofegypt / dagre-reactjs

React component for rendering a dagre graph layout without any dependency on d3
MIT License
28 stars 8 forks source link

Rendering Order #17

Closed josephmturner closed 2 years ago

josephmturner commented 2 years ago

Hello! Thank you for dagre-reactjs - it has made a big difference in our project .

In our use case, nodes should render last so that they display on top of edges and markers. The change is as simple as moving https://github.com/bobthekingofegypt/dagre-reactjs/blob/a514063a016c5a9a02059c7564c05b2dfd5927cc/src/DagreReact.tsx#L198-L205 down to the end of the group: https://github.com/bobthekingofegypt/dagre-reactjs/blob/a514063a016c5a9a02059c7564c05b2dfd5927cc/src/DagreReact.tsx#L197-L216

Would you be open to a PR which adds an optional attribute to the graphOptions prop which controls the rendering order? Something like renderingOrder, an array of strings like ['nodes', 'edges', edgeLabels'] (current behavior), ['edges', 'edgeLabels', 'nodes'] (what I need), or some other iteration?

josephmturner commented 2 years ago

It might be more appropriate to pass renderingOrder directly to DagreReact, not inside graphOptions. Let me know what you think!

bobthekingofegypt commented 2 years ago

Sure, happy to take a PR for this.

Just browsing the repo I realise I left the branches in a bit of a mess by never releasing version 1.0 final. I should really do that at some point, but the latest version of the code is on the alpha branch (1.0.0-alpha.2 on npm). If you are going to make changes I'd make them against that starting point.

Is your project working against 1.0.0-alpha.2 or the older 0.2.0 release?

josephmturner commented 2 years ago

Thank you! We are using the npm version 1.0.0-alpha.2. I'll be sure to make changes against that version.

bobthekingofegypt commented 2 years ago

Thanks for that.

I will try push out another alpha release to make sure I can get a release working and then later I'll push out the current version as version 1.0 final.

josephmturner commented 2 years ago

Splendid! Thank you for your prompt response and merge!!