mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-02-26 15:40:46 +00:00
This commit adds the ability to model participants from the palette. * Empty diagrams can be used as a start for participant _AND_ process diagram * Process diagrams can be converted to collaboration diagrams by dropping a participant onto them Closes #128
34 lines
912 B
JavaScript
34 lines
912 B
JavaScript
'use strict';
|
|
|
|
var forEach = require('lodash/collection/forEach'),
|
|
inherits = require('inherits');
|
|
|
|
var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
|
|
|
|
function DropBehavior(eventBus, modeling) {
|
|
|
|
CommandInterceptor.call(this, eventBus);
|
|
|
|
// remove sequence flows that should not be allowed
|
|
// after a move operation
|
|
|
|
this.postExecute('shapes.move', function(context) {
|
|
|
|
var closure = context.closure,
|
|
allConnections = closure.allConnections;
|
|
|
|
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);
|
|
}
|
|
});
|
|
}, true);
|
|
}
|
|
|
|
inherits(DropBehavior, CommandInterceptor);
|
|
|
|
DropBehavior.$inject = [ 'eventBus', 'modeling' ];
|
|
|
|
module.exports = DropBehavior; |