1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 12:03:07 +01:00

Fix #5005: The Right Arrow in Horizontal scroll bars does not work anymore. (#5107)

Both horizontal and vertical scrollbars had a malfunctioning widget: both the
right and bottom widgets weren't fired properly.

The bug was less noticeable for vertical scrollbars, as clicking the widget would
be treated as clicking empty space, which did not happen for the horizontal
scrollbar.

This patch fixes the underlying inconsistencies, making sure the widgets for
both types of scrollbars work -- when using either scrollbar, or when combined.
This commit is contained in:
Aaron van Geffen
2017-01-23 19:06:53 +01:00
committed by Michael Steenbeek
parent 04a1e5a488
commit 990b9b8708
2 changed files with 8 additions and 7 deletions

View File

@@ -686,7 +686,6 @@ static void input_scroll_continue(rct_window *w, sint32 widgetIndex, sint32 stat
case SCROLL_PART_HSCROLLBAR_RIGHT:
input_scroll_part_update_hright(w, widgetIndex, scroll_id);
break;
case SCROLL_PART_HSCROLLBAR_THUMB:
case SCROLL_PART_VSCROLLBAR_TOP:
input_scroll_part_update_vtop(w, widgetIndex, scroll_id);
break;

View File

@@ -941,23 +941,24 @@ void widget_scroll_get_part(rct_window *w, rct_widget *widget, sint32 x, sint32
if ((w->scrolls[*scroll_id].flags & HSCROLLBAR_VISIBLE) && y >= (w->y + widget->bottom - 11))
{
//horizon scrollbar
// horizontal scrollbar
sint32 rightOffset = 0;
sint32 iteratorLeft = widget->left + w->x + 10;
sint32 iteratorRight = widget->right + w->x - 10;
if (w->scrolls[*scroll_id].flags & VSCROLLBAR_VISIBLE)
if (!(w->scrolls[*scroll_id].flags & VSCROLLBAR_VISIBLE))
{
rightOffset = 11;
}
if (x <= iteratorLeft)
{
*output_scroll_area = SCROLL_PART_HSCROLLBAR_LEFT;
}
else if (x >= (iteratorRight -= rightOffset))
else if (x >= iteratorRight + rightOffset)
{
*output_scroll_area = SCROLL_PART_NONE;
}
else if (x >= iteratorRight)
else if (x >= iteratorRight + rightOffset - 10)
{
*output_scroll_area = SCROLL_PART_HSCROLLBAR_RIGHT;
}
@@ -976,7 +977,7 @@ void widget_scroll_get_part(rct_window *w, rct_widget *widget, sint32 x, sint32
}
else if ((w->scrolls[*scroll_id].flags & VSCROLLBAR_VISIBLE) && (x >= w->x + widget->right - 11))
{
//vertical scrollbar
// vertical scrollbar
sint32 bottomOffset = 0;
sint32 iteratorTop = widget->top + w->y + 10;
sint32 iteratorBottom = widget->bottom + w->y;
@@ -984,6 +985,7 @@ void widget_scroll_get_part(rct_window *w, rct_widget *widget, sint32 x, sint32
{
bottomOffset = 11;
}
if (y <= iteratorTop)
{
*output_scroll_area = SCROLL_PART_VSCROLLBAR_TOP;
@@ -992,7 +994,7 @@ void widget_scroll_get_part(rct_window *w, rct_widget *widget, sint32 x, sint32
{
*output_scroll_area = SCROLL_PART_NONE;
}
else if (y >= (iteratorBottom - 10))
else if (y >= (iteratorBottom - bottomOffset - 10))
{
*output_scroll_area = SCROLL_PART_VSCROLLBAR_BOTTOM;
}