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

Ability to specify size of parent nodes #1051

Closed
dabobert opened this issue Aug 22, 2015 · 7 comments
Closed

Ability to specify size of parent nodes #1051

dabobert opened this issue Aug 22, 2015 · 7 comments

Comments

@dabobert
Copy link

Even though i try to specify the size of parent nodes, the width and height attributes always seems to be ignored. I would find it beneficial to limit the space that parent nodes and their children take up on the canvas

@maxkfranz
Copy link
Member

This may be possible to set as an option in particular layouts, but it's probably not possible in general with all the features that the API supports.

For example, some layouts only apply to noncompound nodes. So, all the child nodes get positioned according to the layout algorithm (e.g. arbor or grid). A compound parent has its dimensions set automatically based on its children. If a restriction is set on compound dimensions, there is a contradiction.

It would be possible to have layouts (like the upcoming CoSE2) have support for limiting compound node sizes -- but even then this is more of just a hint rather than a hard and fast restriction. Even within a layout, restricting compound size can create contradictions. Consider avoiding overlap. The compound may not have enough space to avoid its children from overlapping.

@dabobert
Copy link
Author

dabobert commented Sep 2, 2015

honestly a hint would be amazing. I understand that if a person were to define too little space for a compound nodes and its child nodes, it would have to "bust out" of the size originally designed

And if this could be included in an upcoming release that would be amazing.

@ugurdogrusoz
Copy link

Limiting compound node sizes is not straightforward at all. Any particular reason that you'd like to limit a compound node's size? Can you share with us some examples where the layout inside compounds are not to your satisfaction? Have you tried increasing gravity if you think layout produces compound nodes that are too large? Also, if your compounds typically include disconnected nodes, you should turn tiling on.

@ugurdogrusoz
Copy link

ugurdogrusoz commented Oct 6, 2016

I think a layout algorithm's treatment of compound sizes is independent of whether or not the core allows resize of compounds. When you call layout, you should be ready to / expect to see node positions and compound node dimensions change!
I think there should be an option at the core for compounds for auto resizing of compounds. I would make it true by default (current behavior). If false, however, I would allow compounds to be resized arbitrarily (independent of their children). We might want to restrict the geometry of the compounds in such a way that a compound is always "bigger" than its children's bounding rectangle (+paddings). There is no reason to disallow a compound to be "bigger" than its content, otherwise.
The behavior about moving children as a compound moves, and adjusting compound dimensions to include all children when children are moved as necessary should be kept of course. In addition, when the user tries to resize a compound to be smaller than its content, it should be adjusted to be at least as big as its content, regardless of the current value of this option.

@ugurdogrusoz
Copy link

@dabobert Now it's possible to size compounds to be bigger than their children's bounds using the options specified under "Compound parent sizing" in Cytoscape.js documentation. This is a feature outside a layout. For a layout to support this is a separate issue; in other words, layout might change any specified size for a compound.

@kunalganglani
Copy link

I want to use dagre layout along with an option to make the child nodes have vertical alignment and compound nodes a fixed height and width. Is this possible?

@rbowers02
Copy link

@kunalganglani Just curious were you able to accomplish this? I was looking to do the same thing I have 20 nodes inside a parent and I would like to be able to set max width on that parent and force a 4x5 layout inside that parent.

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

5 participants