Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

d2sequence: fix self reference message alignment #2043

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 ⛑️
9 changes: 3 additions & 6 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 {
messageOffset += MIN_MESSAGE_DISTANCE
// we need extra space if the previous message is a loop
if prevIsLoop {
messageOffset += MIN_MESSAGE_DISTANCE * 1.5
}
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.
Loading
Loading