edge case of edges on grid container

This commit is contained in:
Gavin Nishizawa 2023-09-12 17:08:34 -07:00
parent 10775c2f32
commit 46bd6aeee5
No known key found for this signature in database
GPG key ID: AE3B177777CE55CD
3 changed files with 11 additions and 5 deletions

View file

@ -2476,15 +2476,17 @@ d2/testdata/d2compiler/TestCompile/grid_gap_negative.d2:3:16: vertical-gap must
name: "grid_edge",
text: `hey: {
grid-rows: 1
a -> b
a -> b: ok
}
c -> hey.b
hey.a -> c
hey -> hey.a
hey -> c: ok
`,
expErr: `d2/testdata/d2compiler/TestCompile/grid_edge.d2:5:2: edges into grid diagrams are not supported yet
d2/testdata/d2compiler/TestCompile/grid_edge.d2:6:2: edges into grid diagrams are not supported yet`,
d2/testdata/d2compiler/TestCompile/grid_edge.d2:6:2: edges into grid diagrams are not supported yet
d2/testdata/d2compiler/TestCompile/grid_edge.d2:7:2: edges into grid diagrams are not supported yet`,
},
{
name: "grid_nested",

View file

@ -209,7 +209,7 @@ func withoutGridDiagrams(ctx context.Context, g *d2graph.Graph, layout d2graph.L
// simple straight line edge routing between grid objects
for i, e := range g.Edges {
edgeOrder[e.AbsID()] = i
if e.Dst.ClosestGridDiagram() != obj {
if e.Dst.Parent.ClosestGridDiagram() != obj {
continue
}
e.Route = []*geo.Point{e.Src.Center(), e.Dst.Center()}

View file

@ -3,12 +3,16 @@
"err": {
"errs": [
{
"range": "d2/testdata/d2compiler/TestCompile/grid_edge.d2,4:1:32-4:11:42",
"range": "d2/testdata/d2compiler/TestCompile/grid_edge.d2,4:1:36-4:11:46",
"errmsg": "d2/testdata/d2compiler/TestCompile/grid_edge.d2:5:2: edges into grid diagrams are not supported yet"
},
{
"range": "d2/testdata/d2compiler/TestCompile/grid_edge.d2,5:1:44-5:11:54",
"range": "d2/testdata/d2compiler/TestCompile/grid_edge.d2,5:1:48-5:11:58",
"errmsg": "d2/testdata/d2compiler/TestCompile/grid_edge.d2:6:2: edges into grid diagrams are not supported yet"
},
{
"range": "d2/testdata/d2compiler/TestCompile/grid_edge.d2,6:1:60-6:13:72",
"errmsg": "d2/testdata/d2compiler/TestCompile/grid_edge.d2:7:2: edges into grid diagrams are not supported yet"
}
]
}