# all files / bpmn-js/lib/features/modeling/behavior/ CreateBehavior.js

100% Statements 8/8
100% Branches 2/2
100% Functions 2/2
100% Lines 8/8

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27

    1189×

    1189×
    420×
    420×

    420×
    9×

    1×

    1×import inherits from 'inherits';

    import { is } from '../../../util/ModelUtil';

    import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';

    import { getParent } from '../util/ModelingUtil';

    export default function CreateBehavior(injector) {
      injector.invoke(CommandInterceptor, this);

      this.preExecute('shape.create', 1500, function(event) {
        var context = event.context,
            parent = context.parent;

        if (is(parent, 'bpmn:Lane')) {
          context.parent = getParent(parent, 'bpmn:Participant');
        }
      });

    }

    CreateBehavior.$inject = [ 'injector' ];

    inherits(CreateBehavior, CommandInterceptor);