jerosoler / Drawflow

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

Designated Inputs and Outputs #636

Closed ghost closed 1 year ago

ghost commented 1 year ago

Is there anything on the cards to be able to link inputs to labels or objects inside the node.

Functionality:

Before rearange image

After rearange image

This is likely possible by hacking the system and physically moving a node into another node and just piggybacking off the base functionality, but if it's natively supported, that would be nice

jerosoler commented 1 year ago

1: Here is an example of how to align output to element.

2: I don't understand. But you can detect node movements using the nodeMoved event

ghost commented 1 year ago

Interesting, ok that will work for what I need, thanks :)

Question 2 is then not important.

On a side not in relation to this, Is it possible to give connection ports custom name?

For example, connection ports are currently labeled input, output so when it's exported it exports as

json { "inputs":{ "input_1":{ "connections":[ { "node":"2", "input":"output_1" } ] } } }

Assigning a custom name value like "input_username"

The expected export json { "inputs":{ "input_username":{ "connections":[ { "node":"2", "input":"output_1" } ] } } }

jerosoler commented 1 year ago

Cannot currently be assigned a name. They need to have a number.

But you could add information like this:

editor.drawflow.drawflow.Home.data[1].outputs["output_1"].name = "output_username";

Another way would be saving the data in the information

editor.addNode('NodeA', 1, 1, 440, 300, 'NodeA', { outputsname: { 1: "output_username "}}, 'NodeA');
ghost commented 1 year ago

Very cool, ok I'll play around with that, thanks for the assistance.

Steller project, can't wait to see where it goes.