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

Drag node issue #423

Closed
ktei opened this issue Oct 14, 2014 · 11 comments
Closed

Drag node issue #423

ktei opened this issue Oct 14, 2014 · 11 comments
Labels

Comments

@ktei
Copy link

ktei commented Oct 14, 2014

The library is light and nice but...Currently when you drag a node to the edge of the canvas, the whole graph is re-scaled (zoomed out). If you drag the node far enough, and you go back to the center of the graph, the node goes back too. Ideally, can it be simpler so that if I drag a node off canvas then the graph won't be scaled and the node will just be dragged to where I drop it?

@sheymann
Copy link
Contributor

Hello use autoRescale: ['nodeSize', 'edgeSize'] instead of autoRescale:true (default) to prevent this issue.

@ktei
Copy link
Author

ktei commented Oct 15, 2014

Hi, sheymann:
Thanks for the help, but I couldn't make it work still. I downloaded the latest sigma.js and edited examples/drag-nodes.html, where I changed the code to this:

s = new sigma({
  graph: g,
  container: 'graph-container',
  settings: {
    autoRescale: ['nodeSize', 'edgeSize']
  }
});

But what I got is the similar issue as mentioned in issue #373
Have I done something wrong?

@ktei
Copy link
Author

ktei commented Oct 20, 2014

@sheymann have you got a chance to look at my comment? I'm not sure where I did wrong here, but that autoRescale will make all the nodes collapsed on a single dot...

@sheymann
Copy link
Contributor

Hello, you'll need to set the zoom ratio manually to use this setting.

@ktei
Copy link
Author

ktei commented Oct 21, 2014

@sheymann I've searched the wiki and the only zoom ratio setting I found is 'zoomingRatio'. So if I understood you correctly, this is what I need to do (in examples/drag-nodes.html):

s = new sigma({
  graph: g,
  container: 'graph-container',
  settings: {
    autoRescale: ['nodeSize', 'edgeSize'],
    zoomingRatio: 5 /* Not exactly sure about this number yet, but it doesn't make much difference so far*/
  }
});

But the code snippet above doesn't seem to work still. All the nodes are collapsed together. Please see the attached image
capture

If I didn't quite get what you meant, could you be kind enough to write some code snippet that could work for examples/drag-nodes.html? Many thanks to you!

@sheymann
Copy link
Contributor

settings:

zoomMin: 0.01,
zoomMax: 2,

code:

sigma.utils.zoomTo(s.camera, 0, 0, 0.02);

@ktei
Copy link
Author

ktei commented Oct 21, 2014

Thank you @sheymann , so I did this:

sigma.renderers.def = sigma.renderers.canvas
// Instantiate sigma:
s = new sigma({
  graph: g,
  container: 'graph-container',
  settings: {
    autoRescale: ['nodeSize', 'edgeSize'],
    zoomMin: 0.01,
    zoomMax: 2,
  }
});

sigma.utils.zoomTo(s.camera, 0, 0, 0.02);

And it seems that this will enlarge every single node but it won't solve the problem that all the nodes are collapsed together. Please see the image below. And I tried zoomTo with other numbers such as 0.01, 0.001, and what they did was just make nodes larger but didn't solve the core problem here.

capture

Is there anything else I need to set?

@patrickmarabeas
Copy link
Contributor

My current work around for this issue is: #302, but I am also interested in dumping it for a native fix!

@sheymann
Copy link
Contributor

Did you apply the layout algorithm?

@ktei
Copy link
Author

ktei commented Oct 24, 2014

@sheymann no, I actually only need to play with predefined coordinates because I need to use the layout generated by back-end server (which gives better layout). However, @patrickmarabeas 's workaround seems working for me, so big thanks to both of you!

@stale
Copy link

stale bot commented Oct 9, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Oct 9, 2021
@stale stale bot closed this as completed Oct 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants