all files / lib/features/auto-resize/ BpmnAutoResize.js

100% Statements 7/7
100% Branches 2/2
100% Functions 2/2
100% Lines 7/7
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                          79×                             29× 16×   13×    
import AutoResize from 'diagram-js/lib/features/auto-resize/AutoResize';
 
import inherits from 'inherits';
 
import { is } from '../../util/ModelUtil';
 
 
/**
 * Sub class of the AutoResize module which implements a BPMN
 * specific resize function.
 */
export default function BpmnAutoResize(injector) {
 
  injector.invoke(AutoResize, this);
}
 
BpmnAutoResize.$inject = [
  'injector'
];
 
inherits(BpmnAutoResize, AutoResize);
 
 
/**
 * Resize shapes and lanes
 *
 * @param  {djs.model.Shape} target
 * @param  {Object} newBounds
 */
BpmnAutoResize.prototype.resize = function(target, newBounds) {
 
  if (is(target, 'bpmn:Participant')) {
    this._modeling.resizeLane(target, newBounds);
  } else {
    this._modeling.resizeShape(target, newBounds);
  }
};