parent
018b0d4fa0
commit
2edcacffaa
3 changed files with 297 additions and 304 deletions
|
|
@ -374,18 +374,11 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err
|
|||
if hasTop || hasBottom {
|
||||
padding := parsePadding(elkNodes[obj].LayoutOptions.Padding)
|
||||
if hasTop {
|
||||
ownLabelHeight := 0
|
||||
if obj.LabelPosition != nil && strings.HasPrefix(*obj.LabelPosition, "INSIDE_TOP") {
|
||||
ownLabelHeight = obj.LabelDimensions.Height + label.PADDING
|
||||
}
|
||||
padding.top = go2.Max(padding.top, d2target.MAX_ICON_SIZE+2*label.PADDING+ownLabelHeight)
|
||||
// TODO I think this fails to account for a potential inner label of container
|
||||
padding.top = go2.Max(padding.top, d2target.MAX_ICON_SIZE+2*label.PADDING)
|
||||
}
|
||||
if hasBottom {
|
||||
ownLabelHeight := 0
|
||||
if obj.LabelPosition != nil && strings.HasPrefix(*obj.LabelPosition, "INSIDE_BOTTOM") {
|
||||
ownLabelHeight = obj.LabelDimensions.Height + label.PADDING
|
||||
}
|
||||
padding.bottom = go2.Max(padding.bottom, d2target.MAX_ICON_SIZE+2*label.PADDING+ownLabelHeight)
|
||||
padding.bottom = go2.Max(padding.bottom, d2target.MAX_ICON_SIZE+2*label.PADDING)
|
||||
}
|
||||
elkNodes[obj].LayoutOptions.Padding = padding.String()
|
||||
}
|
||||
|
|
|
|||
18
e2etests/testdata/txtar/sql-icon/elk/board.exp.json
generated
vendored
18
e2etests/testdata/txtar/sql-icon/elk/board.exp.json
generated
vendored
|
|
@ -253,7 +253,7 @@
|
|||
"y": 330
|
||||
},
|
||||
"width": 972,
|
||||
"height": 303,
|
||||
"height": 262,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
|
|
@ -291,7 +291,7 @@
|
|||
"type": "sql_table",
|
||||
"pos": {
|
||||
"x": 62,
|
||||
"y": 445
|
||||
"y": 404
|
||||
},
|
||||
"width": 106,
|
||||
"height": 72,
|
||||
|
|
@ -375,7 +375,7 @@
|
|||
"type": "class",
|
||||
"pos": {
|
||||
"x": 188,
|
||||
"y": 445
|
||||
"y": 404
|
||||
},
|
||||
"width": 204,
|
||||
"height": 138,
|
||||
|
|
@ -436,7 +436,7 @@
|
|||
"type": "code",
|
||||
"pos": {
|
||||
"x": 412,
|
||||
"y": 445
|
||||
"y": 404
|
||||
},
|
||||
"width": 74,
|
||||
"height": 37,
|
||||
|
|
@ -488,7 +488,7 @@
|
|||
"type": "text",
|
||||
"pos": {
|
||||
"x": 506,
|
||||
"y": 445
|
||||
"y": 404
|
||||
},
|
||||
"width": 428,
|
||||
"height": 91,
|
||||
|
|
@ -567,7 +567,7 @@
|
|||
},
|
||||
{
|
||||
"x": 115,
|
||||
"y": 445
|
||||
"y": 404
|
||||
}
|
||||
],
|
||||
"animated": false,
|
||||
|
|
@ -605,7 +605,7 @@
|
|||
},
|
||||
{
|
||||
"x": 290,
|
||||
"y": 445
|
||||
"y": 404
|
||||
}
|
||||
],
|
||||
"animated": false,
|
||||
|
|
@ -643,7 +643,7 @@
|
|||
},
|
||||
{
|
||||
"x": 449,
|
||||
"y": 445
|
||||
"y": 404
|
||||
}
|
||||
],
|
||||
"animated": false,
|
||||
|
|
@ -681,7 +681,7 @@
|
|||
},
|
||||
{
|
||||
"x": 720,
|
||||
"y": 445
|
||||
"y": 404
|
||||
}
|
||||
],
|
||||
"animated": false,
|
||||
|
|
|
|||
570
e2etests/testdata/txtar/sql-icon/elk/sketch.exp.svg
vendored
570
e2etests/testdata/txtar/sql-icon/elk/sketch.exp.svg
vendored
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
Loading…
Reference in a new issue