Register customRenderer in Modeler

I’m trying to implement customRenderer. But it is not registering with the modeler.

loadModeler() {
    this.container = document.getElementById('js-drop-zone');

    this.modeler = new RtBpmnModeler({
      container: '#js-canvas',
      propertiesPanel: {
        parent: '#js-properties-panel'
      },
      additionalModules: [
        PropertiesPanelModule,
        PropertiesProviderModule,
        { ['customRenderer']: ['type', CustomRenderer] }, // <-- customRenderer
      ],
      moddleExtensions: {
        camunda: BPMN.CamundaModdleDescriptor,
      }
    });
  }

CustomRenderer (renderer.ts)

export class CustomRenderer extends BaseRenderer {

    constructor(eventBus: IEventBus, private styles: IStyles) {
        super(eventBus, 30000);
    }


    drawShape(p: any, element: IPaletteElement) {
        // custom shape logic
    }

When I debug, I get the CustomRenderer class. But still the CustomRenderer class is not initiated while creating instance.

image

Am I missing something? Is there any way to know the exception?

Note: No console errors.

My guess is that you’re missing the __init__ property of your custom module.

Try:

{
  __init__: [ 'customRenderer' ],
  customRenderer: [ 'type', MyCustomRenderer ]
}
1 Like

Thank you @philippfromme. It worked!