diff --git a/nuklear.h b/nuklear.h index 891f7054b..551cd0a13 100644 --- a/nuklear.h +++ b/nuklear.h @@ -24564,6 +24564,9 @@ nk_do_button_text_image(nk_flags *state, icon.x = bounds.x + 2 * style->padding.x; content.x += icon.w; content.w = NK_MAX(content.w - icon.w, 0); + + content.x += style->image_padding.x; + content.w -= style->image_padding.x; } icon.x += style->image_padding.x; @@ -24571,9 +24574,6 @@ nk_do_button_text_image(nk_flags *state, icon.w -= 2 * style->image_padding.x; icon.h -= 2 * style->image_padding.y; - content.x += style->image_padding.x; - content.w -= style->image_padding.x; - if (style->draw_begin) style->draw_begin(out, style->userdata); nk_draw_button_text_image(out, &bounds, &content, &icon, *state, style, str, len, font, &img); if (style->draw_end) style->draw_end(out, style->userdata); diff --git a/src/nuklear_button.c b/src/nuklear_button.c index ebe740268..d2f6e0801 100644 --- a/src/nuklear_button.c +++ b/src/nuklear_button.c @@ -402,6 +402,9 @@ nk_do_button_text_image(nk_flags *state, icon.x = bounds.x + 2 * style->padding.x; content.x += icon.w; content.w = NK_MAX(content.w - icon.w, 0); + + content.x += style->image_padding.x; + content.w -= style->image_padding.x; } icon.x += style->image_padding.x; @@ -409,9 +412,6 @@ nk_do_button_text_image(nk_flags *state, icon.w -= 2 * style->image_padding.x; icon.h -= 2 * style->image_padding.y; - content.x += style->image_padding.x; - content.w -= style->image_padding.x; - if (style->draw_begin) style->draw_begin(out, style->userdata); nk_draw_button_text_image(out, &bounds, &content, &icon, *state, style, str, len, font, &img); if (style->draw_end) style->draw_end(out, style->userdata);