jerosoler / Drawflow

Simple flow library 🖥️🖱️
https://jerosoler.github.io/Drawflow/
MIT License
4.78k stars 741 forks source link

Design problem: connection line is not positioned in an intelligent way. #539

Open quentingosset opened 2 years ago

quentingosset commented 2 years ago

Hello :)

I have a little annoying problem. As you can see in the first screen, I have a right output node-b that should connect to the top input node-p but the drawing of the connection line is not done properly and so it ends up in the other nodes.

I also noticed that when I draw a connection line from 0 (see screen 2) I have my connection that curve directly which creates the problem of the non direct connection.

Is there a way to force drawflow to say "let me draw the path and then calculate it so that it aligns correctly"?

I would like to have the following result (red line in the screen).

image image

jerosoler commented 2 years ago

I understand that you have modified the curvature function with https://github.com/jerosoler/Drawflow/issues/20

You would have to modify the function to be able to create the line you need.

It is difficult to find a single way for all types of lines.

Maybe you can play if the distance is greater or less, make this line or this other...

Perhaps a collision system could be implemented: https://developer.mozilla.org/en-US/docs/Games/Techniques/2D_collision_detection