jerosoler / Drawflow

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

Ability to define custom port name #128

Closed nsisodiya closed 3 years ago

nsisodiya commented 3 years ago

right now Drawflow is generating input_x & output_x.

for(var x = 0; x < num_in; x++) {
      const input = document.createElement('div');
      input.classList.add("input");
      input.classList.add("input_"+(x+1));
      json_inputs["input_"+(x+1)] = { "connections": []};
      inputs.appendChild(input);
    }

    const json_outputs = {}
    for(var x = 0; x < num_out; x++) {
      const output = document.createElement('div');
      output.classList.add("output");
      output.classList.add("output_"+(x+1));
      json_outputs["output_"+(x+1)] = { "connections": []};
      outputs.appendChild(output);
    }

In our software, port names are predefined like these.

image Check port names in the given image. How can we solve this problem.

nsisodiya commented 3 years ago

I was able to solve the problem using generating map where i need to give label and portname to generate input/output classNames.