chore(draw): render connections without source
This allows us to renders temporary connections, i.e. during create / connect.
This commit is contained in:
parent
0dd5c9cb6c
commit
6b5277b936
|
@ -1327,21 +1327,26 @@ function BpmnRenderer(eventBus, styles, pathMap, canvas, priority) {
|
|||
var path = drawPath(parentGfx, pathData, attrs);
|
||||
|
||||
var sequenceFlow = getSemantic(element);
|
||||
var source = element.source.businessObject;
|
||||
|
||||
// conditional flow marker
|
||||
if (sequenceFlow.conditionExpression && source.$instanceOf('bpmn:Activity')) {
|
||||
svgAttr(path, {
|
||||
markerStart: marker('conditional-flow-marker', fill, stroke)
|
||||
});
|
||||
}
|
||||
var source;
|
||||
|
||||
// default marker
|
||||
if (source.default && (source.$instanceOf('bpmn:Gateway') || source.$instanceOf('bpmn:Activity')) &&
|
||||
source.default === sequenceFlow) {
|
||||
svgAttr(path, {
|
||||
markerStart: marker('conditional-default-flow-marker', fill, stroke)
|
||||
});
|
||||
if (element.source) {
|
||||
source = element.source.businessObject;
|
||||
|
||||
// conditional flow marker
|
||||
if (sequenceFlow.conditionExpression && source.$instanceOf('bpmn:Activity')) {
|
||||
svgAttr(path, {
|
||||
markerStart: marker('conditional-flow-marker', fill, stroke)
|
||||
});
|
||||
}
|
||||
|
||||
// default marker
|
||||
if (source.default && (source.$instanceOf('bpmn:Gateway') || source.$instanceOf('bpmn:Activity')) &&
|
||||
source.default === sequenceFlow) {
|
||||
svgAttr(path, {
|
||||
markerStart: marker('conditional-default-flow-marker', fill, stroke)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return path;
|
||||
|
|
|
@ -2,8 +2,11 @@
|
|||
|
||||
require('../../TestHelper');
|
||||
|
||||
var svgCreate = require('tiny-svg/lib/create');
|
||||
|
||||
var coreModule = require('../../../lib/core'),
|
||||
rendererModule = require('../../../lib/draw');
|
||||
rendererModule = require('../../../lib/draw'),
|
||||
modelingModule = require('../../../lib/features/modeling');
|
||||
|
||||
var domQuery = require('min-dom/lib/query');
|
||||
|
||||
|
@ -249,6 +252,41 @@ describe('draw - bpmn renderer', function() {
|
|||
});
|
||||
|
||||
|
||||
it('should render sequenceFlows without source', function(done) {
|
||||
|
||||
var xml = require('../../fixtures/bpmn/draw/colors.bpmn');
|
||||
bootstrapModeler(xml, {
|
||||
modules: [
|
||||
coreModule,
|
||||
rendererModule,
|
||||
modelingModule
|
||||
]
|
||||
})(function(err) {
|
||||
|
||||
inject(function(elementFactory, graphicsFactory) {
|
||||
|
||||
// given
|
||||
var g = svgCreate('g');
|
||||
|
||||
var connection = elementFactory.create('connection', {
|
||||
type: 'bpmn:SequenceFlow',
|
||||
waypoints: [
|
||||
{ x: 0, y: 0 },
|
||||
{ x: 10, y: 100 }
|
||||
]
|
||||
});
|
||||
|
||||
var gfx = graphicsFactory.drawConnection(g, connection);
|
||||
|
||||
expect(gfx).to.exist;
|
||||
})();
|
||||
|
||||
done(err);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('path', function() {
|
||||
|
||||
var diagramXML = require('./BpmnRenderer.simple-cropping.bpmn');
|
||||
|
|
Loading…
Reference in New Issue