diff --git a/d2layouts/d2sequence/sequence_diagram.go b/d2layouts/d2sequence/sequence_diagram.go index 2ed3e5950..1845a8d93 100644 --- a/d2layouts/d2sequence/sequence_diagram.go +++ b/d2layouts/d2sequence/sequence_diagram.go @@ -142,6 +142,9 @@ func newSequenceDiagram(objects []*d2graph.Object, messages []*d2graph.Edge) *se nextActorHW := actors[rank+1].Width / 2. sd.actorXStep[rank] = math.Max(actorHW+nextActorHW+HORIZONTAL_PAD, MIN_ACTOR_DISTANCE) sd.actorXStep[rank] = math.Max(maxNoteWidth/2.+HORIZONTAL_PAD, sd.actorXStep[rank]) + if rank > 0 { + sd.actorXStep[rank-1] = math.Max(maxNoteWidth/2.+HORIZONTAL_PAD, sd.actorXStep[rank-1]) + } } } diff --git a/e2etests/testdata/stable/sequence_diagram_nested_groups/dagre/board.exp.json b/e2etests/testdata/stable/sequence_diagram_nested_groups/dagre/board.exp.json index bb9d9cfd7..fa562a98c 100644 --- a/e2etests/testdata/stable/sequence_diagram_nested_groups/dagre/board.exp.json +++ b/e2etests/testdata/stable/sequence_diagram_nested_groups/dagre/board.exp.json @@ -8,7 +8,7 @@ "x": -97, "y": 290 }, - "width": 592, + "width": 655, "height": 952, "opacity": 1, "strokeDash": 0, @@ -47,7 +47,7 @@ "x": -73, "y": 420 }, - "width": 544, + "width": 607, "height": 798, "opacity": 1, "strokeDash": 0, @@ -86,7 +86,7 @@ "x": -49, "y": 550 }, - "width": 496, + "width": 559, "height": 644, "opacity": 1, "strokeDash": 0, @@ -125,7 +125,7 @@ "x": -25, "y": 680 }, - "width": 448, + "width": 511, "height": 490, "opacity": 1, "strokeDash": 0, @@ -244,7 +244,7 @@ "x": 49, "y": 1066 }, - "width": 350, + "width": 413, "height": 80, "opacity": 1, "strokeDash": 0, @@ -280,10 +280,10 @@ "id": "alt", "type": "", "pos": { - "x": 275, + "x": 338, "y": 1172 }, - "width": 461, + "width": 460, "height": 518, "opacity": 1, "strokeDash": 0, @@ -319,10 +319,10 @@ "id": "alt.case 1", "type": "", "pos": { - "x": 299, + "x": 362, "y": 1196 }, - "width": 413, + "width": 412, "height": 80, "opacity": 1, "strokeDash": 0, @@ -358,10 +358,10 @@ "id": "alt.case 2", "type": "", "pos": { - "x": 299, + "x": 362, "y": 1326 }, - "width": 413, + "width": 412, "height": 80, "opacity": 1, "strokeDash": 0, @@ -397,10 +397,10 @@ "id": "alt.case 3", "type": "", "pos": { - "x": 299, + "x": 362, "y": 1456 }, - "width": 413, + "width": 412, "height": 80, "opacity": 1, "strokeDash": 0, @@ -436,10 +436,10 @@ "id": "alt.case 4", "type": "", "pos": { - "x": 299, + "x": 362, "y": 1586 }, - "width": 413, + "width": 412, "height": 80, "opacity": 1, "strokeDash": 0, @@ -475,7 +475,7 @@ "id": "b", "type": "", "pos": { - "x": 274, + "x": 337, "y": 74 }, "width": 150, @@ -515,7 +515,7 @@ "id": "b.note", "type": "rectangle", "pos": { - "x": 86, + "x": 149, "y": 2076 }, "width": 525, @@ -595,7 +595,7 @@ "id": "c", "type": "", "pos": { - "x": 567, + "x": 629, "y": 74 }, "width": 190, @@ -663,7 +663,7 @@ "y": 330 }, { - "x": 349, + "x": 412, "y": 330 } ], @@ -702,7 +702,7 @@ "y": 460 }, { - "x": 349, + "x": 412, "y": 460 } ], @@ -741,7 +741,7 @@ "y": 590 }, { - "x": 349, + "x": 412, "y": 590 } ], @@ -780,7 +780,7 @@ "y": 976 }, { - "x": 349, + "x": 412, "y": 976 } ], @@ -819,7 +819,7 @@ "y": 1106 }, { - "x": 349, + "x": 412, "y": 1106 } ], @@ -854,11 +854,11 @@ "labelPercentage": 0, "route": [ { - "x": 349, + "x": 412, "y": 1236 }, { - "x": 662, + "x": 724, "y": 1236 } ], @@ -893,11 +893,11 @@ "labelPercentage": 0, "route": [ { - "x": 349, + "x": 412, "y": 1366 }, { - "x": 662, + "x": 724, "y": 1366 } ], @@ -932,11 +932,11 @@ "labelPercentage": 0, "route": [ { - "x": 349, + "x": 412, "y": 1496 }, { - "x": 662, + "x": 724, "y": 1496 } ], @@ -971,11 +971,11 @@ "labelPercentage": 0, "route": [ { - "x": 349, + "x": 412, "y": 1626 }, { - "x": 662, + "x": 724, "y": 1626 } ], @@ -1049,11 +1049,11 @@ "labelPercentage": 0, "route": [ { - "x": 349, + "x": 412, "y": 200 }, { - "x": 349, + "x": 412, "y": 2332 } ], @@ -1088,11 +1088,11 @@ "labelPercentage": 0, "route": [ { - "x": 662, + "x": 724, "y": 200 }, { - "x": 662, + "x": 724, "y": 2332 } ], diff --git a/e2etests/testdata/stable/sequence_diagram_nested_groups/dagre/sketch.exp.svg b/e2etests/testdata/stable/sequence_diagram_nested_groups/dagre/sketch.exp.svg index c2688555c..e97ce77dc 100644 --- a/e2etests/testdata/stable/sequence_diagram_nested_groups/dagre/sketch.exp.svg +++ b/e2etests/testdata/stable/sequence_diagram_nested_groups/dagre/sketch.exp.svg @@ -2,7 +2,7 @@