BpmnAutoResize.js 812 B

1234567891011121314151617181920212223242526272829303132333435363738
  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 {Bounds} newBounds
  20. * @param {Object} hints
  21. */
  22. BpmnAutoResize.prototype.resize = function(target, newBounds, hints) {
  23. if (is(target, 'bpmn:Participant')) {
  24. this._modeling.resizeLane(target, newBounds, null, hints);
  25. } else {
  26. this._modeling.resizeShape(target, newBounds, null, hints);
  27. }
  28. };