AssociationBehavior.js 851 B

1234567891011121314151617181920212223242526272829303132333435
  1. import inherits from 'inherits';
  2. import { is } from '../../../util/ModelUtil';
  3. import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
  4. import {
  5. filter,
  6. forEach
  7. } from 'min-dash';
  8. export default function AssociationBehavior(injector, modeling) {
  9. injector.invoke(CommandInterceptor, this);
  10. this.postExecute('shape.move', function(context) {
  11. var newParent = context.newParent,
  12. shape = context.shape;
  13. var associations = filter(shape.incoming.concat(shape.outgoing), function(connection) {
  14. return is(connection, 'bpmn:Association');
  15. });
  16. forEach(associations, function(association) {
  17. modeling.moveConnection(association, { x: 0, y: 0 }, newParent);
  18. });
  19. }, true);
  20. }
  21. inherits(AssociationBehavior, CommandInterceptor);
  22. AssociationBehavior.$inject = [
  23. 'injector',
  24. 'modeling'
  25. ];