diff --git a/public/app.js b/public/app.js index 3f944be..020647d 100644 --- a/public/app.js +++ b/public/app.js @@ -341,33 +341,23 @@ window.addEventListener('resize', resizeAndCenterNetwork); // Removed the stabilizationIterationsDone event listener to avoid redundant calls to resizeAndCenterNetwork -let lastUpdateTime = 0; let lastPieChartUpdateTime = 0; -let lastCounterUpdateTime = 0; -const updateInterval = 120; // 120ms throttle -const counterUpdateInterval = 50; // 50ms throttle for counter +const pieChartUpdateInterval = 1000; // Update pie chart every second function updateNodes() { - const currentTime = performance.now(); - if (currentTime - lastUpdateTime >= updateInterval && nodesToUpdate.length > 0) { + if (nodesToUpdate.length > 0) { nodes.update(nodesToUpdate); nodesToUpdate = []; calculateSmallGroups(); - lastUpdateTime = currentTime; + updateCounter(); } - // Separate throttle for pie chart update - if (currentTime - lastPieChartUpdateTime >= updateInterval) { + const currentTime = performance.now(); + if (currentTime - lastPieChartUpdateTime >= pieChartUpdateInterval) { updatePieChart(); lastPieChartUpdateTime = currentTime; } - // Separate throttle for counter update - if (currentTime - lastCounterUpdateTime >= counterUpdateInterval) { - updateCounter(); - lastCounterUpdateTime = currentTime; - } - requestAnimationFrame(updateNodes); }