better zooming

This commit is contained in:
Utsob Roy 2023-02-02 11:16:45 +06:00
parent 5fcee3da0b
commit fb91fc90c7

View File

@ -93,7 +93,7 @@
.onNodeClick(node => { .onNodeClick(node => {
window.location = node.url; window.location = node.url;
}); });
if (delay != null) { if (delay != null && graphData.nodes.length > 2) {
setTimeout(() => { setTimeout(() => {
Graph.zoomToFit(5, 75); Graph.zoomToFit(5, 75);
}, delay); }, delay);
@ -104,7 +104,7 @@
function fetchGraphData() { function fetchGraphData() {
fetch('/graph.json').then(res => res.json()).then(data => { fetch('/graph.json').then(res => res.json()).then(data => {
window.graphData = data; window.graphData = data;
Graph = renderGraph(filterToDepth(JSON.parse(JSON.stringify(data))), "link-graph", 330, 330); Graph = renderGraph(filterToDepth(JSON.parse(JSON.stringify(data))), "link-graph", 330, 330, 1);
}); });
} }
@ -119,7 +119,7 @@
Graph._destructor(); Graph._destructor();
Graph = null; Graph = null;
} }
renderGraph(filterToDepth(JSON.parse(JSON.stringify(window.graphData))), "link-graph", 330, 330, null); renderGraph(filterToDepth(JSON.parse(JSON.stringify(window.graphData))), "link-graph", 330, 330, 1);
}) })
window.fullGraph = null; window.fullGraph = null;