taron133
2020-10-26 aa8d874c8a3287d41d26566ae32b6ed8d4557ff9
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
import RuleProvider from 'diagram-js/lib/features/rules/RuleProvider';
import inherits from 'inherits';
 
 
export default function TaskResize(eventBus, taskResizingEnabled) {
  RuleProvider.call(this, eventBus);
  this.taskResizingEnabled=taskResizingEnabled || false;
}
 
inherits(TaskResize, RuleProvider);
 
TaskResize.$inject = [ 'eventBus', 'config.taskResizingEnabled' ];
 
TaskResize.prototype.init = function() {
  var me=this;
 
  me.addRule('shape.resize', 1500, function(data) {
    if (me.taskResizingEnabled && data.shape.businessObject && 
        (data.shape.businessObject.$instanceOf('bpmn:Task') || 
         data.shape.businessObject.$instanceOf('bpmn:CallActivity') ||
         data.shape.businessObject.$instanceOf('bpmn:SubProcess'))) {
      if (data.newBounds) {
        data.newBounds.width=Math.max(100,data.newBounds.width);
        data.newBounds.height=Math.max(80,data.newBounds.height);
      }
      return true;
    }
  });
};