Label on doubleclick

Hi again. :wink:

I created some labels with the help of the elementFactory:

var label = elementFactory.createLabel({ businessObject: someTextObject x: 100, y: 100, width: 50, height: 30 });

and added them to the canvas:

canvas.addShape(label, connection);

The label is displayed correct and the element registry contains it too, but when i doubleclick i dont get this element from the corresponding event:

eventBus.on('element.dblclick', function(event) { console.log(event.element); });

I always get the connection or root element if i change the parent to root. If i dopubleclick on another shape or connection i get the expected result, the doubleclicked element.

Why don’t i get the label here?

When adding a label to the canvas the parent element is not its label target but the underlying flow elements container.

Instead of

canvas.addShape(label, connection);

do

canvas.addShape(label, processOrParticipantOrSubprocess);