Zoom to fit viewport when opening a diagram.

This commit is contained in:
Dan 2023-03-31 14:56:29 -04:00
parent 5fbe08d3cd
commit 653d15acf3
1 changed files with 4 additions and 1 deletions

View File

@ -450,7 +450,10 @@ export default function ReactDiagramEditor({
if (alreadyImportedXmlRef.current) {
return;
}
diagramModelerToUse.importXML(diagramXMLToDisplay);
diagramModelerToUse.importXML(diagramXMLToDisplay).then(() => {
diagramModelerToUse.get('canvas').zoom('fit-viewport');
});
alreadyImportedXmlRef.current = true;
}