Merge pull request #363 from ejulio-ts/fix-note

Fix actor padding for long notes
This commit is contained in:
ejulio-ts 2022-12-05 13:51:21 -08:00 committed by GitHub
commit de3486f185
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 77 additions and 74 deletions

View file

@ -142,6 +142,9 @@ func newSequenceDiagram(objects []*d2graph.Object, messages []*d2graph.Edge) *se
nextActorHW := actors[rank+1].Width / 2. nextActorHW := actors[rank+1].Width / 2.
sd.actorXStep[rank] = math.Max(actorHW+nextActorHW+HORIZONTAL_PAD, MIN_ACTOR_DISTANCE) sd.actorXStep[rank] = math.Max(actorHW+nextActorHW+HORIZONTAL_PAD, MIN_ACTOR_DISTANCE)
sd.actorXStep[rank] = math.Max(maxNoteWidth/2.+HORIZONTAL_PAD, sd.actorXStep[rank]) sd.actorXStep[rank] = math.Max(maxNoteWidth/2.+HORIZONTAL_PAD, sd.actorXStep[rank])
if rank > 0 {
sd.actorXStep[rank-1] = math.Max(maxNoteWidth/2.+HORIZONTAL_PAD, sd.actorXStep[rank-1])
}
} }
} }

View file

@ -8,7 +8,7 @@
"x": -121, "x": -121,
"y": 266 "y": 266
}, },
"width": 592, "width": 655,
"height": 952, "height": 952,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -47,7 +47,7 @@
"x": -97, "x": -97,
"y": 396 "y": 396
}, },
"width": 544, "width": 607,
"height": 798, "height": 798,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -86,7 +86,7 @@
"x": -73, "x": -73,
"y": 526 "y": 526
}, },
"width": 496, "width": 559,
"height": 644, "height": 644,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -125,7 +125,7 @@
"x": -49, "x": -49,
"y": 656 "y": 656
}, },
"width": 448, "width": 511,
"height": 490, "height": 490,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -244,7 +244,7 @@
"x": 25, "x": 25,
"y": 1042 "y": 1042
}, },
"width": 350, "width": 413,
"height": 80, "height": 80,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -280,10 +280,10 @@
"id": "alt", "id": "alt",
"type": "", "type": "",
"pos": { "pos": {
"x": 251, "x": 314,
"y": 1148 "y": 1148
}, },
"width": 461, "width": 460,
"height": 518, "height": 518,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -319,10 +319,10 @@
"id": "alt.case 1", "id": "alt.case 1",
"type": "", "type": "",
"pos": { "pos": {
"x": 275, "x": 338,
"y": 1172 "y": 1172
}, },
"width": 413, "width": 412,
"height": 80, "height": 80,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -358,10 +358,10 @@
"id": "alt.case 2", "id": "alt.case 2",
"type": "", "type": "",
"pos": { "pos": {
"x": 275, "x": 338,
"y": 1302 "y": 1302
}, },
"width": 413, "width": 412,
"height": 80, "height": 80,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -397,10 +397,10 @@
"id": "alt.case 3", "id": "alt.case 3",
"type": "", "type": "",
"pos": { "pos": {
"x": 275, "x": 338,
"y": 1432 "y": 1432
}, },
"width": 413, "width": 412,
"height": 80, "height": 80,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -436,10 +436,10 @@
"id": "alt.case 4", "id": "alt.case 4",
"type": "", "type": "",
"pos": { "pos": {
"x": 275, "x": 338,
"y": 1562 "y": 1562
}, },
"width": 413, "width": 412,
"height": 80, "height": 80,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -475,7 +475,7 @@
"id": "b", "id": "b",
"type": "", "type": "",
"pos": { "pos": {
"x": 250, "x": 313,
"y": 50 "y": 50
}, },
"width": 150, "width": 150,
@ -515,7 +515,7 @@
"id": "b.note", "id": "b.note",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 62, "x": 125,
"y": 2052 "y": 2052
}, },
"width": 525, "width": 525,
@ -595,7 +595,7 @@
"id": "c", "id": "c",
"type": "", "type": "",
"pos": { "pos": {
"x": 543, "x": 605,
"y": 50 "y": 50
}, },
"width": 190, "width": 190,
@ -663,7 +663,7 @@
"y": 306 "y": 306
}, },
{ {
"x": 325, "x": 388,
"y": 306 "y": 306
} }
], ],
@ -702,7 +702,7 @@
"y": 436 "y": 436
}, },
{ {
"x": 325, "x": 388,
"y": 436 "y": 436
} }
], ],
@ -741,7 +741,7 @@
"y": 566 "y": 566
}, },
{ {
"x": 325, "x": 388,
"y": 566 "y": 566
} }
], ],
@ -780,7 +780,7 @@
"y": 952 "y": 952
}, },
{ {
"x": 325, "x": 388,
"y": 952 "y": 952
} }
], ],
@ -819,7 +819,7 @@
"y": 1082 "y": 1082
}, },
{ {
"x": 325, "x": 388,
"y": 1082 "y": 1082
} }
], ],
@ -854,11 +854,11 @@
"labelPercentage": 0, "labelPercentage": 0,
"route": [ "route": [
{ {
"x": 325, "x": 388,
"y": 1212 "y": 1212
}, },
{ {
"x": 638, "x": 700,
"y": 1212 "y": 1212
} }
], ],
@ -893,11 +893,11 @@
"labelPercentage": 0, "labelPercentage": 0,
"route": [ "route": [
{ {
"x": 325, "x": 388,
"y": 1342 "y": 1342
}, },
{ {
"x": 638, "x": 700,
"y": 1342 "y": 1342
} }
], ],
@ -932,11 +932,11 @@
"labelPercentage": 0, "labelPercentage": 0,
"route": [ "route": [
{ {
"x": 325, "x": 388,
"y": 1472 "y": 1472
}, },
{ {
"x": 638, "x": 700,
"y": 1472 "y": 1472
} }
], ],
@ -971,11 +971,11 @@
"labelPercentage": 0, "labelPercentage": 0,
"route": [ "route": [
{ {
"x": 325, "x": 388,
"y": 1602 "y": 1602
}, },
{ {
"x": 638, "x": 700,
"y": 1602 "y": 1602
} }
], ],
@ -1049,11 +1049,11 @@
"labelPercentage": 0, "labelPercentage": 0,
"route": [ "route": [
{ {
"x": 325, "x": 388,
"y": 176 "y": 176
}, },
{ {
"x": 325, "x": 388,
"y": 2308 "y": 2308
} }
], ],
@ -1088,11 +1088,11 @@
"labelPercentage": 0, "labelPercentage": 0,
"route": [ "route": [
{ {
"x": 638, "x": 700,
"y": 176 "y": 176
}, },
{ {
"x": 638, "x": 700,
"y": 2308 "y": 2308
} }
], ],

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 332 KiB

