diff --git a/src/input.c b/src/input.c index d0558e0992..4160cf4a13 100644 --- a/src/input.c +++ b/src/input.c @@ -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;