# all files / Github/diagram-js/lib/features/auto-resize/ AutoResizeProvider.js

87.5% Statements 7/8
100% Branches 0/0
66.67% Functions 2/3
87.5% Lines 7/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
    28
    29
    30
    31
    32
    33

    85×

    85×

    85×
    123×

    1×

    1×

    1×

     import RuleProvider from '../rules/RuleProvider';

    import inherits from 'inherits';

    /**
     * This is a base rule provider for the element.autoResize rule.
     */
    export default function AutoResizeProvider(eventBus) {

      RuleProvider.call(this, eventBus);

      var self = this;

      this.addRule('element.autoResize', function(context) {
        return self.canResize(context.elements, context.target);
      });
    }

    AutoResizeProvider.$inject = [ 'eventBus' ];

    inherits(AutoResizeProvider, RuleProvider);

    /**
     * Needs to be implemented by sub classes to allow actual auto resize
     *
     * @param  {Array<djs.model.Shape>} elements
     * @param  {djs.model.Shape} target
     *
     * @return {Boolean}
     */
    AutoResizeProvider.prototype.canResize = function(elements, target) {
      return false;
    };