Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Assign Labels to Connections in DrawFlow Condition Node? #704

Open
ahmadshaik1608 opened this issue Jun 2, 2023 · 11 comments
Open
Assignees
Labels
question Further information is requested

Comments

@ahmadshaik1608
Copy link

I'm currently working with DrawFlow and I have a requirement to assign labels to connections in the condition node. The condition node has a rhombus shape and consists of one input and two outputs.

image

I would like to know how I can achieve the following behaviour:

When a connection is dragged from the right end of the condition node, I want to set the label of the connection to "true".
When a connection is dragged from the bottom of the condition node, I want to set the label of the connection to "false".
I would appreciate any guidance, code examples, or suggestions on how to implement this functionality in DrawFlow.

Please feel free to share your insights or point me in the right direction. Thank you in advance for your help!

@jerosoler jerosoler self-assigned this Jun 2, 2023
@jerosoler jerosoler added the question Further information is requested label Jun 2, 2023
@jerosoler
Copy link
Owner

View:

@ahmadshaik1608
Copy link
Author

ahmadshaik1608 commented Jun 2, 2023

Thanks,

But how to identify the link coming form true output or false output in exported json.

Can we pass the outputId and node name to the create curvature function to implement node specific style to the link?

@jerosoler
Copy link
Owner

In the export with output_1 and output_2

@ahmadshaik1608
Copy link
Author

Can you please provide with the code.

this.editor.createCurvature = function (start_x, start_y, end_x, end_y, curvature_value, type) {
....
}

Iam using this function to create curvatures, but now i want to pass the nodeid and outpuId (from which output the connection is creating) based on these values, i will put conditions inside above function and generate links respectively.

@jerosoler
Copy link
Owner

CreateCurvature function not get the nodeId.

But use events with connection created:

editor.on('connectionCreated', (obj) => {
 console.log(obj)
});

@ahmadshaik1608
Copy link
Author

Is it possible to redraw the curvature of the connection within the 'connectionCreated' event handler? I would like to customize the curvature based on the newly created connection, its source node, and the output it is coming from.

Specifically, I'd like to adjust the curvature based on different conditions depending on the source node and the specific output that was used to create the connection.

Please help me.

@jerosoler
Copy link
Owner

You could modify the creacteCurvature function in the code.
You could modify drawflow to pass it more values.

Here, for example, there is a PR to add the input and output addresses of a node.

#32

@ahmadshaik1608
Copy link
Author

I replaced the code mentioned there in drawflow.min.js, in angular

But not working, is there any other fix for adding the input and output addresses of a node.

@ahmadshaik1608
Copy link
Author

I checked with that code but it is giving only the in_dir only and giving unknown for value out_dir

this.editor.createCurvature = function (start_x, start_y, end_x, end_y, curvature_value, type, out_dir = 'unknown', in_dir = 'unknown')

image

For the bottom node the curvature is not rendering correctly.

Please help me with this

@ahmadshaik1608
Copy link
Author

Hi @jerosoler, Can you please help me with it

@jerosoler
Copy link
Owner

out_dir and in_dir is not drawflow is the fork drawflow. I can't help you. From what I see in the PR, it has to indicate if it is top or bottom in the curve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants