summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-16 22:26:38 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-16 22:26:38 -0700
commit270dd272f5fd2e9c7e178ba31c561e41d820608a (patch)
treeaa9418a20e6f54faf5dce8c7135edcf789675e33 /web
parent04b2beaaa2bf38ef9716702413fa4b5fcbc37a2b (diff)
downloaddartboat-270dd272f5fd2e9c7e178ba31c561e41d820608a.tar.gz
dartboat-270dd272f5fd2e9c7e178ba31c561e41d820608a.tar.xz
web: display svg overflow
Diffstat (limited to 'web')
-rw-r--r--web/static/style.css1
-rw-r--r--web/static/sw.js2
-rw-r--r--web/web_dom.c3
-rw-r--r--web/web_svg.c15
4 files changed, 9 insertions, 12 deletions
diff --git a/web/static/style.css b/web/static/style.css
index 57c670a..6256709 100644
--- a/web/static/style.css
+++ b/web/static/style.css
@@ -370,6 +370,7 @@ body {
height: 100%;
filter: drop-shadow(0 0 0.4rem #111);
+ overflow: visible;
}
@keyframes throw-anim {
diff --git a/web/static/sw.js b/web/static/sw.js
index ac42ae1..3e3ccfd 100644
--- a/web/static/sw.js
+++ b/web/static/sw.js
@@ -1,5 +1,5 @@
const CACHE_PREFIX = 'dartboat-'
-const CACHE_VERSION = '11';
+const CACHE_VERSION = '12';
const CACHE_NAME = `${CACHE_PREFIX}${CACHE_VERSION}`;
const CACHE_FILES = [
diff --git a/web/web_dom.c b/web/web_dom.c
index 6aa50ed..07602f8 100644
--- a/web/web_dom.c
+++ b/web/web_dom.c
@@ -44,9 +44,8 @@ void dom_elem_free(struct dom_elem *e)
free(e->attr_vals[i]);
}
- for (int i = 0; i < e->n_children; ++i) {
+ for (int i = 0; i < e->n_children; ++i)
dom_elem_free(e->children[i]);
- }
free(e->ns);
free(e->name);
diff --git a/web/web_svg.c b/web/web_svg.c
index 485583d..8714e69 100644
--- a/web/web_svg.c
+++ b/web/web_svg.c
@@ -188,27 +188,24 @@ static void draw_board()
static void create_board()
{
+ char buf[512];
+
struct dom_elem *e = svg_elem_init("svg", 2);
dom_elem_add_attr(e, "id", "dartboard");
- char *viewbox;
- asprintf(&viewbox, "0 0 %f %f", DIAMETER, DIAMETER);
- dom_elem_add_attr(e, "viewBox", viewbox);
- free(viewbox);
+ sprintf(buf, "0 0 %f %f", DIAMETER, DIAMETER);
+ dom_elem_add_attr(e, "viewBox", buf);
dom_append_elemv("#dartboard-container", 1, &e);
struct dom_elem **elemv = malloc(2 * sizeof(*elemv));
int elemc = 0;
- char *transform;
- asprintf(&transform, "translate(%f %f) scale(1 -1)",
- DIAMETER/2, DIAMETER/2);
+ sprintf(buf, "translate(%f %f) scale(1 -1)", DIAMETER/2, DIAMETER/2);
for (int i = 0; i < 2; ++i) {
struct dom_elem *e = svg_elem_init("g", 2);
dom_elem_add_attr(e, "class", i ? "overlay" : "base");
- dom_elem_add_attr(e, "transform", transform);
+ dom_elem_add_attr(e, "transform", buf);
elemv[elemc++] = e;
}
- free(transform);
dom_append_elemv("#dartboard", elemc, elemv);