X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=www%2Fjs%2Fremoteglot.js;h=d6292c3c8077e63ee5371347fa3d303a8602d08c;hb=b8d98f5af526cd395b7ef7f47c7d87e40e80a107;hp=c96335feb62baeacd88435fcc65c91c6375920b2;hpb=9dd737c8851cf2706b4823dc886e1311854ede64;p=remoteglot diff --git a/www/js/remoteglot.js b/www/js/remoteglot.js index c96335f..d6292c3 100644 --- a/www/js/remoteglot.js +++ b/www/js/remoteglot.js @@ -1395,7 +1395,10 @@ let update_sparkline = function(data) { scores.push(last_score); } if (data['score']) { - scores.push(compute_plot_score(data['score'])); + let score = compute_plot_score(data['score']); + scores.push(score); + if (score < min_score) min_score = score; + if (score > max_score) max_score = score; } const h = scorespark.getBoundingClientRect().height; @@ -1441,7 +1444,7 @@ let update_sparkline = function(data) { rect.addEventListener('mouseenter', (e) => draw_hover(e, hlcolor, tooltip)); rect.addEventListener('mousemove', (e) => draw_hover(e, hlcolor, tooltip)); rect.addEventListener('mouseleave', (e) => hide_hover(e, color)); - rect.addEventListener('click', (e) => show_line(0, i + first_move_num - 1)); + rect.addEventListener('click', (e) => { hide_hover(e, color); show_line(0, i + first_move_num - 1) }); scorespark.appendChild(rect); } }