feat(modeling): move to rules infrastructure

Related to bpmn-io/diagram-js#55
This commit is contained in:
Nico Rehwaldt
2014-11-21 09:19:35 +01:00
parent 90513e94b4
commit 2f679a36b9
22 changed files with 174 additions and 335 deletions

View File

@ -0,0 +1,30 @@
var _ = require('lodash');
function DropBehavior(eventBus, modeling) {
// sequence flow handling
eventBus.on([
'commandStack.shapes.move.postExecute'
], function(e) {
var context = e.context,
closure = context.closure,
allConnections = closure.allConnections,
allShapes = closure.allShapes;
_.forEach(allConnections, function(c) {
// 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;

View File

@ -0,0 +1,4 @@
module.exports = {
__init__: [ 'dropBehavior' ],
dropBehavior: [ 'type', require('./Drop') ]
};