Merge pull request #427 from alixander/blank-sequence
fix sequence diagram with no messages
This commit is contained in:
commit
2ac363d404
7 changed files with 401 additions and 3 deletions
|
|
@ -4,5 +4,7 @@
|
||||||
|
|
||||||
#### Bugfixes ⛑️
|
#### Bugfixes ⛑️
|
||||||
|
|
||||||
|
- Fixed crash when sequence diagrams had no messages
|
||||||
|
[https://github.com/terrastruct/d2/pull/427](https://github.com/terrastruct/d2/pull/427)
|
||||||
- Fixed serialization affecting binary plugins (TALA).
|
- Fixed serialization affecting binary plugins (TALA).
|
||||||
[https://github.com/terrastruct/d2/pull/426](https://github.com/terrastruct/d2/pull/426)
|
[https://github.com/terrastruct/d2/pull/426](https://github.com/terrastruct/d2/pull/426)
|
||||||
|
|
|
||||||
|
|
@ -299,14 +299,19 @@ func (sd *sequenceDiagram) placeActors() {
|
||||||
// │
|
// │
|
||||||
// │
|
// │
|
||||||
func (sd *sequenceDiagram) addLifelineEdges() {
|
func (sd *sequenceDiagram) addLifelineEdges() {
|
||||||
lastRoute := sd.messages[len(sd.messages)-1].Route
|
|
||||||
endY := 0.
|
endY := 0.
|
||||||
for _, p := range lastRoute {
|
if len(sd.messages) > 0 {
|
||||||
endY = math.Max(endY, p.Y)
|
lastRoute := sd.messages[len(sd.messages)-1].Route
|
||||||
|
for _, p := range lastRoute {
|
||||||
|
endY = math.Max(endY, p.Y)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for _, note := range sd.notes {
|
for _, note := range sd.notes {
|
||||||
endY = math.Max(endY, note.TopLeft.Y+note.Height)
|
endY = math.Max(endY, note.TopLeft.Y+note.Height)
|
||||||
}
|
}
|
||||||
|
for _, actor := range sd.actors {
|
||||||
|
endY = math.Max(endY, actor.TopLeft.Y+actor.Height)
|
||||||
|
}
|
||||||
endY += sd.yStep
|
endY += sd.yStep
|
||||||
|
|
||||||
for _, actor := range sd.actors {
|
for _, actor := range sd.actors {
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,11 @@ A->B`,
|
||||||
script: `shape: sequence_diagram
|
script: `shape: sequence_diagram
|
||||||
b.1 -> b.1
|
b.1 -> b.1
|
||||||
b.1 -> b.1`,
|
b.1 -> b.1`,
|
||||||
|
}, {
|
||||||
|
name: "sequence_diagram_no_message",
|
||||||
|
script: `shape: sequence_diagram
|
||||||
|
a: A
|
||||||
|
b: B`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
165
e2etests/testdata/regression/sequence_diagram_no_message/dagre/board.exp.json
generated
vendored
Normal file
165
e2etests/testdata/regression/sequence_diagram_no_message/dagre/board.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,165 @@
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"shapes": [
|
||||||
|
{
|
||||||
|
"id": "a",
|
||||||
|
"type": "",
|
||||||
|
"pos": {
|
||||||
|
"x": 24,
|
||||||
|
"y": 74
|
||||||
|
},
|
||||||
|
"width": 150,
|
||||||
|
"height": 126,
|
||||||
|
"opacity": 1,
|
||||||
|
"strokeDash": 0,
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"borderRadius": 0,
|
||||||
|
"fill": "#FFFFFF",
|
||||||
|
"stroke": "#0D32B2",
|
||||||
|
"shadow": false,
|
||||||
|
"3d": false,
|
||||||
|
"multiple": false,
|
||||||
|
"tooltip": "",
|
||||||
|
"link": "",
|
||||||
|
"icon": null,
|
||||||
|
"iconPosition": "",
|
||||||
|
"blend": false,
|
||||||
|
"fields": null,
|
||||||
|
"methods": null,
|
||||||
|
"columns": null,
|
||||||
|
"label": "A",
|
||||||
|
"fontSize": 16,
|
||||||
|
"fontFamily": "DEFAULT",
|
||||||
|
"language": "",
|
||||||
|
"color": "#0A0F25",
|
||||||
|
"italic": false,
|
||||||
|
"bold": false,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 14,
|
||||||
|
"labelHeight": 26,
|
||||||
|
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||||
|
"zIndex": 0,
|
||||||
|
"level": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "b",
|
||||||
|
"type": "",
|
||||||
|
"pos": {
|
||||||
|
"x": 274,
|
||||||
|
"y": 74
|
||||||
|
},
|
||||||
|
"width": 150,
|
||||||
|
"height": 126,
|
||||||
|
"opacity": 1,
|
||||||
|
"strokeDash": 0,
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"borderRadius": 0,
|
||||||
|
"fill": "#FFFFFF",
|
||||||
|
"stroke": "#0D32B2",
|
||||||
|
"shadow": false,
|
||||||
|
"3d": false,
|
||||||
|
"multiple": false,
|
||||||
|
"tooltip": "",
|
||||||
|
"link": "",
|
||||||
|
"icon": null,
|
||||||
|
"iconPosition": "",
|
||||||
|
"blend": false,
|
||||||
|
"fields": null,
|
||||||
|
"methods": null,
|
||||||
|
"columns": null,
|
||||||
|
"label": "B",
|
||||||
|
"fontSize": 16,
|
||||||
|
"fontFamily": "DEFAULT",
|
||||||
|
"language": "",
|
||||||
|
"color": "#0A0F25",
|
||||||
|
"italic": false,
|
||||||
|
"bold": false,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 13,
|
||||||
|
"labelHeight": 26,
|
||||||
|
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||||
|
"zIndex": 0,
|
||||||
|
"level": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"connections": [
|
||||||
|
{
|
||||||
|
"id": "(a -- )[0]",
|
||||||
|
"src": "a",
|
||||||
|
"srcArrow": "none",
|
||||||
|
"srcLabel": "",
|
||||||
|
"dst": "a-lifeline-end-2251863791",
|
||||||
|
"dstArrow": "none",
|
||||||
|
"dstLabel": "",
|
||||||
|
"opacity": 1,
|
||||||
|
"strokeDash": 6,
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"stroke": "#0D32B2",
|
||||||
|
"label": "",
|
||||||
|
"fontSize": 16,
|
||||||
|
"fontFamily": "DEFAULT",
|
||||||
|
"language": "",
|
||||||
|
"color": "#676C7E",
|
||||||
|
"italic": true,
|
||||||
|
"bold": false,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 0,
|
||||||
|
"labelHeight": 0,
|
||||||
|
"labelPosition": "",
|
||||||
|
"labelPercentage": 0,
|
||||||
|
"route": [
|
||||||
|
{
|
||||||
|
"x": 99,
|
||||||
|
"y": 200
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 99,
|
||||||
|
"y": 330
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"animated": false,
|
||||||
|
"tooltip": "",
|
||||||
|
"icon": null,
|
||||||
|
"zIndex": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "(b -- )[0]",
|
||||||
|
"src": "b",
|
||||||
|
"srcArrow": "none",
|
||||||
|
"srcLabel": "",
|
||||||
|
"dst": "b-lifeline-end-668380428",
|
||||||
|
"dstArrow": "none",
|
||||||
|
"dstLabel": "",
|
||||||
|
"opacity": 1,
|
||||||
|
"strokeDash": 6,
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"stroke": "#0D32B2",
|
||||||
|
"label": "",
|
||||||
|
"fontSize": 16,
|
||||||
|
"fontFamily": "DEFAULT",
|
||||||
|
"language": "",
|
||||||
|
"color": "#676C7E",
|
||||||
|
"italic": true,
|
||||||
|
"bold": false,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 0,
|
||||||
|
"labelHeight": 0,
|
||||||
|
"labelPosition": "",
|
||||||
|
"labelPercentage": 0,
|
||||||
|
"route": [
|
||||||
|
{
|
||||||
|
"x": 349,
|
||||||
|
"y": 200
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 349,
|
||||||
|
"y": 330
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"animated": false,
|
||||||
|
"tooltip": "",
|
||||||
|
"icon": null,
|
||||||
|
"zIndex": 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
28
e2etests/testdata/regression/sequence_diagram_no_message/dagre/sketch.exp.svg
vendored
Normal file
28
e2etests/testdata/regression/sequence_diagram_no_message/dagre/sketch.exp.svg
vendored
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 325 KiB |
165
e2etests/testdata/regression/sequence_diagram_no_message/elk/board.exp.json
generated
vendored
Normal file
165
e2etests/testdata/regression/sequence_diagram_no_message/elk/board.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,165 @@
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"shapes": [
|
||||||
|
{
|
||||||
|
"id": "a",
|
||||||
|
"type": "",
|
||||||
|
"pos": {
|
||||||
|
"x": 24,
|
||||||
|
"y": 74
|
||||||
|
},
|
||||||
|
"width": 150,
|
||||||
|
"height": 126,
|
||||||
|
"opacity": 1,
|
||||||
|
"strokeDash": 0,
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"borderRadius": 0,
|
||||||
|
"fill": "#FFFFFF",
|
||||||
|
"stroke": "#0D32B2",
|
||||||
|
"shadow": false,
|
||||||
|
"3d": false,
|
||||||
|
"multiple": false,
|
||||||
|
"tooltip": "",
|
||||||
|
"link": "",
|
||||||
|
"icon": null,
|
||||||
|
"iconPosition": "",
|
||||||
|
"blend": false,
|
||||||
|
"fields": null,
|
||||||
|
"methods": null,
|
||||||
|
"columns": null,
|
||||||
|
"label": "A",
|
||||||
|
"fontSize": 16,
|
||||||
|
"fontFamily": "DEFAULT",
|
||||||
|
"language": "",
|
||||||
|
"color": "#0A0F25",
|
||||||
|
"italic": false,
|
||||||
|
"bold": false,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 14,
|
||||||
|
"labelHeight": 26,
|
||||||
|
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||||
|
"zIndex": 0,
|
||||||
|
"level": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "b",
|
||||||
|
"type": "",
|
||||||
|
"pos": {
|
||||||
|
"x": 274,
|
||||||
|
"y": 74
|
||||||
|
},
|
||||||
|
"width": 150,
|
||||||
|
"height": 126,
|
||||||
|
"opacity": 1,
|
||||||
|
"strokeDash": 0,
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"borderRadius": 0,
|
||||||
|
"fill": "#FFFFFF",
|
||||||
|
"stroke": "#0D32B2",
|
||||||
|
"shadow": false,
|
||||||
|
"3d": false,
|
||||||
|
"multiple": false,
|
||||||
|
"tooltip": "",
|
||||||
|
"link": "",
|
||||||
|
"icon": null,
|
||||||
|
"iconPosition": "",
|
||||||
|
"blend": false,
|
||||||
|
"fields": null,
|
||||||
|
"methods": null,
|
||||||
|
"columns": null,
|
||||||
|
"label": "B",
|
||||||
|
"fontSize": 16,
|
||||||
|
"fontFamily": "DEFAULT",
|
||||||
|
"language": "",
|
||||||
|
"color": "#0A0F25",
|
||||||
|
"italic": false,
|
||||||
|
"bold": false,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 13,
|
||||||
|
"labelHeight": 26,
|
||||||
|
"labelPosition": "INSIDE_MIDDLE_CENTER",
|
||||||
|
"zIndex": 0,
|
||||||
|
"level": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"connections": [
|
||||||
|
{
|
||||||
|
"id": "(a -- )[0]",
|
||||||
|
"src": "a",
|
||||||
|
"srcArrow": "none",
|
||||||
|
"srcLabel": "",
|
||||||
|
"dst": "a-lifeline-end-2251863791",
|
||||||
|
"dstArrow": "none",
|
||||||
|
"dstLabel": "",
|
||||||
|
"opacity": 1,
|
||||||
|
"strokeDash": 6,
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"stroke": "#0D32B2",
|
||||||
|
"label": "",
|
||||||
|
"fontSize": 16,
|
||||||
|
"fontFamily": "DEFAULT",
|
||||||
|
"language": "",
|
||||||
|
"color": "#676C7E",
|
||||||
|
"italic": true,
|
||||||
|
"bold": false,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 0,
|
||||||
|
"labelHeight": 0,
|
||||||
|
"labelPosition": "",
|
||||||
|
"labelPercentage": 0,
|
||||||
|
"route": [
|
||||||
|
{
|
||||||
|
"x": 99,
|
||||||
|
"y": 200
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 99,
|
||||||
|
"y": 330
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"animated": false,
|
||||||
|
"tooltip": "",
|
||||||
|
"icon": null,
|
||||||
|
"zIndex": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "(b -- )[0]",
|
||||||
|
"src": "b",
|
||||||
|
"srcArrow": "none",
|
||||||
|
"srcLabel": "",
|
||||||
|
"dst": "b-lifeline-end-668380428",
|
||||||
|
"dstArrow": "none",
|
||||||
|
"dstLabel": "",
|
||||||
|
"opacity": 1,
|
||||||
|
"strokeDash": 6,
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"stroke": "#0D32B2",
|
||||||
|
"label": "",
|
||||||
|
"fontSize": 16,
|
||||||
|
"fontFamily": "DEFAULT",
|
||||||
|
"language": "",
|
||||||
|
"color": "#676C7E",
|
||||||
|
"italic": true,
|
||||||
|
"bold": false,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 0,
|
||||||
|
"labelHeight": 0,
|
||||||
|
"labelPosition": "",
|
||||||
|
"labelPercentage": 0,
|
||||||
|
"route": [
|
||||||
|
{
|
||||||
|
"x": 349,
|
||||||
|
"y": 200
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 349,
|
||||||
|
"y": 330
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"animated": false,
|
||||||
|
"tooltip": "",
|
||||||
|
"icon": null,
|
||||||
|
"zIndex": 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
28
e2etests/testdata/regression/sequence_diagram_no_message/elk/sketch.exp.svg
vendored
Normal file
28
e2etests/testdata/regression/sequence_diagram_no_message/elk/sketch.exp.svg
vendored
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 325 KiB |
Loading…
Reference in a new issue