iVis-at-Bilkent / cytoscape.js-fcose

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

Prevent overlaps with custom DOM nodes? #55

Closed RaitoBezarius closed 1 month ago

RaitoBezarius commented 2 years ago

Hi there, thank you for your package.

I am using React.js and custom DOM components for my nodes and it result in overlaps with fCOSE using layout constraints. I am guessing fCOSE is not measuring the actual size of my nodes and thinks it's not creating any overlap.

How could I insert a phase to measure the whole DOM nodes sizes before starting the actual layout work?

Thank you in advance!

RaitoBezarius commented 2 years ago

Ha, from what I am seeing, the bounding boxes are used here: https://github.com/iVis-at-Bilkent/cytoscape.js-fcose/blob/master/src/fcose/cose.js#L56-L113 ; by doing some breakpoints there, I can see the right width / height received, could that be a bug or is overlap possible even if the viewport has enough space to do it? Should I try to do a reproducer?

hasanbalci commented 2 years ago

Hi @RaitoBezarius, a reproducible example would be great for us to make observations and comment about your issue. fCoSE aims to prevent node overlaps but it may be inevitable in some cases based on the graph topology.

hasanbalci commented 1 month ago

Closing now, feel free to reopen it if you have similar issue but please provide a reproducible example.