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.38k stars 224 forks source link

[Question] How to detect whether two Connections intersect or are close enough? #134

Closed Summpot closed 2 months ago

Summpot commented 3 months ago

I would like to implement this effect in StepConnection or CircuitConnection. image I also want a certain segment of the StepConnection to be draggable in the direction perpendicular to the line, and to prevent any draggable segments of two StepConnections from overlapping. It all seems to require detecting if the lines intersect or are close enough. However, I don't see any good way to get the actual path of the line. Does anyone have any suggestions? Thanks!

miroiu commented 2 months ago

Hi, sorry for no response. While I believe it is possible to implement this functionality, I can't think of a simple or an efficient solution. It may be better just implementing a custom connection type from search.

Summpot commented 2 months ago

Thanks to your reply, I have implemented a StepSonnection that can be dragged through some vector operations and rewrite the logic of drawing geometry.