Skip to content

Commit

Permalink
pad content only when text on right of image
Browse files Browse the repository at this point in the history
  • Loading branch information
Dodzey committed Aug 31, 2024
1 parent 41072b4 commit 00d94e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions nuklear.h
Original file line number Diff line number Diff line change
Expand Up @@ -24564,16 +24564,16 @@ 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;
icon.y += style->image_padding.y;
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);
Expand Down
6 changes: 3 additions & 3 deletions src/nuklear_button.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,16 +402,16 @@ 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;
icon.y += style->image_padding.y;
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);
Expand Down

0 comments on commit 00d94e5

Please sign in to comment.