After

Width:  |  Height:  |  Size: 332 KiB

View file

@ -8,7 +8,7 @@
"x": -121, "x": -121,
"y": 266 "y": 266
}, },
"width": 592, "width": 655,
"height": 952, "height": 952,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -47,7 +47,7 @@
"x": -97, "x": -97,
"y": 396 "y": 396
}, },
"width": 544, "width": 607,
"height": 798, "height": 798,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -86,7 +86,7 @@
"x": -73, "x": -73,
"y": 526 "y": 526
}, },
"width": 496, "width": 559,
"height": 644, "height": 644,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -125,7 +125,7 @@
"x": -49, "x": -49,
"y": 656 "y": 656
}, },
"width": 448, "width": 511,
"height": 490, "height": 490,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -244,7 +244,7 @@
"x": 25, "x": 25,
"y": 1042 "y": 1042
}, },
"width": 350, "width": 413,
"height": 80, "height": 80,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -280,10 +280,10 @@
"id": "alt", "id": "alt",
"type": "", "type": "",
"pos": { "pos": {
"x": 251, "x": 314,
"y": 1148 "y": 1148
}, },
"width": 461, "width": 460,
"height": 518, "height": 518,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -319,10 +319,10 @@
"id": "alt.case 1", "id": "alt.case 1",
"type": "", "type": "",
"pos": { "pos": {
"x": 275, "x": 338,
"y": 1172 "y": 1172
}, },
"width": 413, "width": 412,
"height": 80, "height": 80,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -358,10 +358,10 @@
"id": "alt.case 2", "id": "alt.case 2",
"type": "", "type": "",
"pos": { "pos": {
"x": 275, "x": 338,
"y": 1302 "y": 1302
}, },
"width": 413, "width": 412,
"height": 80, "height": 80,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -397,10 +397,10 @@
"id": "alt.case 3", "id": "alt.case 3",
"type": "", "type": "",
"pos": { "pos": {
"x": 275, "x": 338,
"y": 1432 "y": 1432
}, },
"width": 413, "width": 412,
"height": 80, "height": 80,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -436,10 +436,10 @@
"id": "alt.case 4", "id": "alt.case 4",
"type": "", "type": "",
"pos": { "pos": {
"x": 275, "x": 338,
"y": 1562 "y": 1562
}, },
"width": 413, "width": 412,
"height": 80, "height": 80,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
@ -475,7 +475,7 @@
"id": "b", "id": "b",
"type": "", "type": "",
"pos": { "pos": {
"x": 250, "x": 313,
"y": 50 "y": 50
}, },
"width": 150, "width": 150,
@ -515,7 +515,7 @@
"id": "b.note", "id": "b.note",
"type": "rectangle", "type": "rectangle",
"pos": { "pos": {
"x": 62, "x": 125,
"y": 2052 "y": 2052
}, },
"width": 525, "width": 525,
@ -595,7 +595,7 @@
"id": "c", "id": "c",
"type": "", "type": "",
"pos": { "pos": {
"x": 543, "x": 605,
"y": 50 "y": 50
}, },
"width": 190, "width": 190,
@ -663,7 +663,7 @@
"y": 306 "y": 306
}, },
{ {
"x": 325, "x": 388,
"y": 306 "y": 306
} }
], ],
@ -702,7 +702,7 @@
"y": 436 "y": 436
}, },
{ {
"x": 325, "x": 388,
"y": 436 "y": 436
} }
], ],
@ -741,7 +741,7 @@
"y": 566 "y": 566
}, },
{ {
"x": 325, "x": 388,
"y": 566 "y": 566
} }
], ],
@ -780,7 +780,7 @@
"y": 952 "y": 952
}, },
{ {
"x": 325, "x": 388,
"y": 952 "y": 952
} }
], ],
@ -819,7 +819,7 @@
"y": 1082 "y": 1082
}, },
{ {
"x": 325, "x": 388,
"y": 1082 "y": 1082
} }
], ],
@ -854,11 +854,11 @@
"labelPercentage": 0, "labelPercentage": 0,
"route": [ "route": [
{ {
"x": 325, "x": 388,
"y": 1212 "y": 1212
}, },
{ {
"x": 638, "x": 700,
"y": 1212 "y": 1212
} }
], ],
@ -893,11 +893,11 @@
"labelPercentage": 0, "labelPercentage": 0,
"route": [ "route": [
{ {
"x": 325, "x": 388,
"y": 1342 "y": 1342
}, },
{ {
"x": 638, "x": 700,
"y": 1342 "y": 1342
} }
], ],
@ -932,11 +932,11 @@
"labelPercentage": 0, "labelPercentage": 0,
"route": [ "route": [
{ {
"x": 325, "x": 388,
"y": 1472 "y": 1472
}, },
{ {
"x": 638, "x": 700,
"y": 1472 "y": 1472
} }
], ],
@ -971,11 +971,11 @@
"labelPercentage": 0, "labelPercentage": 0,
"route": [ "route": [
{ {
"x": 325, "x": 388,
"y": 1602 "y": 1602
}, },
{ {
"x": 638, "x": 700,
"y": 1602 "y": 1602
} }
], ],
@ -1049,11 +1049,11 @@
"labelPercentage": 0, "labelPercentage": 0,
"route": [ "route": [
{ {
"x": 325, "x": 388,
"y": 176 "y": 176
}, },
{ {
"x": 325, "x": 388,
"y": 2308 "y": 2308
} }
], ],
@ -1088,11 +1088,11 @@
"labelPercentage": 0, "labelPercentage": 0,
"route": [ "route": [
{ {
"x": 638, "x": 700,
"y": 176 "y": 176
}, },
{ {
"x": 638, "x": 700,
"y": 2308 "y": 2308
} }
], ],

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 332 KiB

After

Width:  |  Height:  |  Size: 332 KiB