summaryrefslogtreecommitdiff
path: root/textscreen/txt_scrollpane.c
diff options
context:
space:
mode:
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;
}