elk icon indicating copy to clipboard operation
elk copied to clipboard

Layout option to force global `container: root` coordinates for all children and edges

Open snelsi opened this issue 1 year ago • 7 comments

New to Elk , I will be glad for any help.

I have a nested layout with cross-parent edges. After enabling "hierarchyHandling": "INCLUDE_CHILDREN" layout option, I noticed that some of the edges are using startPoint / endPoint sections relative to the container coordinates they are located.

Is there a layout option I can enable to force all children and edges to use global container: root coordinates instead?

snelsi avatar Mar 29 '24 15:03 snelsi

Hi snemsi, You have a documentation about coordinates system here. There is no link between this coordinates system and the layout options. Regards, Laurent

lredor avatar Mar 29 '24 16:03 lredor

Sorry, I don't follow you. Is there a way to force all childrens/edges to use global root coordinates?

snelsi avatar Mar 29 '24 17:03 snelsi

No, not that I know of.

lredor avatar Apr 02 '24 06:04 lredor

Hi @snelsi, as I understand it, you want to be able to configure whether to use absolute or relative coordinates. This is currently not possible and also probably out of the scope of ELK. Is there any obstacle to simply computing the absolute coordinates from the layout results produced by ELK?

Eddykasp avatar Apr 09 '24 12:04 Eddykasp

This should be addressed when fixing https://github.com/eclipse/elk/issues/901

soerendomroes avatar Apr 09 '24 12:04 soerendomroes

@Eddykasp,

I'm currently using elkjs along with xyflow/react and integrating my custom edge renderer.

xyflow organizes nodes and edges separately into two flat arrays without nested hierarchy. While it handles nodes with parent-relative coordinates well, I'm unsure if it can manage edges with parent-relative coordinates.

This means I have to calculate and convert all edges to absolute coordinates, which is a bit inconvenient and increases the chance of mistakes.

I had hoped that elk would provide an option to use flat children/edges output with absolute coordinates.

snelsi avatar Apr 09 '24 13:04 snelsi

I see, I previously misunderstood the problem.

Eddykasp avatar Apr 10 '24 06:04 Eddykasp