fix(draw): render labels as one-liner per default

This is a temporary fix for #113
This commit is contained in:
Nico Rehwaldt 2014-09-15 14:41:26 +02:00
parent 8cc530bf58
commit 4428be4227
3 changed files with 7 additions and 7 deletions

View File

@ -281,7 +281,7 @@ function BpmnRenderer(events, styles, pathMap) {
function renderEmbeddedLabel(p, element, align) {
var semantic = getSemantic(element);
return renderLabel(p, semantic.name, { box: element, align: align });
return renderLabel(p, semantic.name, { box: element, align: align, padding: 5 });
}
function renderExternalLabel(p, element, align) {
@ -799,7 +799,7 @@ function BpmnRenderer(events, styles, pathMap) {
var expanded = DiUtil.isExpanded(semantic);
var isEventSubProcess = !!getSemantic(element).triggeredByEvent;
var isEventSubProcess = !!semantic.triggeredByEvent;
if (isEventSubProcess) {
rect.attr({
strokeDasharray: '1,2'
@ -1220,7 +1220,7 @@ function BpmnRenderer(events, styles, pathMap) {
drawPath(p, textPathData);
var text = getSemantic(element).text || '';
renderLabel(p, text, { box: element, align: 'left-middle' });
renderLabel(p, text, { box: element, align: 'left-middle', padding: 5 });
return textElement;
},

View File

@ -5,7 +5,7 @@ var _ = require('lodash');
var DEFAULT_LABEL_SIZE = module.exports.DEFAULT_LABEL_SIZE = {
width: 90,
height: 50
height: 20
};
@ -53,7 +53,7 @@ var getExternalLabelMid = module.exports.getExternalLabelMid = function(element)
} else {
return {
x: element.x + element.width / 2,
y: element.y + element.height + DEFAULT_LABEL_SIZE.height / 2 - 5
y: element.y + element.height + DEFAULT_LABEL_SIZE.height / 2
};
}
};
@ -77,7 +77,7 @@ module.exports.getExternalLabelBounds = function(semantic, element) {
bounds = label.bounds;
size = {
width: Math.max(150, bounds.width),
width: Math.max(DEFAULT_LABEL_SIZE.width, bounds.width),
height: bounds.height
};

View File

@ -109,7 +109,7 @@ describe('features/modeling - append shape', function() {
expect(elementRegistry.getById(label.id)).toBeDefined();
expect(label.x).toBe(443);
expect(label.y).toBe(273);
expect(label.y).toBe(278);
expect(label.width).toBe(LabelUtil.DEFAULT_LABEL_SIZE.width);
expect(label.height).toBe(LabelUtil.DEFAULT_LABEL_SIZE.height);
}));