mirror of
https://github.com/bpmn-io/bpmn-js.git
synced 2025-08-26 04:32:44 +08:00
feat(modeling): move to rules infrastructure
Related to bpmn-io/diagram-js#55
This commit is contained in:
30
lib/features/modeling/behavior/Drop.js
Normal file
30
lib/features/modeling/behavior/Drop.js
Normal 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;
|
4
lib/features/modeling/behavior/index.js
Normal file
4
lib/features/modeling/behavior/index.js
Normal file
@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
__init__: [ 'dropBehavior' ],
|
||||
dropBehavior: [ 'type', require('./Drop') ]
|
||||
};
|
Reference in New Issue
Block a user