A couple of questions

I’m trying to reposition an element on the canvas. I was wondering what is the best way to do this?

Also, we are dynamically resizing the SVGs of the elements based on what the user types as the name of the node. I have the SVG resizing, but I don’t think I’m getting everything right. The problem is any connections to that node only go to where the old node ended. So if the new size is less than the old size, the connections don’t adjust to the new size. So is there a call I should be making after I resize the custom element or do I need to make a call to adjust the connection.

Thanks,

Paul

Hi Paul,

Moving of shapes
Shapes can be moved using modeling.moveShape, see the test file for some examples. Typically you would do something like

    const modeling = bpmnJS.get("modeling"),
          elementRegistry = bpmnJS.get("elementRegistry");

    const startEvent = elementRegistry.get("StartEvent_1");

    modeling.moveShape(startEvent, { x: -20, y: +20 });

(Note that the code snippet does not change the root of the moved shape. If you want to move a shape onto a new root (e.g., another expanded subProcess), you would need to provide that subProcess as root element as third argument)

Resizing
Can you please share the issue you are facing (e.g., code snippet or sandbox)? It will be then easier to help you.
I think you are resizing the shape after it was created. If you create the shape instead with the target width/height, this might solve your issue. But as said, we would need to take a look at the concrete example.

Best,
Max