summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/gui.c b/gui.c
index 5efda30..063a644 100644
--- a/gui.c
+++ b/gui.c
@@ -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(