Improve vertical scrollbars.

This commit is contained in:
Wirlie 2016-06-19 15:10:16 -05:00
parent 7b421c8052
commit 20fce67e9a
No known key found for this signature in database
GPG Key ID: 79B38B5188BB43B1
1 changed files with 7 additions and 7 deletions

View File

@ -613,37 +613,37 @@ static void input_scroll_begin(rct_window *w, int widgetIndex, int x, int y)
int widget_width = widg->right - widg->left - 1;
if (scroll->flags & VSCROLLBAR_VISIBLE)
widget_width -= 11;
widget_width = max(scroll->h_right - widget_width, 0);
int widget_content_width = max(scroll->h_right - widget_width, 0);
int widget_height = widg->bottom - widg->top - 1;
if (scroll->flags & HSCROLLBAR_VISIBLE)
widget_height -= 11;
widget_height = max(scroll->v_bottom - widget_height, 0);
int widget_content_height = max(scroll->v_bottom - widget_height, 0);
switch (scroll_area) {
case SCROLL_PART_HSCROLLBAR_LEFT:
scroll->h_left = max(scroll->h_left - 3, 0);
break;
case SCROLL_PART_HSCROLLBAR_RIGHT:
scroll->h_left = min(scroll->h_left + 3, widget_width);
scroll->h_left = min(scroll->h_left + 3, widget_content_width);
break;
case SCROLL_PART_HSCROLLBAR_LEFT_TROUGH:
scroll->h_left = max(scroll->h_left - widget_width , 0);
scroll->h_left = max(scroll->h_left - widget_content_width, 0);
break;
case SCROLL_PART_HSCROLLBAR_RIGHT_TROUGH:
scroll->h_left = min(scroll->h_left + widget_width, widget_width);
scroll->h_left = min(scroll->h_left + widget_content_width, widget_content_width);
break;
case SCROLL_PART_VSCROLLBAR_TOP:
scroll->v_top = max(scroll->v_top - 3, 0);
break;
case SCROLL_PART_VSCROLLBAR_BOTTOM:
scroll->v_top = min(scroll->v_top + 3, widget_height);
scroll->v_top = min(scroll->v_top + 3, widget_content_height);
break;
case SCROLL_PART_VSCROLLBAR_TOP_TROUGH:
scroll->v_top = max(scroll->v_top - widget_height, 0);
break;
case SCROLL_PART_VSCROLLBAR_BOTTOM_TROUGH:
scroll->v_top = min(scroll->v_top + widget_height, widget_height);
scroll->v_top = min(scroll->v_top + widget_height, widget_content_height);
break;
default:
break;