mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-19 07:19:41 +02:00
fix: Sequence diagram loop rendering
This commit is contained in:
@@ -1421,6 +1421,13 @@ const buildMessageModel = function (msg, actors, diagObj) {
|
||||
return isArrowToRight ? -value : value;
|
||||
};
|
||||
|
||||
// 3 is max difference for +/- 1
|
||||
if (Math.abs(startx - stopx) <= 3) {
|
||||
// This is a self reference, so we need to make sure the arrow is drawn correctly
|
||||
// There are many checks in the downstream rendering that checks for equality.
|
||||
// The lines on loops will be off by few pixels, but that's fine for now.
|
||||
stopx = startx;
|
||||
} else {
|
||||
/**
|
||||
* This is an edge case for the first activation.
|
||||
* Proper fix would require significant changes.
|
||||
@@ -1439,6 +1446,7 @@ const buildMessageModel = function (msg, actors, diagObj) {
|
||||
if (![diagObj.db.LINETYPE.SOLID_OPEN, diagObj.db.LINETYPE.DOTTED_OPEN].includes(msg.type)) {
|
||||
stopx += adjustValue(3);
|
||||
}
|
||||
}
|
||||
|
||||
const allBounds = [fromLeft, fromRight, toLeft, toRight];
|
||||
const boundedWidth = Math.abs(startx - stopx);
|
||||
|
Reference in New Issue
Block a user