CreateBehavior.js 691 B

12345678910111213141516171819202122232425262728
  1. import inherits from 'inherits';
  2. import { is } from '../../../util/ModelUtil';
  3. import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
  4. import { getParent } from '../util/ModelingUtil';
  5. export default function CreateBehavior(injector) {
  6. injector.invoke(CommandInterceptor, this);
  7. this.preExecute('shape.create', 1500, function(event) {
  8. var context = event.context,
  9. parent = context.parent,
  10. shape = context.shape;
  11. if (is(parent, 'bpmn:Lane') && !is(shape, 'bpmn:Lane')) {
  12. context.parent = getParent(parent, 'bpmn:Participant');
  13. }
  14. });
  15. }
  16. CreateBehavior.$inject = [ 'injector' ];
  17. inherits(CreateBehavior, CommandInterceptor);