]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Scroll faster while dragging the scrollbar
authorterencehill <piuntn@gmail.com>
Fri, 31 Jul 2015 17:39:20 +0000 (19:39 +0200)
committerterencehill <piuntn@gmail.com>
Fri, 31 Jul 2015 17:39:20 +0000 (19:39 +0200)
qcsrc/menu/item/listbox.qc

index 196aa3aec847469ac8cbfb7706d9bab2e25f337b..1940e324f27b0fa3174bbaf1db2652cf13292c25 100644 (file)
@@ -419,8 +419,11 @@ void ListBox_draw(entity me)
        if(me.scrollPos != me.scrollPosTarget)
        {
                float PI = 3.1415926535897932384626433832795028841971693993751058209749445923;
-               // this formula is guaranted to work with whatever framerate
-               float f = sin(PI / 2 * pow(frametime, 0.65));
+               float exp_factor = 0.65;
+               if(me.pressed == 1)
+                       exp_factor = 0.45; // scroll faster while dragging the scrollbar
+               // this formula works with whatever framerate
+               float f = sin(PI / 2 * pow(frametime, exp_factor));
                me.scrollPos = me.scrollPos * (1 - f) + me.scrollPosTarget * f;
                if(fabs(me.scrollPos - me.scrollPosTarget) < 0.001)
                        me.scrollPos = me.scrollPosTarget;