From 3002a799441a53edfa2c6d5fd16c159021708f3c Mon Sep 17 00:00:00 2001 From: jdotzki Date: Tue, 6 May 2014 16:21:53 +0200 Subject: [PATCH] impr(bpmnrenderer): multi line label support for lanes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 '…. ' --- lib/draw/BpmnRenderer.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/draw/BpmnRenderer.js b/lib/draw/BpmnRenderer.js index 9b4725f3..c571448e 100644 --- a/lib/draw/BpmnRenderer.js +++ b/lib/draw/BpmnRenderer.js @@ -275,12 +275,21 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) { } function renderLaneLabel(p, text, data) { - // position text left top - var textBox = renderLabel(p, text, {height: data.width, width: data.height}, 'left-top'); - // rotate text and center it on the middle of the lane height + var textBox = renderLabel( + p, + text, + { + height: 30, + width: data.height + }, + 'center-middle' + ); var bbox = textBox.getBBox(); - var top = (data.height / 2) + (bbox.width / 2); - textBox.transform('translate(0,' + top + ') rotate(270)'); + var top = -1 * data.height; + textBox.transform( + 'rotate(270) ' + + 'translate(' + top + ',' + 0 + ')' + ); } var handlers = {