move arrowhead adjustment to buildMessageModel

This commit is contained in:
Ronid1 2024-06-04 14:58:47 -07:00
parent 0417a8ddff
commit 20f9abcc38

View File

@ -425,14 +425,7 @@ const drawMessage = async function (diagram, msgModel, lineStartY: number, diagO
} }
} else { } else {
line = diagram.append('line'); line = diagram.append('line');
let adjustedStartx = startx; line.attr('x1', startx);
if (
type === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED ||
type === diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID
) {
startx < stopx ? (adjustedStartx += 3) : (adjustedStartx -= 3);
}
line.attr('x1', adjustedStartx);
line.attr('y1', lineStartY); line.attr('y1', lineStartY);
line.attr('x2', stopx); line.attr('x2', stopx);
line.attr('y2', lineStartY); line.attr('y2', lineStartY);
@ -1481,6 +1474,14 @@ const buildMessageModel = function (msg, actors, diagObj) {
if (![diagObj.db.LINETYPE.SOLID_OPEN, diagObj.db.LINETYPE.DOTTED_OPEN].includes(msg.type)) { if (![diagObj.db.LINETYPE.SOLID_OPEN, diagObj.db.LINETYPE.DOTTED_OPEN].includes(msg.type)) {
stopx += adjustValue(3); stopx += adjustValue(3);
} }
if (
![diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID, diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED].includes(
msg.type
)
) {
startx -= adjustValue(3);
}
} }
const allBounds = [fromLeft, fromRight, toLeft, toRight]; const allBounds = [fromLeft, fromRight, toLeft, toRight];