iVis-at-Bilkent / cytoscape.js-fcose

fCoSE: a fast Compound Spring Embedder
MIT License
134 stars 25 forks source link

Shift components to original location on layout #47

Closed ugurdogrusoz closed 2 years ago

ugurdogrusoz commented 3 years ago

When fCoSE runs, it might shift the center of the drawing arbitrarily (see this similar issue in CiSE for an example; this is due to problems in our force model). In order to avoid this, we should calculate the center of the drawing before layout and move the laid-out drawing back to this location. This should be the case for each individual component if packing is enabled. This is already done in non-incremental layout but should be done for incremental one as well.

hasanbalci commented 2 years ago

@ugurdogrusoz We now shift graph to its original location in both randomized and incremental layout. If packing is enabled, we first shift each individual component to its original location, then apply packing.

I added fit option to both demo.html and demo-compound.html files so that we can test whether the graph stays in its original location after layout.