Immediate-Mode-UI / Nuklear

A single-header ANSI C immediate mode cross-platform GUI library
https://immediate-mode-ui.github.io/Nuklear/doc/index.html
Other
9.17k stars 553 forks source link

Fix button text alignment error. #586

Closed mackron closed 10 months ago

mackron commented 10 months ago

When calculating the width and height of the content rect of a button, only the border of one side is being taken into account. Instead the border width needs to be multiplied by two before subtracting from the bounds. This is being done for padding and rounding, but not border, which is resulting in text being misaligned. The screenshots below demonstrate the issue (I've exaggerated the borders to make it easier to see the effect).

Before: image

After: image

mackron commented 10 months ago

Cheers. clib.json updated. Was already up to date with master.

RobLoach commented 10 months ago

Good catch.