additional fix for scrolllist

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@6890 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 6cfdb3087025bcc40fc3ae3c428f021b7981a445
Former-commit-id: e2a95d747f4f7687f1f20529f8735d13c87e9454
This commit is contained in:
icystar 2020-04-05 13:07:55 +00:00
parent da08ee36b4
commit e6c0970f7d

View file

@ -63,16 +63,16 @@ gfuiScroll(tScrollBarInfo *sinfo)
static void
gfuiScrollListUpdateScroll(tGfuiScrollList *scrollist, int showElt = -1, int elemBeforeAfter = 0)
{
if (showElt >= 0) {
showElt = MIN(showElt, scrollist->nbElts);
elemBeforeAfter = MIN(elemBeforeAfter, (scrollist->nbElts-1)/2);
if (showElt >= 0 && scrollist->nbElts > 0) {
showElt = MIN(showElt, scrollist->nbElts - 1);
elemBeforeAfter = MIN(elemBeforeAfter, (scrollist->nbVisible-1)/2);
elemBeforeAfter = MAX(elemBeforeAfter, 0);
scrollist->firstVisible = MIN(
scrollist->firstVisible,
showElt - scrollist->nbVisible + 1 + elemBeforeAfter );
showElt - elemBeforeAfter );
scrollist->firstVisible = MAX(
scrollist->firstVisible,
scrollist->selectedElt - elemBeforeAfter );
showElt - scrollist->nbVisible + 1 + elemBeforeAfter );
}
scrollist->firstVisible = MIN(scrollist->firstVisible, scrollist->nbElts - scrollist->nbVisible);