use foreignObject/div to place actor label in sequence diagram, enabled by config.textPlacement:fo

This commit is contained in:
whyzdev
2016-12-01 00:16:44 -05:00
parent da99d3b15e
commit 1e41cea107
2 changed files with 39 additions and 14 deletions

View File

@@ -32,10 +32,12 @@ var conf = {
bottomMarginAdj:1,
// width of activation box
activationWidth:10
activationWidth:10,
//text placement as: tspan | fo
textPlacement: 'fo',
};
//var bb = getBBox('path');
exports.bounds = {
data:{
startx:undefined,
@@ -221,8 +223,8 @@ var drawMessage = function(elem, startx, stopx, verticalPos, msg){
}
else{
//textWidth = getBBox(textElem).width; //.getComputedTextLength()
textWidth = textElem[0][0].getBoundingClientRect();
//textWidth = textElem[0][0].getComputedTextLength();
textWidth = textElem[0][0].getBoundingClientRect();
//textWidth = textElem[0][0].getComputedTextLength();
}
var line;
@@ -273,6 +275,7 @@ var drawMessage = function(elem, startx, stopx, verticalPos, msg){
};
module.exports.drawActors = function(diagram, actors, actorKeys,verticalPos){
var i;
// Draw the actors
@@ -476,14 +479,14 @@ module.exports.draw = function (text, id) {
}
var width = (box.stopx - box.startx) + (2 * conf.diagramMarginX);
if(title) {
diagram.append('text')
.text(title)
.attr('x', ( ( box.stopx-box.startx) / 2 ) - ( 2 * conf.diagramMarginX ) )
.attr('y', -25);
}
if(conf.useMaxWidth) {
diagram.attr('height', '100%');
diagram.attr('width', '100%');