From 66c5d1166787922007ccd2a1b10bd37929bb8d62 Mon Sep 17 00:00:00 2001 From: awschult002 <73046001+awschult002@users.noreply.github.com> Date: Thu, 17 Oct 2024 20:24:49 -0400 Subject: [PATCH] removes rounded corners from checkboxes the rounded corners on the checkboxes looked terrible with the X11 and rawfb demos. This was also in-congruent with the previous look. Reverting to sharp corners keeps the previous look while also removing the issue of the X11 looking terrible. This commit also shrinks the select toggle box inside the checkbox by a couple pixels to better match the radio button's look and feel --- src/nuklear_toggle.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/nuklear_toggle.c b/src/nuklear_toggle.c index 28839f6..188e441 100644 --- a/src/nuklear_toggle.c +++ b/src/nuklear_toggle.c @@ -31,6 +31,12 @@ nk_draw_checkbox(struct nk_command_buffer *out, const struct nk_style_item *background; const struct nk_style_item *cursor; struct nk_text text; + struct nk_rect toggle_active_box = *cursors; + toggle_active_box.x += 1; + toggle_active_box.y += 1; + toggle_active_box.w -= 2; + toggle_active_box.h -= 2; + /* select correct colors/images */ if (state & NK_WIDGET_STATE_HOVER) { @@ -55,12 +61,12 @@ nk_draw_checkbox(struct nk_command_buffer *out, /* draw background and cursor */ if (background->type == NK_STYLE_ITEM_COLOR) { - nk_stroke_rect(out, *selector, 2, 2, nk_rgb_factor(background->data.color, style->color_factor)); + nk_stroke_rect(out, *selector, 2, 0, nk_rgb_factor(background->data.color, style->color_factor)); } else nk_draw_image(out, *selector, &background->data.image, nk_rgb_factor(nk_white, style->color_factor)); if (active) { if (cursor->type == NK_STYLE_ITEM_IMAGE) nk_draw_image(out, *cursors, &cursor->data.image, nk_rgb_factor(nk_white, style->color_factor)); - else nk_fill_rect(out, *cursors, 0, nk_rgb_factor(background->data.color, style->color_factor)); + else nk_fill_rect(out, toggle_active_box, 0, nk_rgb_factor(background->data.color, style->color_factor)); }