fix class shape in sequence diagram render
This commit is contained in:
parent
1fcb075e04
commit
4411fbdabc
6 changed files with 285 additions and 6 deletions
|
|
@ -338,6 +338,12 @@ func (l ContainerLevel) LabelSize() int {
|
|||
|
||||
func (obj *Object) GetFill() string {
|
||||
level := int(obj.Level())
|
||||
shape := obj.Attributes.Shape.Value
|
||||
|
||||
if strings.EqualFold(shape, d2target.ShapeSQLTable) || strings.EqualFold(shape, d2target.ShapeClass) {
|
||||
return color.N1
|
||||
}
|
||||
|
||||
if obj.IsSequenceDiagramNote() {
|
||||
return color.N7
|
||||
} else if obj.IsSequenceDiagramGroup() {
|
||||
|
|
@ -366,8 +372,6 @@ func (obj *Object) GetFill() string {
|
|||
return color.N7
|
||||
}
|
||||
|
||||
shape := obj.Attributes.Shape.Value
|
||||
|
||||
if shape == "" || strings.EqualFold(shape, d2target.ShapeSquare) || strings.EqualFold(shape, d2target.ShapeCircle) || strings.EqualFold(shape, d2target.ShapeOval) || strings.EqualFold(shape, d2target.ShapeRectangle) {
|
||||
if level == 1 {
|
||||
if !obj.IsContainer() {
|
||||
|
|
@ -409,10 +413,6 @@ func (obj *Object) GetFill() string {
|
|||
return color.N5
|
||||
}
|
||||
|
||||
if strings.EqualFold(shape, d2target.ShapeSQLTable) || strings.EqualFold(shape, d2target.ShapeClass) {
|
||||
return color.N1
|
||||
}
|
||||
|
||||
return color.N7
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,17 @@ group.nested: {
|
|||
`,
|
||||
expErr: "no actors declared in sequence diagram",
|
||||
},
|
||||
{
|
||||
name: "class_font_style_sequence",
|
||||
script: `shape: sequence_diagram
|
||||
a: {
|
||||
shape: class
|
||||
style: {
|
||||
font-color: red
|
||||
}
|
||||
}
|
||||
`,
|
||||
},
|
||||
{
|
||||
name: "nested_steps",
|
||||
script: `a: {
|
||||
|
|
|
|||
91
e2etests/testdata/regression/class_font_style_sequence/dagre/board.exp.json
generated
vendored
Normal file
91
e2etests/testdata/regression/class_font_style_sequence/dagre/board.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
{
|
||||
"name": "",
|
||||
"fontFamily": "SourceSansPro",
|
||||
"shapes": [
|
||||
{
|
||||
"id": "a",
|
||||
"type": "class",
|
||||
"pos": {
|
||||
"x": 12,
|
||||
"y": 52
|
||||
},
|
||||
"width": 117,
|
||||
"height": 92,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "N1",
|
||||
"stroke": "N7",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"double-border": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"blend": false,
|
||||
"fields": null,
|
||||
"methods": null,
|
||||
"columns": null,
|
||||
"label": "a",
|
||||
"fontSize": 20,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "red",
|
||||
"italic": false,
|
||||
"bold": false,
|
||||
"underline": false,
|
||||
"labelWidth": 12,
|
||||
"labelHeight": 31,
|
||||
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||
"zIndex": 0,
|
||||
"level": 1,
|
||||
"primaryAccentColor": "B2",
|
||||
"secondaryAccentColor": "AA2",
|
||||
"neutralAccentColor": "N2"
|
||||
}
|
||||
],
|
||||
"connections": [
|
||||
{
|
||||
"id": "(a -- )[0]",
|
||||
"src": "a",
|
||||
"srcArrow": "none",
|
||||
"srcLabel": "",
|
||||
"dst": "a-lifeline-end-2251863791",
|
||||
"dstArrow": "none",
|
||||
"dstLabel": "",
|
||||
"opacity": 1,
|
||||
"strokeDash": 6,
|
||||
"strokeWidth": 2,
|
||||
"stroke": "B2",
|
||||
"label": "",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "N2",
|
||||
"italic": true,
|
||||
"bold": false,
|
||||
"underline": false,
|
||||
"labelWidth": 0,
|
||||
"labelHeight": 0,
|
||||
"labelPosition": "",
|
||||
"labelPercentage": 0,
|
||||
"route": [
|
||||
{
|
||||
"x": 70.5,
|
||||
"y": 144
|
||||
},
|
||||
{
|
||||
"x": 70.5,
|
||||
"y": 214
|
||||
}
|
||||
],
|
||||
"animated": false,
|
||||
"tooltip": "",
|
||||
"icon": null,
|
||||
"zIndex": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
43
e2etests/testdata/regression/class_font_style_sequence/dagre/sketch.exp.svg
vendored
Normal file
43
e2etests/testdata/regression/class_font_style_sequence/dagre/sketch.exp.svg
vendored
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 186 KiB |
91
e2etests/testdata/regression/class_font_style_sequence/elk/board.exp.json
generated
vendored
Normal file
91
e2etests/testdata/regression/class_font_style_sequence/elk/board.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
{
|
||||
"name": "",
|
||||
"fontFamily": "SourceSansPro",
|
||||
"shapes": [
|
||||
{
|
||||
"id": "a",
|
||||
"type": "class",
|
||||
"pos": {
|
||||
"x": 12,
|
||||
"y": 52
|
||||
},
|
||||
"width": 117,
|
||||
"height": 92,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "N1",
|
||||
"stroke": "N7",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"double-border": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"blend": false,
|
||||
"fields": null,
|
||||
"methods": null,
|
||||
"columns": null,
|
||||
"label": "a",
|
||||
"fontSize": 20,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "red",
|
||||
"italic": false,
|
||||
"bold": false,
|
||||
"underline": false,
|
||||
"labelWidth": 12,
|
||||
"labelHeight": 31,
|
||||
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||
"zIndex": 0,
|
||||
"level": 1,
|
||||
"primaryAccentColor": "B2",
|
||||
"secondaryAccentColor": "AA2",
|
||||
"neutralAccentColor": "N2"
|
||||
}
|
||||
],
|
||||
"connections": [
|
||||
{
|
||||
"id": "(a -- )[0]",
|
||||
"src": "a",
|
||||
"srcArrow": "none",
|
||||
"srcLabel": "",
|
||||
"dst": "a-lifeline-end-2251863791",
|
||||
"dstArrow": "none",
|
||||
"dstLabel": "",
|
||||
"opacity": 1,
|
||||
"strokeDash": 6,
|
||||
"strokeWidth": 2,
|
||||
"stroke": "B2",
|
||||
"label": "",
|
||||
"fontSize": 16,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "N2",
|
||||
"italic": true,
|
||||
"bold": false,
|
||||
"underline": false,
|
||||
"labelWidth": 0,
|
||||
"labelHeight": 0,
|
||||
"labelPosition": "",
|
||||
"labelPercentage": 0,
|
||||
"route": [
|
||||
{
|
||||
"x": 70.5,
|
||||
"y": 144
|
||||
},
|
||||
{
|
||||
"x": 70.5,
|
||||
"y": 214
|
||||
}
|
||||
],
|
||||
"animated": false,
|
||||
"tooltip": "",
|
||||
"icon": null,
|
||||
"zIndex": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
43
e2etests/testdata/regression/class_font_style_sequence/elk/sketch.exp.svg
vendored
Normal file
43
e2etests/testdata/regression/class_font_style_sequence/elk/sketch.exp.svg
vendored
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 186 KiB |
Loading…
Reference in a new issue