diff --git a/d2layouts/d2dagrelayout/layout.go b/d2layouts/d2dagrelayout/layout.go index 5826aa603..a9b33e87b 100644 --- a/d2layouts/d2dagrelayout/layout.go +++ b/d2layouts/d2dagrelayout/layout.go @@ -41,7 +41,7 @@ type ConfigurableOpts struct { } var DefaultOpts = ConfigurableOpts{ - NodeSep: 60, + NodeSep: 40, EdgeSep: 20, } @@ -194,7 +194,7 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err if obj.LabelWidth != nil && obj.LabelHeight != nil { if len(obj.ChildrenArray) > 0 { - obj.LabelPosition = go2.Pointer(string(label.InsideTopCenter)) + obj.LabelPosition = go2.Pointer(string(label.OutsideTopCenter)) } else if obj.Attributes.Shape.Value == d2target.ShapeImage { obj.LabelPosition = go2.Pointer(string(label.OutsideBottomCenter)) // remove the extra height we added to the node when passing to dagre 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 b2afe756e..8bcbbde44 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": 358, - "height": 468, + "width": 425, + "height": 528, "opacity": 1, "strokeDash": 0, "strokeWidth": 2, @@ -47,8 +47,8 @@ "id": "a.b", "type": "rectangle", "pos": { - "x": 40, - "y": 45 + "x": 94, + "y": 55 }, "width": 53, "height": 66, @@ -88,11 +88,11 @@ "id": "a.c", "type": "rectangle", "pos": { - "x": 23, - "y": 269 + "x": 40, + "y": 299 }, - "width": 298, - "height": 155, + "width": 345, + "height": 175, "opacity": 1, "strokeDash": 0, "strokeWidth": 2, @@ -129,8 +129,8 @@ "id": "a.1", "type": "rectangle", "pos": { - "x": 153, - "y": 45 + "x": 207, + "y": 55 }, "width": 52, "height": 66, @@ -170,8 +170,8 @@ "id": "a.2", "type": "rectangle", "pos": { - "x": 265, - "y": 45 + "x": 319, + "y": 55 }, "width": 53, "height": 66, @@ -211,8 +211,8 @@ "id": "a.c.d", "type": "rectangle", "pos": { - "x": 152, - "y": 313 + "x": 206, + "y": 353 }, "width": 54, "height": 66, @@ -276,20 +276,20 @@ "labelPercentage": 0, "route": [ { - "x": 66.5, - "y": 111.5 + "x": 120, + "y": 121.5 }, { - "x": 66.5, - "y": 173.9 + "x": 120, + "y": 191.9 }, { - "x": 66.5, - "y": 205.5 + "x": 120, + "y": 227.5 }, { - "x": 66.5, - "y": 269.5 + "x": 120, + "y": 299.5 } ], "isCurve": true, @@ -324,20 +324,20 @@ "labelPercentage": 0, "route": [ { - "x": 179, - "y": 111.5 + "x": 232.5, + "y": 121.5 }, { - "x": 179, - "y": 173.9 + "x": 232.5, + "y": 191.9 }, { - "x": 179, - "y": 205.5 + "x": 232.5, + "y": 227.5 }, { - "x": 179, - "y": 269.5 + "x": 232.5, + "y": 299.5 } ], "isCurve": true, @@ -372,20 +372,20 @@ "labelPercentage": 0, "route": [ { - "x": 291.5, - "y": 111.5 + "x": 345, + "y": 121.5 }, { - "x": 291.5, - "y": 173.9 + "x": 345, + "y": 191.9 }, { - "x": 291.5, - "y": 205.5 + "x": 345, + "y": 227.5 }, { - "x": 291.5, - "y": 269.5 + "x": 345, + "y": 299.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 31af2ce5b..50d166f55 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="562" height="672" viewBox="-102 -102 562 672">

Oldest message

-

Offset

-

Last message

-

Next message will be
+

Oldest message

+

Offset

+

Last message

+

Next message will be
inserted here

-
M0M1M2M3M4M5M6 - +
M0M1M2M3M4M5M6 +

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="611" viewBox="-102 -102 299 611">

      hey

      +

      hey

      • they
          @@ -804,8 +804,8 @@ width="299" height="591" viewBox="-90 -90 299 591">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. + + 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 + + + + + + + + + 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 + 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

      +
      + 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 +

      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 +

      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 + + mixed togethersugarsolution we get - - +mixed togethersugarsolution we get + +
        +
        • Overview
          • Philosophy
          • @@ -808,8 +808,8 @@ width="583" height="596" viewBox="-102 -102 583 596">
              +
              • Overview
                • Philosophy
                • @@ -808,8 +808,8 @@ width="583" height="576" viewBox="-90 -90 583 576">
                    +
                    • Overview ok this is all measured
                      • Philosophy
                      • @@ -804,8 +804,8 @@ width="449" height="572" viewBox="-102 -102 449 572">
                          +
                          • Overview ok this is all measured
                            • Philosophy
                            • @@ -804,8 +804,8 @@ width="449" height="552" viewBox="-90 -90 449 552">
                                +
                                • Overview
                                  • Philosophy
                                  • @@ -829,8 +829,8 @@ width="551" height="1008" viewBox="-102 -102 551 1008">
                                      +
                                      • Overview
                                        • Philosophy
                                        • @@ -829,8 +829,8 @@ width="551" height="988" viewBox="-90 -90 551 988">

                                          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 +

                                    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 +

                              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 +

                              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="496" height="646" viewBox="-102 -102 496 646">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="656" viewBox="-90 -90 516 656">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.

                              -
                              - +
                              + 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 +
                              {
                              +
                              {
                               	fenced: "block",
                               	of: "json",
                               }
                               
                              -
                              ab - +
                              ab +

                              a line of text and an

                              +

                              a line of text and an

                              {
                               	indented: "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 +

                              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 +

                              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 +

                              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 + 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 + 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 +