mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
fix message to self with activation
This commit is contained in:
parent
3f85391bde
commit
0435509952
@ -347,6 +347,18 @@ module.exports.draw = function (text, id) {
|
|||||||
svgDraw.insertArrowHead(diagram);
|
svgDraw.insertArrowHead(diagram);
|
||||||
svgDraw.insertArrowCrossHead(diagram);
|
svgDraw.insertArrowCrossHead(diagram);
|
||||||
|
|
||||||
|
function activeEnd(msg, verticalPos) {
|
||||||
|
var activationData = exports.bounds.endActivation(msg);
|
||||||
|
if(activationData.starty + 18 > verticalPos) {
|
||||||
|
activationData.starty = verticalPos - 18;
|
||||||
|
}
|
||||||
|
svgDraw.drawActivation(diagram, activationData, verticalPos, conf);
|
||||||
|
|
||||||
|
exports.bounds.insert(activationData.startx, verticalPos -10, activationData.stopx, verticalPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
var lastMsg;
|
||||||
|
|
||||||
// Draw the messages/signals
|
// Draw the messages/signals
|
||||||
messages.forEach(function(msg){
|
messages.forEach(function(msg){
|
||||||
var loopData;
|
var loopData;
|
||||||
@ -377,12 +389,12 @@ module.exports.draw = function (text, id) {
|
|||||||
// exports.bounds.bumpVerticalPos(conf.boxMargin);
|
// exports.bounds.bumpVerticalPos(conf.boxMargin);
|
||||||
exports.bounds.newActivation(msg, diagram);
|
exports.bounds.newActivation(msg, diagram);
|
||||||
// exports.bounds.bumpVerticalPos(conf.boxMargin + conf.boxTextMargin);
|
// exports.bounds.bumpVerticalPos(conf.boxMargin + conf.boxTextMargin);
|
||||||
|
if (lastMsg && (lastMsg.from == lastMsg.to)) {
|
||||||
|
activeEnd(msg, exports.bounds.getVerticalPos() - 12);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case sq.yy.LINETYPE.ACTIVE_END:
|
case sq.yy.LINETYPE.ACTIVE_END:
|
||||||
var activationData = exports.bounds.endActivation(msg);
|
activeEnd(msg, exports.bounds.getVerticalPos());
|
||||||
svgDraw.drawActivation(diagram, activationData, exports.bounds.getVerticalPos(), conf);
|
|
||||||
|
|
||||||
exports.bounds.insert(activationData.startx, exports.bounds.getVerticalPos() -10, activationData.stopx, exports.bounds.getVerticalPos());
|
|
||||||
break;
|
break;
|
||||||
case sq.yy.LINETYPE.LOOP_START:
|
case sq.yy.LINETYPE.LOOP_START:
|
||||||
exports.bounds.bumpVerticalPos(conf.boxMargin);
|
exports.bounds.bumpVerticalPos(conf.boxMargin);
|
||||||
@ -426,12 +438,14 @@ module.exports.draw = function (text, id) {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
try {
|
try {
|
||||||
|
lastMsg = msg;
|
||||||
exports.bounds.bumpVerticalPos(conf.messageMargin);
|
exports.bounds.bumpVerticalPos(conf.messageMargin);
|
||||||
var fromBounds = actorFlowVerticaBounds(msg.from);
|
var fromBounds = actorFlowVerticaBounds(msg.from);
|
||||||
var toBounds = actorFlowVerticaBounds(msg.to);
|
var toBounds = actorFlowVerticaBounds(msg.to);
|
||||||
var forward = fromBounds[0] < toBounds[0];
|
var fromIdx = fromBounds[0] <= toBounds[0]?1:0;
|
||||||
startx = fromBounds[forward?1:0];
|
var toIdx = fromBounds[0] < toBounds[0]?0:1;
|
||||||
stopx = toBounds[forward?0:1];
|
startx = fromBounds[fromIdx];
|
||||||
|
stopx = toBounds[toIdx];
|
||||||
|
|
||||||
drawMessage(diagram, startx, stopx, exports.bounds.getVerticalPos(), msg);
|
drawMessage(diagram, startx, stopx, exports.bounds.getVerticalPos(), msg);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user