summaryrefslogtreecommitdiff
path: root/src/input.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/input.c')
-rw-r--r--src/input.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/input.c b/src/input.c
index c4b1be7..20551a6 100644
--- a/src/input.c
+++ b/src/input.c
@@ -6,6 +6,7 @@
6 6
7#include <cassert.h> 7#include <cassert.h>
8 8
9#define Min(a, b) ((a) < (b) ? (a) : (b))
9#define Max(a, b) ((a) > (b) ? (a) : (b)) 10#define Max(a, b) ((a) > (b) ? (a) : (b))
10 11
11/// Return true if the rectangle contains the point. 12/// Return true if the rectangle contains the point.
@@ -85,7 +86,9 @@ static void ClickTable(uiTable* table, const uiMouseClickEvent* event) {
85static void ScrollTable(uiTable* table, const uiMouseScrollEvent* event) { 86static void ScrollTable(uiTable* table, const uiMouseScrollEvent* event) {
86 assert(table); 87 assert(table);
87 assert(event); 88 assert(event);
88 table->offset = Max(0, table->offset - event->scroll_offset); 89 table->offset =
90 Min(table->rows - table->num_visible_rows,
91 Max(0, table->offset - event->scroll_offset));
89} 92}
90 93
91/// Process a scroll event. 94/// Process a scroll event.