diff --git a/d2layouts/d2dagrelayout/layout.go b/d2layouts/d2dagrelayout/layout.go index 201509cee..5826aa603 100644 --- a/d2layouts/d2dagrelayout/layout.go +++ b/d2layouts/d2dagrelayout/layout.go @@ -32,7 +32,7 @@ var dagreJS string const ( MIN_SEGMENT_LEN = 10 - MIN_RANK_SEP = 100 + MIN_RANK_SEP = 80 ) type ConfigurableOpts struct { @@ -42,7 +42,7 @@ type ConfigurableOpts struct { var DefaultOpts = ConfigurableOpts{ NodeSep: 60, - EdgeSep: 40, + EdgeSep: 20, } type DagreNode struct { @@ -115,7 +115,7 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err } maxLabelSize = go2.Max(maxLabelSize, size) } - rootAttrs.ranksep = go2.Max(MIN_RANK_SEP, maxLabelSize+40) + rootAttrs.ranksep = go2.Max(MIN_RANK_SEP, maxLabelSize+20) configJS := setGraphAttrs(rootAttrs) if _, err := vm.RunString(configJS); err != nil { 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 8bcbbde44..b2afe756e 100644 --- a/e2etests/testdata/regression/dagre_broken_arrowhead/dagre/board.exp.json +++ b/e2etests/testdata/regression/dagre_broken_arrowhead/dagre/board.exp.json @@ -9,8 +9,8 @@ "x": 0, "y": 0 }, - "width": 425, - "height": 528, + "width": 358, + "height": 468, "opacity": 1, "strokeDash": 0, "strokeWidth": 2, @@ -47,8 +47,8 @@ "id": "a.b", "type": "rectangle", "pos": { - "x": 94, - "y": 55 + "x": 40, + "y": 45 }, "width": 53, "height": 66, @@ -88,11 +88,11 @@ "id": "a.c", "type": "rectangle", "pos": { - "x": 40, - "y": 299 + "x": 23, + "y": 269 }, - "width": 345, - "height": 175, + "width": 298, + "height": 155, "opacity": 1, "strokeDash": 0, "strokeWidth": 2, @@ -129,8 +129,8 @@ "id": "a.1", "type": "rectangle", "pos": { - "x": 207, - "y": 55 + "x": 153, + "y": 45 }, "width": 52, "height": 66, @@ -170,8 +170,8 @@ "id": "a.2", "type": "rectangle", "pos": { - "x": 319, - "y": 55 + "x": 265, + "y": 45 }, "width": 53, "height": 66, @@ -211,8 +211,8 @@ "id": "a.c.d", "type": "rectangle", "pos": { - "x": 206, - "y": 353 + "x": 152, + "y": 313 }, "width": 54, "height": 66, @@ -276,20 +276,20 @@ "labelPercentage": 0, "route": [ { - "x": 120, - "y": 121.5 + "x": 66.5, + "y": 111.5 }, { - "x": 120, - "y": 191.9 + "x": 66.5, + "y": 173.9 }, { - "x": 120, - "y": 227.5 + "x": 66.5, + "y": 205.5 }, { - "x": 120, - "y": 299.5 + "x": 66.5, + "y": 269.5 } ], "isCurve": true, @@ -324,20 +324,20 @@ "labelPercentage": 0, "route": [ { - "x": 232.5, - "y": 121.5 + "x": 179, + "y": 111.5 }, { - "x": 232.5, - "y": 191.9 + "x": 179, + "y": 173.9 }, { - "x": 232.5, - "y": 227.5 + "x": 179, + "y": 205.5 }, { - "x": 232.5, - "y": 299.5 + "x": 179, + "y": 269.5 } ], "isCurve": true, @@ -372,20 +372,20 @@ "labelPercentage": 0, "route": [ { - "x": 345, - "y": 121.5 + "x": 291.5, + "y": 111.5 }, { - "x": 345, - "y": 191.9 + "x": 291.5, + "y": 173.9 }, { - "x": 345, - "y": 227.5 + "x": 291.5, + "y": 205.5 }, { - "x": 345, - "y": 299.5 + "x": 291.5, + "y": 269.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 50d166f55..31af2ce5b 100644 --- a/e2etests/testdata/regression/dagre_broken_arrowhead/dagre/sketch.exp.svg +++ b/e2etests/testdata/regression/dagre_broken_arrowhead/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="629" height="732" viewBox="-102 -102 629 732">

Oldest message

-

Offset

-

Last message

-

Next message will be
+

Oldest message

+

Offset

+

Last message

+

Next message will be
inserted here

-
M0M1M2M3M4M5M6 - +
M0M1M2M3M4M5M6 +

hey

+

hey

  • they
      @@ -804,8 +804,8 @@ width="299" height="651" viewBox="-102 -102 299 651">x

      linux: because a PC is a terrible thing to waste

      -
      a You don't have to know how the computer works,just how to work the computer. - - +
a You don't have to know how the computer works,just how to work the computer. + + aabbllmmnnoocciikkddgghhjjeeff1122 334455667788 - - - - - - - - - +aabbllmmnnoocciikkddgghhjjeeff1122 334455667788 + + + + + + + + + xyThe top of the mountain

Cats, no less liquid than their shadows, offer no angles to the wind.

+xyThe top of the mountain

Cats, no less liquid than their shadows, offer no angles to the wind.

If we can't fix it, it ain't broke.

Dieters live life in the fasting lane.

-
JoeDonaldi am top lefti am top righti am bottom lefti am bottom right - +
JoeDonaldi am top lefti am top righti am bottom lefti am bottom right + poll the peopleresultsunfavorablefavorablewill of the people

A winning strategy

-
- +poll the peopleresultsunfavorablefavorablewill of the people

A winning strategy

+
+

Markdown: Syntax

+

Markdown: Syntax

  • Overview
      @@ -1053,8 +1053,8 @@ title for the link, surrounded in quotes. For example:

      Code

      Unlike a pre-formatted code block, a code span indicates code within a normal paragraph. For example:

      -
ab - +
ab +

Note: This document is itself written using Markdown; you +

Note: This document is itself written using Markdown; you can see the source for it by adding '.text' to the URL.


Overview

-
ab - +
ab + mixed togethersugarsolution we get - - +mixed togethersugarsolution we get + +
    +
    • Overview
      • Philosophy
      • @@ -808,8 +808,8 @@ width="583" height="636" viewBox="-102 -102 583 636">
          +
          • Overview ok this is all measured
            • Philosophy
            • @@ -804,8 +804,8 @@ width="449" height="612" viewBox="-102 -102 449 612">
                +
                • Overview
                  • Philosophy
                  • @@ -829,8 +829,8 @@ width="551" height="1048" viewBox="-102 -102 551 1048">

                    List items may consist of multiple paragraphs. Each subsequent +

                    List items may consist of multiple paragraphs. Each subsequent paragraph in a list item must be indented by either 4 spaces or one tab:

                      @@ -827,8 +827,8 @@ sit amet, consectetuer adipiscing elit.

                      Another item in the same list.

                  -
                ab - +
              ab +

              Markdown: Syntax

              -
              ab - +

              Markdown: Syntax

              +
              ab +

              Every frustum longs to be a cone

              +

              Every frustum longs to be a cone

              • A continuing flow of paper is sufficient to continue the flow of paper
              • Please remain calm, it's no use both of us being hysterical at the same time
              • Visits always give pleasure: if not on arrival, then on the departure

              Festivity Level 1: Your guests are chatting amiably with each other.

              -
              xy - +
              xy + container

              they did it in style

              -

              a header

              +container

              they did it in style

              +

              a header

              a line of text and an

              {
               	indented: "block",
              @@ -805,8 +805,8 @@ width="516" height="686" viewBox="-102 -102 516 686">markdown

              Lorem ipsum dolor sit amet, consectetur adipiscing elit,
              +markdown

              Lorem ipsum dolor sit amet, consectetur adipiscing elit,
              sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

              -
              - +
              + markdown

              Lorem ipsum dolor sit amet, consectetur adipiscing elit,
              +markdown

              Lorem ipsum dolor sit amet, consectetur adipiscing elit,
              sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

              -
              - +
              +
              {
              +
              {
               	fenced: "block",
               	of: "json",
               }
               
              -
              ab - +
              ab +

              a line of text and an

              +

              a line of text and an

              {
               	indented: "block",
               	of: "json",
               }
               
              -
              ab - +
              ab +

              code

              -
              ab - +

              code

              +
              ab +

              A paragraph is simply one or more consecutive lines of text, separated +

              A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines. (A blank line is any line that looks like a blank line -- a line containing nothing but spaces or tabs is considered blank.) Normal paragraphs should not be indented with spaces or tabs.

              -
              ab - +
              ab +

              Here is an example of AppleScript:

              +

              Here is an example of AppleScript:

              tell application "Foo"
                   beep
               end tell
               

              A code block continues until it reaches a line that is not indented (or the end of the article).

              -
              ab - +
              ab + bearmama bearpapa bear - +bearmama bearpapa bear + containerscloudtall cylinderclass- -num -int- -timeout -int- -pid -+ -getStatus() -Enum+ -getJobs() -Job[]+ -setTimeout(seconds int) -voidusersid -int -name -string -email -string -password -string -last_login -datetime -container

              markdown text expanded to 800x400

              -
              := 5 +containerscloudtall cylinderclass- +num +int- +timeout +int- +pid ++ +getStatus() +Enum+ +getJobs() +Job[]+ +setTimeout(seconds int) +voidusersid +int +name +string +email +string +password +string +last_login +datetime +container

              markdown text expanded to 800x400

              +
              := 5 := a + 7 -fmt.Printf("%d", b):= 5 +fmt.Printf("%d", b):= 5 := a + 7 -fmt.Printf("%d", b)circle containerdiamond containeroval containerhexagon containerdiamondcirclehexagonoval - +
              fmt.Printf("%d", b)
              circle containerdiamond containeroval containerhexagon containerdiamondcirclehexagonoval +