impr(bpmnrenderer): multi line label support for lanes

Lane labels can be two lines long.
Later improvement: If label is longer as two lines align it at container bottom so that text leaves lanes to the left or scale text size or cut text with '…. '
This commit is contained in:
jdotzki 2014-05-06 16:21:53 +02:00
parent daeed80b49
commit 3002a79944
1 changed files with 14 additions and 5 deletions

View File

@ -275,12 +275,21 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
} }
function renderLaneLabel(p, text, data) { function renderLaneLabel(p, text, data) {
// position text left top var textBox = renderLabel(
var textBox = renderLabel(p, text, {height: data.width, width: data.height}, 'left-top'); p,
// rotate text and center it on the middle of the lane height text,
{
height: 30,
width: data.height
},
'center-middle'
);
var bbox = textBox.getBBox(); var bbox = textBox.getBBox();
var top = (data.height / 2) + (bbox.width / 2); var top = -1 * data.height;
textBox.transform('translate(0,' + top + ') rotate(270)'); textBox.transform(
'rotate(270) ' +
'translate(' + top + ',' + 0 + ')'
);
} }
var handlers = { var handlers = {