jerosoler / Drawflow

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

[FEATURE REQUEST] - Add Conditional node and Loop node #346

Closed sujit-baniya closed 2 years ago

sujit-baniya commented 2 years ago

Thank you for awesome library.

Adding Conditional node would be very helpful. Some days back, I built a library: https://github.com/sujit-baniya/flow in golang that would allow executing functions in flow. I'm looking to integrate this library with Drawflow

Feature:

jerosoler commented 2 years ago

Hi, Thanks

A conditional node is only a node with 1 input and 2 outputs.

// editor.addNode(name, inputs, outputs, posx, posy, class, data, html);
editor.addNode('github', 1,2, 150, 300, 'github', data, html);

You can add as many inputs and outputs as you like.

ariselseng commented 1 year ago

@jerosoler Is it possible to get different styling on the connection line based on the condition? If the condition is true then the line is blue but if it false then it would be preferable to make it red? If not, is it possible to mark the two outputs by text or styling some other way?

jerosoler commented 1 year ago

Not by default.

but you could use this approach:

ariselseng commented 1 year ago

@jerosoler Thank you! You project seems great by the way.