AddMarker() error

In trying to add custom markers, I followed the way it was done in the bpmn renderer and maintained the addMarker function unchanged. But there seems to be an error message every time I try to run the source code I get the error message below referring to these lines of code:

var defs = domQuery('defs', canvas._svg);
    
        if (!defs) {
          defs = svgCreate('defs');
    
          svgAppend(canvas._svg, defs);
        }
    
        svgAppend(defs, marker);

image

Seems to me as an issue with the canvas._svg but I’m not sure and don’t know why that is the case.

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

Here is a link

cd modeler
npm install
npm start

For more context, I’m trying to make a custom connector just like the sequence flow. It has an arrow icon on the palette and when I click on it I can select a source element and and a target just as is the case with the global connector tool for example in bpmn-js. Whenever I click on the arrow icon labeled "Custom flow: Draw Include-flow" at the moment I get the above error.

A link to the github folder if sandbox does not work

Thanks!

Here is a working sandbox of the problem and the context is in the previous reply:

Hi @barmac,

Did you see my code-sandbox?
Any help with this will be greatly appreciated.

Regards!

Update:
After going through multiple suggested solutions and text online, the issue was with the order of parameters in CustomRenderer.$inject. Before is looked like this:

export default function CustomRenderer(
    eventBus, styles, pathMap, priority, textRenderer, canvas) {
  
    ....

}

and

CustomRenderer.$inject = [
    'eventBus',
    'styles',
    'pathMap',
    'canvas',
    'textRenderer'
];

So in the correct solution it is as follows:

export default function CustomRenderer(
    eventBus, styles, pathMap, textRenderer, canvas, priority) {
  
    ....

}

and

DcrRenderer.$inject = [
    'eventBus',
    'styles',
    'pathMap',
    'textRenderer',
    'canvas'
];

Thanks for sharing the solution with us.

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