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

Add the ability to re-run layout for compound node children. #1372

Closed
aindlq opened this issue May 12, 2016 · 3 comments
Closed

Add the ability to re-run layout for compound node children. #1372

aindlq opened this issue May 12, 2016 · 3 comments

Comments

@aindlq
Copy link

aindlq commented May 12, 2016

I'm trying to do some ad-hock collapse/expand feature for compound nodes.

Collapse is done with changing position of all compound node children to one point:
elem.descendants().positions(elem.position());

And then, on expand, I'm trying to re-run layout over all node children:
elem.descendants().layout({name: 'cose-bilkent'});

Reading the http://js.cytoscape.org/#eles.layout it seems that it should be possible to layout only some collection of nodes. But it seems this doesn't work for compound node children.

See http://jsbin.com/didunafota/1/edit?html,output

@maxkfranz
Copy link
Member

Not an issue with Cytoscape. If you try with a different layout like circle, you'll notice your demo works fine.

See cytoscape/cytoscape.js-cose-bilkent#14

@maxkfranz
Copy link
Member

@aindlq In the meantime, I suspect you could just run the random layout before cose-bilkent and it would work OK as a workaround. You can use the boundingBox to constrain the layout bounds.

@maxkfranz
Copy link
Member

@aindlq Or rather than running a layout to expand, you could save the relative positions of each child before collapsing. Then you can restore that relative position on the expand action.

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

No branches or pull requests

2 participants