fix(draw/labels): adjust font-size and no-di positioning

This commit is contained in:
Nico Rehwaldt 2014-05-06 17:22:39 +02:00
parent 70778082b5
commit 7540186f6e
2 changed files with 15 additions and 19 deletions

View File

@ -22,8 +22,8 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
var INNER_OUTER_DIST = 3; var INNER_OUTER_DIST = 3;
var LABEL_STYLE = { var LABEL_STYLE = {
fontFamily: '"Helvetica Neue", Helvetica, Arial, sans-serif', fontFamily: 'Arial, sans-serif',
fontSize: '10pt' fontSize: '12px'
}; };
var labelUtil = new LabelUtil({ var labelUtil = new LabelUtil({
@ -261,31 +261,27 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
return null; return null;
} }
function renderLabel(p, label, box, align) { function renderLabel(p, label, options) {
return labelUtil.createLabel(p, label || '', { box: box, align: align }).addClass('djs-label'); return labelUtil.createLabel(p, label || '', options).addClass('djs-label');
} }
function renderEmbeddedLabel(p, data, align) { function renderEmbeddedLabel(p, data, align) {
var element = bpmnRegistry.getSemantic(data); var element = bpmnRegistry.getSemantic(data);
return renderLabel(p, element.name, data, align); return renderLabel(p, element.name, { box: data, align: align });
} }
function renderExternalLabel(p, data, align) { function renderExternalLabel(p, data, align) {
var element = bpmnRegistry.getSemantic(data.attachedId); var element = bpmnRegistry.getSemantic(data.attachedId);
return renderLabel(p, element.name, data, align); return renderLabel(p, element.name, { box: data, align: align, style: { fontSize: '11px' } });
} }
function renderLaneLabel(p, text, data) { function renderLaneLabel(p, text, data) {
var textBox = renderLabel( var textBox = renderLabel(p, text, {
p, box: { height: 30, width: data.height },
text, align: 'center-middle'
{ });
height: 30,
width: data.height
},
'center-middle'
);
var bbox = textBox.getBBox(); var bbox = textBox.getBBox();
var top = -1 * data.height; var top = -1 * data.height;
textBox.transform( textBox.transform(
@ -654,7 +650,7 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
} else { } else {
// Collapsed pool draw text inline // Collapsed pool draw text inline
var text2 = bpmnRegistry.getSemantic(data.id).name; var text2 = bpmnRegistry.getSemantic(data.id).name;
renderLabel(p, text2, data, 'center-middle'); renderLabel(p, text2, { box: data, align: 'center-middle' });
} }
return lane; return lane;
@ -981,7 +977,7 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
var textPath = drawPath(p, textPathData); var textPath = drawPath(p, textPathData);
var text = bpmnRegistry.getSemantic(data.id).text || ''; var text = bpmnRegistry.getSemantic(data.id).text || '';
var label = renderLabel(p, text, data, 'left-middle'); var label = renderLabel(p, text, { box: data, align: 'left-middle' });
return label; return label;
} }

View File

@ -53,12 +53,12 @@ function getLabelBounds(di, data) {
} else { } else {
mid = { mid = {
x: data.x + data.width / 2, x: data.x + data.width / 2,
y: data.y + data.height + 5 y: data.y + data.height - 5
}; };
} }
size = { size = {
width: 150, width: 90,
height: 50 height: 50
}; };
} }