From 653d15acf378c582c4c9e9dc9f10e56b4bc73d98 Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 31 Mar 2023 14:56:29 -0400 Subject: [PATCH] Zoom to fit viewport when opening a diagram. --- spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx b/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx index e3989c63c..eefaff829 100644 --- a/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx +++ b/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx @@ -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; }