Skip to content

Commit

Permalink
d2sequence: fix self reference message alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
alixander committed Aug 5, 2024
1 parent 9b83a0f commit f3b0a2f
Show file tree
Hide file tree
Showing 32 changed files with 2,817 additions and 1,115 deletions.
1 change: 1 addition & 0 deletions ci/release/changelogs/next.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@

- Sequence diagram edge groups account for edge label heights [#2038](https://github.com/terrastruct/d2/pull/2038)
- Sequence diagram self-referential edges account for edge label heights [#2040](https://github.com/terrastruct/d2/pull/2040)
- Sequence diagram: The spacing between self-referential edges and regular edges is uniform [#2043](https://github.com/terrastruct/d2/pull/2043)

#### Bugfixes ⛑️
7 changes: 2 additions & 5 deletions d2layouts/d2sequence/sequence_diagram.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,6 @@ func (sd *sequenceDiagram) placeSpans() {
// in another step, routes are adjusted to spans borders when necessary
func (sd *sequenceDiagram) routeMessages() error {
var prevIsLoop bool
var prevGroup *d2graph.Object
messageOffset := sd.maxActorHeight + sd.yStep
for _, message := range sd.messages {
message.ZIndex = MESSAGE_Z_INDEX
Expand All @@ -547,12 +546,10 @@ func (sd *sequenceDiagram) routeMessages() error {
}
}

// we need extra space if the previous message is a loop in a different group
group := message.GetGroup()
if prevIsLoop && prevGroup != group {
// we need extra space if the previous message is a loop
if prevIsLoop {
messageOffset += MIN_MESSAGE_DISTANCE
}
prevGroup = group

startY := messageOffset + noteOffset

Expand Down
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

0 comments on commit f3b0a2f

Please sign in to comment.