From 9bfa4de445c5dba85b3c904221bfa4520cf2fafe Mon Sep 17 00:00:00 2001 From: jdotzki Date: Tue, 27 May 2014 12:25:28 +0200 Subject: [PATCH] fix(bpmnrenderer): render conditional flow marker only on task close #67 --- lib/draw/BpmnRenderer.js | 26 ++++----- test/fixtures/bpmn/issue/bpmn-js-67.bpmn | 73 ++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 14 deletions(-) create mode 100644 test/fixtures/bpmn/issue/bpmn-js-67.bpmn diff --git a/lib/draw/BpmnRenderer.js b/lib/draw/BpmnRenderer.js index dd0fe967..8c7d0104 100644 --- a/lib/draw/BpmnRenderer.js +++ b/lib/draw/BpmnRenderer.js @@ -1096,29 +1096,27 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) { var flowPath = drawPath(p, linePathData); var sequence = bpmnRegistry.getSemantic(data.id); + var source = !!sequence.sourceRef ? bpmnRegistry.getSemantic(sequence.sourceRef) : {}; + var sourceType = source.$type; // Conditional Flow Marker - if(!!sequence.conditionExpression) { + if(!!sequence.conditionExpression && + sourceType === 'bpmn:Task') { flowPath.attr({ 'marker-start': marker('conditional-flow-marker') }); } // Default Marker - var srcRef = sequence.sourceRef; - if(!!srcRef) { - var source = bpmnRegistry.getSemantic(srcRef); - if(!!source && - (source.$type === 'bpmn:InclusiveGateway' || - source.$type === 'bpmn:ExclusiveGateway')) { + if(sourceType === 'bpmn:InclusiveGateway' || + sourceType === 'bpmn:ExclusiveGateway') { - if(!!source.default && - source.default.$type === 'bpmn:SequenceFlow' && - source.default.id === data.id) { - flowPath.attr({ - 'marker-start': marker('conditional-default-flow-marker') - }); - } + if(!!source.default && + source.default.$type === 'bpmn:SequenceFlow' && + source.default.id === data.id) { + flowPath.attr({ + 'marker-start': marker('conditional-default-flow-marker') + }); } } diff --git a/test/fixtures/bpmn/issue/bpmn-js-67.bpmn b/test/fixtures/bpmn/issue/bpmn-js-67.bpmn new file mode 100644 index 00000000..7392ae67 --- /dev/null +++ b/test/fixtures/bpmn/issue/bpmn-js-67.bpmn @@ -0,0 +1,73 @@ + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + SequenceFlow_3 + + + + test + + + SequenceFlow_2 + + + + SequenceFlow_3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file