-
Notifications
You must be signed in to change notification settings - Fork 42
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 connect two default nodes programmatically #37
Comments
This is what I'm trying to do:
And this is the error that I get:
|
Hi, if you are still facing this issue, I think i've got a solution. While dragging from one connector to another to create connection, the TailManager::snapPosition method is called, which calls GTailSkin::draw method. In DefaultTailSkin, this method adds some points (joitns) to the connection. When you release your mouse while hovering over target connector, the releaseHandler for Connector is called, which, if the connection is valid, calls private ConnectorDragManager::addConnection method. It looks like this:
As you can see, this method collects joints and passes it as an argument to ConnectionCommands::addConnection. Your main problem was that you did not create any joints hence the method resulted in throwing IndexOutOfBoundsException. So, if you want to add a connection programatically, you should call first:
and then:
Which should result in adding the connection in the way you expected. The connection path does not look perfectly, but you could try to deal with joints coordinates - i suppose it should help. Hope you find it helpful. |
I didn't manage to connect two simple nodes together programmatically.
In the demo it is done with the tree skin, but what if I just want to do it with the default skin?
I would add this to the wiki documentation too.
The text was updated successfully, but these errors were encountered: