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;
|
}
|
});
|
};
|