mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-02-17 11:26:42 +00:00
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
|
target.incoming.length
|
||||||
) {
|
) {
|
||||||
|
|
||||||
existingIncomingConnections
|
existingIncomingConnections.filter(isSequenceFlow)
|
||||||
.filter(isSequenceFlow)
|
|
||||||
.forEach(function(sequenceFlow) {
|
.forEach(function(sequenceFlow) {
|
||||||
modeling.removeConnection(sequenceFlow);
|
modeling.removeConnection(sequenceFlow);
|
||||||
});
|
});
|
||||||
@ -40,33 +39,28 @@ export default function EventBasedGatewayBehavior(eventBus, modeling) {
|
|||||||
|
|
||||||
var newShape = event.context.newShape,
|
var newShape = event.context.newShape,
|
||||||
newShapeTargets,
|
newShapeTargets,
|
||||||
newShapeTargetsIncomingSequenceFlows = [];
|
newShapeTargetsIncomingSequenceFlows;
|
||||||
|
|
||||||
if (!is(newShape, 'bpmn:EventBasedGateway')) {
|
if (!is(newShape, 'bpmn:EventBasedGateway')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
newShapeTargets = newShape.outgoing
|
newShapeTargets = newShape.outgoing.filter(isSequenceFlow)
|
||||||
.filter(isSequenceFlow)
|
|
||||||
.map(function(sequenceFlow) {
|
.map(function(sequenceFlow) {
|
||||||
return sequenceFlow.target;
|
return sequenceFlow.target;
|
||||||
});
|
});
|
||||||
|
|
||||||
newShapeTargets
|
newShapeTargetsIncomingSequenceFlows = newShapeTargets.reduce(function(sequenceFlows, target) {
|
||||||
.forEach(function(target) {
|
var incomingSequenceFlows = target.incoming.filter(isSequenceFlow);
|
||||||
target.incoming
|
|
||||||
.filter(isSequenceFlow)
|
|
||||||
.forEach(function(sequenceFlow) {
|
|
||||||
newShapeTargetsIncomingSequenceFlows.push(sequenceFlow);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
newShapeTargetsIncomingSequenceFlows
|
return sequenceFlows.concat(incomingSequenceFlows);
|
||||||
.forEach(function(sequenceFlow) {
|
}, []);
|
||||||
if (sequenceFlow.source !== newShape) {
|
|
||||||
modeling.removeConnection(sequenceFlow);
|
newShapeTargetsIncomingSequenceFlows.forEach(function(sequenceFlow) {
|
||||||
}
|
if (sequenceFlow.source !== newShape) {
|
||||||
});
|
modeling.removeConnection(sequenceFlow);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,6 +71,8 @@ EventBasedGatewayBehavior.$inject = [
|
|||||||
|
|
||||||
inherits(EventBasedGatewayBehavior, CommandInterceptor);
|
inherits(EventBasedGatewayBehavior, CommandInterceptor);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// helpers //////////////////////
|
// helpers //////////////////////
|
||||||
|
|
||||||
function isSequenceFlow(connection) {
|
function isSequenceFlow(connection) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user