From 4f0e6077cf88fd7380a294f3e8e0bd3047b299d0 Mon Sep 17 00:00:00 2001 From: terencehill Date: Fri, 24 Jul 2015 16:10:41 +0200 Subject: [PATCH] End scrolling when it becomes imperceptible --- qcsrc/menu/item/listbox.qc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qcsrc/menu/item/listbox.qc b/qcsrc/menu/item/listbox.qc index 5f2e03b24..48af5e501 100644 --- a/qcsrc/menu/item/listbox.qc +++ b/qcsrc/menu/item/listbox.qc @@ -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) -- 2.39.2