Separated pie chart update from node update and added throttling for both.
This commit is contained in:
committed by
Benjamin Arntzen (aider)
parent
10fd8cd461
commit
183ec0d5bf
+8
-1
@@ -347,6 +347,7 @@ window.addEventListener('resize', resizeAndCenterNetwork);
|
||||
|
||||
|
||||
let lastUpdateTime = 0;
|
||||
let lastPieChartUpdateTime = 0;
|
||||
const updateInterval = 120; // 120ms throttle
|
||||
|
||||
function updateNodes() {
|
||||
@@ -355,10 +356,16 @@ function updateNodes() {
|
||||
nodes.update(nodesToUpdate);
|
||||
nodesToUpdate = [];
|
||||
calculateSmallGroups();
|
||||
updatePieChartThrottled();
|
||||
updateCounter();
|
||||
lastUpdateTime = currentTime;
|
||||
}
|
||||
|
||||
// Separate throttle for pie chart update
|
||||
if (currentTime - lastPieChartUpdateTime >= updateInterval) {
|
||||
updatePieChart();
|
||||
lastPieChartUpdateTime = currentTime;
|
||||
}
|
||||
|
||||
setTimeout(updateNodes, updateInterval);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user