d2 icon indicating copy to clipboard operation
d2 copied to clipboard

layout: fix dagre container-child connections

Open gavin-ts opened this issue 3 years ago • 0 comments

dagre doesn't handle container connections so the solution is to connect to a container's child, then cut the edge at the container's border. This works well if something outside is connecting to the container, but if it is from a child/descendant, then it will show up as an edge between descendants. Perhaps we can add a dummy node outside the container, and use that for connections going to a container from a descendant.

example:

container.first -> container.second: 1->2
container -> container.second: container->2

dagre layout (incorrect edge)

Screen Shot 2022-11-11 at 3 29 24 PM

tala layout

Screen Shot 2022-11-11 at 3 29 36 PM

gavin-ts avatar Nov 11 '22 23:11 gavin-ts