diff --git a/d2layouts/d2dagrelayout/layout.go b/d2layouts/d2dagrelayout/layout.go
index bb5bbe506..6df8e9288 100644
--- a/d2layouts/d2dagrelayout/layout.go
+++ b/d2layouts/d2dagrelayout/layout.go
@@ -372,9 +372,10 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err
}
if isSrcDesc && isDstDesc {
stepSize := float64(*obj.LabelHeight)
- if e.Src != obj || e.Dst != obj {
- stepSize /= 2.
- }
+ // Container self edges don't work right now, but when they do, this should be uncommented
+ // if e.Src != obj || e.Dst != obj {
+ // stepSize /= 2.
+ // }
movedEdges[e] = struct{}{}
for _, p := range e.Route {
p.Y += stepSize
diff --git a/e2etests/stable_test.go b/e2etests/stable_test.go
index a20144558..b3f7a73c7 100644
--- a/e2etests/stable_test.go
+++ b/e2etests/stable_test.go
@@ -609,17 +609,24 @@ x -> hey -> y
`,
},
{
- name: "child_parent_edges",
- script: `a.b -> a
-a.b -> a.b.c
-a.b.c.d -> a.b`,
- },
- {
- name: "container_label_loop",
- script: `a: "If we were meant to fly, we wouldn't keep losing our luggage" {
- b -> c
+ name: "font_sizes_containers_large",
+ script: `
+ninety nine: {
+ style.font-size: 99
+ sixty four: {
+ style.font-size: 64
+ thirty two:{
+ style.font-size: 32
+ sixteen: {
+ style.font-size: 16
+ eight: {
+ style.font-size: 8
+ }
+ }
+ }
+ }
}
-a -> a`,
+`,
},
{
name: "lone_h1",
diff --git a/e2etests/testdata/regression/dagre_broken_arrowhead/dagre/board.exp.json b/e2etests/testdata/regression/dagre_broken_arrowhead/dagre/board.exp.json
index 9fa93bf6e..df4e0a899 100644
--- a/e2etests/testdata/regression/dagre_broken_arrowhead/dagre/board.exp.json
+++ b/e2etests/testdata/regression/dagre_broken_arrowhead/dagre/board.exp.json
@@ -277,19 +277,19 @@
"route": [
{
"x": 120,
- "y": 139.5
+ "y": 157.5
},
{
"x": 120,
- "y": 209.9
+ "y": 227.9
},
{
"x": 120,
- "y": 245.5
+ "y": 263.5
},
{
"x": 120,
- "y": 317.5
+ "y": 335.5
}
],
"isCurve": true,
@@ -325,19 +325,19 @@
"route": [
{
"x": 232.5,
- "y": 139.5
+ "y": 157.5
},
{
"x": 232.5,
- "y": 209.9
+ "y": 227.9
},
{
"x": 232.5,
- "y": 245.5
+ "y": 263.5
},
{
"x": 232.5,
- "y": 317.5
+ "y": 335.5
}
],
"isCurve": true,
@@ -373,19 +373,19 @@
"route": [
{
"x": 345,
- "y": 139.5
+ "y": 157.5
},
{
"x": 345,
- "y": 209.9
+ "y": 227.9
},
{
"x": 345,
- "y": 245.5
+ "y": 263.5
},
{
"x": 345,
- "y": 317.5
+ "y": 335.5
}
],
"isCurve": true,
diff --git a/e2etests/testdata/regression/dagre_broken_arrowhead/dagre/sketch.exp.svg b/e2etests/testdata/regression/dagre_broken_arrowhead/dagre/sketch.exp.svg
index 7af02a256..03d845992 100644
--- a/e2etests/testdata/regression/dagre_broken_arrowhead/dagre/sketch.exp.svg
+++ b/e2etests/testdata/regression/dagre_broken_arrowhead/dagre/sketch.exp.svg
@@ -39,9 +39,9 @@ width="629" height="735" viewBox="-102 -105 629 735">aabbllmmnnoocciikkddgghhjjeeff1122 334455667788
+aabbllmmnnoocciikkddgghhjjeeff1122 334455667788
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
eightsixteenthirty twosixty fourninety nine twelvetwenty fourforty eighteighty one
-
-
-
-
-
-
\ No newline at end of file
diff --git a/e2etests/testdata/todo/font_sizes_large/elk/board.exp.json b/e2etests/testdata/todo/font_sizes_large/elk/board.exp.json
deleted file mode 100644
index 463f68094..000000000
--- a/e2etests/testdata/todo/font_sizes_large/elk/board.exp.json
+++ /dev/null
@@ -1,369 +0,0 @@
-{
- "name": "",
- "fontFamily": "SourceSansPro",
- "shapes": [
- {
- "id": "eight",
- "type": "rectangle",
- "pos": {
- "x": 244,
- "y": 12
- },
- "width": 64,
- "height": 56,
- "opacity": 1,
- "strokeDash": 0,
- "strokeWidth": 2,
- "borderRadius": 0,
- "fill": "#F7F8FE",
- "stroke": "#0D32B2",
- "shadow": false,
- "3d": false,
- "multiple": false,
- "double-border": false,
- "tooltip": "",
- "link": "",
- "icon": null,
- "iconPosition": "",
- "blend": false,
- "fields": null,
- "methods": null,
- "columns": null,
- "label": "eight",
- "fontSize": 8,
- "fontFamily": "DEFAULT",
- "language": "",
- "color": "#0A0F25",
- "italic": false,
- "bold": true,
- "underline": false,
- "labelWidth": 19,
- "labelHeight": 11,
- "labelPosition": "INSIDE_MIDDLE_CENTER",
- "zIndex": 0,
- "level": 1
- },
- {
- "id": "sixteen",
- "type": "rectangle",
- "pos": {
- "x": 228,
- "y": 284
- },
- "width": 97,
- "height": 66,
- "opacity": 1,
- "strokeDash": 0,
- "strokeWidth": 2,
- "borderRadius": 0,
- "fill": "#F7F8FE",
- "stroke": "#0D32B2",
- "shadow": false,
- "3d": false,
- "multiple": false,
- "double-border": false,
- "tooltip": "",
- "link": "",
- "icon": null,
- "iconPosition": "",
- "blend": false,
- "fields": null,
- "methods": null,
- "columns": null,
- "label": "sixteen",
- "fontSize": 16,
- "fontFamily": "DEFAULT",
- "language": "",
- "color": "#0A0F25",
- "italic": false,
- "bold": true,
- "underline": false,
- "labelWidth": 52,
- "labelHeight": 21,
- "labelPosition": "INSIDE_MIDDLE_CENTER",
- "zIndex": 0,
- "level": 1
- },
- {
- "id": "thirty two",
- "type": "rectangle",
- "pos": {
- "x": 183,
- "y": 581
- },
- "width": 187,
- "height": 86,
- "opacity": 1,
- "strokeDash": 0,
- "strokeWidth": 2,
- "borderRadius": 0,
- "fill": "#F7F8FE",
- "stroke": "#0D32B2",
- "shadow": false,
- "3d": false,
- "multiple": false,
- "double-border": false,
- "tooltip": "",
- "link": "",
- "icon": null,
- "iconPosition": "",
- "blend": false,
- "fields": null,
- "methods": null,
- "columns": null,
- "label": "thirty two",
- "fontSize": 32,
- "fontFamily": "DEFAULT",
- "language": "",
- "color": "#0A0F25",
- "italic": false,
- "bold": true,
- "underline": false,
- "labelWidth": 142,
- "labelHeight": 41,
- "labelPosition": "INSIDE_MIDDLE_CENTER",
- "zIndex": 0,
- "level": 1
- },
- {
- "id": "sixty four",
- "type": "rectangle",
- "pos": {
- "x": 119,
- "y": 928
- },
- "width": 314,
- "height": 126,
- "opacity": 1,
- "strokeDash": 0,
- "strokeWidth": 2,
- "borderRadius": 0,
- "fill": "#F7F8FE",
- "stroke": "#0D32B2",
- "shadow": false,
- "3d": false,
- "multiple": false,
- "double-border": false,
- "tooltip": "",
- "link": "",
- "icon": null,
- "iconPosition": "",
- "blend": false,
- "fields": null,
- "methods": null,
- "columns": null,
- "label": "sixty four",
- "fontSize": 64,
- "fontFamily": "DEFAULT",
- "language": "",
- "color": "#0A0F25",
- "italic": false,
- "bold": true,
- "underline": false,
- "labelWidth": 269,
- "labelHeight": 81,
- "labelPosition": "INSIDE_MIDDLE_CENTER",
- "zIndex": 0,
- "level": 1
- },
- {
- "id": "ninety nine",
- "type": "rectangle",
- "pos": {
- "x": 12,
- "y": 1356
- },
- "width": 529,
- "height": 170,
- "opacity": 1,
- "strokeDash": 0,
- "strokeWidth": 2,
- "borderRadius": 0,
- "fill": "#F7F8FE",
- "stroke": "#0D32B2",
- "shadow": false,
- "3d": false,
- "multiple": false,
- "double-border": false,
- "tooltip": "",
- "link": "",
- "icon": null,
- "iconPosition": "",
- "blend": false,
- "fields": null,
- "methods": null,
- "columns": null,
- "label": "ninety nine",
- "fontSize": 99,
- "fontFamily": "DEFAULT",
- "language": "",
- "color": "#0A0F25",
- "italic": false,
- "bold": true,
- "underline": false,
- "labelWidth": 484,
- "labelHeight": 125,
- "labelPosition": "INSIDE_MIDDLE_CENTER",
- "zIndex": 0,
- "level": 1
- }
- ],
- "connections": [
- {
- "id": "(eight -> sixteen)[0]",
- "src": "eight",
- "srcArrow": "none",
- "srcLabel": "",
- "dst": "sixteen",
- "dstArrow": "triangle",
- "dstLabel": "",
- "opacity": 1,
- "strokeDash": 0,
- "strokeWidth": 2,
- "stroke": "#0D32B2",
- "label": "twelve",
- "fontSize": 12,
- "fontFamily": "DEFAULT",
- "language": "",
- "color": "#676C7E",
- "italic": true,
- "bold": false,
- "underline": false,
- "labelWidth": 33,
- "labelHeight": 16,
- "labelPosition": "INSIDE_MIDDLE_CENTER",
- "labelPercentage": 0,
- "route": [
- {
- "x": 276.5,
- "y": 68
- },
- {
- "x": 276.5,
- "y": 284
- }
- ],
- "animated": false,
- "tooltip": "",
- "icon": null,
- "zIndex": 0
- },
- {
- "id": "(sixteen -> thirty two)[0]",
- "src": "sixteen",
- "srcArrow": "none",
- "srcLabel": "",
- "dst": "thirty two",
- "dstArrow": "triangle",
- "dstLabel": "",
- "opacity": 1,
- "strokeDash": 0,
- "strokeWidth": 2,
- "stroke": "#0D32B2",
- "label": "twenty four",
- "fontSize": 24,
- "fontFamily": "DEFAULT",
- "language": "",
- "color": "#676C7E",
- "italic": true,
- "bold": false,
- "underline": false,
- "labelWidth": 114,
- "labelHeight": 31,
- "labelPosition": "INSIDE_MIDDLE_CENTER",
- "labelPercentage": 0,
- "route": [
- {
- "x": 276.5,
- "y": 350
- },
- {
- "x": 276.5,
- "y": 581
- }
- ],
- "animated": false,
- "tooltip": "",
- "icon": null,
- "zIndex": 0
- },
- {
- "id": "(thirty two -> sixty four)[0]",
- "src": "thirty two",
- "srcArrow": "none",
- "srcLabel": "",
- "dst": "sixty four",
- "dstArrow": "triangle",
- "dstLabel": "",
- "opacity": 1,
- "strokeDash": 0,
- "strokeWidth": 2,
- "stroke": "#0D32B2",
- "label": "forty eight",
- "fontSize": 48,
- "fontFamily": "DEFAULT",
- "language": "",
- "color": "#676C7E",
- "italic": true,
- "bold": false,
- "underline": false,
- "labelWidth": 202,
- "labelHeight": 61,
- "labelPosition": "INSIDE_MIDDLE_CENTER",
- "labelPercentage": 0,
- "route": [
- {
- "x": 276.5,
- "y": 667
- },
- {
- "x": 276.5,
- "y": 928
- }
- ],
- "animated": false,
- "tooltip": "",
- "icon": null,
- "zIndex": 0
- },
- {
- "id": "(sixty four -> ninety nine)[0]",
- "src": "sixty four",
- "srcArrow": "none",
- "srcLabel": "",
- "dst": "ninety nine",
- "dstArrow": "triangle",
- "dstLabel": "",
- "opacity": 1,
- "strokeDash": 0,
- "strokeWidth": 2,
- "stroke": "#0D32B2",
- "label": "eighty one",
- "fontSize": 81,
- "fontFamily": "DEFAULT",
- "language": "",
- "color": "#676C7E",
- "italic": true,
- "bold": false,
- "underline": false,
- "labelWidth": 341,
- "labelHeight": 102,
- "labelPosition": "INSIDE_MIDDLE_CENTER",
- "labelPercentage": 0,
- "route": [
- {
- "x": 276.5,
- "y": 1054
- },
- {
- "x": 276.5,
- "y": 1356
- }
- ],
- "animated": false,
- "tooltip": "",
- "icon": null,
- "zIndex": 0
- }
- ]
-}
diff --git a/e2etests/testdata/todo/font_sizes_large/elk/sketch.exp.svg b/e2etests/testdata/todo/font_sizes_large/elk/sketch.exp.svg
deleted file mode 100644
index 28c54832a..000000000
--- a/e2etests/testdata/todo/font_sizes_large/elk/sketch.exp.svg
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
\ No newline at end of file
diff --git a/e2etests/testdata/todo/tall_edge_label/dagre/board.exp.json b/e2etests/testdata/todo/tall_edge_label/dagre/board.exp.json
deleted file mode 100644
index bafced325..000000000
--- a/e2etests/testdata/todo/tall_edge_label/dagre/board.exp.json
+++ /dev/null
@@ -1,138 +0,0 @@
-{
- "name": "",
- "fontFamily": "SourceSansPro",
- "shapes": [
- {
- "id": "a",
- "type": "rectangle",
- "pos": {
- "x": 0,
- "y": 0
- },
- "width": 53,
- "height": 66,
- "opacity": 1,
- "strokeDash": 0,
- "strokeWidth": 2,
- "borderRadius": 0,
- "fill": "#F7F8FE",
- "stroke": "#0D32B2",
- "shadow": false,
- "3d": false,
- "multiple": false,
- "double-border": false,
- "tooltip": "",
- "link": "",
- "icon": null,
- "iconPosition": "",
- "blend": false,
- "fields": null,
- "methods": null,
- "columns": null,
- "label": "a",
- "fontSize": 16,
- "fontFamily": "DEFAULT",
- "language": "",
- "color": "#0A0F25",
- "italic": false,
- "bold": true,
- "underline": false,
- "labelWidth": 8,
- "labelHeight": 21,
- "labelPosition": "INSIDE_MIDDLE_CENTER",
- "zIndex": 0,
- "level": 1
- },
- {
- "id": "b",
- "type": "rectangle",
- "pos": {
- "x": 0,
- "y": 372
- },
- "width": 53,
- "height": 66,
- "opacity": 1,
- "strokeDash": 0,
- "strokeWidth": 2,
- "borderRadius": 0,
- "fill": "#F7F8FE",
- "stroke": "#0D32B2",
- "shadow": false,
- "3d": false,
- "multiple": false,
- "double-border": false,
- "tooltip": "",
- "link": "",
- "icon": null,
- "iconPosition": "",
- "blend": false,
- "fields": null,
- "methods": null,
- "columns": null,
- "label": "b",
- "fontSize": 16,
- "fontFamily": "DEFAULT",
- "language": "",
- "color": "#0A0F25",
- "italic": false,
- "bold": true,
- "underline": false,
- "labelWidth": 8,
- "labelHeight": 21,
- "labelPosition": "INSIDE_MIDDLE_CENTER",
- "zIndex": 0,
- "level": 1
- }
- ],
- "connections": [
- {
- "id": "(a -> b)[0]",
- "src": "a",
- "srcArrow": "none",
- "srcLabel": "",
- "dst": "b",
- "dstArrow": "triangle",
- "dstLabel": "",
- "opacity": 1,
- "strokeDash": 0,
- "strokeWidth": 2,
- "stroke": "#0D32B2",
- "label": "There\nonce\nwas\na\nvery\ntall\nedge\nlabel",
- "fontSize": 16,
- "fontFamily": "DEFAULT",
- "language": "",
- "color": "#676C7E",
- "italic": true,
- "bold": false,
- "underline": false,
- "labelWidth": 38,
- "labelHeight": 133,
- "labelPosition": "INSIDE_MIDDLE_CENTER",
- "labelPercentage": 0,
- "route": [
- {
- "x": 26.5,
- "y": 66
- },
- {
- "x": 26.5,
- "y": 188.4
- },
- {
- "x": 26.5,
- "y": 249.6
- },
- {
- "x": 26.5,
- "y": 372
- }
- ],
- "isCurve": true,
- "animated": false,
- "tooltip": "",
- "icon": null,
- "zIndex": 0
- }
- ]
-}
diff --git a/e2etests/testdata/todo/tall_edge_label/dagre/sketch.exp.svg b/e2etests/testdata/todo/tall_edge_label/dagre/sketch.exp.svg
deleted file mode 100644
index 231114a5f..000000000
--- a/e2etests/testdata/todo/tall_edge_label/dagre/sketch.exp.svg
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
\ No newline at end of file
diff --git a/e2etests/testdata/todo/tall_edge_label/elk/board.exp.json b/e2etests/testdata/todo/tall_edge_label/elk/board.exp.json
deleted file mode 100644
index 6f0851cca..000000000
--- a/e2etests/testdata/todo/tall_edge_label/elk/board.exp.json
+++ /dev/null
@@ -1,129 +0,0 @@
-{
- "name": "",
- "fontFamily": "SourceSansPro",
- "shapes": [
- {
- "id": "a",
- "type": "rectangle",
- "pos": {
- "x": 12,
- "y": 12
- },
- "width": 53,
- "height": 66,
- "opacity": 1,
- "strokeDash": 0,
- "strokeWidth": 2,
- "borderRadius": 0,
- "fill": "#F7F8FE",
- "stroke": "#0D32B2",
- "shadow": false,
- "3d": false,
- "multiple": false,
- "double-border": false,
- "tooltip": "",
- "link": "",
- "icon": null,
- "iconPosition": "",
- "blend": false,
- "fields": null,
- "methods": null,
- "columns": null,
- "label": "a",
- "fontSize": 16,
- "fontFamily": "DEFAULT",
- "language": "",
- "color": "#0A0F25",
- "italic": false,
- "bold": true,
- "underline": false,
- "labelWidth": 8,
- "labelHeight": 21,
- "labelPosition": "INSIDE_MIDDLE_CENTER",
- "zIndex": 0,
- "level": 1
- },
- {
- "id": "b",
- "type": "rectangle",
- "pos": {
- "x": 12,
- "y": 411
- },
- "width": 53,
- "height": 66,
- "opacity": 1,
- "strokeDash": 0,
- "strokeWidth": 2,
- "borderRadius": 0,
- "fill": "#F7F8FE",
- "stroke": "#0D32B2",
- "shadow": false,
- "3d": false,
- "multiple": false,
- "double-border": false,
- "tooltip": "",
- "link": "",
- "icon": null,
- "iconPosition": "",
- "blend": false,
- "fields": null,
- "methods": null,
- "columns": null,
- "label": "b",
- "fontSize": 16,
- "fontFamily": "DEFAULT",
- "language": "",
- "color": "#0A0F25",
- "italic": false,
- "bold": true,
- "underline": false,
- "labelWidth": 8,
- "labelHeight": 21,
- "labelPosition": "INSIDE_MIDDLE_CENTER",
- "zIndex": 0,
- "level": 1
- }
- ],
- "connections": [
- {
- "id": "(a -> b)[0]",
- "src": "a",
- "srcArrow": "none",
- "srcLabel": "",
- "dst": "b",
- "dstArrow": "triangle",
- "dstLabel": "",
- "opacity": 1,
- "strokeDash": 0,
- "strokeWidth": 2,
- "stroke": "#0D32B2",
- "label": "There\nonce\nwas\na\nvery\ntall\nedge\nlabel",
- "fontSize": 16,
- "fontFamily": "DEFAULT",
- "language": "",
- "color": "#676C7E",
- "italic": true,
- "bold": false,
- "underline": false,
- "labelWidth": 38,
- "labelHeight": 133,
- "labelPosition": "INSIDE_MIDDLE_CENTER",
- "labelPercentage": 0,
- "route": [
- {
- "x": 38.5,
- "y": 78
- },
- {
- "x": 38.5,
- "y": 411
- }
- ],
- "animated": false,
- "tooltip": "",
- "icon": null,
- "zIndex": 0
- }
- ]
-}
diff --git a/e2etests/testdata/todo/tall_edge_label/elk/sketch.exp.svg b/e2etests/testdata/todo/tall_edge_label/elk/sketch.exp.svg
deleted file mode 100644
index ce817e41e..000000000
--- a/e2etests/testdata/todo/tall_edge_label/elk/sketch.exp.svg
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
\ No newline at end of file
diff --git a/e2etests/todo_test.go b/e2etests/todo_test.go
index a1a413206..32c45f052 100644
--- a/e2etests/todo_test.go
+++ b/e2etests/todo_test.go
@@ -16,57 +16,19 @@ container -> container.second: c->2
`,
},
{
- // issue https://github.com/terrastruct/d2/issues/263
- name: "tall_edge_label",
- script: `
-a -> b: There\nonce\nwas\na\nvery\ntall\nedge\nlabel
-`,
+ name: "child_parent_edges",
+ script: `a.b -> a
+a.b -> a.b.c
+a.b.c.d -> a.b`,
},
{
- // issue https://github.com/terrastruct/d2/issues/263
- name: "font_sizes_large",
- script: `
-eight.style.font-size: 8
-sixteen.style.font-size: 16
-thirty two.style.font-size: 32
-sixty four.style.font-size: 64
-ninety nine.style.font-size: 99
-
-eight -> sixteen : twelve {
- style.font-size: 12
+ name: "container_label_loop",
+ script: `a: "If we were meant to fly, we wouldn't keep losing our luggage" {
+ b -> c
}
-sixteen -> thirty two : twenty four {
- style.font-size: 24
-}
-thirty two -> sixty four: forty eight {
- style.font-size: 48
-}
-sixty four -> ninety nine: eighty one {
- style.font-size: 81
-}
-`,
+a -> a`,
},
{
- // issue https://github.com/terrastruct/d2/issues/19
- name: "font_sizes_containers_large",
- script: `
-ninety nine: {
- style.font-size: 99
- sixty four: {
- style.font-size: 64
- thirty two:{
- style.font-size: 32
- sixteen: {
- style.font-size: 16
- eight: {
- style.font-size: 8
- }
- }
- }
- }
-}
-`,
- }, {
// as nesting gets deeper, the groups advance towards `c` and may overlap its lifeline
// needs to consider the group size when computing the distance from `a` to `c`
// a similar effect can be seen for spans