Skip to content

Commit

Permalink
Lifeline should inherit the stroke style from the actor
Browse files Browse the repository at this point in the history
Fixes #1137
  • Loading branch information
alexstoick committed Apr 6, 2023
1 parent d1c980d commit 282bfb1
Show file tree
Hide file tree
Showing 14 changed files with 522 additions and 508 deletions.
25 changes: 17 additions & 8 deletions d2layouts/d2sequence/sequence_diagram.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,15 +386,24 @@ 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 = actor.Attributes.Style.StrokeDash
}
if actor.Attributes.Style.StrokeWidth != nil {
style.StrokeWidth = actor.Attributes.Style.StrokeWidth
}
if actor.Attributes.Style.Stroke != nil {
style.Stroke = actor.Attributes.Style.Stroke
}

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")),
},
Expand Down
9 changes: 7 additions & 2 deletions e2etests/stable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1487,8 +1487,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
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

160 changes: 80 additions & 80 deletions e2etests/testdata/stable/sequence_diagram_simple/dagre/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

160 changes: 80 additions & 80 deletions e2etests/testdata/stable/sequence_diagram_simple/elk/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions e2etests/testdata/stable/sequence_diagrams/dagre/board.exp.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

164 changes: 82 additions & 82 deletions e2etests/testdata/stable/sequence_diagrams/dagre/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions e2etests/testdata/stable/sequence_diagrams/elk/board.exp.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

164 changes: 82 additions & 82 deletions e2etests/testdata/stable/sequence_diagrams/elk/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 282bfb1

Please sign in to comment.