stopping graph animation, clearing graphs on test init

This commit is contained in:
Miodec 2021-01-21 18:51:37 +00:00
parent 0c5f1144c5
commit 06ff9c9a4b

View file

@ -484,7 +484,7 @@ function updateAllGraphs(graphs, max) {
graph.options.scales.yAxes[0].ticks.max = Math.round(max);
graph.options.scales.yAxes[1].ticks.max = Math.round(max);
}
graph.update();
graph.update({ duration: 0 });
});
}
@ -517,11 +517,17 @@ function drawMinigraph(sid, result) {
graph.data.datasets[1].borderColor = themeColors.sub;
graph.data.datasets[1].pointBackgroundColor = themeColors.sub;
graph.update();
graph.update({ duration: 0 });
graphs.push(graph);
}
function destroyAllGraphs(graphs) {
graphs.forEach((graph) => {
graph.destroy();
});
}
MP.socket.on("connect", (f) => {
MP.state = 1;
MP.reconnectionAttempts = 0;
@ -756,6 +762,7 @@ MP.socket.on("mp_room_finishTimer_over", (data) => {
MP.socket.on("mp_room_test_init", (data) => {
mp_playSound("start");
MP.room.testStats = {};
destroyAllGraphs();
seedrandom(data.seed, { global: true });
mp_refreshTestUserList();
changePage("");