parent
b5483b2565
commit
0044a51bc5
|
@ -125,7 +125,7 @@ BpmnImporter.prototype.addLabel = function (semantic, element) {
|
|||
id: semantic.id + '_label',
|
||||
labelTarget: element,
|
||||
type: 'label',
|
||||
hidden: element.hidden || !semantic.name,
|
||||
hidden: element.hidden,
|
||||
x: bounds.x,
|
||||
y: bounds.y,
|
||||
width: bounds.width,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
var _ = require('lodash');
|
||||
|
||||
var DefaultRenderer = require('diagram-js/lib/draw/Renderer');
|
||||
var TextUtil = require('diagram-js/lib/util/TextUtil');
|
||||
var TextUtil = require('diagram-js/lib/util/Text');
|
||||
|
||||
var DiUtil = require('../util/Di');
|
||||
|
||||
|
@ -22,7 +22,7 @@ function BpmnRenderer(events, styles, pathMap) {
|
|||
fontSize: '12px'
|
||||
};
|
||||
|
||||
var labelUtil = new TextUtil({
|
||||
var textUtil = new TextUtil({
|
||||
style: LABEL_STYLE,
|
||||
size: { width: 100 }
|
||||
});
|
||||
|
@ -276,7 +276,7 @@ function BpmnRenderer(events, styles, pathMap) {
|
|||
}
|
||||
|
||||
function renderLabel(p, label, options) {
|
||||
return labelUtil.createLabel(p, label || '', options).addClass('djs-label');
|
||||
return textUtil.createText(p, label || '', options).addClass('djs-label');
|
||||
}
|
||||
|
||||
function renderEmbeddedLabel(p, element, align) {
|
||||
|
@ -286,6 +286,11 @@ function BpmnRenderer(events, styles, pathMap) {
|
|||
|
||||
function renderExternalLabel(p, element, align) {
|
||||
var semantic = getSemantic(element);
|
||||
|
||||
if (!semantic.name) {
|
||||
element.hidden = true;
|
||||
}
|
||||
|
||||
return renderLabel(p, semantic.name, { box: element, align: align, style: { fontSize: '11px' } });
|
||||
}
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ module.exports.setLabel = function(element, text) {
|
|||
|
||||
var label = element.label || element;
|
||||
|
||||
// hide label if not set
|
||||
label.hidden = !text;
|
||||
// show label
|
||||
label.hidden = false;
|
||||
|
||||
return label;
|
||||
};
|
|
@ -65,9 +65,7 @@ ElementFactory.prototype.createRoot = function(attrs) {
|
|||
};
|
||||
|
||||
ElementFactory.prototype.createLabel = function(attrs) {
|
||||
return this.create('label', _.extend({
|
||||
type: 'label'
|
||||
}, LabelUtil.DEFAULT_LABEL_SIZE, attrs));
|
||||
return this.create('label', _.extend({ type: 'label' }, LabelUtil.DEFAULT_LABEL_SIZE, attrs));
|
||||
};
|
||||
|
||||
ElementFactory.prototype.createShape = function(attrs) {
|
||||
|
|
Loading…
Reference in New Issue