From da3f7fed6c79bfce26b855e8d77f337b86bccfd8 Mon Sep 17 00:00:00 2001 From: vurtun Date: Mon, 23 Apr 2018 11:01:06 +0200 Subject: [PATCH] Fixed #675 List view --- nuklear.h | 2 +- src/nuklear_list_view.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nuklear.h b/nuklear.h index 71aa36e..3ad2a9e 100644 --- a/nuklear.h +++ b/nuklear.h @@ -18730,7 +18730,7 @@ nk_list_view_begin(struct nk_context *ctx, struct nk_list_view *view, view->total_height = row_height * NK_MAX(row_count,1); view->begin = (int)NK_MAX(((float)view->scroll_value / (float)row_height), 0.0f); - view->count = (int)NK_MAX(nk_iceilf((layout->clip.h)/(float)row_height), 0); + view->count = NK_MIN(view->count, row_count - view->begin); view->end = view->begin + view->count; view->ctx = ctx; return result; diff --git a/src/nuklear_list_view.c b/src/nuklear_list_view.c index ac8b424..b98dd75 100644 --- a/src/nuklear_list_view.c +++ b/src/nuklear_list_view.c @@ -54,7 +54,7 @@ nk_list_view_begin(struct nk_context *ctx, struct nk_list_view *view, view->total_height = row_height * NK_MAX(row_count,1); view->begin = (int)NK_MAX(((float)view->scroll_value / (float)row_height), 0.0f); - view->count = (int)NK_MAX(nk_iceilf((layout->clip.h)/(float)row_height), 0); + view->count = NK_MIN(view->count, row_count - view->begin); view->end = view->begin + view->count; view->ctx = ctx; return result;