2015-02-02 13:46:21 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var forEach = require('lodash/collection/forEach');
|
2014-11-21 08:19:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
function DropBehavior(eventBus, modeling) {
|
|
|
|
|
|
|
|
// sequence flow handling
|
|
|
|
|
|
|
|
eventBus.on([
|
|
|
|
'commandStack.shapes.move.postExecute'
|
|
|
|
], function(e) {
|
|
|
|
|
|
|
|
var context = e.context,
|
|
|
|
closure = context.closure,
|
2015-02-02 13:46:21 +00:00
|
|
|
allConnections = closure.allConnections;
|
2014-11-21 08:19:35 +00:00
|
|
|
|
2015-02-02 13:46:21 +00:00
|
|
|
forEach(allConnections, function(c) {
|
2014-11-21 08:19:35 +00:00
|
|
|
|
|
|
|
// remove sequence flows having source / target on different parents
|
|
|
|
if (c.businessObject.$instanceOf('bpmn:SequenceFlow') && c.source.parent !== c.target.parent) {
|
|
|
|
modeling.removeConnection(c);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
DropBehavior.$inject = [ 'eventBus', 'modeling' ];
|
|
|
|
|
|
|
|
module.exports = DropBehavior;
|