From 61361932bf9f92deea2a97b84f8eefc8a7f0b252 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 29 Jan 2009 23:00:14 +0000 Subject: Allow clicking within scroll bars to set position. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1438 --- textscreen/txt_scrollpane.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'textscreen') 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; } -- cgit v1.2.3