BpmnAutoResize.js 755 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import AutoResize from 'diagram-js/lib/features/auto-resize/AutoResize';
  2. import inherits from 'inherits';
  3. import { is } from '../../util/ModelUtil';
  4. /**
  5. * Sub class of the AutoResize module which implements a BPMN
  6. * specific resize function.
  7. */
  8. export default function BpmnAutoResize(injector) {
  9. injector.invoke(AutoResize, this);
  10. }
  11. BpmnAutoResize.$inject = [
  12. 'injector'
  13. ];
  14. inherits(BpmnAutoResize, AutoResize);
  15. /**
  16. * Resize shapes and lanes
  17. *
  18. * @param {djs.model.Shape} target
  19. * @param {Object} newBounds
  20. */
  21. BpmnAutoResize.prototype.resize = function(target, newBounds) {
  22. if (is(target, 'bpmn:Participant')) {
  23. this._modeling.resizeLane(target, newBounds);
  24. } else {
  25. this._modeling.resizeShape(target, newBounds);
  26. }
  27. };