Slower scrolling for dropdown lists and scrollbars
This commit is contained in:
@@ -105,7 +105,7 @@ static void ScrollbarClickPositioning(Window *w, NWidgetScrollbar *sb, int x, in
|
||||
/* Pressing the upper button? */
|
||||
SetBit(sb->disp_flags, NDB_SCROLLBAR_UP);
|
||||
if (_scroller_click_timeout <= 1) {
|
||||
_scroller_click_timeout = 3;
|
||||
_scroller_click_timeout = SCROLLER_CLICK_DELAY;
|
||||
sb->UpdatePosition(rtl ? 1 : -1);
|
||||
}
|
||||
w->scrolling_scrollbar = sb->index;
|
||||
@@ -114,7 +114,7 @@ static void ScrollbarClickPositioning(Window *w, NWidgetScrollbar *sb, int x, in
|
||||
SetBit(sb->disp_flags, NDB_SCROLLBAR_DOWN);
|
||||
|
||||
if (_scroller_click_timeout <= 1) {
|
||||
_scroller_click_timeout = 3;
|
||||
_scroller_click_timeout = SCROLLER_CLICK_DELAY;
|
||||
sb->UpdatePosition(rtl ? -1 : 1);
|
||||
}
|
||||
w->scrolling_scrollbar = sb->index;
|
||||
|
||||
@@ -260,8 +260,11 @@ struct DropdownWindow : Window {
|
||||
if (this->scrolling != 0) {
|
||||
int pos = this->vscroll->GetPosition();
|
||||
|
||||
this->vscroll->UpdatePosition(this->scrolling);
|
||||
this->scrolling = 0;
|
||||
if (_scroller_click_timeout <= 1) {
|
||||
_scroller_click_timeout = SCROLLER_CLICK_DELAY;
|
||||
this->vscroll->UpdatePosition(this->scrolling);
|
||||
this->scrolling = 0;
|
||||
}
|
||||
|
||||
if (pos != this->vscroll->GetPosition()) {
|
||||
this->SetDirty();
|
||||
|
||||
@@ -2398,7 +2398,7 @@ static EventState HandleScrollbarScrolling()
|
||||
|
||||
if (sb->disp_flags & ND_SCROLLBAR_BTN) {
|
||||
if (_scroller_click_timeout == 1) {
|
||||
_scroller_click_timeout = 3;
|
||||
_scroller_click_timeout = SCROLLER_CLICK_DELAY;
|
||||
sb->UpdatePosition(rtl == HasBit(sb->disp_flags, NDB_SCROLLBAR_UP) ? 1 : -1);
|
||||
w->SetDirty();
|
||||
}
|
||||
|
||||
@@ -885,6 +885,9 @@ extern Point _cursorpos_drag_start;
|
||||
extern int _scrollbar_start_pos;
|
||||
extern int _scrollbar_size;
|
||||
extern byte _scroller_click_timeout;
|
||||
enum {
|
||||
SCROLLER_CLICK_DELAY = 6 ///< Delay in video frames between scrollbar doing scroll, we don't want to get to the bottom of the list in an instant
|
||||
};
|
||||
|
||||
extern bool _scrolling_viewport;
|
||||
extern bool _mouse_hovering;
|
||||
|
||||
Reference in New Issue
Block a user