fixed zooming after adding states/edges

This commit is contained in:
David Mosbach 2023-05-29 18:35:33 +02:00
parent c242c4a39a
commit b99dda2e85

View File

@ -45,14 +45,15 @@ function openSearchMenu(menuitem) {
} }
// Workflow processing // Workflow processing
var workflow = {};
var workflow = {} const wfGraph = ForceGraph();
fetch('http://localhost:8080/test.json') fetch('http://localhost:8080/test.json')
.then((response) => response.json()) .then((response) => response.json())
.then((data) => { .then((data) => {
for (var key in data) for (var key in data)
workflow[key] = data[key]; workflow[key] = data[key];
wfGraph(document.getElementById('graph')).graphData({nodes: workflow.states, links: workflow.actions});
runnn(); runnn();
}); });
@ -277,15 +278,13 @@ var overlappingEdges = {}; // All edges whose target and source are connected
const selfLoopCurvMin = 0.5; // Minimum curvature of a self loop. const selfLoopCurvMin = 0.5; // Minimum curvature of a self loop.
const curvatureMinMax = 0.2; // Minimum/maximum curvature (1 +/- x) of overlapping edges. const curvatureMinMax = 0.2; // Minimum/maximum curvature (1 +/- x) of overlapping edges.
const wfGraph = ForceGraph()
/** /**
* Updates the nodes and edges of the workflow graph. * Updates the nodes and edges of the workflow graph.
*/ */
function updateGraph() { function updateGraph() {
identifyOverlappingEdges() identifyOverlappingEdges()
computeCurvatures() computeCurvatures()
wfGraph(document.getElementById('graph')).graphData({nodes: workflow.states, links: workflow.actions}); wfGraph.graphData({nodes: workflow.states, links: workflow.actions});
} }
/** /**