diff --git a/public/elotracker/chart-integration.js b/public/elotracker/chart-integration.js index e01d7f5..f20c0da 100644 --- a/public/elotracker/chart-integration.js +++ b/public/elotracker/chart-integration.js @@ -25,6 +25,21 @@ const x_scale = { } } } +const zoom_plugin = { + zoom: { + wheel: { + enabled: true, + }, + pinch: { + enabled: true, + }, + mode: "x", + }, + pan: { + enabled: true, + mode: "x", + }, +} window.onload = create_charts; @@ -108,7 +123,8 @@ async function create_charts() { return context[0].dataset.label; }, } - } + }, + zoom: zoom_plugin, }, scales: { x: x_scale, @@ -142,7 +158,8 @@ async function create_charts() { return context[0].dataset.label; }, } - } + }, + zoom: zoom_plugin, }, scales: { x: x_scale, @@ -190,7 +207,8 @@ async function create_charts() { return context[0].dataset.label; }, } - } + }, + zoom: zoom_plugin, }, scales: { x: x_scale, @@ -286,15 +304,16 @@ function toggle_combined_chart() { chart.classList.add("closed"); } } -function toggle_leaderboard_chart() { +function toggle_leaderboard_chart(event) { if (this.classList.contains("closed")) { this.classList.remove("closed"); } else { + if (event.target.nodeName === "CANVAS") return; this.classList.add("closed"); } } document.querySelectorAll("button.open-general-graph").forEach(element => element.addEventListener("click", toggle_combined_chart)); -document.querySelectorAll("button.leaderboard-element").forEach(element => element.addEventListener("click", toggle_leaderboard_chart)); +document.querySelectorAll("button.leaderboard-element").forEach(element => element.addEventListener("mousedown", toggle_leaderboard_chart)); async function update_leaderboard_entries() { this.disabled = true; diff --git a/public/elotracker/index.php b/public/elotracker/index.php index eba3d97..9eb9ac8 100644 --- a/public/elotracker/index.php +++ b/public/elotracker/index.php @@ -4,27 +4,25 @@