I want to modify the BPMN: usertask default shape

I want to change its height。

It turned out to be 80px.

I hope it’s 50px

image

The 80px in this element, I want to know where I can set it. How to set up

(这个元素中的80px,我想知道从哪里可以设置。怎么设置)

1 Like

The default sizes for each element are set here.

1 Like

Thank you very much. This helped me. Do you know how to modify the default value conveniently?

Create a custom ElementFactory and override the _getDefaultSize method, so something like that:


import ElementFactory from 'bpmn-js/lib/features/modeling/ElementFactory';

export default class CustomElementFactory extends ElementFactory {

   constructor(bpmnFactory, moddle, translate) {
      super(bpmnFactory, moddle, translate);
   }

   _getDefaultSize(semantic) {

      if (is(semantic, 'bpmn:UserTask')) {
           return { width: 100, height: 50 };
      }  

     return super._getDefaultSize(semantic);

   }

}

ElementFactory.$inject = [
  'bpmnFactory',
  'moddle',
  'translate'
];
2 Likes

Thank you very much. It’s a timely help.

1 Like