style(modeling): simplify event-based-gateway behavior
This commit is contained in:
parent
424a05a18a
commit
e4fe8c239b
|
@ -23,8 +23,7 @@ export default function EventBasedGatewayBehavior(eventBus, modeling) {
|
|||
target.incoming.length
|
||||
) {
|
||||
|
||||
existingIncomingConnections
|
||||
.filter(isSequenceFlow)
|
||||
existingIncomingConnections.filter(isSequenceFlow)
|
||||
.forEach(function(sequenceFlow) {
|
||||
modeling.removeConnection(sequenceFlow);
|
||||
});
|
||||
|
@ -40,33 +39,28 @@ export default function EventBasedGatewayBehavior(eventBus, modeling) {
|
|||
|
||||
var newShape = event.context.newShape,
|
||||
newShapeTargets,
|
||||
newShapeTargetsIncomingSequenceFlows = [];
|
||||
newShapeTargetsIncomingSequenceFlows;
|
||||
|
||||
if (!is(newShape, 'bpmn:EventBasedGateway')) {
|
||||
return;
|
||||
}
|
||||
|
||||
newShapeTargets = newShape.outgoing
|
||||
.filter(isSequenceFlow)
|
||||
newShapeTargets = newShape.outgoing.filter(isSequenceFlow)
|
||||
.map(function(sequenceFlow) {
|
||||
return sequenceFlow.target;
|
||||
});
|
||||
|
||||
newShapeTargets
|
||||
.forEach(function(target) {
|
||||
target.incoming
|
||||
.filter(isSequenceFlow)
|
||||
.forEach(function(sequenceFlow) {
|
||||
newShapeTargetsIncomingSequenceFlows.push(sequenceFlow);
|
||||
});
|
||||
});
|
||||
newShapeTargetsIncomingSequenceFlows = newShapeTargets.reduce(function(sequenceFlows, target) {
|
||||
var incomingSequenceFlows = target.incoming.filter(isSequenceFlow);
|
||||
|
||||
newShapeTargetsIncomingSequenceFlows
|
||||
.forEach(function(sequenceFlow) {
|
||||
if (sequenceFlow.source !== newShape) {
|
||||
modeling.removeConnection(sequenceFlow);
|
||||
}
|
||||
});
|
||||
return sequenceFlows.concat(incomingSequenceFlows);
|
||||
}, []);
|
||||
|
||||
newShapeTargetsIncomingSequenceFlows.forEach(function(sequenceFlow) {
|
||||
if (sequenceFlow.source !== newShape) {
|
||||
modeling.removeConnection(sequenceFlow);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -77,6 +71,8 @@ EventBasedGatewayBehavior.$inject = [
|
|||
|
||||
inherits(EventBasedGatewayBehavior, CommandInterceptor);
|
||||
|
||||
|
||||
|
||||
// helpers //////////////////////
|
||||
|
||||
function isSequenceFlow(connection) {
|
||||
|
|
Loading…
Reference in New Issue