Skip to content

Commit

Permalink
Fixed centered not being quite in the center
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Ahnstedt committed Nov 26, 2023
1 parent 657e525 commit 8af4468
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions nuklear.h
Original file line number Diff line number Diff line change
Expand Up @@ -24842,11 +24842,11 @@ nk_do_toggle(nk_flags *state,
label.x = r.x;
label.w = r.w - select.w - style->spacing * 2;
} else if (widget_alignment & NK_WIDGET_ALIGN_CENTERED) {
select.x = (r.x + r.w) / 2;
select.x = r.x + (r.w - select.w) / 2;

/* label in front of selector */
label.x = r.x;
label.w = r.w / 2 - select.w - style->spacing * 2;
label.w = (r.w - select.w - style->spacing * 2) / 2;
} else { /* Default: NK_WIDGET_ALIGN_LEFT */
select.x = r.x;

Expand Down
4 changes: 2 additions & 2 deletions src/nuklear_toggle.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ nk_do_toggle(nk_flags *state,
label.x = r.x;
label.w = r.w - select.w - style->spacing * 2;
} else if (widget_alignment & NK_WIDGET_ALIGN_CENTERED) {
select.x = (r.x + r.w) / 2;
select.x = r.x + (r.w - select.w) / 2;

/* label in front of selector */
label.x = r.x;
label.w = r.w / 2 - select.w - style->spacing * 2;
label.w = (r.w - select.w - style->spacing * 2) / 2;
} else { /* Default: NK_WIDGET_ALIGN_LEFT */
select.x = r.x;

Expand Down

0 comments on commit 8af4468

Please sign in to comment.