function DetachEventBehavior(bpmnReplace, injector) {
  injector.invoke(CommandInterceptor, this);

  this._bpmnReplace = bpmnReplace;

  var self = this;

  this.postExecuted('elements.create', LOW_PRIORITY, function(context) {
    var elements = context.elements;

    elements.filter(function(shape) {
      var host = shape.host;

      return shouldReplace(shape, host);
    }).map(function(shape) {
      return elements.indexOf(shape);
    }).forEach(function(index) {
      context.elements[ index ] = self.replaceShape(elements[ index ]);
    });
  }, true);

  this.preExecute('elements.move', LOW_PRIORITY, function(context) {
    var shapes = context.shapes,
        newHost = context.newHost;

    shapes.forEach(function(shape, index) {
      var host = shape.host;

      if (shouldReplace(shape, includes(shapes, host) ? host : newHost)) {
        shapes[ index ] = self.replaceShape(shape);
      }
    });
  }, true);
}
/**
 * Replace boundary event with intermediate event when creating or moving results in detached event.
 */
Replace boundary event with intermediate event when creating or moving results in detached event.
Replace boundary event with intermediate event when creating or moving results in detached event .
function DetachEventBehavior(bpmnReplace, injector) {
  injector.invoke(CommandInterceptor, this);
  this._bpmnReplace = bpmnReplace;
  var self = this;
  this.postExecuted('elements.create', LOW_PRIORITY, function(context) {
    var elements = context.elements;
    elements.filter(function(shape) {
      var host = shape.host;
      return shouldReplace(shape, host);
    }).map(function(shape) {
      return elements.indexOf(shape);
    }).forEach(function(index) {
      context.elements[ index ] = self.replaceShape(elements[ index ]);
    });
  }, true);
  this.preExecute('elements.move', LOW_PRIORITY, function(context) {
    var shapes = context.shapes,
        newHost = context.newHost;
    shapes.forEach(function(shape, index) {
      var host = shape.host;
      if (shouldReplace(shape, includes(shapes, host) ? host : newHost)) {
        shapes[ index ] = self.replaceShape(shape);
      }
    });
  }, true);
}
function DetachEventBehavior ( bpmnReplace , injector ) { injector . invoke ( CommandInterceptor , this ) ; this . _bpmnReplace = bpmnReplace ; var self = this ; this . postExecuted ( 'elements.create' , LOW_PRIORITY , function ( context ) { var elements = context . elements ; elements . filter ( function ( shape ) { var host = shape . host ; return shouldReplace ( shape , host ) ; } ) . map ( function ( shape ) { return elements . indexOf ( shape ) ; } ) . forEach ( function ( index ) { context . elements [ index ] = self . replaceShape ( elements [ index ] ) ; } ) ; } , true ) ; this . preExecute ( 'elements.move' , LOW_PRIORITY , function ( context ) { var shapes = context . shapes , newHost = context . newHost ; shapes . forEach ( function ( shape , index ) { var host = shape . host ; if ( shouldReplace ( shape , includes ( shapes , host ) ? host : newHost ) ) { shapes [ index ] = self . replaceShape ( shape ) ; } } ) ; } , true ) ; }
Replace boundary event with intermediate event when creating or moving results in detached event.
Replace boundary event with intermediate event when creating or moving results in detached event .