miroiu / nodify

Highly performant and modular controls for node-based editors designed for data-binding and MVVM.
https://miroiu.github.io/nodify
MIT License
1.4k stars 226 forks source link

[Question] How to control the path of the connection? #164

Closed lyq-lin closed 6 hours ago

lyq-lin commented 2 days ago

Hello, @miroiu ! I am implementing some graphic layout algorithms based on using notify, of course, they have certain scenarios.

As shown in the figure, the final sorting result is as follows. But there is a problem with graphical interfaces: how can I control the paths of certain connections?

As shown in the diagram, if there are nodes with hierarchical balance, I can control the coordinates of the nodes to draw the Connection.

But when there is no balanced hierarchy in the nodes, I seem to have no way to control these connections to achieve a beautiful effect.

So, will Notify support dragging of Connections? Or will there be any optimization in this idea?

ex: image

Also, I noticed that StepConnection seems to support controlling turning points, right? Can I get some examples about using them?

miroiu commented 1 day ago

Hi @lyq-lin , unfortunately, the built-in connections do not support dragging or manually updating the points. They are automatically calculated based on the Source and the Target points of the connection, also taking into consideration other layout settings including: SourceOrientation, TargetOrientation and Direction. For StepConnection, there are additional properties available: SourcePosition and TargetPosition, which provides more control over the connection’s layout.

Given your requirements, I believe implementing a custom connection would be the best approach. This will allow you to fully customize how the points and connections behave.

lyq-lin commented 6 hours ago

OK, thanks for the answer, I will try to implement this idea again