Slower scrolling for dropdown lists and scrollbars

This commit is contained in:
pelya
2014-07-20 00:35:07 +03:00
parent fb567341fc
commit 7991048105
4 changed files with 11 additions and 5 deletions

View File

@@ -103,7 +103,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;
@@ -112,7 +112,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;

View File

@@ -256,8 +256,11 @@ struct DropdownWindow : Window {
if (this->scrolling != 0) {
int pos = this->vscroll->GetPosition();
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();

View File

@@ -2395,7 +2395,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();
}

View File

@@ -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;