# all files / bpmn-js/lib/features/auto-resize/ BpmnAutoResizeProvider.js

100% Statements 13/13
100% Branches 9/9
100% Functions 3/3
100% Lines 13/13

    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
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52

    84×

    84×

    1×

    1×

    1×

    123×
    77×

    46×

    46×

    59×
    5×
    5×

    46×

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

    import inherits from 'inherits';

    import { forEach } from 'min-dash';

    import AutoResizeProvider from 'diagram-js/lib/features/auto-resize/AutoResizeProvider';

    /**
     * This module is a provider for automatically resizing parent BPMN elements
     */
    export default function BpmnAutoResizeProvider(eventBus, modeling) {
      AutoResizeProvider.call(this, eventBus);

      this._modeling = modeling;
    }

    inherits(BpmnAutoResizeProvider, AutoResizeProvider);

    BpmnAutoResizeProvider.$inject = [
      'eventBus',
      'modeling'
    ];

    /**
     * Check if the given target can be expanded
     *
     * @param  {djs.model.Shape} target
     *
     * @return {boolean}
     */
    BpmnAutoResizeProvider.prototype.canResize = function(elements, target) {

      if (!is(target, 'bpmn:Participant') && !is(target, 'bpmn:Lane') && !(is(target, 'bpmn:SubProcess'))) {
        return false;
      }

      var canResize = true;

      forEach(elements, function(element) {

        if (is(element, 'bpmn:Lane') || element.labelTarget) {
          canResize = false;
          return;
        }
      });

      return canResize;
    };