Fix for issue #209, missing links when baste tag is used

Fix for issue #195, text wrap in sequence diagrams drops last word
Documentation
This commit is contained in:
knsv
2015-09-26 12:09:47 +02:00
parent bae1e80ac0
commit fb94aaaa6f
7 changed files with 239 additions and 511 deletions

View File

@@ -414,7 +414,7 @@ exports.draw = function (text, id,isDot) {
if(conf.useMaxWidth) {
// Center the graph
svg.attr("height", '100%');
svg.attr("width", '100%');
svg.attr("width", conf.width);
//svg.attr("viewBox", svgb.getBBox().x + ' 0 '+ g.graph().width+' '+ g.graph().height);
svg.attr("viewBox", '0 0 ' + (g.graph().width + 20) + ' ' + (g.graph().height + 20));
svg.attr('style', 'max-width:' + (g.graph().width + 20) + 'px;');

View File

@@ -138,21 +138,23 @@ var drawNote = function(elem, startx, verticalPos, msg){
var rectElem = svgDraw.drawRect(g, rect);
var textObj = svgDraw.getTextObj();
textObj.x = startx;
textObj.y = verticalPos;
textObj.x = startx-4;
textObj.y = verticalPos-13;
textObj.textMargin = conf.noteMargin;
textObj.dy = '1em';
textObj.text = msg.message;
textObj.class = 'noteText';
var textElem = svgDraw.drawText(g,textObj, conf.width);
var textElem = svgDraw.drawText(g,textObj, conf.width-conf.noteMargin);
var textHeight = textElem[0][0].getBBox().height;
if(textHeight > conf.width){
textElem.remove();
g = elem.append("g");
textElem = svgDraw.drawText(g,textObj, 2*conf.width);
//textObj.x = textObj.x - conf.width;
//textElem = svgDraw.drawText(g,textObj, 2*conf.noteMargin);
textElem = svgDraw.drawText(g,textObj, 2*conf.width-conf.noteMargin);
textHeight = textElem[0][0].getBBox().height;
rectElem.attr('width',2*conf.width);
exports.bounds.insert(startx, verticalPos, startx + 2*conf.width, verticalPos + 2*conf.noteMargin + textHeight);
@@ -228,11 +230,11 @@ var drawMessage = function(elem, startx, stopx, verticalPos, msg){
line.attr("stroke", "black");
line.style("fill", "none"); // remove any fill colour
if (msg.type === sq.yy.LINETYPE.SOLID || msg.type === sq.yy.LINETYPE.DOTTED){
line.attr("marker-end", "url(#arrowhead)");
line.attr("marker-end", "url(" + window.location.protocol+'//'+window.location.host+window.location.pathname + "#arrowhead)");
}
if (msg.type === sq.yy.LINETYPE.SOLID_CROSS || msg.type === sq.yy.LINETYPE.DOTTED_CROSS){
line.attr("marker-end", "url(#crosshead)");
line.attr("marker-end", "url(" + window.location.protocol+'//'+window.location.host+window.location.pathname + "#crosshead)");
}
};

View File

@@ -41,13 +41,14 @@ exports.drawText = function(elem, textData, width) {
var span = textElem.append('tspan');
span.attr('x', textData.x);
span.attr('dy', textData.dy);
//span.attr('x', textData.x);
span.attr('x', textData.x+textData.textMargin*2);
//span.attr('dy', textData.dy);
span.text(nText);
if(typeof textElem.textwrap !== 'undefined'){
textElem.textwrap({
x: textData.x+4, // bounding box is 300 pixels from the left
y: textData.y-2, // bounding box is 400 pixels from the top
x: textData.x, // bounding box is 300 pixels from the left
y: textData.y, // bounding box is 400 pixels from the top
width: width, // bounding box is 500 pixels across
height: 1800 // bounding box is 600 pixels tall
}, textData.textMargin);