shithub: choc

Download patch

ref: 61361932bf9f92deea2a97b84f8eefc8a7f0b252
parent: 5a122d591e8fdecd767f12e93f13974cfc86f75a
author: Simon Howard <[email protected]>
date: Thu Jan 29 18:00:14 EST 2009

Allow clicking within scroll bars to set position.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 1438

--- a/textscreen/txt_scrollpane.c
+++ b/textscreen/txt_scrollpane.c
@@ -251,7 +251,13 @@
         {
             ++scrollpane->x;
         }
+        else
+        {
+            int range = FullWidth(scrollpane) - scrollpane->w;
 
+            scrollpane->x = ((rel_x - 1) * range) / (scrollpane->w - 3);
+        }
+
         return;
     }
 
@@ -265,6 +271,12 @@
         else if (rel_y == scrollpane->h - 1)
         {
             ++scrollpane->y;
+        }
+        else
+        {
+            int range = FullHeight(scrollpane) - scrollpane->h;
+
+            scrollpane->y = ((rel_y - 1) * range) / (scrollpane->h - 3);
         }
 
         return;