fix: adjust line start position for bidirectional arrows

on-behalf-of: @Mermaid-Chart <hello@mermaidchart.com>
This commit is contained in:
omkarht
2025-11-11 12:29:10 +05:30
parent e7c78dec87
commit 0d1f6af383

View File

@@ -648,9 +648,14 @@ const drawMessage = async function (diagram, msgModel, lineStartY: number, diagO
if (isBidirectional) { if (isBidirectional) {
// For bidirectional arrows, adjust the start position // For bidirectional arrows, adjust the start position
if (startx < stopx) { if (startx < stopx) {
lineStartX = startx + SEQUENCE_NUMBER_RADIUS + (hasCentralConn ? 5 : 0); lineStartX = startx + SEQUENCE_NUMBER_RADIUS * 2;
} else { } else {
lineStartX = startx - SEQUENCE_NUMBER_RADIUS + (hasCentralConn ? -5 : 0); lineStartX = startx - SEQUENCE_NUMBER_RADIUS + (hasCentralConn ? -5 : 0);
lineStartX +=
msg?.centralConnection === diagObj.db.LINETYPE.CENTRAL_CONNECTION_DUAL ||
msg?.centralConnection === diagObj.db.LINETYPE.CENTRAL_CONNECTION_REVERSE
? -7.5
: 0;
} }
line.attr('x1', lineStartX); line.attr('x1', lineStartX);
} else if (isReverseArrowType) { } else if (isReverseArrowType) {
@@ -1730,7 +1735,8 @@ const calculateCentralConnectionOffset = function (msg, diagObj, isArrowToRight)
} }
if ( if (
msg.centralConnection === CENTRAL_CONNECTION_DUAL && (msg.centralConnection === CENTRAL_CONNECTION_REVERSE ||
msg.centralConnection === CENTRAL_CONNECTION_DUAL) &&
(msg.type === BIDIRECTIONAL_SOLID || msg.type === BIDIRECTIONAL_DOTTED) (msg.type === BIDIRECTIONAL_SOLID || msg.type === BIDIRECTIONAL_DOTTED)
) { ) {
offset += isArrowToRight ? 0 : -CENTRAL_CONNECTION_BIDIRECTIONAL_OFFSET; offset += isArrowToRight ? 0 : -CENTRAL_CONNECTION_BIDIRECTIONAL_OFFSET;