From 69c062d8ea8ff04d19e3f67a065e34f5780d75cb Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Sun, 1 Jan 2023 01:46:24 -0800 Subject: [PATCH] update --- d2graph/d2graph.go | 5 +- .../dagre/board.exp.json | 94 +++++++++---------- .../dagre/sketch.exp.svg | 52 +++++----- .../elk/board.exp.json | 78 +++++++-------- .../elk/sketch.exp.svg | 52 +++++----- .../unnamed_only_height/dagre/board.exp.json | 90 +++++++++--------- .../unnamed_only_height/dagre/sketch.exp.svg | 52 +++++----- .../unnamed_only_height/elk/board.exp.json | 74 +++++++-------- .../unnamed_only_height/elk/sketch.exp.svg | 52 +++++----- .../unnamed_only_width/dagre/board.exp.json | 88 ++++++++--------- .../unnamed_only_width/dagre/sketch.exp.svg | 52 +++++----- .../unnamed_only_width/elk/board.exp.json | 72 +++++++------- .../unnamed_only_width/elk/sketch.exp.svg | 52 +++++----- 13 files changed, 408 insertions(+), 405 deletions(-) diff --git a/d2graph/d2graph.go b/d2graph/d2graph.go index 10e43dcdf..21361304a 100644 --- a/d2graph/d2graph.go +++ b/d2graph/d2graph.go @@ -1068,7 +1068,10 @@ func (g *Graph) SetDimensions(mtexts []*d2target.MText, ruler *textmeasure.Ruler desiredHeight, _ = strconv.Atoi(obj.Attributes.Height.Value) } - if obj.Attributes.Label.Value == "" && obj.Attributes.Shape.Value != d2target.ShapeImage { + if obj.Attributes.Label.Value == "" && + obj.Attributes.Shape.Value != d2target.ShapeImage && + obj.Attributes.Shape.Value != d2target.ShapeSQLTable && + obj.Attributes.Shape.Value != d2target.ShapeClass { obj.Width = DEFAULT_SHAPE_PADDING obj.Height = DEFAULT_SHAPE_PADDING if desiredWidth != 0 { diff --git a/e2etests/testdata/regression/unnamed_class_table_code/dagre/board.exp.json b/e2etests/testdata/regression/unnamed_class_table_code/dagre/board.exp.json index c01b08b63..2d10adc2e 100644 --- a/e2etests/testdata/regression/unnamed_class_table_code/dagre/board.exp.json +++ b/e2etests/testdata/regression/unnamed_class_table_code/dagre/board.exp.json @@ -6,11 +6,11 @@ "id": "class", "type": "class", "pos": { - "x": 48, + "x": 0, "y": 0 }, - "width": 100, - "height": 100, + "width": 422, + "height": 368, "opacity": 1, "strokeDash": 0, "strokeWidth": 2, @@ -80,11 +80,11 @@ "id": "users", "type": "sql_table", "pos": { - "x": 48, - "y": 200 + "x": 107, + "y": 468 }, - "width": 100, - "height": 100, + "width": 208, + "height": 186, "opacity": 1, "strokeDash": 0, "strokeWidth": 2, @@ -112,8 +112,8 @@ "italic": false, "bold": false, "underline": false, - "labelWidth": 0, - "labelHeight": 0 + "labelWidth": 15, + "labelHeight": 26 }, "type": { "label": "int", @@ -124,8 +124,8 @@ "italic": false, "bold": false, "underline": false, - "labelWidth": 0, - "labelHeight": 0 + "labelWidth": 23, + "labelHeight": 26 }, "constraint": "", "reference": "" @@ -140,8 +140,8 @@ "italic": false, "bold": false, "underline": false, - "labelWidth": 0, - "labelHeight": 0 + "labelWidth": 47, + "labelHeight": 26 }, "type": { "label": "string", @@ -152,8 +152,8 @@ "italic": false, "bold": false, "underline": false, - "labelWidth": 0, - "labelHeight": 0 + "labelWidth": 48, + "labelHeight": 26 }, "constraint": "", "reference": "" @@ -168,8 +168,8 @@ "italic": false, "bold": false, "underline": false, - "labelWidth": 0, - "labelHeight": 0 + "labelWidth": 47, + "labelHeight": 26 }, "type": { "label": "string", @@ -180,8 +180,8 @@ "italic": false, "bold": false, "underline": false, - "labelWidth": 0, - "labelHeight": 0 + "labelWidth": 48, + "labelHeight": 26 }, "constraint": "", "reference": "" @@ -196,8 +196,8 @@ "italic": false, "bold": false, "underline": false, - "labelWidth": 0, - "labelHeight": 0 + "labelWidth": 80, + "labelHeight": 26 }, "type": { "label": "string", @@ -208,8 +208,8 @@ "italic": false, "bold": false, "underline": false, - "labelWidth": 0, - "labelHeight": 0 + "labelWidth": 48, + "labelHeight": 26 }, "constraint": "", "reference": "" @@ -224,8 +224,8 @@ "italic": false, "bold": false, "underline": false, - "labelWidth": 0, - "labelHeight": 0 + "labelWidth": 81, + "labelHeight": 26 }, "type": { "label": "datetime", @@ -236,8 +236,8 @@ "italic": false, "bold": false, "underline": false, - "labelWidth": 0, - "labelHeight": 0 + "labelWidth": 77, + "labelHeight": 26 }, "constraint": "", "reference": "" @@ -251,8 +251,8 @@ "italic": false, "bold": true, "underline": false, - "labelWidth": 0, - "labelHeight": 0, + "labelWidth": 59, + "labelHeight": 31, "zIndex": 0, "level": 1, "primaryAccentColor": "#0D32B2", @@ -263,8 +263,8 @@ "id": "code", "type": "code", "pos": { - "x": 0, - "y": 400 + "x": 113, + "y": 754 }, "width": 196, "height": 70, @@ -326,20 +326,20 @@ "labelPercentage": 0, "route": [ { - "x": 98, - "y": 100 + "x": 211, + "y": 368 }, { - "x": 98, - "y": 140 + "x": 211, + "y": 408 }, { - "x": 98, - "y": 160 + "x": 211, + "y": 428 }, { - "x": 98, - "y": 200 + "x": 211, + "y": 468 } ], "isCurve": true, @@ -374,20 +374,20 @@ "labelPercentage": 0, "route": [ { - "x": 98, - "y": 300 + "x": 211, + "y": 654 }, { - "x": 98, - "y": 340 + "x": 211, + "y": 694 }, { - "x": 98, - "y": 360 + "x": 211, + "y": 714 }, { - "x": 98, - "y": 400 + "x": 211, + "y": 754 } ], "isCurve": true, diff --git a/e2etests/testdata/regression/unnamed_class_table_code/dagre/sketch.exp.svg b/e2etests/testdata/regression/unnamed_class_table_code/dagre/sketch.exp.svg index 426680010..0c32095a8 100644 --- a/e2etests/testdata/regression/unnamed_class_table_code/dagre/sketch.exp.svg +++ b/e2etests/testdata/regression/unnamed_class_table_code/dagre/sketch.exp.svg @@ -2,7 +2,7 @@ - +num +int- +timeout +int- +pid ++ +getStatus() +Enum+ +getJobs() +Job[]+ +setTimeout(seconds int) +voidid +int +name +string +email +string +password +string +last_login +datetime +:= 5 := a + 7 -fmt.Printf("%d", b) - +fmt.Printf("%d", b) + - -num -int- -timeout -int- -pid -+ -getStatus() -Enum+ -getJobs() -Job[]+ -setTimeout(seconds int) -voidid -int -name -string -email -string -password -string -last_login -datetime -:= 5 +- +num +int- +timeout +int- +pid ++ +getStatus() +Enum+ +getJobs() +Job[]+ +setTimeout(seconds int) +voidid +int +name +string +email +string +password +string +last_login +datetime +:= 5 := a + 7 -fmt.Printf("%d", b) - +fmt.Printf("%d", b) + - -num -int- -timeout -int- -pid -+ -getStatus() -Enum+ -getJobs() -Job[]+ -setTimeout(seconds int) -voidid -int -name -string -email -string -password -string -last_login -datetime -:= 5 +- +num +int- +timeout +int- +pid ++ +getStatus() +Enum+ +getJobs() +Job[]+ +setTimeout(seconds int) +voidid +int +name +string +email +string +password +string +last_login +datetime +:= 5 := a + 7 -fmt.Printf("%d", b) - +fmt.Printf("%d", b) + - -num -int- -timeout -int- -pid -+ -getStatus() -Enum+ -getJobs() -Job[]+ -setTimeout(seconds int) -voidid -int -name -string -email -string -password -string -last_login -datetime -:= 5 +- +num +int- +timeout +int- +pid ++ +getStatus() +Enum+ +getJobs() +Job[]+ +setTimeout(seconds int) +voidid +int +name +string +email +string +password +string +last_login +datetime +:= 5 := a + 7 -fmt.Printf("%d", b) - +fmt.Printf("%d", b) + - -num -int- -timeout -int- -pid -+ -getStatus() -Enum+ -getJobs() -Job[]+ -setTimeout(seconds int) -voidid -int -name -string -email -string -password -string -last_login -datetime -:= 5 +- +num +int- +timeout +int- +pid ++ +getStatus() +Enum+ +getJobs() +Job[]+ +setTimeout(seconds int) +voidid +int +name +string +email +string +password +string +last_login +datetime +:= 5 := a + 7 -fmt.Printf("%d", b) - +fmt.Printf("%d", b) + - -num -int- -timeout -int- -pid -+ -getStatus() -Enum+ -getJobs() -Job[]+ -setTimeout(seconds int) -voidid -int -name -string -email -string -password -string -last_login -datetime -:= 5 +- +num +int- +timeout +int- +pid ++ +getStatus() +Enum+ +getJobs() +Job[]+ +setTimeout(seconds int) +voidid +int +name +string +email +string +password +string +last_login +datetime +:= 5 := a + 7 -fmt.Printf("%d", b) - +fmt.Printf("%d", b) +