raysan5 / raygui

A simple and easy-to-use immediate-mode gui library
zlib License
3.26k stars 280 forks source link

Slider now centers correctly and general UX improvements #368

Closed jk- closed 5 months ago

jk- commented 6 months ago

This addresses two issues I found with the slider.

  1. When clicking once in a location, the offset of the slider is not centered.
  2. When dragging the slider to the edges, the slider is not compensating for its width.

I also removed an extra branch, did the calculations for the slider value after we calculate everything, and removed the weird (additional) setting of the slider values (:2999-:3000)

Both seen here: bug

And the fixed version: fixed

This needs tested with styles that have borders/padding.

raysan5 commented 5 months ago

@jk- This is really great! It has been on my TODO list for long time! Thank you very much for reviewing it!