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:
parent
da08ee36b4
commit
e6c0970f7d
1 changed files with 5 additions and 5 deletions
|
@ -63,16 +63,16 @@ gfuiScroll(tScrollBarInfo *sinfo)
|
||||||
static void
|
static void
|
||||||
gfuiScrollListUpdateScroll(tGfuiScrollList *scrollist, int showElt = -1, int elemBeforeAfter = 0)
|
gfuiScrollListUpdateScroll(tGfuiScrollList *scrollist, int showElt = -1, int elemBeforeAfter = 0)
|
||||||
{
|
{
|
||||||
if (showElt >= 0) {
|
if (showElt >= 0 && scrollist->nbElts > 0) {
|
||||||
showElt = MIN(showElt, scrollist->nbElts);
|
showElt = MIN(showElt, scrollist->nbElts - 1);
|
||||||
elemBeforeAfter = MIN(elemBeforeAfter, (scrollist->nbElts-1)/2);
|
elemBeforeAfter = MIN(elemBeforeAfter, (scrollist->nbVisible-1)/2);
|
||||||
elemBeforeAfter = MAX(elemBeforeAfter, 0);
|
elemBeforeAfter = MAX(elemBeforeAfter, 0);
|
||||||
scrollist->firstVisible = MIN(
|
scrollist->firstVisible = MIN(
|
||||||
scrollist->firstVisible,
|
scrollist->firstVisible,
|
||||||
showElt - scrollist->nbVisible + 1 + elemBeforeAfter );
|
showElt - elemBeforeAfter );
|
||||||
scrollist->firstVisible = MAX(
|
scrollist->firstVisible = MAX(
|
||||||
scrollist->firstVisible,
|
scrollist->firstVisible,
|
||||||
scrollist->selectedElt - elemBeforeAfter );
|
showElt - scrollist->nbVisible + 1 + elemBeforeAfter );
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollist->firstVisible = MIN(scrollist->firstVisible, scrollist->nbElts - scrollist->nbVisible);
|
scrollist->firstVisible = MIN(scrollist->firstVisible, scrollist->nbElts - scrollist->nbVisible);
|
||||||
|
|
Loading…
Reference in a new issue