summaryrefslogtreecommitdiff
path: root/web/web_svg.c
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/web_svg.c
parent04b2beaaa2bf38ef9716702413fa4b5fcbc37a2b (diff)
downloaddartboat-270dd272f5fd2e9c7e178ba31c561e41d820608a.tar.gz
dartboat-270dd272f5fd2e9c7e178ba31c561e41d820608a.tar.xz
web: display svg overflow
Diffstat (limited to 'web/web_svg.c')
-rw-r--r--web/web_svg.c15
1 files changed, 6 insertions, 9 deletions
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);