Merge pull request #1140 from alexstoick/feat/lifeline-inherit-actor-style

Lifeline should inherit the stroke style from the actor
This commit is contained in:
Alexander Wang 2023-04-07 14:00:12 -07:00 committed by GitHub
commit 189e5a005c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 510 additions and 498 deletions

View file

@ -8,6 +8,7 @@
#### Improvements 🧹
- Labels on parallel `dagre` connections include a gap between them [#1134](https://github.com/terrastruct/d2/pull/1134)
- Sequence Diagram `Lifelines` now inherit the Actor `stroke` and `stroke-dash` [#1140](https://github.com/terrastruct/d2/pull/1140)
#### Bugfixes ⛑️

View file

@ -386,15 +386,21 @@ func (sd *sequenceDiagram) addLifelineEdges() {
}
actorLifelineEnd := actor.Center()
actorLifelineEnd.Y = endY
style := d2graph.Style{
StrokeDash: &d2graph.Scalar{Value: fmt.Sprintf("%d", LIFELINE_STROKE_DASH)},
StrokeWidth: &d2graph.Scalar{Value: fmt.Sprintf("%d", LIFELINE_STROKE_WIDTH)},
}
if actor.Attributes.Style.StrokeDash != nil {
style.StrokeDash = &d2graph.Scalar{Value: actor.Attributes.Style.StrokeDash.Value}
}
if actor.Attributes.Style.Stroke != nil {
style.Stroke = &d2graph.Scalar{Value: actor.Attributes.Style.Stroke.Value}
}
sd.lifelines = append(sd.lifelines, &d2graph.Edge{
Attributes: &d2graph.Attributes{
Style: d2graph.Style{
StrokeDash: &d2graph.Scalar{Value: fmt.Sprintf("%d", LIFELINE_STROKE_DASH)},
StrokeWidth: &d2graph.Scalar{Value: fmt.Sprintf("%d", LIFELINE_STROKE_WIDTH)},
},
},
Src: actor,
SrcArrow: false,
Attributes: &d2graph.Attributes{Style: style},
Src: actor,
SrcArrow: false,
Dst: &d2graph.Object{
ID: actor.ID + fmt.Sprintf("-lifeline-end-%d", go2.StringToIntHash(actor.ID+"-lifeline-end")),
},

View file

@ -1549,8 +1549,13 @@ finally: {
sequence: {
shape: sequence_diagram
# items appear in this order
scorer
concept
scorer {
style.stroke: red
style.stroke-dash: 2
}
concept {
style.stroke-width: 6
}
essayRubric
item
itemOutcome

View file

@ -1302,7 +1302,7 @@
"opacity": 1,
"strokeDash": 6,
"strokeWidth": 2,
"stroke": "B2",
"stroke": "red",
"borderRadius": 10,
"label": "",
"fontSize": 16,

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View file

@ -1302,7 +1302,7 @@
"opacity": 1,
"strokeDash": 6,
"strokeWidth": 2,
"stroke": "B2",
"stroke": "red",
"borderRadius": 10,
"label": "",
"fontSize": 16,

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View file

@ -621,7 +621,7 @@
"opacity": 1,
"strokeDash": 6,
"strokeWidth": 2,
"stroke": "B2",
"stroke": "red",
"borderRadius": 10,
"label": "",
"fontSize": 16,

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View file

@ -621,7 +621,7 @@
"opacity": 1,
"strokeDash": 6,
"strokeWidth": 2,
"stroke": "B2",
"stroke": "red",
"borderRadius": 10,
"label": "",
"fontSize": 16,

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View file

@ -1672,11 +1672,11 @@
"width": 100,
"height": 66,
"opacity": 1,
"strokeDash": 0,
"strokeDash": 2,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "B5",
"stroke": "B1",
"stroke": "red",
"shadow": false,
"3d": false,
"multiple": false,
@ -1714,7 +1714,7 @@
"height": 66,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"strokeWidth": 6,
"borderRadius": 0,
"fill": "B5",
"stroke": "B1",
@ -4744,9 +4744,9 @@
"dstArrow": "none",
"dstLabel": "",
"opacity": 1,
"strokeDash": 6,
"strokeDash": 2,
"strokeWidth": 2,
"stroke": "B2",
"stroke": "red",
"borderRadius": 10,
"label": "",
"fontSize": 16,

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View file

@ -1672,11 +1672,11 @@
"width": 100,
"height": 66,
"opacity": 1,
"strokeDash": 0,
"strokeDash": 2,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "B5",
"stroke": "B1",
"stroke": "red",
"shadow": false,
"3d": false,
"multiple": false,
@ -1714,7 +1714,7 @@
"height": 66,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"strokeWidth": 6,
"borderRadius": 0,
"fill": "B5",
"stroke": "B1",
@ -4655,9 +4655,9 @@
"dstArrow": "none",
"dstLabel": "",
"opacity": 1,
"strokeDash": 6,
"strokeDash": 2,
"strokeWidth": 2,
"stroke": "B2",
"stroke": "red",
"borderRadius": 10,
"label": "",
"fontSize": 16,

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB