Blazor-Diagrams / Blazor.Diagrams

A fully customizable and extensible all-purpose diagrams library for Blazor
https://blazor-diagrams.zhaytam.com
MIT License
917 stars 176 forks source link

How to make links always attach to nodes orthogonally #417

Open Phloog opened 4 months ago

Phloog commented 4 months ago

If I'm using the Smooth PathGenerator with nodes without anchors, the links often attach to the node tangentially, not orthogonally:

image

How can I change this so that the links always attach orthogonally to the border of the node?

zHaytam commented 4 months ago

Hello, can you show in that same screenshot how you want them to be? I'm afraid I don't understand what you mean

Phloog commented 4 months ago

Hey, I tried to mock the desired behaviour:

image

The point being that all links leave their nodes orthogonally, not tangentially (see yellow markers and red links).

This becomes even more apparent it there are Arrows etc. at the ends of the links. If the links attach to the nodes tangentially, as in the first screenshot (yellow markers), the arrowheads don't point to the nodes, but sideways.

zHaytam commented 4 months ago

Oh, I see now! It does look very ugly with arrowheads, you're right.

If you know your way around SVG/paths, you could try to create a custom path generator that returns the links the way you want them, until I have the chance to try to fix them myself

Phloog commented 4 months ago

I'll have a look, thanks!

Phloog commented 3 months ago

Hi, unfortunately I didn't manage to fix the link routing yet. What I found was that maybe the desired behaviour can be achieved without touching the routing logic, but instead by changing the rotation value on the anchors itself - am I right? This may be a bit easier to do.

What do you think?