From 4657542def6defaa923f245a5811d241c136e824 Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Fri, 6 Jan 2023 12:21:47 -0800 Subject: [PATCH] labelpos --- d2layouts/d2dagrelayout/layout.go | 3 +- .../elk_alignment/dagre/board.exp.json | 54 +++--- .../elk_alignment/dagre/sketch.exp.svg | 14 +- .../dagre/board.exp.json | 44 ++--- .../dagre/sketch.exp.svg | 12 +- .../arrowhead_labels/dagre/board.exp.json | 12 +- .../arrowhead_labels/dagre/sketch.exp.svg | 6 +- .../stable/chaos1/dagre/board.exp.json | 24 +-- .../stable/chaos1/dagre/sketch.exp.svg | 8 +- .../stable/chaos2/dagre/board.exp.json | 164 +++++++++--------- .../stable/chaos2/dagre/sketch.exp.svg | 22 +-- .../child_parent_edges/dagre/board.exp.json | 80 ++++----- .../child_parent_edges/dagre/sketch.exp.svg | 6 +- .../dagre/board.exp.json | 2 +- .../dagre/sketch.exp.svg | 6 +- .../self-referencing/dagre/board.exp.json | 118 ++++++------- .../self-referencing/dagre/sketch.exp.svg | 8 +- .../container_child_edge/dagre/board.exp.json | 18 +- .../container_child_edge/dagre/sketch.exp.svg | 10 +- 19 files changed, 305 insertions(+), 306 deletions(-) diff --git a/d2layouts/d2dagrelayout/layout.go b/d2layouts/d2dagrelayout/layout.go index 5543d541f..0d5c5d569 100644 --- a/d2layouts/d2dagrelayout/layout.go +++ b/d2layouts/d2dagrelayout/layout.go @@ -291,7 +291,6 @@ func setGraphAttrs(attrs dagreOpts) string { edgesep: %d, nodesep: %d, rankdir: "%s", - labelpos: "c", }); `, attrs.ranksep, @@ -322,5 +321,5 @@ func generateAddParentLine(childID, parentID string) string { } func generateAddEdgeLine(fromID, toID, edgeID string, width, height int) string { - return fmt.Sprintf("g.setEdge({v:`%s`, w:`%s`, name:`%s`}, { width:%d, height:%d });\n", escapeID(fromID), escapeID(toID), escapeID(edgeID), width, height) + return fmt.Sprintf("g.setEdge({v:`%s`, w:`%s`, name:`%s`}, { width:%d, height:%d, labelpos: `c` });\n", escapeID(fromID), escapeID(toID), escapeID(edgeID), width, height) } diff --git a/e2etests/testdata/regression/elk_alignment/dagre/board.exp.json b/e2etests/testdata/regression/elk_alignment/dagre/board.exp.json index c6210fd19..8e9064df9 100644 --- a/e2etests/testdata/regression/elk_alignment/dagre/board.exp.json +++ b/e2etests/testdata/regression/elk_alignment/dagre/board.exp.json @@ -9,7 +9,7 @@ "x": 0, "y": 0 }, - "width": 457, + "width": 430, "height": 1672, "opacity": 1, "strokeDash": 0, @@ -246,10 +246,10 @@ "id": "deploy_workflow", "type": "", "pos": { - "x": 497, + "x": 470, "y": 0 }, - "width": 388, + "width": 371, "height": 981, "opacity": 1, "strokeDash": 0, @@ -286,7 +286,7 @@ "id": "deploy_workflow.manual", "type": "", "pos": { - "x": 547, + "x": 520, "y": 73 }, "width": 271, @@ -326,7 +326,7 @@ "id": "deploy_workflow.GHA", "type": "", "pos": { - "x": 548, + "x": 521, "y": 382 }, "width": 269, @@ -366,7 +366,7 @@ "id": "deploy_workflow.AWS", "type": "", "pos": { - "x": 605, + "x": 578, "y": 771 }, "width": 155, @@ -406,10 +406,10 @@ "id": "apollo_workflow", "type": "", "pos": { - "x": 926, + "x": 881, "y": 0 }, - "width": 767, + "width": 613, "height": 981, "opacity": 1, "strokeDash": 0, @@ -446,7 +446,7 @@ "id": "apollo_workflow.apollo", "type": "", "pos": { - "x": 991, + "x": 1069, "y": 73 }, "width": 238, @@ -486,7 +486,7 @@ "id": "apollo_workflow.GHA", "type": "", "pos": { - "x": 976, + "x": 1053, "y": 382 }, "width": 269, @@ -526,7 +526,7 @@ "id": "apollo_workflow.AWS", "type": "", "pos": { - "x": 1033, + "x": 1110, "y": 771 }, "width": 155, @@ -782,19 +782,19 @@ "labelPercentage": 0, "route": [ { - "x": 682.5, + "x": 655.5, "y": 210 }, { - "x": 682.5, + "x": 655.5, "y": 278.8 }, { - "x": 682.5, + "x": 655.5, "y": 313.2 }, { - "x": 682.5, + "x": 655.5, "y": 382 } ], @@ -830,19 +830,19 @@ "labelPercentage": 0, "route": [ { - "x": 682.5, + "x": 655.5, "y": 519 }, { - "x": 682.5, + "x": 655.5, "y": 619.8 }, { - "x": 682.5, + "x": 655.5, "y": 670.2 }, { - "x": 682.5, + "x": 655.5, "y": 771 } ], @@ -878,19 +878,19 @@ "labelPercentage": 0, "route": [ { - "x": 1110, + "x": 1187.5, "y": 210 }, { - "x": 1110, + "x": 1187.5, "y": 278.8 }, { - "x": 1110, + "x": 1187.5, "y": 313.2 }, { - "x": 1110, + "x": 1187.5, "y": 382 } ], @@ -926,19 +926,19 @@ "labelPercentage": 0, "route": [ { - "x": 1110, + "x": 1187.5, "y": 519 }, { - "x": 1110, + "x": 1187.5, "y": 619.8 }, { - "x": 1110, + "x": 1187.5, "y": 670.2 }, { - "x": 1110, + "x": 1187.5, "y": 771 } ], diff --git a/e2etests/testdata/regression/elk_alignment/dagre/sketch.exp.svg b/e2etests/testdata/regression/elk_alignment/dagre/sketch.exp.svg index c4ccbb2cd..63e8305ca 100644 --- a/e2etests/testdata/regression/elk_alignment/dagre/sketch.exp.svg +++ b/e2etests/testdata/regression/elk_alignment/dagre/sketch.exp.svg @@ -3,7 +3,7 @@ id="d2-svg" style="background: white;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" -width="1897" height="1876" viewBox="-102 -102 1897 1876">aabbllmmnnoocciikkddgghhjjeeff1122 334455667788 - - - - - - - - - +aabbllmmnnoocciikkddgghhjjeeff1122 334455667788 + + + + + + + + +