]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
End scrolling when it becomes imperceptible
authorterencehill <piuntn@gmail.com>
Fri, 24 Jul 2015 14:10:41 +0000 (16:10 +0200)
committerterencehill <piuntn@gmail.com>
Fri, 24 Jul 2015 14:10:41 +0000 (16:10 +0200)
qcsrc/menu/item/listbox.qc

index 5f2e03b2463ebfe94b2edd96e768980ee398f0a3..48af5e5017867d8e7d7049f9704b94da069dd42b 100644 (file)
@@ -363,6 +363,8 @@ void ListBox_draw(entity me)
                // this formula is guaranted to work with whatever framerate
                float f = sin(PI / 2 * pow(frametime, 0.65));
                me.scrollPos = me.scrollPos * (1 - f) + me.scrollPosTarget * f;
+               if(fabs(me.scrollPos - me.scrollPosTarget) < 0.001)
+                       me.scrollPos = me.scrollPosTarget;
 
                // update focusedItem while scrolling
                if(me.focusedItem >= 0)