Blazor.Diagrams icon indicating copy to clipboard operation
Blazor.Diagrams copied to clipboard

How to make links always attach to nodes orthogonally

Open Phloog opened this issue 1 year ago • 5 comments

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?

Phloog avatar Feb 21 '24 13:02 Phloog

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

zHaytam avatar Feb 24 '24 10:02 zHaytam

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.

Phloog avatar Feb 26 '24 09:02 Phloog

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

zHaytam avatar Feb 26 '24 09:02 zHaytam

I'll have a look, thanks!

Phloog avatar Feb 26 '24 09:02 Phloog

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?

Phloog avatar Mar 08 '24 15:03 Phloog