summaryrefslogtreecommitdiff
path: root/web/web_scoreboard.c
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-21 14:53:36 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-21 14:53:36 -0700
commite7a2e5e24bf0523fb49a3ce07e3eb96d1fd5aea2 (patch)
tree4683b059195d817e8177c3474c61bf4e6e382776 /web/web_scoreboard.c
parent3e8b8b804e7b30f096e557839eb5cc419a647f78 (diff)
downloaddartboat-e7a2e5e24bf0523fb49a3ce07e3eb96d1fd5aea2.tar.gz
dartboat-e7a2e5e24bf0523fb49a3ce07e3eb96d1fd5aea2.tar.xz
web: automatically scroll dense visits to active player
Diffstat (limited to 'web/web_scoreboard.c')
-rw-r--r--web/web_scoreboard.c9
1 files changed, 6 insertions, 3 deletions
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()