From ae2f75890bf7ed8351753e637fbded53df5de9d0 Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Sat, 24 Dec 2022 16:19:09 -0800 Subject: [PATCH] fix class header --- d2graph/d2graph.go | 3 + .../dagre/board.exp.json | 182 +++++++++--------- .../dagre/sketch.exp.svg | 26 +-- .../elk/board.exp.json | 182 +++++++++--------- .../elk/sketch.exp.svg | 26 +-- 5 files changed, 211 insertions(+), 208 deletions(-) diff --git a/d2graph/d2graph.go b/d2graph/d2graph.go index 956244dc9..e60aa17c0 100644 --- a/d2graph/d2graph.go +++ b/d2graph/d2graph.go @@ -457,6 +457,9 @@ func (obj *Object) Text() *d2target.MText { if obj.Class != nil || obj.SQLTable != nil { fontSize = d2fonts.FONT_SIZE_XL } + if obj.Class != nil { + isBold = false + } return &d2target.MText{ Text: obj.Attributes.Label.Value, FontSize: fontSize, diff --git a/e2etests/testdata/stable/sequence_diagram_all_shapes/dagre/board.exp.json b/e2etests/testdata/stable/sequence_diagram_all_shapes/dagre/board.exp.json index 4b77fb8ae..42c5c962e 100644 --- a/e2etests/testdata/stable/sequence_diagram_all_shapes/dagre/board.exp.json +++ b/e2etests/testdata/stable/sequence_diagram_all_shapes/dagre/board.exp.json @@ -86,10 +86,10 @@ "id": "c", "type": "class", "pos": { - "x": 486, + "x": 481, "y": 74 }, - "width": 241, + "width": 302, "height": 184, "opacity": 1, "strokeDash": 0, @@ -127,7 +127,7 @@ "italic": false, "bold": false, "underline": false, - "labelWidth": 71, + "labelWidth": 104, "labelHeight": 36, "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 0, @@ -140,7 +140,7 @@ "id": "d", "type": "cloud", "pos": { - "x": 777, + "x": 833, "y": 132 }, "width": 174, @@ -180,7 +180,7 @@ "id": "e", "type": "code", "pos": { - "x": 1016, + "x": 1072, "y": 188 }, "width": 196, @@ -220,7 +220,7 @@ "id": "f", "type": "cylinder", "pos": { - "x": 1289, + "x": 1345, "y": 132 }, "width": 150, @@ -260,7 +260,7 @@ "id": "g", "type": "diamond", "pos": { - "x": 1539, + "x": 1595, "y": 132 }, "width": 150, @@ -300,7 +300,7 @@ "id": "h", "type": "document", "pos": { - "x": 1789, + "x": 1845, "y": 132 }, "width": 150, @@ -340,7 +340,7 @@ "id": "i", "type": "hexagon", "pos": { - "x": 2025, + "x": 2082, "y": 132 }, "width": 177, @@ -380,7 +380,7 @@ "id": "j", "type": "image", "pos": { - "x": 2289, + "x": 2345, "y": 109 }, "width": 150, @@ -431,7 +431,7 @@ "id": "k", "type": "oval", "pos": { - "x": 2539, + "x": 2595, "y": 132 }, "width": 150, @@ -471,7 +471,7 @@ "id": "l", "type": "package", "pos": { - "x": 2789, + "x": 2845, "y": 132 }, "width": 150, @@ -511,7 +511,7 @@ "id": "m", "type": "page", "pos": { - "x": 3027, + "x": 3084, "y": 132 }, "width": 173, @@ -551,7 +551,7 @@ "id": "n", "type": "parallelogram", "pos": { - "x": 3275, + "x": 3332, "y": 116 }, "width": 177, @@ -591,7 +591,7 @@ "id": "o", "type": "person", "pos": { - "x": 3538, + "x": 3595, "y": 79 }, "width": 151, @@ -631,7 +631,7 @@ "id": "p", "type": "queue", "pos": { - "x": 3784, + "x": 3841, "y": 132 }, "width": 159, @@ -671,7 +671,7 @@ "id": "q", "type": "rectangle", "pos": { - "x": 4032, + "x": 4089, "y": 95 }, "width": 163, @@ -711,7 +711,7 @@ "id": "r", "type": "step", "pos": { - "x": 4260, + "x": 4317, "y": 132 }, "width": 207, @@ -751,7 +751,7 @@ "id": "s", "type": "stored_data", "pos": { - "x": 4539, + "x": 4595, "y": 132 }, "width": 150, @@ -791,7 +791,7 @@ "id": "t", "type": "sql_table", "pos": { - "x": 4783, + "x": 4840, "y": 150 }, "width": 161, @@ -958,7 +958,7 @@ "y": 518 }, { - "x": 606.5, + "x": 632, "y": 518 } ], @@ -993,11 +993,11 @@ "labelPercentage": 0, "route": [ { - "x": 606.5, + "x": 632, "y": 648 }, { - "x": 864, + "x": 920, "y": 648 } ], @@ -1032,11 +1032,11 @@ "labelPercentage": 0, "route": [ { - "x": 864, + "x": 920, "y": 778 }, { - "x": 1114, + "x": 1170, "y": 778 } ], @@ -1071,11 +1071,11 @@ "labelPercentage": 0, "route": [ { - "x": 1114, + "x": 1170, "y": 908 }, { - "x": 1364, + "x": 1420, "y": 908 } ], @@ -1110,11 +1110,11 @@ "labelPercentage": 0, "route": [ { - "x": 1364, + "x": 1420, "y": 1038 }, { - "x": 1614, + "x": 1670, "y": 1038 } ], @@ -1149,11 +1149,11 @@ "labelPercentage": 0, "route": [ { - "x": 1614, + "x": 1670, "y": 1168 }, { - "x": 1864, + "x": 1920, "y": 1168 } ], @@ -1188,11 +1188,11 @@ "labelPercentage": 0, "route": [ { - "x": 1864, + "x": 1920, "y": 1298 }, { - "x": 2113.5, + "x": 2170.5, "y": 1298 } ], @@ -1227,11 +1227,11 @@ "labelPercentage": 0, "route": [ { - "x": 2113.5, + "x": 2170.5, "y": 1428 }, { - "x": 2364, + "x": 2420, "y": 1428 } ], @@ -1266,11 +1266,11 @@ "labelPercentage": 0, "route": [ { - "x": 2364, + "x": 2420, "y": 1558 }, { - "x": 2614, + "x": 2670, "y": 1558 } ], @@ -1305,11 +1305,11 @@ "labelPercentage": 0, "route": [ { - "x": 2614, + "x": 2670, "y": 1688 }, { - "x": 2864, + "x": 2920, "y": 1688 } ], @@ -1344,11 +1344,11 @@ "labelPercentage": 0, "route": [ { - "x": 2864, + "x": 2920, "y": 1818 }, { - "x": 3113.5, + "x": 3170.5, "y": 1818 } ], @@ -1383,11 +1383,11 @@ "labelPercentage": 0, "route": [ { - "x": 3113.5, + "x": 3170.5, "y": 1948 }, { - "x": 3363.5, + "x": 3420.5, "y": 1948 } ], @@ -1422,11 +1422,11 @@ "labelPercentage": 0, "route": [ { - "x": 3363.5, + "x": 3420.5, "y": 2078 }, { - "x": 3613.5, + "x": 3670.5, "y": 2078 } ], @@ -1461,11 +1461,11 @@ "labelPercentage": 0, "route": [ { - "x": 3613.5, + "x": 3670.5, "y": 2208 }, { - "x": 3863.5, + "x": 3920.5, "y": 2208 } ], @@ -1500,11 +1500,11 @@ "labelPercentage": 0, "route": [ { - "x": 3863.5, + "x": 3920.5, "y": 2338 }, { - "x": 4113.5, + "x": 4170.5, "y": 2338 } ], @@ -1539,11 +1539,11 @@ "labelPercentage": 0, "route": [ { - "x": 4113.5, + "x": 4170.5, "y": 2468 }, { - "x": 4363.5, + "x": 4420.5, "y": 2468 } ], @@ -1578,11 +1578,11 @@ "labelPercentage": 0, "route": [ { - "x": 4363.5, + "x": 4420.5, "y": 2598 }, { - "x": 4614, + "x": 4670, "y": 2598 } ], @@ -1617,11 +1617,11 @@ "labelPercentage": 0, "route": [ { - "x": 4614, + "x": 4670, "y": 2728 }, { - "x": 4863.5, + "x": 4920.5, "y": 2728 } ], @@ -1734,11 +1734,11 @@ "labelPercentage": 0, "route": [ { - "x": 606.5, + "x": 632, "y": 258 }, { - "x": 606.5, + "x": 632, "y": 2858 } ], @@ -1773,11 +1773,11 @@ "labelPercentage": 0, "route": [ { - "x": 864, + "x": 920, "y": 258 }, { - "x": 864, + "x": 920, "y": 2858 } ], @@ -1812,11 +1812,11 @@ "labelPercentage": 0, "route": [ { - "x": 1114, + "x": 1170, "y": 258 }, { - "x": 1114, + "x": 1170, "y": 2858 } ], @@ -1851,11 +1851,11 @@ "labelPercentage": 0, "route": [ { - "x": 1364, + "x": 1420, "y": 258 }, { - "x": 1364, + "x": 1420, "y": 2858 } ], @@ -1890,11 +1890,11 @@ "labelPercentage": 0, "route": [ { - "x": 1614, + "x": 1670, "y": 258 }, { - "x": 1614, + "x": 1670, "y": 2858 } ], @@ -1929,11 +1929,11 @@ "labelPercentage": 0, "route": [ { - "x": 1864, + "x": 1920, "y": 258 }, { - "x": 1864, + "x": 1920, "y": 2858 } ], @@ -1968,11 +1968,11 @@ "labelPercentage": 0, "route": [ { - "x": 2113.5, + "x": 2170.5, "y": 258 }, { - "x": 2113.5, + "x": 2170.5, "y": 2858 } ], @@ -2007,11 +2007,11 @@ "labelPercentage": 0, "route": [ { - "x": 2364, + "x": 2420, "y": 263 }, { - "x": 2364, + "x": 2420, "y": 2858 } ], @@ -2046,11 +2046,11 @@ "labelPercentage": 0, "route": [ { - "x": 2614, + "x": 2670, "y": 258 }, { - "x": 2614, + "x": 2670, "y": 2858 } ], @@ -2085,11 +2085,11 @@ "labelPercentage": 0, "route": [ { - "x": 2864, + "x": 2920, "y": 258 }, { - "x": 2864, + "x": 2920, "y": 2858 } ], @@ -2124,11 +2124,11 @@ "labelPercentage": 0, "route": [ { - "x": 3113.5, + "x": 3170.5, "y": 258 }, { - "x": 3113.5, + "x": 3170.5, "y": 2858 } ], @@ -2163,11 +2163,11 @@ "labelPercentage": 0, "route": [ { - "x": 3363.5, + "x": 3420.5, "y": 258 }, { - "x": 3363.5, + "x": 3420.5, "y": 2858 } ], @@ -2202,11 +2202,11 @@ "labelPercentage": 0, "route": [ { - "x": 3613.5, + "x": 3670.5, "y": 263 }, { - "x": 3613.5, + "x": 3670.5, "y": 2858 } ], @@ -2241,11 +2241,11 @@ "labelPercentage": 0, "route": [ { - "x": 3863.5, + "x": 3920.5, "y": 258 }, { - "x": 3863.5, + "x": 3920.5, "y": 2858 } ], @@ -2280,11 +2280,11 @@ "labelPercentage": 0, "route": [ { - "x": 4113.5, + "x": 4170.5, "y": 258 }, { - "x": 4113.5, + "x": 4170.5, "y": 2858 } ], @@ -2319,11 +2319,11 @@ "labelPercentage": 0, "route": [ { - "x": 4363.5, + "x": 4420.5, "y": 258 }, { - "x": 4363.5, + "x": 4420.5, "y": 2858 } ], @@ -2358,11 +2358,11 @@ "labelPercentage": 0, "route": [ { - "x": 4614, + "x": 4670, "y": 258 }, { - "x": 4614, + "x": 4670, "y": 2858 } ], @@ -2397,11 +2397,11 @@ "labelPercentage": 0, "route": [ { - "x": 4863.5, + "x": 4920.5, "y": 258 }, { - "x": 4863.5, + "x": 4920.5, "y": 2858 } ], diff --git a/e2etests/testdata/stable/sequence_diagram_all_shapes/dagre/sketch.exp.svg b/e2etests/testdata/stable/sequence_diagram_all_shapes/dagre/sketch.exp.svg index c059492d0..2b86d5324 100644 --- a/e2etests/testdata/stable/sequence_diagram_all_shapes/dagre/sketch.exp.svg +++ b/e2etests/testdata/stable/sequence_diagram_all_shapes/dagre/sketch.exp.svg @@ -2,7 +2,7 @@ a labelblabelsa class+ +public() bool +void- +private() int +voidcloudyyyy:= 5 := a + 7 -fmt.Printf("%d", b)cyldiadocssix cornersa random iconoverpackdocs pagetoohard o saysinglepersona queuea squarea step at a timedatausersid -int -name -varchar - result := callThisFunction(obj, 5) midthis sideother side - +fmt.Printf("%d", b)cyldiadocssix cornersa random iconoverpackdocs pagetoohard o saysinglepersona queuea squarea step at a timedatausersid +int +name +varchar + result := callThisFunction(obj, 5) midthis sideother side + - + a labelblabelsa class+ -public() bool -void- -private() int -voidcloudyyyy:= 5 +a labelblabelsa class+ +public() bool +void- +private() int +voidcloudyyyy:= 5 := a + 7 -fmt.Printf("%d", b)cyldiadocssix cornersa random iconoverpackdocs pagetoohard o saysinglepersona queuea squarea step at a timedatausersid -int -name -varchar - result := callThisFunction(obj, 5) midthis sideother side - +fmt.Printf("%d", b)cyldiadocssix cornersa random iconoverpackdocs pagetoohard o saysinglepersona queuea squarea step at a timedatausersid +int +name +varchar + result := callThisFunction(obj, 5) midthis sideother side + - +