diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index 2543ebe96..c81cdb0bd 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -5,3 +5,4 @@ #### Bugfixes ⛑️ - Local relative icons are relative to the d2 file instead of CLI invoke path [#1924](https://github.com/terrastruct/d2/pull/1924) +- Custom label positions weren't being read when the width was smaller than the label [#1928](https://github.com/terrastruct/d2/pull/1928) diff --git a/e2etests/testdata/regression/glob_dimensions/dagre/board.exp.json b/e2etests/testdata/regression/glob_dimensions/dagre/board.exp.json index bb38e0c9f..d16374a7f 100644 --- a/e2etests/testdata/regression/glob_dimensions/dagre/board.exp.json +++ b/e2etests/testdata/regression/glob_dimensions/dagre/board.exp.json @@ -40,7 +40,7 @@ "underline": false, "labelWidth": 9, "labelHeight": 21, - "labelPosition": "OUTSIDE_BOTTOM_CENTER", + "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 0, "level": 1 }, @@ -122,7 +122,7 @@ "underline": false, "labelWidth": 9, "labelHeight": 21, - "labelPosition": "OUTSIDE_BOTTOM_CENTER", + "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 0, "level": 2 }, @@ -399,11 +399,11 @@ "route": [ { "x": 153, - "y": 36 + "y": 10 }, { "x": 153, - "y": 55.20000076293945 + "y": 50 }, { "x": 153, @@ -446,11 +446,11 @@ "route": [ { "x": 153, - "y": 196 + "y": 170 }, { "x": 153, - "y": 215.1999969482422 + "y": 210 }, { "x": 153, diff --git a/e2etests/testdata/regression/glob_dimensions/dagre/sketch.exp.svg b/e2etests/testdata/regression/glob_dimensions/dagre/sketch.exp.svg index 0b14c9702..acb01ded3 100644 --- a/e2etests/testdata/regression/glob_dimensions/dagre/sketch.exp.svg +++ b/e2etests/testdata/regression/glob_dimensions/dagre/sketch.exp.svg @@ -1,23 +1,23 @@ -Check PINSearch NetworkReadyOffEnter PIN /check PIN[pin invalid][pin OK][pin OK]network foundpower offpower offpower off - - + .d2-2887586175 .fill-N1{fill:#0A0F25;} + .d2-2887586175 .fill-N2{fill:#676C7E;} + .d2-2887586175 .fill-N3{fill:#9499AB;} + .d2-2887586175 .fill-N4{fill:#CFD2DD;} + .d2-2887586175 .fill-N5{fill:#DEE1EB;} + .d2-2887586175 .fill-N6{fill:#EEF1F8;} + .d2-2887586175 .fill-N7{fill:#FFFFFF;} + .d2-2887586175 .fill-B1{fill:#0D32B2;} + .d2-2887586175 .fill-B2{fill:#0D32B2;} + .d2-2887586175 .fill-B3{fill:#E3E9FD;} + .d2-2887586175 .fill-B4{fill:#E3E9FD;} + .d2-2887586175 .fill-B5{fill:#EDF0FD;} + .d2-2887586175 .fill-B6{fill:#F7F8FE;} + .d2-2887586175 .fill-AA2{fill:#4A6FF3;} + .d2-2887586175 .fill-AA4{fill:#EDF0FD;} + .d2-2887586175 .fill-AA5{fill:#F7F8FE;} + .d2-2887586175 .fill-AB4{fill:#EDF0FD;} + .d2-2887586175 .fill-AB5{fill:#F7F8FE;} + .d2-2887586175 .stroke-N1{stroke:#0A0F25;} + .d2-2887586175 .stroke-N2{stroke:#676C7E;} + .d2-2887586175 .stroke-N3{stroke:#9499AB;} + .d2-2887586175 .stroke-N4{stroke:#CFD2DD;} + .d2-2887586175 .stroke-N5{stroke:#DEE1EB;} + .d2-2887586175 .stroke-N6{stroke:#EEF1F8;} + .d2-2887586175 .stroke-N7{stroke:#FFFFFF;} + .d2-2887586175 .stroke-B1{stroke:#0D32B2;} + .d2-2887586175 .stroke-B2{stroke:#0D32B2;} + .d2-2887586175 .stroke-B3{stroke:#E3E9FD;} + .d2-2887586175 .stroke-B4{stroke:#E3E9FD;} + .d2-2887586175 .stroke-B5{stroke:#EDF0FD;} + .d2-2887586175 .stroke-B6{stroke:#F7F8FE;} + .d2-2887586175 .stroke-AA2{stroke:#4A6FF3;} + .d2-2887586175 .stroke-AA4{stroke:#EDF0FD;} + .d2-2887586175 .stroke-AA5{stroke:#F7F8FE;} + .d2-2887586175 .stroke-AB4{stroke:#EDF0FD;} + .d2-2887586175 .stroke-AB5{stroke:#F7F8FE;} + .d2-2887586175 .background-color-N1{background-color:#0A0F25;} + .d2-2887586175 .background-color-N2{background-color:#676C7E;} + .d2-2887586175 .background-color-N3{background-color:#9499AB;} + .d2-2887586175 .background-color-N4{background-color:#CFD2DD;} + .d2-2887586175 .background-color-N5{background-color:#DEE1EB;} + .d2-2887586175 .background-color-N6{background-color:#EEF1F8;} + .d2-2887586175 .background-color-N7{background-color:#FFFFFF;} + .d2-2887586175 .background-color-B1{background-color:#0D32B2;} + .d2-2887586175 .background-color-B2{background-color:#0D32B2;} + .d2-2887586175 .background-color-B3{background-color:#E3E9FD;} + .d2-2887586175 .background-color-B4{background-color:#E3E9FD;} + .d2-2887586175 .background-color-B5{background-color:#EDF0FD;} + .d2-2887586175 .background-color-B6{background-color:#F7F8FE;} + .d2-2887586175 .background-color-AA2{background-color:#4A6FF3;} + .d2-2887586175 .background-color-AA4{background-color:#EDF0FD;} + .d2-2887586175 .background-color-AA5{background-color:#F7F8FE;} + .d2-2887586175 .background-color-AB4{background-color:#EDF0FD;} + .d2-2887586175 .background-color-AB5{background-color:#F7F8FE;} + .d2-2887586175 .color-N1{color:#0A0F25;} + .d2-2887586175 .color-N2{color:#676C7E;} + .d2-2887586175 .color-N3{color:#9499AB;} + .d2-2887586175 .color-N4{color:#CFD2DD;} + .d2-2887586175 .color-N5{color:#DEE1EB;} + .d2-2887586175 .color-N6{color:#EEF1F8;} + .d2-2887586175 .color-N7{color:#FFFFFF;} + .d2-2887586175 .color-B1{color:#0D32B2;} + .d2-2887586175 .color-B2{color:#0D32B2;} + .d2-2887586175 .color-B3{color:#E3E9FD;} + .d2-2887586175 .color-B4{color:#E3E9FD;} + .d2-2887586175 .color-B5{color:#EDF0FD;} + .d2-2887586175 .color-B6{color:#F7F8FE;} + .d2-2887586175 .color-AA2{color:#4A6FF3;} + .d2-2887586175 .color-AA4{color:#EDF0FD;} + .d2-2887586175 .color-AA5{color:#F7F8FE;} + .d2-2887586175 .color-AB4{color:#EDF0FD;} + .d2-2887586175 .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);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]>Check PINSearch NetworkReadyOffEnter PIN /check PIN[pin invalid][pin OK][pin OK]network foundpower offpower offpower off + + - + diff --git a/e2etests/testdata/regression/glob_dimensions/elk/board.exp.json b/e2etests/testdata/regression/glob_dimensions/elk/board.exp.json index 61b314cc0..d6f22abdc 100644 --- a/e2etests/testdata/regression/glob_dimensions/elk/board.exp.json +++ b/e2etests/testdata/regression/glob_dimensions/elk/board.exp.json @@ -40,7 +40,7 @@ "underline": false, "labelWidth": 9, "labelHeight": 21, - "labelPosition": "OUTSIDE_BOTTOM_CENTER", + "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 0, "level": 1 }, @@ -49,10 +49,10 @@ "type": "rectangle", "pos": { "x": 37, - "y": 118 + "y": 103 }, "width": 262, - "height": 670, + "height": 655, "opacity": 1, "strokeDash": 0, "strokeWidth": 2, @@ -90,7 +90,7 @@ "type": "oval", "pos": { "x": 161, - "y": 168 + "y": 153 }, "width": 10, "height": 10, @@ -122,7 +122,7 @@ "underline": false, "labelWidth": 9, "labelHeight": 21, - "labelPosition": "OUTSIDE_BOTTOM_CENTER", + "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 0, "level": 2 }, @@ -131,7 +131,7 @@ "type": "rectangle", "pos": { "x": 111, - "y": 274 + "y": 244 }, "width": 111, "height": 66, @@ -172,7 +172,7 @@ "type": "diamond", "pos": { "x": 156, - "y": 521 + "y": 491 }, "width": 20, "height": 20, @@ -212,7 +212,7 @@ "type": "oval", "pos": { "x": 161, - "y": 702 + "y": 672 }, "width": 10, "height": 10, @@ -253,7 +253,7 @@ "type": "rectangle", "pos": { "x": 29, - "y": 959 + "y": 929 }, "width": 159, "height": 66, @@ -294,7 +294,7 @@ "type": "rectangle", "pos": { "x": 15, - "y": 1196 + "y": 1166 }, "width": 89, "height": 66, @@ -335,7 +335,7 @@ "type": "rectangle", "pos": { "x": 95, - "y": 1433 + "y": 1403 }, "width": 120, "height": 66, @@ -398,12 +398,12 @@ "labelPercentage": 0, "route": [ { - "x": 168.5, - "y": 48 + "x": 169, + "y": 22 }, { - "x": 168.5, - "y": 118 + "x": 168, + "y": 103 } ], "animated": false, @@ -436,12 +436,12 @@ "labelPercentage": 0, "route": [ { - "x": 166.5, - "y": 204 + "x": 167, + "y": 163 }, { - "x": 166.5, - "y": 274 + "x": 166, + "y": 244 } ], "animated": false, @@ -475,19 +475,19 @@ "route": [ { "x": 123.5, - "y": 340 + "y": 310 }, { "x": 123.5, - "y": 481 + "y": 451 }, { "x": 163.16600036621094, - "y": 481 + "y": 451 }, { "x": 163, - "y": 524 + "y": 494 } ], "animated": false, @@ -521,19 +521,19 @@ "route": [ { "x": 170, - "y": 525 + "y": 495 }, { "x": 169.83299255371094, - "y": 481 + "y": 451 }, { "x": 209.5, - "y": 481 + "y": 451 }, { "x": 209.5, - "y": 340 + "y": 310 } ], "animated": false, @@ -567,11 +567,11 @@ "route": [ { "x": 166, - "y": 540 + "y": 510 }, { "x": 167, - "y": 702 + "y": 672 } ], "animated": false, @@ -605,11 +605,11 @@ "route": [ { "x": 108.75, - "y": 788 + "y": 758 }, { "x": 108.75, - "y": 959 + "y": 929 } ], "animated": false, @@ -643,11 +643,11 @@ "route": [ { "x": 60, - "y": 1025 + "y": 995 }, { "x": 60, - "y": 1196 + "y": 1166 } ], "animated": false, @@ -681,19 +681,19 @@ "route": [ { "x": 240.99899291992188, - "y": 788 + "y": 758 }, { "x": 240.99899291992188, - "y": 1393 + "y": 1363 }, { "x": 185.25, - "y": 1393 + "y": 1363 }, { "x": 185.25, - "y": 1433 + "y": 1403 } ], "animated": false, @@ -727,11 +727,11 @@ "route": [ { "x": 157.5, - "y": 1025 + "y": 995 }, { "x": 157.5, - "y": 1433 + "y": 1403 } ], "animated": false, @@ -765,19 +765,19 @@ "route": [ { "x": 60, - "y": 1262 + "y": 1232 }, { "x": 60, - "y": 1393 + "y": 1363 }, { "x": 125.25, - "y": 1393 + "y": 1363 }, { "x": 125.25, - "y": 1433 + "y": 1403 } ], "animated": false, diff --git a/e2etests/testdata/regression/glob_dimensions/elk/sketch.exp.svg b/e2etests/testdata/regression/glob_dimensions/elk/sketch.exp.svg index d1f0af7b2..0079d186d 100644 --- a/e2etests/testdata/regression/glob_dimensions/elk/sketch.exp.svg +++ b/e2etests/testdata/regression/glob_dimensions/elk/sketch.exp.svg @@ -1,23 +1,23 @@ -Check PINSearch NetworkReadyOffEnter PIN /check PIN[pin invalid][pin OK][pin OK]network foundpower offpower offpower off - - - - - - - - - - - - - - - - - + .d2-1524816052 .fill-N1{fill:#0A0F25;} + .d2-1524816052 .fill-N2{fill:#676C7E;} + .d2-1524816052 .fill-N3{fill:#9499AB;} + .d2-1524816052 .fill-N4{fill:#CFD2DD;} + .d2-1524816052 .fill-N5{fill:#DEE1EB;} + .d2-1524816052 .fill-N6{fill:#EEF1F8;} + .d2-1524816052 .fill-N7{fill:#FFFFFF;} + .d2-1524816052 .fill-B1{fill:#0D32B2;} + .d2-1524816052 .fill-B2{fill:#0D32B2;} + .d2-1524816052 .fill-B3{fill:#E3E9FD;} + .d2-1524816052 .fill-B4{fill:#E3E9FD;} + .d2-1524816052 .fill-B5{fill:#EDF0FD;} + .d2-1524816052 .fill-B6{fill:#F7F8FE;} + .d2-1524816052 .fill-AA2{fill:#4A6FF3;} + .d2-1524816052 .fill-AA4{fill:#EDF0FD;} + .d2-1524816052 .fill-AA5{fill:#F7F8FE;} + .d2-1524816052 .fill-AB4{fill:#EDF0FD;} + .d2-1524816052 .fill-AB5{fill:#F7F8FE;} + .d2-1524816052 .stroke-N1{stroke:#0A0F25;} + .d2-1524816052 .stroke-N2{stroke:#676C7E;} + .d2-1524816052 .stroke-N3{stroke:#9499AB;} + .d2-1524816052 .stroke-N4{stroke:#CFD2DD;} + .d2-1524816052 .stroke-N5{stroke:#DEE1EB;} + .d2-1524816052 .stroke-N6{stroke:#EEF1F8;} + .d2-1524816052 .stroke-N7{stroke:#FFFFFF;} + .d2-1524816052 .stroke-B1{stroke:#0D32B2;} + .d2-1524816052 .stroke-B2{stroke:#0D32B2;} + .d2-1524816052 .stroke-B3{stroke:#E3E9FD;} + .d2-1524816052 .stroke-B4{stroke:#E3E9FD;} + .d2-1524816052 .stroke-B5{stroke:#EDF0FD;} + .d2-1524816052 .stroke-B6{stroke:#F7F8FE;} + .d2-1524816052 .stroke-AA2{stroke:#4A6FF3;} + .d2-1524816052 .stroke-AA4{stroke:#EDF0FD;} + .d2-1524816052 .stroke-AA5{stroke:#F7F8FE;} + .d2-1524816052 .stroke-AB4{stroke:#EDF0FD;} + .d2-1524816052 .stroke-AB5{stroke:#F7F8FE;} + .d2-1524816052 .background-color-N1{background-color:#0A0F25;} + .d2-1524816052 .background-color-N2{background-color:#676C7E;} + .d2-1524816052 .background-color-N3{background-color:#9499AB;} + .d2-1524816052 .background-color-N4{background-color:#CFD2DD;} + .d2-1524816052 .background-color-N5{background-color:#DEE1EB;} + .d2-1524816052 .background-color-N6{background-color:#EEF1F8;} + .d2-1524816052 .background-color-N7{background-color:#FFFFFF;} + .d2-1524816052 .background-color-B1{background-color:#0D32B2;} + .d2-1524816052 .background-color-B2{background-color:#0D32B2;} + .d2-1524816052 .background-color-B3{background-color:#E3E9FD;} + .d2-1524816052 .background-color-B4{background-color:#E3E9FD;} + .d2-1524816052 .background-color-B5{background-color:#EDF0FD;} + .d2-1524816052 .background-color-B6{background-color:#F7F8FE;} + .d2-1524816052 .background-color-AA2{background-color:#4A6FF3;} + .d2-1524816052 .background-color-AA4{background-color:#EDF0FD;} + .d2-1524816052 .background-color-AA5{background-color:#F7F8FE;} + .d2-1524816052 .background-color-AB4{background-color:#EDF0FD;} + .d2-1524816052 .background-color-AB5{background-color:#F7F8FE;} + .d2-1524816052 .color-N1{color:#0A0F25;} + .d2-1524816052 .color-N2{color:#676C7E;} + .d2-1524816052 .color-N3{color:#9499AB;} + .d2-1524816052 .color-N4{color:#CFD2DD;} + .d2-1524816052 .color-N5{color:#DEE1EB;} + .d2-1524816052 .color-N6{color:#EEF1F8;} + .d2-1524816052 .color-N7{color:#FFFFFF;} + .d2-1524816052 .color-B1{color:#0D32B2;} + .d2-1524816052 .color-B2{color:#0D32B2;} + .d2-1524816052 .color-B3{color:#E3E9FD;} + .d2-1524816052 .color-B4{color:#E3E9FD;} + .d2-1524816052 .color-B5{color:#EDF0FD;} + .d2-1524816052 .color-B6{color:#F7F8FE;} + .d2-1524816052 .color-AA2{color:#4A6FF3;} + .d2-1524816052 .color-AA4{color:#EDF0FD;} + .d2-1524816052 .color-AA5{color:#F7F8FE;} + .d2-1524816052 .color-AB4{color:#EDF0FD;} + .d2-1524816052 .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);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]>Check PINSearch NetworkReadyOffEnter PIN /check PIN[pin invalid][pin OK][pin OK]network foundpower offpower offpower off + + + + + + + + + + + + + + + + + \ No newline at end of file