How do I change the width and height of the task node

I want the task node to be square, so I need to change the width of the element to do that.
But I looked for a long time for a way, and I couldn’t find it.
Can someone help me with this? Thank you very much.

Please share a CodeSandbox that reproduces your issue in a way that we can inspect it.

Thank you, my problem is solved.

import ElementFactory from 'bpmn-js/lib/features/modeling/ElementFactory'; 
import defaultStyle from './defaultStyle'
import { merge } from 'min-dash';
import { is } from 'bpmn-js/lib/util/ModelUtil';

class CustomElementFactory extends ElementFactory {
  constructor(bpmnFactory, moddle, translate, elementFactory) {
      super(bpmnFactory, moddle, translate);
      const backup_getDefaultSize = elementFactory.getDefaultSize;
      elementFactory.getDefaultSize = (element, di) => {
          if (is(element, 'bpmn:Task')) {
              return { width: 50, height: 50};
          return backup_getDefaultSize(element, di);
CustomElementFactory.$inject = [
export default CustomElementFactory

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.