summaryrefslogtreecommitdiff
path: root/src/render.c
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2026-03-12 15:29:23 -0700
committer3gg <3gg@shellblade.net>2026-03-12 15:29:23 -0700
commit92978a10576d52a0f6c9983d3b6afae7c40eff40 (patch)
treebf73faed8aa1ecd71b9f61c37a549faf4cd30372 /src/render.c
parent58c0f40df5947b3933bf7b6564b2ba5dc39fbd92 (diff)
Support scrolling by dragging scrollbars
Diffstat (limited to 'src/render.c')
-rw-r--r--src/render.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/render.c b/src/render.c
index 20ab142..a242504 100644
--- a/src/render.c
+++ b/src/render.c
@@ -224,7 +224,7 @@ static void RenderTable(const uiTable* table, RenderState* state) {
224 state->subsurface.width = table->widths[col]; 224 state->subsurface.width = table->widths[col];
225 state->pen.x = 0; 225 state->pen.x = 0;
226 226
227 const uiCell* cell = GetCell(table, row, col); 227 const uiCell* cell = TableGetCell(table, row, col);
228 RenderText(string_data(cell->text), string_length(cell->text), state); 228 RenderText(string_data(cell->text), string_length(cell->text), state);
229 229
230 // Reset the original subsurface and pen for subsequent columns. 230 // Reset the original subsurface and pen for subsequent columns.
@@ -242,14 +242,11 @@ static void RenderTable(const uiTable* table, RenderState* state) {
242 if (table->flags.vertical_overflow) { 242 if (table->flags.vertical_overflow) {
243 state->pen.x = col_widths_sum; 243 state->pen.x = col_widths_sum;
244 244
245 const int y_start = (int)((double)table->offset / (double)table->rows * 245 const uiScrollbar* scrollbar = &table->scrollbar;
246 (double)table->height);
247
248 const int height = (int)((double)table->num_visible_rows /
249 (double)table->rows * (double)table->height);
250
251 FillRect( 246 FillRect(
252 &(uiRect){.y = y_start, .width = ScrollBarWidth, .height = height}, 247 &(uiRect){.y = scrollbar->handle_y,
248 .width = ScrollbarWidth,
249 .height = scrollbar->handle_height},
253 uiPink, state); 250 uiPink, state);
254 251
255 state->pen.x = x0; 252 state->pen.x = x0;