BpmnAutoResize.js 1021 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import AutoResize from 'diagram-js/lib/features/auto-resize/AutoResize';
  2. import inherits from 'inherits-browser';
  3. import { is } from '../../util/ModelUtil';
  4. /**
  5. * @typedef {import('didi').Injector} Injector
  6. *
  7. * @typedef {import('../../model/Types').Shape} Shape
  8. *
  9. * @typedef {import('diagram-js/lib/util/Types').Rect} Rect
  10. */
  11. /**
  12. * BPMN-specific resize behavior.
  13. *
  14. * @param {Injector} injector
  15. */
  16. export default function BpmnAutoResize(injector) {
  17. injector.invoke(AutoResize, this);
  18. }
  19. BpmnAutoResize.$inject = [
  20. 'injector'
  21. ];
  22. inherits(BpmnAutoResize, AutoResize);
  23. /**
  24. * Perform BPMN-specific resizing of participants.
  25. *
  26. * @param {Shape} target
  27. * @param {Rect} newBounds
  28. * @param {Object} [hints]
  29. * @param {string} [hints.autoResize]
  30. */
  31. BpmnAutoResize.prototype.resize = function(target, newBounds, hints) {
  32. if (is(target, 'bpmn:Participant')) {
  33. this._modeling.resizeLane(target, newBounds, null, hints);
  34. } else {
  35. this._modeling.resizeShape(target, newBounds, null, hints);
  36. }
  37. };