mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-16 02:34:41 +01:00
fix: adjust line start position for bidirectional arrows
on-behalf-of: @Mermaid-Chart <hello@mermaidchart.com>
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user