BpmnAutoResizeProvider.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { is } from '../../util/ModelUtil';
  2. import inherits from 'inherits';
  3. import { forEach } from 'min-dash';
  4. import AutoResizeProvider from 'diagram-js/lib/features/auto-resize/AutoResizeProvider';
  5. /**
  6. * This module is a provider for automatically resizing parent BPMN elements
  7. */
  8. export default function BpmnAutoResizeProvider(eventBus, modeling) {
  9. AutoResizeProvider.call(this, eventBus);
  10. this._modeling = modeling;
  11. }
  12. inherits(BpmnAutoResizeProvider, AutoResizeProvider);
  13. BpmnAutoResizeProvider.$inject = [
  14. 'eventBus',
  15. 'modeling'
  16. ];
  17. /**
  18. * Check if the given target can be expanded
  19. *
  20. * @param {djs.model.Shape} target
  21. *
  22. * @return {boolean}
  23. */
  24. BpmnAutoResizeProvider.prototype.canResize = function(elements, target) {
  25. if (!is(target, 'bpmn:Participant') && !is(target, 'bpmn:Lane') && !(is(target, 'bpmn:SubProcess'))) {
  26. return false;
  27. }
  28. var canResize = true;
  29. forEach(elements, function(element) {
  30. if (is(element, 'bpmn:Lane') || element.labelTarget) {
  31. canResize = false;
  32. return;
  33. }
  34. });
  35. return canResize;
  36. };