-
Notifications
You must be signed in to change notification settings - Fork 425
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
Any way to add node to center of canvas? #153
Comments
I believe this is a miss on my end - I cannot find this documented in the current repository. What you are looking for is It was documented in the ngraph.forcelayout module, but not here. Please let me know if this works for you. |
I'm not exactly sure how to call this method. When I try to use the ngraph syntax, it says that "require is not defined". When I try to access it via "graph.layout", it's undefined. Can you cure my stupid? |
Just for reference, this is me trying to solve Issue #2 on my repo. In addition to my comment above, I've tried going into each node and changing their position to {x:0,y:0}, but it appears that this location still drifts over time. |
using the method you described, it's still drifting. I'm currently calling layout.setNodePosition(nodeId,0,0); on every addition, yet this point still drifts significantly over time. I'm going to try a workaround to see if I can give you more data to work off of. I'll get back to you in a bit. |
Just found out that layout.setNodePosition() was calling a non-existent method, so that would explain some. I decided to try going in and replacing force_directed_bodies properties, and that works for a little while, but the program quickly crashes. Still, though, there's no noticeable drift in that time. |
Wow, so I'm a little embarrassed here. Turns out when I forked this project, I never checked what version of Vivagraph it was using. It was nearly 2 years old. So yeah, my fault, not yours. I'm still having trouble properly placing 2/4 of my node types, but that's on me, not you. I still wish there was a way to automatically do this, but feel free to consider this closed. |
Hi @gappleto97 The layout object created here should be exactly the same as
I'm not sure I understand. Are you trying to prevent nodes from flying away? |
No. When I call addNode(), the location it adds them at changes over time. Using the above hack makes it relatively stable, but for some reason I'm
|
Ah, I see what you mean. Physics simulator will attempt to to put node as close as possible towards its neighbors. This is by design, since in most cases it will reduce amount of required work. What this means - if you add your node via Have you tried calling |
I have. I haven't tried it on the most recent version yet (again, was using I'll try it on the new version tomorrow. Hopefully that will work better.
|
Sorry if I'm missing something obvious, but as near as I can tell, the point of insertion for nodes is wandering all over the place. I just want a reliable way to add nodes to the center of any given canvas, and have them rearrange accordingly afterwards.
Is there a way to do this?
The text was updated successfully, but these errors were encountered: