Drawflow icon indicating copy to clipboard operation
Drawflow copied to clipboard

Connection customization

Open urveerendra opened this issue 2 years ago • 3 comments

Firstly thank you for giving a base & themed reference which can be extended to many of our custom requirements. After doing many customizations on node, now I am working with customizing the connections with below points, Needed ur inputs on these,

  1. Avoiding colliding connections or avoiding overlapping connections
  2. Avoiding connections colliding with nodes
  3. Creating curvature with slant connections( have got connections with horizontal/vertical connections) needed something which can be connected slantly(e.g., 45deg)

urveerendra avatar Jul 10 '22 19:07 urveerendra

  1. and 2. You will have to modify the createcurvature function. View: #20

You will have to take into account the nodes and have their getBBox (Width, height, x and y). I see the problem in the connections that do not overlap, it can be more difficult, since there is no straight line.

  1. You mean this? -https://github.com/jerosoler/Drawflow/issues/454

jerosoler avatar Jul 11 '22 06:07 jerosoler

Thanks for the immediate reply, For point 1 and 2 : I did try with the various examples provided in the examples of #20 . But my requirement is something unique, where in we build kind of circuits where connections cannot overlap, something like this image (attached) image

where in we have to avoid the overlaping(colliding) of any connection on the circuit or to avoid overlap on the equipment itself.

I used collision detection (https://developer.mozilla.org/en-US/docs/Games/Techniques/2D_collision_detection) function for the node overlapping.

Not seeing much option for SVG colliding/overlapping, do u have any other thoughts?

For Point 3 : we have 2 nodes kept in ( 2 different positions) slope positions, where we have to optimally connect those components. trying this connections with "v" and "L" in the editor.createcurvature . any other option left other than this?

like in the below picture. image

urveerendra avatar Jul 11 '22 10:07 urveerendra

Point 1. It is as you describe with the collision system, as long as the object is rectangular.

Point 2 is tricky. I think it would have to be done the same as 1 and with the change of the same lines. Depending on the objects maybe it could be predicted.

Point 3, the best is Lineto. Or Vertical or Horizontal with transformation.

Another option is if you put in drawflow: editor.curvature = 0.1; In this case it is a curve "C" Curveto.

image


One question, the lines will be created by the user or is it only to generate the drawing?

If not created by the user, maybe you could store it in the node or in the connection itself.

Modifying the library a bit.

jerosoler avatar Jul 11 '22 14:07 jerosoler

Hi, i want to make the lines like this...like curvy at start of the node and end of the node for vertical .... need your assists image

ArG97 avatar Oct 31 '22 02:10 ArG97

Hi! @ArG97 For vertical lines view:

  • https://github.com/jerosoler/Drawflow/issues/20

jerosoler avatar Oct 31 '22 07:10 jerosoler

Hi! @ArG97 For vertical lines view:

Thank you!!

ArG97 avatar Oct 31 '22 08:10 ArG97