]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix scrolling with mouse wheel down when list is smaller than list box
authorterencehill <piuntn@gmail.com>
Wed, 2 Sep 2015 08:53:34 +0000 (10:53 +0200)
committerterencehill <piuntn@gmail.com>
Wed, 2 Sep 2015 08:53:34 +0000 (10:53 +0200)
qcsrc/menu/item/listbox.qc

index 6aead0a87641755344f9f4222faed80d28b63225..067234d3cc08665526a037da66ab39d2fec18c27 100644 (file)
@@ -171,7 +171,7 @@ float ListBox_keyDown(entity me, float key, float ascii, float shift)
        }
        else if(key == K_MWHEELDOWN)
        {
-               me.scrollPosTarget = min(me.scrollPosTarget + 0.5, me.getTotalHeight(me) - 1);
+               me.scrollPosTarget = min(me.scrollPosTarget + 0.5, max(0, me.getTotalHeight(me) - 1));
        }
        else if(key == K_PGUP || key == K_KP_PGUP)
        {