jerosoler / Drawflow

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

Connection Metadata / Module(?) #45

Closed jhollowayj closed 4 years ago

jhollowayj commented 4 years ago

For some use cases, it would be nice to add metadata (name, weight, etc) to the connections between nodes/modules. Is this something that would be a) easy to implement and b) valuable to the general community?

I'd be happy to help implement it, but I'm new to this code base and would likely need a few pointers on where to get started, and how it would be best to architect this to work well with existing ideas and coding practices.

jerosoler commented 4 years ago

Hello @jhollowayj

You mean this right https://github.com/jerosoler/Drawflow/issues/18?

jhollowayj commented 4 years ago

Yeah, I think so. I'd like to be able to have a text box in the middle of the line, or be able to change that text box to my own custom vue component. Does #18 completely cover that idea? If so, should we close this issue?

jerosoler commented 4 years ago

I close issue for duplicate.

I have the idea in mind that the inputs and outputs can be formed with a json or array when the node is added.

Currently it is like this:

editor.addNode ('github', 0, 1, 150, 300, 'github', data, html);

And I think it could be a solution to implement:

editor.addNode('github', 0, [
   { 
   label: 'For text label bullet or null for not display' , 
   labelconnection: 'Label of connection middle or null for not display',   
   type: 'For force only connection with input type or null for not display',   
    }, { ... }
 ] , 150, 300, 'github', data, html);
techies-sudo commented 3 years ago

Can you give a vue example for this?labeling on top of line.

jerosoler commented 3 years ago

Hello @techies-sudo

The labels on the lines have not been implemented yet.