How to disable 'selection.changed' event on connection creation?

Hi,
When a connection is created between two nodes, I see that the sequence flow becomes the node under selection. I would like to have the source/target instead of sequence flow.
I could find a way to do it. But with my changes, the target/source gets selected, then the sequence gets selected. So I added a delay in my code. So now the target/source is selected, but the sequence gets selected between and then after the delay, source/target shows as selected.

I tried several ways to bypass the ‘selection.changed’ event that gets triggered when a connection is created. But no luck.

bpmnModeler.on('commandStack.connection.create.postExecuted', (e) => {
      if (condition1) {
        setTimeout(() => {
          bpmnModeler.get('selection').select(e.context.source);
        }, 1);
      } else {
        setTimeout(() => {
          bpmnModeler.get('selection').select(e.context.target);
        }, 1);
      }
    });```

This is controlled through selectionBehavior, a component that you can override to customize the behavior.

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