mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-01-27 09:15:01 +00:00
delay all label rendering
This commit is contained in:
parent
4c71906405
commit
ff387e5aad
@ -69,9 +69,9 @@ var ELEMENT_LABEL_DISTANCE = 10;
|
||||
|
||||
export default function BpmnRenderer(
|
||||
config, eventBus, styles, pathMap,
|
||||
canvas, textRenderer, priority) {
|
||||
canvas, textRenderer, scheduler, priority) {
|
||||
|
||||
BaseRenderer.call(this, eventBus, priority);
|
||||
BaseRenderer.call(this, eventBus, scheduler, priority);
|
||||
|
||||
var defaultFillColor = config && config.defaultFillColor,
|
||||
defaultStrokeColor = config && config.defaultStrokeColor,
|
||||
@ -449,27 +449,29 @@ export default function BpmnRenderer(
|
||||
return null;
|
||||
}
|
||||
|
||||
function renderLabel(parentGfx, label, options) {
|
||||
async function renderLabel(parentGfx, label, options) {
|
||||
|
||||
options = assign({
|
||||
size: {
|
||||
width: 100
|
||||
}
|
||||
}, options);
|
||||
return scheduler.schedule(() => {
|
||||
options = assign({
|
||||
size: {
|
||||
width: 100
|
||||
}
|
||||
}, options);
|
||||
|
||||
var text = textRenderer.createText(label || '', options);
|
||||
var text = textRenderer.createText(label || '', options);
|
||||
|
||||
svgClasses(text).add('djs-label');
|
||||
svgClasses(text).add('djs-label');
|
||||
|
||||
svgAppend(parentGfx, text);
|
||||
svgAppend(parentGfx, text);
|
||||
|
||||
return text;
|
||||
return text;
|
||||
});
|
||||
}
|
||||
|
||||
function renderEmbeddedLabel(parentGfx, element, align) {
|
||||
async function renderEmbeddedLabel(parentGfx, element, align) {
|
||||
var semantic = getSemantic(element);
|
||||
|
||||
return renderLabel(parentGfx, semantic.name, {
|
||||
return await renderLabel(parentGfx, semantic.name, {
|
||||
box: element,
|
||||
align: align,
|
||||
padding: 5,
|
||||
@ -479,7 +481,7 @@ export default function BpmnRenderer(
|
||||
});
|
||||
}
|
||||
|
||||
function renderExternalLabel(parentGfx, element) {
|
||||
async function renderExternalLabel(parentGfx, element) {
|
||||
|
||||
var box = {
|
||||
width: 90,
|
||||
@ -488,7 +490,7 @@ export default function BpmnRenderer(
|
||||
y: element.height / 2 + element.y
|
||||
};
|
||||
|
||||
return renderLabel(parentGfx, getLabel(element), {
|
||||
return await renderLabel(parentGfx, getLabel(element), {
|
||||
box: box,
|
||||
fitBox: true,
|
||||
style: assign(
|
||||
@ -501,8 +503,8 @@ export default function BpmnRenderer(
|
||||
});
|
||||
}
|
||||
|
||||
function renderLaneLabel(parentGfx, text, element) {
|
||||
var textBox = renderLabel(parentGfx, text, {
|
||||
async function renderLaneLabel(parentGfx, text, element) {
|
||||
var textBox = await renderLabel(parentGfx, text, {
|
||||
box: {
|
||||
height: 30,
|
||||
width: element.height
|
||||
@ -1618,8 +1620,8 @@ export default function BpmnRenderer(
|
||||
|
||||
return group;
|
||||
},
|
||||
'label': function(parentGfx, element) {
|
||||
return renderExternalLabel(parentGfx, element);
|
||||
'label': async function(parentGfx, element) {
|
||||
return await renderExternalLabel(parentGfx, element);
|
||||
},
|
||||
'bpmn:TextAnnotation': function(parentGfx, element) {
|
||||
var style = {
|
||||
@ -1884,7 +1886,8 @@ BpmnRenderer.$inject = [
|
||||
'styles',
|
||||
'pathMap',
|
||||
'canvas',
|
||||
'textRenderer'
|
||||
'textRenderer',
|
||||
'scheduler'
|
||||
];
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user