summaryrefslogtreecommitdiff
path: root/textscreen/txt_scrollpane.c
diff options
context:
space:
mode:
authorSimon Howard2009-01-29 23:00:14 +0000
committerSimon Howard2009-01-29 23:00:14 +0000
commit61361932bf9f92deea2a97b84f8eefc8a7f0b252 (patch)
treea67d81a5cee0fde2407acefca87a854f88bd9be9 /textscreen/txt_scrollpane.c
parent5a122d591e8fdecd767f12e93f13974cfc86f75a (diff)
downloadchocolate-doom-61361932bf9f92deea2a97b84f8eefc8a7f0b252.tar.gz
chocolate-doom-61361932bf9f92deea2a97b84f8eefc8a7f0b252.tar.bz2
chocolate-doom-61361932bf9f92deea2a97b84f8eefc8a7f0b252.zip
Allow clicking within scroll bars to set position.
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1438
Diffstat (limited to 'textscreen/txt_scrollpane.c')
-rw-r--r--textscreen/txt_scrollpane.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/textscreen/txt_scrollpane.c b/textscreen/txt_scrollpane.c
index 9049413b..cfed6a3e 100644
--- a/textscreen/txt_scrollpane.c
+++ b/textscreen/txt_scrollpane.c
@@ -251,6 +251,12 @@ static void TXT_ScrollPaneMousePress(TXT_UNCAST_ARG(scrollpane),
{
++scrollpane->x;
}
+ else
+ {
+ int range = FullWidth(scrollpane) - scrollpane->w;
+
+ scrollpane->x = ((rel_x - 1) * range) / (scrollpane->w - 3);
+ }
return;
}
@@ -266,6 +272,12 @@ static void TXT_ScrollPaneMousePress(TXT_UNCAST_ARG(scrollpane),
{
++scrollpane->y;
}
+ else
+ {
+ int range = FullHeight(scrollpane) - scrollpane->h;
+
+ scrollpane->y = ((rel_y - 1) * range) / (scrollpane->h - 3);
+ }
return;
}