Skip to content

Smarter connector types #16

@setzer22

Description

@setzer22

Hi, first of all, thanks for this awesome library!

After using the connector layout, I feel there is a missing feature. First of all, as a minor introduction, I'm working on a library to dynamically layout flowchart-like diagrams. Because of the dynamic nature of the generation, I do not know a priori where my elements will end up being.

I've encountered an issue when creating what I call a "split" path. Please see the following picture:
image

As you can see, after the diamond-shaped node, the flow "forks" into three different branches. This is how I want my diagram to look. However, when generating the diagram, I have no way to know if one of the branches (in this case, the one containing B) will be horizontally align with the diamond. So I cannot decide at generation type if I want a :-- or a :|- connector. If I use the :|- type in all branches, I end up with this:
image

Now, as I understand, this kind of information cannot be obtained at the diagram generation time, because the document has not been rendered yet, so my idea was to extend the connector types with a "smart connection" one, that will either choose a straight or an angle connector, depending on the slope between the two elements (a configurable parameter). Do you think this is a viable approach?

I'm willing to work on a PR myself, but some guidance would be very much appreciated!

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions