You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
option to add bridges/arcs to crossings/intersections #1932
changed the title [-]consider option to add bridges/arcs to crossings/intersections[/-][+]option to add bridges/arcs to crossings/intersections[/+]on May 3, 2024
Hey @alixander , interested in working on this, added the test in txtar.txt which generated svg in testdata/txtar. Added the boolean value in Config and changed compileConfig. If its not urgent, can i work on this ?
We went with the empty gap discussed here. D2 now draws it by default, so existing diagrams get the crossing treatment when you render them again. This was merged in #3011 and will be in the next D2 release.
At the red X in this SVG, the connection from g to a stays continuous. The connection from b to d has a small gap where they cross.
Activity
[-]consider option to add bridges/arcs to crossings/intersections[/-][+]option to add bridges/arcs to crossings/intersections[/+]H0onnn commentedon May 6, 2024
@alixander Hello ! I am interested in this issue. If it's okay, can I solve it?
alixander commentedon May 6, 2024
@H0onnn Yes certainly!
Some pointers:
intersection-bridgeas a boolean tod2-configs: https://github.com/terrastruct/d2/blob/7269d3000feeb8745f3952edb2edea3048742590/d2compiler/compile.go#L1394TA=1 ./ci/test.sh ./e2etests -run TestE2E/txtar/your-test-name -vto see changes and keep opening the new svg to see what it looks like.bridge: truefield to connections which should have a bridge rendered: https://github.com/terrastruct/d2/blob/master/d2exporter/export.go . Note that this function which detects intersections may be useful: https://github.com/terrastruct/d2/blob/7269d3000feeb8745f3952edb2edea3048742590/lib/geo/segment.go#L41 .bridge: truefield, you'll want to actually draw the little bridge at the intersection. This will probably be the hardest part, since you'll have to calculate svg paths. https://github.com/terrastruct/d2/blob/7269d3000feeb8745f3952edb2edea3048742590/d2renderers/d2svg/d2svg.go#L497Here to answer any questions as you go. If you decide you're no longer interested (no worries), just un-assign yourself.
alixander commentedon May 6, 2024
A test with orthogonal edges: https://play.d2lang.com/?script=XMxBCoMwEIXh_TvFw6VgELopWfQu0YzOQKjFBESKdy9Nu8pq5n2Lf04hZ8meb5BqMcrz95MpTJI8u66uXM4kbnuF2crpOYK8cGHdLQ77dmTPGxBc7fl_CRPmRiKkkQVrIwprBL07LBb1vI_onYqtWurAxOFBRfyeBZ8AAAD__w%3D%3D&
Probably worth adding both to make sure the arc looks good both diagonally and orthogonally
H0onnn commentedon May 7, 2024
Thank you for your kind response ! I will keep this in mind as I proceed with the work.
alixander commentedon May 23, 2024
Hi @H0onnn just checking in to see if you're still pursuing this
H0onnn commentedon May 27, 2024
@alixander Sorry, I'm not good at it :(
briheet commentedon May 27, 2024
Hey @alixander , interested in working on this, added the test in txtar.txt which generated svg in testdata/txtar. Added the boolean value in Config and changed compileConfig. If its not urgent, can i work on this ?
alixander commentedon May 27, 2024
@H0onnn No worries, thanks for trying!
@briheet Go for it!
alixander commentedon Mar 27, 2025
i quite like just an empty gap too
alixander commentedon Mar 28, 2025
I'm inclined to just make the empty gap the default. Will see what comes up
bo-ku-ra commentedon Mar 28, 2025
is here what happens when you show up with a big 'elk'.
https://play.d2lang.com/?script=hMnNqsIwEMXx_XmKofsMly4umIXvcmYaS7Gk4EdBQt5d1E1Rg7vf_5yVp3Pshl7WP_3XXScFIkMffMmHaYzPFJl5W66XkPI45RQlzUeIVFQALCAM_ggr27TNUwGqh70plU3y62ovWpP-QW_SfpFvNHXgHgAA__8%3D&layout=elk&
bo-ku-ra commentedon Mar 29, 2025
how about the idea of using opacity?

e2etests: cover gaps where connections cross
alixander commentedon Nov 23, 2026
We went with the empty gap discussed here. D2 now draws it by default, so existing diagrams get the crossing treatment when you render them again. This was merged in #3011 and will be in the next D2 release.
At the red X in this SVG, the connection from g to a stays continuous. The connection from b to d has a small gap where they cross.