From e7a2e5e24bf0523fb49a3ce07e3eb96d1fd5aea2 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Sat, 21 May 2022 14:53:36 -0700 Subject: web: automatically scroll dense visits to active player --- web/web_scoreboard.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'web/web_scoreboard.c') diff --git a/web/web_scoreboard.c b/web/web_scoreboard.c index e79d104..2916ae8 100644 --- a/web/web_scoreboard.c +++ b/web/web_scoreboard.c @@ -296,14 +296,14 @@ void draw_visits_dense() struct dom_elem **elemv = malloc( (np * 2 + 1) * (2 * n_visits + 2) * sizeof(*elemv)); int elemc = 0; + char buf[32], buf2[32]; elemv[elemc++] = create_div("", ""); for (int i = 0; i < np; ++i) { - elemv[elemc++] = create_div(state->legs[i]->name, - "visit-name"); + sprintf(buf, "visit-name visit-name-%d", i + 1); + elemv[elemc++] = create_div(state->legs[i]->name, buf); } - char buf[32], buf2[32]; elemv[elemc++] = create_div("0", "visit-n"); for (int i = 0; i < np; ++i) { if (i + 1 == match_opts->throws_first) @@ -371,6 +371,9 @@ void draw_visits_dense() free(elemv); dom_scroll_to_bottom("#visits"); + int pn = match_is_over() ? state->active_player : match_next_player(); + sprintf(buf, ".visit-name-%d", pn); + dom_scroll_to_center_child("#visits", buf); } void draw_visits() -- cgit v1.2.3-70-g09d2