diff options
author | quou <quou@disroot.org> | 2024-08-03 16:37:08 +1000 |
---|---|---|
committer | quou <quou@disroot.org> | 2024-08-03 16:37:08 +1000 |
commit | e7278ae98fb95e7e2d79caea2321076ba83918bc (patch) | |
tree | ed1f946afe7cb02e1fe0e25fc131b735415e0f21 | |
parent | fbf210c76a4c548fe16513a0c07c50532b51d4fb (diff) |
Fix scrollbar clamping
-rw-r--r-- | gui.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -145,14 +145,12 @@ void gui_scrollable( nx = cs[0] - (r.w - size); ny = cs[1] - (r.h - size); } - if (nx > 0) { - state->x = clamp(state->x, 0, nx); + state->x = clamp(state->x, 0, maxi(0, nx)); + state->y = clamp(state->y, 0, maxi(0, ny)); + if (nx > 0) gui_scrollbar(g, state, srx, nx, 1); - } - if (ny > 0) { - state->y = clamp(state->y, 0, ny); + if (ny > 0) gui_scrollbar(g, state, sry, ny, 0); - } } void gui_scrollbar( |