diff --git a/d2layouts/d2cycle/layout.go b/d2layouts/d2cycle/layout.go index 531464f0b..81f94c153 100644 --- a/d2layouts/d2cycle/layout.go +++ b/d2layouts/d2cycle/layout.go @@ -90,7 +90,7 @@ func createCircularArc(edge *d2graph.Edge, radius float64) { dstAngle := math.Atan2(newDst.Y, newDst.X) tangent := geo.NewPoint(-math.Sin(dstAngle), math.Cos(dstAngle)) ε := 0.01 * radius // Small offset, e.g., 1% of radius - preDst := geo.NewPoint(newDst.X-ε*tangent.X, newDst.Y-ε*tangent.Y) + preDst := geo.NewPoint(newDst.X+ε*tangent.X, newDst.Y+ε*tangent.Y) // Insert preDst before newDst path = append(path[:len(path)-1], preDst, newDst) } diff --git a/e2etests/testdata/txtar/cycle-diagram/dagre/board.exp.json b/e2etests/testdata/txtar/cycle-diagram/dagre/board.exp.json index 1453daf86..78ed2dffe 100644 --- a/e2etests/testdata/txtar/cycle-diagram/dagre/board.exp.json +++ b/e2etests/testdata/txtar/cycle-diagram/dagre/board.exp.json @@ -867,10 +867,6 @@ "x": 197.02099609375, "y": -34.3849983215332 }, - { - "x": 196.9219970703125, - "y": -34.97200012207031 - }, { "x": 197.2519989013672, "y": -33 @@ -1235,10 +1231,6 @@ "x": 28.18000030517578, "y": 198.00399780273438 }, - { - "x": 28.48200035095215, - "y": 197.96499633789062 - }, { "x": 26.5, "y": 198.22999572753906 @@ -1603,10 +1595,6 @@ "x": -197.02099609375, "y": 34.3849983215332 }, - { - "x": -196.9219970703125, - "y": 34.97200012207031 - }, { "x": -197.2519989013672, "y": 33 @@ -1987,10 +1975,6 @@ "x": 701.875, "y": 115.77300262451172 }, - { - "x": 702.10302734375, - "y": 115.11499786376953 - }, { "x": 701.4329833984375, "y": 116.9990005493164 @@ -2355,10 +2339,6 @@ "x": 364.3710021972656, "y": 183.8260040283203 }, - { - "x": 364.97198486328125, - "y": 184.4929962158203 - }, { "x": 363.6419982910156, "y": 183 @@ -2763,10 +2743,6 @@ "x": 1003.2860107421875, "y": 197.53700256347656 }, - { - "x": 1000.4819946289062, - "y": 197.9530029296875 - }, { "x": 998.5, "y": 198.21800231933594 diff --git a/e2etests/testdata/txtar/cycle-diagram/dagre/sketch.exp.svg b/e2etests/testdata/txtar/cycle-diagram/dagre/sketch.exp.svg index be500c952..015478d74 100644 --- a/e2etests/testdata/txtar/cycle-diagram/dagre/sketch.exp.svg +++ b/e2etests/testdata/txtar/cycle-diagram/dagre/sketch.exp.svg @@ -1,9 +1,9 @@ -abcdabcab + .d2-153681122 .fill-N1{fill:#0A0F25;} + .d2-153681122 .fill-N2{fill:#676C7E;} + .d2-153681122 .fill-N3{fill:#9499AB;} + .d2-153681122 .fill-N4{fill:#CFD2DD;} + .d2-153681122 .fill-N5{fill:#DEE1EB;} + .d2-153681122 .fill-N6{fill:#EEF1F8;} + .d2-153681122 .fill-N7{fill:#FFFFFF;} + .d2-153681122 .fill-B1{fill:#0D32B2;} + .d2-153681122 .fill-B2{fill:#0D32B2;} + .d2-153681122 .fill-B3{fill:#E3E9FD;} + .d2-153681122 .fill-B4{fill:#E3E9FD;} + .d2-153681122 .fill-B5{fill:#EDF0FD;} + .d2-153681122 .fill-B6{fill:#F7F8FE;} + .d2-153681122 .fill-AA2{fill:#4A6FF3;} + .d2-153681122 .fill-AA4{fill:#EDF0FD;} + .d2-153681122 .fill-AA5{fill:#F7F8FE;} + .d2-153681122 .fill-AB4{fill:#EDF0FD;} + .d2-153681122 .fill-AB5{fill:#F7F8FE;} + .d2-153681122 .stroke-N1{stroke:#0A0F25;} + .d2-153681122 .stroke-N2{stroke:#676C7E;} + .d2-153681122 .stroke-N3{stroke:#9499AB;} + .d2-153681122 .stroke-N4{stroke:#CFD2DD;} + .d2-153681122 .stroke-N5{stroke:#DEE1EB;} + .d2-153681122 .stroke-N6{stroke:#EEF1F8;} + .d2-153681122 .stroke-N7{stroke:#FFFFFF;} + .d2-153681122 .stroke-B1{stroke:#0D32B2;} + .d2-153681122 .stroke-B2{stroke:#0D32B2;} + .d2-153681122 .stroke-B3{stroke:#E3E9FD;} + .d2-153681122 .stroke-B4{stroke:#E3E9FD;} + .d2-153681122 .stroke-B5{stroke:#EDF0FD;} + .d2-153681122 .stroke-B6{stroke:#F7F8FE;} + .d2-153681122 .stroke-AA2{stroke:#4A6FF3;} + .d2-153681122 .stroke-AA4{stroke:#EDF0FD;} + .d2-153681122 .stroke-AA5{stroke:#F7F8FE;} + .d2-153681122 .stroke-AB4{stroke:#EDF0FD;} + .d2-153681122 .stroke-AB5{stroke:#F7F8FE;} + .d2-153681122 .background-color-N1{background-color:#0A0F25;} + .d2-153681122 .background-color-N2{background-color:#676C7E;} + .d2-153681122 .background-color-N3{background-color:#9499AB;} + .d2-153681122 .background-color-N4{background-color:#CFD2DD;} + .d2-153681122 .background-color-N5{background-color:#DEE1EB;} + .d2-153681122 .background-color-N6{background-color:#EEF1F8;} + .d2-153681122 .background-color-N7{background-color:#FFFFFF;} + .d2-153681122 .background-color-B1{background-color:#0D32B2;} + .d2-153681122 .background-color-B2{background-color:#0D32B2;} + .d2-153681122 .background-color-B3{background-color:#E3E9FD;} + .d2-153681122 .background-color-B4{background-color:#E3E9FD;} + .d2-153681122 .background-color-B5{background-color:#EDF0FD;} + .d2-153681122 .background-color-B6{background-color:#F7F8FE;} + .d2-153681122 .background-color-AA2{background-color:#4A6FF3;} + .d2-153681122 .background-color-AA4{background-color:#EDF0FD;} + .d2-153681122 .background-color-AA5{background-color:#F7F8FE;} + .d2-153681122 .background-color-AB4{background-color:#EDF0FD;} + .d2-153681122 .background-color-AB5{background-color:#F7F8FE;} + .d2-153681122 .color-N1{color:#0A0F25;} + .d2-153681122 .color-N2{color:#676C7E;} + .d2-153681122 .color-N3{color:#9499AB;} + .d2-153681122 .color-N4{color:#CFD2DD;} + .d2-153681122 .color-N5{color:#DEE1EB;} + .d2-153681122 .color-N6{color:#EEF1F8;} + .d2-153681122 .color-N7{color:#FFFFFF;} + .d2-153681122 .color-B1{color:#0D32B2;} + .d2-153681122 .color-B2{color:#0D32B2;} + .d2-153681122 .color-B3{color:#E3E9FD;} + .d2-153681122 .color-B4{color:#E3E9FD;} + .d2-153681122 .color-B5{color:#EDF0FD;} + .d2-153681122 .color-B6{color:#F7F8FE;} + .d2-153681122 .color-AA2{color:#4A6FF3;} + .d2-153681122 .color-AA4{color:#EDF0FD;} + .d2-153681122 .color-AA5{color:#F7F8FE;} + .d2-153681122 .color-AB4{color:#EDF0FD;} + .d2-153681122 .color-AB5{color:#F7F8FE;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#0D32B2;--color-border-muted:#0D32B2;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0D32B2;--color-accent-emphasis:#0D32B2;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker-d2-153681122);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker-d2-153681122);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright-d2-153681122);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright-d2-153681122);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright-d2-153681122);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright-d2-153681122);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark-d2-153681122);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright-d2-153681122);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright-d2-153681122);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright-d2-153681122);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright-d2-153681122);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker-d2-153681122);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark-d2-153681122);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal-d2-153681122);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal-d2-153681122);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright-d2-153681122);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright-d2-153681122);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright-d2-153681122);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]>abcdabcab diff --git a/e2etests/testdata/txtar/cycle-diagram/elk/board.exp.json b/e2etests/testdata/txtar/cycle-diagram/elk/board.exp.json index d03145822..6eb058a84 100644 --- a/e2etests/testdata/txtar/cycle-diagram/elk/board.exp.json +++ b/e2etests/testdata/txtar/cycle-diagram/elk/board.exp.json @@ -867,10 +867,6 @@ "x": 209.02099609375, "y": -22.385000228881836 }, - { - "x": 208.9219970703125, - "y": -22.972000122070312 - }, { "x": 209.2519989013672, "y": -21 @@ -1235,10 +1231,6 @@ "x": 40.18000030517578, "y": 210.00399780273438 }, - { - "x": 40.481998443603516, - "y": 209.96499633789062 - }, { "x": 38.5, "y": 210.22999572753906 @@ -1603,10 +1595,6 @@ "x": -185.02099609375, "y": 46.3849983215332 }, - { - "x": -184.9219970703125, - "y": 46.97200012207031 - }, { "x": -185.2519989013672, "y": 45 @@ -1987,10 +1975,6 @@ "x": 674.375, "y": 127.77300262451172 }, - { - "x": 674.60302734375, - "y": 127.11499786376953 - }, { "x": 673.9329833984375, "y": 128.99899291992188 @@ -2355,10 +2339,6 @@ "x": 336.8710021972656, "y": 195.8260040283203 }, - { - "x": 337.47198486328125, - "y": 196.4929962158203 - }, { "x": 336.1419982910156, "y": 195 @@ -2763,10 +2743,6 @@ "x": 936.197021484375, "y": 209.53700256347656 }, - { - "x": 933.3920288085938, - "y": 209.9530029296875 - }, { "x": 931.4099731445312, "y": 210.21800231933594 diff --git a/e2etests/testdata/txtar/cycle-diagram/elk/sketch.exp.svg b/e2etests/testdata/txtar/cycle-diagram/elk/sketch.exp.svg index a167e907c..21e65f752 100644 --- a/e2etests/testdata/txtar/cycle-diagram/elk/sketch.exp.svg +++ b/e2etests/testdata/txtar/cycle-diagram/elk/sketch.exp.svg @@ -1,9 +1,9 @@ -abcdabcab + .d2-2891159010 .fill-N1{fill:#0A0F25;} + .d2-2891159010 .fill-N2{fill:#676C7E;} + .d2-2891159010 .fill-N3{fill:#9499AB;} + .d2-2891159010 .fill-N4{fill:#CFD2DD;} + .d2-2891159010 .fill-N5{fill:#DEE1EB;} + .d2-2891159010 .fill-N6{fill:#EEF1F8;} + .d2-2891159010 .fill-N7{fill:#FFFFFF;} + .d2-2891159010 .fill-B1{fill:#0D32B2;} + .d2-2891159010 .fill-B2{fill:#0D32B2;} + .d2-2891159010 .fill-B3{fill:#E3E9FD;} + .d2-2891159010 .fill-B4{fill:#E3E9FD;} + .d2-2891159010 .fill-B5{fill:#EDF0FD;} + .d2-2891159010 .fill-B6{fill:#F7F8FE;} + .d2-2891159010 .fill-AA2{fill:#4A6FF3;} + .d2-2891159010 .fill-AA4{fill:#EDF0FD;} + .d2-2891159010 .fill-AA5{fill:#F7F8FE;} + .d2-2891159010 .fill-AB4{fill:#EDF0FD;} + .d2-2891159010 .fill-AB5{fill:#F7F8FE;} + .d2-2891159010 .stroke-N1{stroke:#0A0F25;} + .d2-2891159010 .stroke-N2{stroke:#676C7E;} + .d2-2891159010 .stroke-N3{stroke:#9499AB;} + .d2-2891159010 .stroke-N4{stroke:#CFD2DD;} + .d2-2891159010 .stroke-N5{stroke:#DEE1EB;} + .d2-2891159010 .stroke-N6{stroke:#EEF1F8;} + .d2-2891159010 .stroke-N7{stroke:#FFFFFF;} + .d2-2891159010 .stroke-B1{stroke:#0D32B2;} + .d2-2891159010 .stroke-B2{stroke:#0D32B2;} + .d2-2891159010 .stroke-B3{stroke:#E3E9FD;} + .d2-2891159010 .stroke-B4{stroke:#E3E9FD;} + .d2-2891159010 .stroke-B5{stroke:#EDF0FD;} + .d2-2891159010 .stroke-B6{stroke:#F7F8FE;} + .d2-2891159010 .stroke-AA2{stroke:#4A6FF3;} + .d2-2891159010 .stroke-AA4{stroke:#EDF0FD;} + .d2-2891159010 .stroke-AA5{stroke:#F7F8FE;} + .d2-2891159010 .stroke-AB4{stroke:#EDF0FD;} + .d2-2891159010 .stroke-AB5{stroke:#F7F8FE;} + .d2-2891159010 .background-color-N1{background-color:#0A0F25;} + .d2-2891159010 .background-color-N2{background-color:#676C7E;} + .d2-2891159010 .background-color-N3{background-color:#9499AB;} + .d2-2891159010 .background-color-N4{background-color:#CFD2DD;} + .d2-2891159010 .background-color-N5{background-color:#DEE1EB;} + .d2-2891159010 .background-color-N6{background-color:#EEF1F8;} + .d2-2891159010 .background-color-N7{background-color:#FFFFFF;} + .d2-2891159010 .background-color-B1{background-color:#0D32B2;} + .d2-2891159010 .background-color-B2{background-color:#0D32B2;} + .d2-2891159010 .background-color-B3{background-color:#E3E9FD;} + .d2-2891159010 .background-color-B4{background-color:#E3E9FD;} + .d2-2891159010 .background-color-B5{background-color:#EDF0FD;} + .d2-2891159010 .background-color-B6{background-color:#F7F8FE;} + .d2-2891159010 .background-color-AA2{background-color:#4A6FF3;} + .d2-2891159010 .background-color-AA4{background-color:#EDF0FD;} + .d2-2891159010 .background-color-AA5{background-color:#F7F8FE;} + .d2-2891159010 .background-color-AB4{background-color:#EDF0FD;} + .d2-2891159010 .background-color-AB5{background-color:#F7F8FE;} + .d2-2891159010 .color-N1{color:#0A0F25;} + .d2-2891159010 .color-N2{color:#676C7E;} + .d2-2891159010 .color-N3{color:#9499AB;} + .d2-2891159010 .color-N4{color:#CFD2DD;} + .d2-2891159010 .color-N5{color:#DEE1EB;} + .d2-2891159010 .color-N6{color:#EEF1F8;} + .d2-2891159010 .color-N7{color:#FFFFFF;} + .d2-2891159010 .color-B1{color:#0D32B2;} + .d2-2891159010 .color-B2{color:#0D32B2;} + .d2-2891159010 .color-B3{color:#E3E9FD;} + .d2-2891159010 .color-B4{color:#E3E9FD;} + .d2-2891159010 .color-B5{color:#EDF0FD;} + .d2-2891159010 .color-B6{color:#F7F8FE;} + .d2-2891159010 .color-AA2{color:#4A6FF3;} + .d2-2891159010 .color-AA4{color:#EDF0FD;} + .d2-2891159010 .color-AA5{color:#F7F8FE;} + .d2-2891159010 .color-AB4{color:#EDF0FD;} + .d2-2891159010 .color-AB5{color:#F7F8FE;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#0D32B2;--color-border-muted:#0D32B2;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0D32B2;--color-accent-emphasis:#0D32B2;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker-d2-2891159010);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker-d2-2891159010);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright-d2-2891159010);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright-d2-2891159010);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright-d2-2891159010);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright-d2-2891159010);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark-d2-2891159010);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright-d2-2891159010);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright-d2-2891159010);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright-d2-2891159010);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright-d2-2891159010);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker-d2-2891159010);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark-d2-2891159010);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal-d2-2891159010);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal-d2-2891159010);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright-d2-2891159010);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright-d2-2891159010);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright-d2-2891159010);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]>abcdabcab