The position of the element is changed when the diagram is reopened


#1

When I draw in the middle of the page and reopen it, the entire diagram move to the upper left corner, making the page have a lot of white space.1 2


#2

I guess the position of the elements isn’t changing. Are you moving the canvas before re-importing?


#3

When I reopen the diagram, I output the information in the console and find that the coordinates have not changed, but the whole diagram has moved to the upper left corner.


#4

There is not guarantee that the canvas will be at the same position with the same zoom after a re-import. What is your expected behavior?


#5

I want the diagram to be displayed in the middle because it looks more friendly.
image


#6

Have you tried:

var canvas = bpmnViewer.get('canvas');
          
// zoom to fit full viewport
canvas.zoom('fit-viewport');